22 #pragma GCC diagnostic push
23 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
24 #include <HepMC/GenEvent.h>
25 #pragma GCC diagnostic pop
27 #include <HepMC/Units.h>
28 #include <HepMC/WeightContainer.h>
30 #include <Pythia8/Event.h>
31 #include <Pythia8/Info.h>
32 #include <Pythia8/Pythia.h>
33 #include <Pythia8Plugins/HepMC2.h>
35 #include <boost/format.hpp>
49 , m_TriggersAND(
false)
51 , m_ConfigFileName(
"phpythia8.cfg")
52 , m_Pythia8ToHepMC(nullptr)
53 , m_SaveEventWeightFlag(
true)
54 , m_SaveIntegratedLuminosityFlag(
true)
55 , m_IntegralNode(nullptr)
57 char *charPath = getenv(
"PYTHIA8");
60 cout <<
"PHPythia8::Could not find $PYTHIA8 path!" << endl;
65 thePath +=
"/xmldoc/";
66 m_Pythia8 =
new Pythia8::Pythia(thePath.c_str());
69 m_Pythia8ToHepMC->set_store_proc(
true);
70 m_Pythia8ToHepMC->set_store_pdf(
true);
71 m_Pythia8ToHepMC->set_store_xsec(
true);
101 if (seed > 900000000)
103 seed = seed % 900000000;
106 if ((seed > 0) && (seed <= 900000000))
108 m_Pythia8->readString(
"Random:setSeed = on");
113 cout <<
PHWHERE <<
" ERROR: seed " << seed <<
" is not valid" << endl;
117 cout <<
"PHPythia8 random seed: " << seed << endl;
128 cout <<
"PHPythia8::End - I'm here!" << endl;
140 <<
" events passed trigger" << endl;
144 cout <<
" *------- End PYTHIA Trigger Statistics ------------------------"
145 <<
"-------------------------------------------------* " << endl;
149 cout <<
"Integral information on stored on node RUN/PHGenIntegral:" << endl;
151 cout <<
" *------- End PYTHIA Integral Node Print ------------------------"
152 <<
"-------------------------------------------------* " << endl;
172 cout <<
"PHPythia8::read_config - Failed to open file " <<
m_ConfigFileName << endl;
191 cout <<
"PHPythia8::process_event - event: " <<
m_EventCount << endl;
194 bool passedGen =
false;
195 bool passedTrigger =
false;
198 while (!passedTrigger)
210 bool andScoreKeeper =
true;
222 cout <<
"PHPythia8::process_event trigger: "
228 passedTrigger =
true;
233 andScoreKeeper &= trigResult;
238 cout <<
"PHPythia8::process_event - failed trigger: "
245 passedTrigger =
true;
254 HepMC::GenEvent *
genevent =
new HepMC::GenEvent(HepMC::Units::GEV, HepMC::Units::MM);
259 genevent->weights().push_back(
m_Pythia8->info.weight());
266 cout <<
"PHPythia8::process_event - Failed to add event to HepMC record!" << endl;
274 cout <<
"PHPythia8::process_event - FINISHED WHOLE EVENT" << endl;
308 cout <<
PHWHERE <<
"RUN Node missing doing nothing" << endl;
313 m_IntegralNode = findNode::getClass<PHGenIntegral>(sumNode,
"PHGenIntegral");
318 sumNode->addNode(newmapnode);
322 cout <<
"PHPythia8::create_node_tree - Fatal Error - "
323 <<
"RUN/PHGenIntegral node already exist. "
324 <<
"It is messy to overwrite integrated luminosities. Please turn off this function in the macro with " << endl;
325 cout <<
" PHPythia8::save_integrated_luminosity(false);" << endl;
326 cout <<
"The current RUN/PHGenIntegral node is ";
340 cout <<
"PHPythia8::registerTrigger - trigger " << theTrigger->
GetName() <<
" registered" << endl;