Go to the documentation of this file.00001 #include <iostream>
00002 #include <cstring>
00003 #include <vector>
00004 #include <memory>
00005 #include <string>
00006
00007 #include <HepMC/GenEvent.h>
00008
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011
00012 #include "GeneratorInterface/LHEInterface/interface/LHERunInfo.h"
00013 #include "GeneratorInterface/LHEInterface/interface/LHEEvent.h"
00014 #include "GeneratorInterface/PartonShowerVeto/interface/JetMatchingAlpgen.h"
00015
00016 namespace gen {
00017
00018 extern "C" {
00019
00020
00021
00022 extern void alsetp_();
00023
00024 extern void alveto_(int *ipveto);
00025
00026 extern void dbpart_();
00027 extern void pyupre_();
00028
00029 void alshcd_(char csho[3]);
00030 void alshen_();
00031 }
00032
00033
00034 JetMatchingAlpgen::JetMatchingAlpgen(const edm::ParameterSet ¶ms) :
00035 JetMatching(params),
00036 applyMatching(params.getParameter<bool>("applyMatching")),
00037 runInitialized(false)
00038 {
00039 ahopts_.etclus = params.getParameter<double>("etMin");
00040 ahopts_.rclus = params.getParameter<double>("drMin");
00041 ahopts_.iexc = params.getParameter<bool>("exclusive");
00042 }
00043
00044
00045 JetMatchingAlpgen::~JetMatchingAlpgen()
00046 {
00047 }
00048
00049 std::set<std::string> JetMatchingAlpgen::capabilities() const
00050 {
00051 std::set<std::string> result;
00052 result.insert("psFinalState");
00053 result.insert("hepevt");
00054 result.insert("pythia6");
00055 return result;
00056 }
00057
00058
00059
00060 void JetMatchingAlpgen::init(const lhef::LHERunInfo* runInfo)
00061 {
00062
00063
00064 std::vector<std::string> headerLines = runInfo->findHeader("AlpgenUnwParFile");
00065 if (headerLines.empty())
00066 throw cms::Exception("Generator|PartonShowerVeto")
00067 << "In order to use Alpgen jet matching, "
00068 "the input file has to contain the corresponding "
00069 "Alpgen headers." << std::endl;
00070
00071
00072 header.parse(headerLines.begin(), headerLines.end());
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 std::copy(header.masses, header.masses + AlpgenHeader::MASS_MAX, ahppara_.masses);
00103 ahppara_.ihrd = header.ihrd;
00104 ahppara_.ebeam = header.ebeam;
00105
00106 for(std::map<AlpgenHeader::Parameter, double>::const_iterator iter =
00107 header.params.begin(); iter != header.params.end(); ++iter) {
00108 if (iter->first <= 0 || iter->first >= (int)AHPARS::nparam - 1)
00109 continue;
00110 ahpars_.parval[(int)iter->first - 1] = iter->second;
00111 }
00112
00113
00114 alsetp_();
00115
00116
00117 runInitialized = true;
00118 }
00119
00120 void JetMatchingAlpgen::beforeHadronisation(const lhef::LHEEvent* event)
00121 {
00122
00123 if (!runInitialized)
00124 throw cms::Exception("Generator|PartonShowerVeto")
00125 << "Run not initialized in JetMatchingAlpgen"
00126 << std::endl;
00127
00128
00129
00130
00131
00132
00133
00134
00135 eventInitialized = true;
00136 }
00137
00138
00139
00140
00141
00142
00143 int JetMatchingAlpgen::match( const lhef::LHEEvent* partonLevel, const std::vector<fastjet::PseudoJet>* jetInput )
00144 {
00145
00146
00147
00148
00149
00150
00151
00152
00153 if (!runInitialized)
00154 throw cms::Exception("Generator|PartonShowerVeto")
00155 << "Run not initialized in JetMatchingAlpgen"
00156 << std::endl;
00157
00158 if (!eventInitialized)
00159 throw cms::Exception("Generator|PartonShowerVeto")
00160 << "Event not initialized in JetMatchingAlpgen"
00161 << std::endl;
00162
00163
00164
00165 if(!applyMatching) return 0;
00166
00167
00168 int veto = 0;
00169 alveto_(&veto);
00170
00171 eventInitialized = false;
00172
00173
00174
00175
00176
00177 return veto ? 1 : 0;
00178 }
00179
00180 void alshcd_(char csho[3])
00181 {
00182 std::strncpy(csho, "PYT", 3);
00183 }
00184
00185 void alshen_()
00186 {
00187 }
00188
00189 }