21 #include "EvtGen_i/EvtGenExternal/EvtExternalGenFactory.hh"
23 #include "EvtGenBase/EvtPatches.hh"
24 #include "EvtGenBase/EvtReport.hh"
26 #include "EvtGen_i/EvtGenExternal/EvtPythiaEngine.hh"
28 #include "EvtGen_i/EvtGenExternal/EvtPhotosEngine.hh"
30 #include "EvtGen_i/EvtGenExternal/EvtTauolaEngine.hh"
35 EvtExternalGenFactory::EvtExternalGenFactory()
40 EvtExternalGenFactory::~EvtExternalGenFactory()
43 for ( iter = m_extGenMap.begin(); iter != m_extGenMap.end(); ++iter ) {
44 EvtAbsExternalGen* theGenerator = iter->second;
51 const EvtExternalGenFactory* EvtExternalGenFactory::getInstance()
53 static const EvtExternalGenFactory theFactory;
59 return const_cast<EvtExternalGenFactory*
>(getInstance());
62 void EvtExternalGenFactory::definePythiaGenerator( std::string xmlDir,
63 bool convertPhysCodes,
64 bool useEvtGenRandom )
66 int genId = EvtExternalGenFactory::PythiaGenId;
68 EvtGenReport( EVTGEN_INFO,
"EvtGen" )
69 <<
"Defining EvtPythiaEngine: data tables defined in " << xmlDir << endl;
70 if ( convertPhysCodes ==
true ) {
71 EvtGenReport( EVTGEN_INFO,
"EvtGen" )
72 <<
"Pythia 6 codes in decay files will be converted to Pythia 8 codes"
75 EvtGenReport( EVTGEN_INFO,
"EvtGen" )
76 <<
"Pythia 8 codes need to be used in decay files" << endl;
79 if ( useEvtGenRandom ==
true ) {
80 EvtGenReport( EVTGEN_INFO,
"EvtGen" )
81 <<
"Using EvtGen random engine for Pythia 8 as well" << endl;
84 EvtAbsExternalGen* pythiaGenerator =
85 new EvtPythiaEngine( xmlDir, convertPhysCodes, useEvtGenRandom );
86 m_extGenMap[genId] = pythiaGenerator;
89 void EvtExternalGenFactory::definePhotosGenerator( std::string photonType,
90 bool useEvtGenRandom )
92 int genId = EvtExternalGenFactory::PhotosGenId;
94 EvtGenReport( EVTGEN_INFO,
"EvtGen" )
95 <<
"Defining EvtPhotosEngine using photonType = " << photonType << endl;
97 EvtAbsExternalGen* photosGenerator =
new EvtPhotosEngine( photonType,
99 m_extGenMap[genId] = photosGenerator;
103 void EvtExternalGenFactory::defineTauolaGenerator(
bool useEvtGenRandom )
105 int genId = EvtExternalGenFactory::TauolaGenId;
107 EvtGenReport( EVTGEN_INFO,
"EvtGen" ) <<
"Defining EvtTauolaEngine." << endl;
109 EvtAbsExternalGen* tauolaGenerator =
new EvtTauolaEngine( useEvtGenRandom );
110 m_extGenMap[genId] = tauolaGenerator;
113 EvtAbsExternalGen* EvtExternalGenFactory::getGenerator(
int genId )
const
115 EvtAbsExternalGen* theGenerator( 0 );
117 ExtGenMap::const_iterator iter;
119 if ( ( iter = m_extGenMap.find( genId ) ) != m_extGenMap.end() ) {
121 theGenerator = iter->second;
124 EvtGenReport( EVTGEN_INFO,
"EvtGen" )
125 <<
"EvtAbsExternalGen::getGenerator: could not find generator for genId = "
132 void EvtExternalGenFactory::initialiseAllGenerators()
135 for ( iter = m_extGenMap.begin(); iter != m_extGenMap.end(); ++iter ) {
136 EvtAbsExternalGen* theGenerator = iter->second;
137 if ( theGenerator != 0 ) {
138 theGenerator->initialise();