//-------------------------------------------------------------------------- // // Environment: // This software is part of the EvtGen package. If you use all or part // of it, please give an appropriate acknowledgement. // // Copyright Information: See EvtGen/COPYRIGHT // Copyright (C) 2011 University of Warwick, UK // // Module: EvtExternalGenFactory // // Description: A factory type method to create engines for external physics // generators like Pythia. // // Modification history: // // John Back April 2011 Module created // //------------------------------------------------------------------------------ // #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtReport.hh" #include "EvtGenExternal/EvtExternalGenFactory.hh" #ifdef EVTGEN_PYTHIA #include "EvtGenExternal/EvtPythiaEngine.hh" #endif #ifdef EVTGEN_PHOTOS #include "EvtGenExternal/EvtPhotosEngine.hh" #endif #ifdef EVTGEN_TAUOLA #include "EvtGenExternal/EvtTauolaEngine.hh" #endif #include using std::endl; EvtExternalGenFactory::EvtExternalGenFactory() { _extGenMap.clear(); } EvtExternalGenFactory::~EvtExternalGenFactory() { ExtGenMap::iterator iter; for (iter = _extGenMap.begin(); iter != _extGenMap.end(); ++iter) { EvtAbsExternalGen* theGenerator = iter->second; delete theGenerator; } _extGenMap.clear(); } EvtExternalGenFactory* EvtExternalGenFactory::getInstance() { static EvtExternalGenFactory* theFactory = 0; if (theFactory == 0) { theFactory = new EvtExternalGenFactory(); } return theFactory; } void EvtExternalGenFactory::definePythiaGenerator(std::string xmlDir, bool convertPhysCodes, bool useEvtGenRandom) { // Only define the generator if we have the external ifdef variable set #ifdef EVTGEN_PYTHIA int genId = EvtExternalGenFactory::PythiaGenId; report(EVT_INFO,"EvtGen")<<"Defining EvtPythiaEngine: data tables defined in " <second; } return theGenerator; } void EvtExternalGenFactory::initialiseAllGenerators() { ExtGenMap::iterator iter; for (iter = _extGenMap.begin(); iter != _extGenMap.end(); ++iter) { EvtAbsExternalGen* theGenerator = iter->second; if (theGenerator != 0) { theGenerator->initialise(); } } }