Changeset View
Changeset View
Standalone View
Standalone View
src/EvtGenExternal/EvtExternalGenFactory.cpp
Show All 34 Lines | |||||
#include "EvtGenExternal/EvtTauolaEngine.hh" | #include "EvtGenExternal/EvtTauolaEngine.hh" | ||||
#endif | #endif | ||||
#include <iostream> | #include <iostream> | ||||
using std::endl; | using std::endl; | ||||
EvtExternalGenFactory::EvtExternalGenFactory() | EvtExternalGenFactory::EvtExternalGenFactory() | ||||
{ | { | ||||
_extGenMap.clear(); | m_extGenMap.clear(); | ||||
} | } | ||||
EvtExternalGenFactory::~EvtExternalGenFactory() | EvtExternalGenFactory::~EvtExternalGenFactory() | ||||
{ | { | ||||
ExtGenMap::iterator iter; | ExtGenMap::iterator iter; | ||||
for ( iter = _extGenMap.begin(); iter != _extGenMap.end(); ++iter ) { | for ( iter = m_extGenMap.begin(); iter != m_extGenMap.end(); ++iter ) { | ||||
EvtAbsExternalGen* theGenerator = iter->second; | EvtAbsExternalGen* theGenerator = iter->second; | ||||
delete theGenerator; | delete theGenerator; | ||||
} | } | ||||
_extGenMap.clear(); | m_extGenMap.clear(); | ||||
} | } | ||||
EvtExternalGenFactory* EvtExternalGenFactory::getInstance() | EvtExternalGenFactory* EvtExternalGenFactory::getInstance() | ||||
{ | { | ||||
static EvtExternalGenFactory* theFactory = 0; | static EvtExternalGenFactory* theFactory = 0; | ||||
if ( theFactory == 0 ) { | if ( theFactory == 0 ) { | ||||
theFactory = new EvtExternalGenFactory(); | theFactory = new EvtExternalGenFactory(); | ||||
Show All 24 Lines | #ifdef EVTGEN_PYTHIA | ||||
if ( useEvtGenRandom == true ) { | if ( useEvtGenRandom == true ) { | ||||
EvtGenReport( EVTGEN_INFO, "EvtGen" ) | EvtGenReport( EVTGEN_INFO, "EvtGen" ) | ||||
<< "Using EvtGen random engine for Pythia 8 as well" << endl; | << "Using EvtGen random engine for Pythia 8 as well" << endl; | ||||
} | } | ||||
EvtAbsExternalGen* pythiaGenerator = | EvtAbsExternalGen* pythiaGenerator = | ||||
new EvtPythiaEngine( xmlDir, convertPhysCodes, useEvtGenRandom ); | new EvtPythiaEngine( xmlDir, convertPhysCodes, useEvtGenRandom ); | ||||
_extGenMap[genId] = pythiaGenerator; | m_extGenMap[genId] = pythiaGenerator; | ||||
#endif | #endif | ||||
} | } | ||||
void EvtExternalGenFactory::definePhotosGenerator( std::string photonType, | void EvtExternalGenFactory::definePhotosGenerator( std::string photonType, | ||||
bool useEvtGenRandom ) | bool useEvtGenRandom ) | ||||
{ | { | ||||
#ifdef EVTGEN_PHOTOS | #ifdef EVTGEN_PHOTOS | ||||
int genId = EvtExternalGenFactory::PhotosGenId; | int genId = EvtExternalGenFactory::PhotosGenId; | ||||
EvtGenReport( EVTGEN_INFO, "EvtGen" ) | EvtGenReport( EVTGEN_INFO, "EvtGen" ) | ||||
<< "Defining EvtPhotosEngine using photonType = " << photonType << endl; | << "Defining EvtPhotosEngine using photonType = " << photonType << endl; | ||||
EvtAbsExternalGen* photosGenerator = new EvtPhotosEngine( photonType, | EvtAbsExternalGen* photosGenerator = new EvtPhotosEngine( photonType, | ||||
useEvtGenRandom ); | useEvtGenRandom ); | ||||
_extGenMap[genId] = photosGenerator; | m_extGenMap[genId] = photosGenerator; | ||||
#endif | #endif | ||||
} | } | ||||
void EvtExternalGenFactory::defineTauolaGenerator( bool useEvtGenRandom ) | void EvtExternalGenFactory::defineTauolaGenerator( bool useEvtGenRandom ) | ||||
{ | { | ||||
#ifdef EVTGEN_TAUOLA | #ifdef EVTGEN_TAUOLA | ||||
int genId = EvtExternalGenFactory::TauolaGenId; | int genId = EvtExternalGenFactory::TauolaGenId; | ||||
EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Defining EvtTauolaEngine." << endl; | EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Defining EvtTauolaEngine." << endl; | ||||
EvtAbsExternalGen* tauolaGenerator = new EvtTauolaEngine( useEvtGenRandom ); | EvtAbsExternalGen* tauolaGenerator = new EvtTauolaEngine( useEvtGenRandom ); | ||||
_extGenMap[genId] = tauolaGenerator; | m_extGenMap[genId] = tauolaGenerator; | ||||
#endif | #endif | ||||
} | } | ||||
EvtAbsExternalGen* EvtExternalGenFactory::getGenerator( int genId ) | EvtAbsExternalGen* EvtExternalGenFactory::getGenerator( int genId ) | ||||
{ | { | ||||
EvtAbsExternalGen* theGenerator( 0 ); | EvtAbsExternalGen* theGenerator( 0 ); | ||||
ExtGenMap::iterator iter; | ExtGenMap::iterator iter; | ||||
if ( ( iter = _extGenMap.find( genId ) ) != _extGenMap.end() ) { | if ( ( iter = m_extGenMap.find( genId ) ) != m_extGenMap.end() ) { | ||||
// Retrieve the external generator engine | // Retrieve the external generator engine | ||||
theGenerator = iter->second; | theGenerator = iter->second; | ||||
} else { | } else { | ||||
EvtGenReport( EVTGEN_INFO, "EvtGen" ) | EvtGenReport( EVTGEN_INFO, "EvtGen" ) | ||||
<< "EvtAbsExternalGen::getGenerator: could not find generator for genId = " | << "EvtAbsExternalGen::getGenerator: could not find generator for genId = " | ||||
<< genId << endl; | << genId << endl; | ||||
} | } | ||||
return theGenerator; | return theGenerator; | ||||
} | } | ||||
void EvtExternalGenFactory::initialiseAllGenerators() | void EvtExternalGenFactory::initialiseAllGenerators() | ||||
{ | { | ||||
ExtGenMap::iterator iter; | ExtGenMap::iterator iter; | ||||
for ( iter = _extGenMap.begin(); iter != _extGenMap.end(); ++iter ) { | for ( iter = m_extGenMap.begin(); iter != m_extGenMap.end(); ++iter ) { | ||||
EvtAbsExternalGen* theGenerator = iter->second; | EvtAbsExternalGen* theGenerator = iter->second; | ||||
if ( theGenerator != 0 ) { | if ( theGenerator != 0 ) { | ||||
theGenerator->initialise(); | theGenerator->initialise(); | ||||
} | } | ||||
} | } | ||||
} | } |