|
|
Go to the documentation of this file.
9 #include <boost/algorithm/string/classification.hpp>
10 #include <boost/algorithm/string/split.hpp>
94 skipEvents_(
params.getUntrackedParameter<unsigned
int>(
"skipEvents", 0)),
96 lheAlpgenUnwParHeader(
"AlpgenUnwParFile"),
97 extraHeaderFileName_(
params.getUntrackedParameter<
std::
string>(
"extraHeaderFileName",
"")),
98 extraHeaderName_(
params.getUntrackedParameter<
std::
string>(
"extraHeaderName",
"")),
99 writeAlpgenWgtFile(
params.getUntrackedParameter<
bool>(
"writeAlpgenWgtFile",
true)),
100 writeAlpgenParFile(
params.getUntrackedParameter<
bool>(
"writeAlpgenParFile",
true)),
101 writeExtraHeader(
params.getUntrackedParameter<
bool>(
"writeExtraHeader",
false)) {
102 std::vector<std::string> allFileNames =
fileNames(0);
105 if (allFileNames.size() != 1)
106 throw cms::Exception(
"Generator|AlpgenInterface") <<
"AlpgenSource needs exactly one file specified "
114 throw cms::Exception(
"Generator|AlpgenInterface") <<
"AlpgenSource only supports the file: scheme "
124 <<
"AlpgenSource was unable to open the file \"" <<
fileName_ <<
"_unw.par\"." << std::endl;
134 throw cms::Exception(
"Generator|AlpgenInterface") <<
"AlpgenSource was unable to parse the Alpgen "
135 <<
"unweighted parameter file." << std::endl;
138 produces<LHERunInfoProduct, edm::Transition::BeginRun>();
139 produces<LHEEventProduct>();
145 std::ostringstream
ss;
158 heprup.
IDBMUP.first = 2212;
161 heprup.
IDBMUP.second = 2212;
164 heprup.
IDBMUP.second = -2212;
167 throw cms::Exception(
"Generator|AlpgenInterface") <<
"AlpgenSource was unable to understand the ih2 "
168 <<
"parameter." << std::endl;
176 heprup.
PDFGUP.second = -1;
178 heprup.
PDFSUP.second = -1;
199 comments.addLine(
"\tExtracted by AlpgenInterface\n");
204 slha.
addLine(
"\n# SLHA header containing masses from Alpgen\n");
205 slha.
addLine(
"Block MASS # Mass spectrum (kinematic masses)\n");
219 std::ifstream wgtascii((
fileName_ +
".wgt").c_str());
220 while (wgtascii.getline(
buffer, 512)) {
227 std::ifstream parascii((
fileName_ +
".par").c_str());
228 while (parascii.getline(
buffer, 512)) {
239 while (extraascii.getline(
buffer, 512)) {
249 runInfo->addHeader(lheAlpgenWgtHeader);
251 runInfo->addHeader(lheAlpgenParHeader);
252 runInfo->addHeader(slha);
254 runInfo->addHeader(extraHeader);
261 <<
"AlpgenSource was unable to open the file \"" <<
fileName_ <<
".unw\"." << std::endl;
264 template <
typename T>
271 "not found in Alpgen parameter file."
274 return T(
pos->second);
277 template <
typename T>
283 return T(
pos->second);
312 if (
ls.bad() || nPart < 1 || nPart > 1000)
324 for (
int i = 0;
i != 2; ++
i) {
344 hepeup.
PUP[
i][0] = 0.;
345 hepeup.
PUP[
i][1] = 0.;
346 hepeup.
PUP[
i][2] = zMomentum;
347 hepeup.
PUP[
i][3] = std::fabs(zMomentum);
348 hepeup.
PUP[
i][4] = 0.;
353 hepeup.
ICOLUP[
i].first = colour1;
354 hepeup.
ICOLUP[
i].second = colour2;
381 hepeup.
PUP[
i][2] = pz;
388 hepeup.
ICOLUP[
i].first = colour1;
389 hepeup.
ICOLUP[
i].second = colour2;
408 <<
"AlpgenSource is not able read event no. " <<
nEvent_ << std::endl;
458 throw cms::Exception(
"Generator|AlpgenInterface") <<
"Unrecognized IHRD process code" << std::endl;
462 std::unique_ptr<LHEEventProduct> lheEvent(
new LHEEventProduct(hepeup));
bool setRunAndEventInfo(edm::EventID &, edm::TimeValue_t &, edm::EventAuxiliary::ExperimentType &) override
std::vector< double > XSECUP
void beginRun(edm::Run &run) override
void fixEventWZ(lhef::HEPEUP &hepeup)
Fixes Event Record for ihrd = 1,2,3,4,10,14,15.
std::string extraHeaderFileName_
Name of the extra header file.
std::unique_ptr< lhef::HEPEUP > hepeup_
void fixEventHiggsTTbar(lhef::HEPEUP &hepeup)
Fixes Event Record for ihrd = 8.
std::vector< std::pair< int, int > > MOTHUP
unsigned long skipEvents_
Number of events to skip.
LHERunInfoProduct::Header lheAlpgenUnwParHeader
Alpgen _unw.par file as a LHE header.
unsigned int processID() const
~AlpgenSource() override
Destructor.
unsigned long nEvent_
Number of events.
AlpgenHeader header
Alpgen _unw.par file as an AlpgenHeader.
std::pair< double, double > EBMUP
AlpgenSource(const edm::ParameterSet ¶ms, const edm::InputSourceDescription &desc)
Constructor.
T getParameter(AlpgenHeader::Parameter index) const
Function to get parameter by name from AlpgenHeader.
TString nPart(Int_t part, TString string, TString delimit=";", Bool_t removerest=true)
std::unique_ptr< std::ifstream > inputFile_
Pointer to the input file.
std::vector< std::pair< int, int > > ICOLUP
std::pair< int, int > PDFGUP
void fixEventSingleTop(lhef::HEPEUP &hepeup, double mb, int itopprc)
Fixes Event Record for ihrd = 13.
std::vector< std::string > fileNames(unsigned iCatalog) const
std::vector< double > XERRUP
void fixEventTTbar(lhef::HEPEUP &hepeup)
Fixes Event Record for ihrd = 6.
std::pair< int, int > PDFSUP
void fixEventMultiBoson(lhef::HEPEUP &hepeup)
Fixes Event Record for ihrd = 5.
std::string slhaMassLine(int pdgId, AlpgenHeader::Masses mass, const std::string &comment) const
bool writeAlpgenWgtFile
configuration flags
std::string fileName_
Name of the input file.
std::vector< double > XMAXUP
void produce(edm::Event &event) override
bool readAlpgenEvent(lhef::HEPEUP &hepeup)
Read an event and put it into the HEPEUP.
std::string extraHeaderName_
Name given to the extra header.
std::vector< FiveVector > PUP
unsigned long long TimeValue_t
std::pair< int, int > IDBMUP