00001
00002 #include "PhysicsListFactory.hh"
00003
00004
00005 #ifdef HAVE_G4PHYSICSLISTS
00006 #include "FTFC.hh"
00007 #include "FTFP.hh"
00008 #ifdef HAVE_FTFP_EMV
00009 #include "FTFP_EMV.hh"
00010 #endif
00011 #include "LBE.hh"
00012 #include "LHEP.hh"
00013 #include "LHEP_BERT.hh"
00014 #include "LHEP_BERT_HP.hh"
00015 #include "LHEP_EMV.hh"
00016 #include "LHEP_PRECO_HP.hh"
00017 #include "QBBC.hh"
00018 #include "QGSC.hh"
00019 #include "QGSC_EFLOW.hh"
00020 #include "QGSC_EMV.hh"
00021 #include "QGSP.hh"
00022 #include "QGSP_BERT.hh"
00023 #ifdef HAVE_QGSP_BERT_EMV
00024 #include "QGSP_BERT_EMV.hh"
00025 #endif
00026 #include "QGSP_BERT_HP.hh"
00027 #ifdef HAVE_QGSP_BERT_NQE
00028 #include "QGSP_BERT_NQE.hh"
00029 #endif
00030 #ifdef HAVE_QGSP_BERT_TRV
00031 #include "QGSP_BERT_TRV.hh"
00032 #endif
00033 #include "QGSP_BIC.hh"
00034 #include "QGSP_BIC_HP.hh"
00035 #include "QGSP_EMV.hh"
00036 #ifdef HAVE_QGSP_EMV_NQE
00037 #include "QGSP_EMV_NQE.hh"
00038 #endif
00039 #include "QGSP_EMX.hh"
00040 #ifdef HAVE_QGSP_NQE
00041 #include "QGSP_NQE.hh"
00042 #endif
00043 #include "QGSP_QEL.hh"
00044 #endif
00045
00046
00047 #ifdef SLIC_USE_LCPHYS
00048 #include "LCPhysicsList.hh"
00049 #endif
00050
00051
00052 #include "PhysicsListBuilder.hh"
00053
00054 using namespace std;
00055
00093 #define BUILDER_LCPHYS(list,name,description) this->addBuilder( new TPhysicsListBuilder<list>( name, description ) );
00094
00095 #define BUILDER(list,description) this->addBuilder( new TPhysicsListBuilder<list>( #list, description ) );
00096
00097 namespace slic
00098 {
00099
00100 PhysicsListFactory::PhysicsListFactory()
00101 : Module("PhysicsListFactory")
00102 {
00103 initializeBuilders();
00104 }
00105
00106 PhysicsListFactory::~PhysicsListFactory()
00107 {
00108 for ( BuilderMap::const_iterator it = m_builders.begin();
00109 it != m_builders.end();
00110 it++ ) {
00111 delete it->second;
00112 }
00113 m_builders.clear();
00114 }
00115
00116 G4VUserPhysicsList* PhysicsListFactory::create( const std::string& name )
00117 {
00118 log().okay("Creating physics list <" + name + ">.");
00119
00120 G4VUserPhysicsList* physicslist = 0;
00121
00122 VPhysicsListBuilder* builder = m_builders[ name ];
00123
00124 if ( builder != 0 ) {
00125 physicslist = builder->create();
00126 }
00127 else {
00128 G4Exception("ERROR: No builder found for physics list <" + name + "> .");
00129 }
00130
00131 return physicslist;
00132 }
00133
00134 void PhysicsListFactory::printAvailableLists()
00135 {
00136 log() << LOG::okay << LOG::done;
00137 log() << LOG::okay << "----GEANT4 PHYSICS LISTS----" << LOG::endl << LOG::done;
00138 log() << LOG::okay << "NAME DESCRIPTION" << LOG::done;
00139 log() << LOG::okay << "----------------------------------------------------------------------" << LOG::done;
00140 for ( BuilderMap::const_iterator it = m_builders.begin();
00141 it != m_builders.end();
00142 it++ ) {
00143 log().width(15);
00144 log() << LOG::okay << left << it->first;
00145 log() << LOG::okay << it->second->getDescription() << LOG::done;
00146 }
00147 }
00148
00149 void PhysicsListFactory::initializeBuilders()
00150 {
00151
00152 #ifdef SLIC_USE_LCPHYS
00153 BUILDER_LCPHYS(LCPhysicsList, "LCPhys", "ILC Physics List by Dennis Wright.")
00154 #endif
00155
00156 #ifdef HAVE_G4PHYSICSLISTS
00157 BUILDER(FTFC, "Fritiof with CHIPS")
00158 BUILDER(FTFP, "Fritiof with precompound")
00159 #ifdef HAVE_FTFP_EMV
00160 BUILDER(FTFP_EMV, "FTFP with v 7.1 EM processes")
00161 #endif
00162 BUILDER(LBE, "Low backgrounds experiment with low energy EM")
00163 BUILDER(LHEP, "Low and High Energy Parameterised")
00164 BUILDER(LHEP_BERT, "LHEP with Bertini Cascade")
00165 BUILDER(LHEP_BERT_HP, "LHEP with Bertini Cascade and high precision neutrons")
00166 BUILDER(LHEP_EMV, "LHEP with v 7.1 EM processes")
00167 BUILDER(LHEP_PRECO_HP, "LHEP_PRECO with HP")
00168 BUILDER(QBBC, "Uses best cross section data within QGSP")
00169 BUILDER(QGSC, "Quark Gluon-String (QGS) with CHIPS")
00170 BUILDER(QGSC_EFLOW, "QGSC using energy flow methods from CHIPS model")
00171 BUILDER(QGSC_EMV, "QGSC with v 7.1 EM processes")
00172 BUILDER(QGSP, "QGS with precompound")
00173 BUILDER(QGSP_BERT, "QGSP with Bertini Cascade")
00174 #ifdef HAVE_QGSP_BERT_EMV
00175 BUILDER(QGSP_BERT_EMV, "QGSP_BERT with v 7.1 EM processes")
00176 #endif
00177 BUILDER(QGSP_BERT_HP, "QGSP with Bertini Cascade and high precision neutrons")
00178 #ifdef HAVE_QGSP_BERT_NQE
00179 BUILDER(QGSP_BERT_NQE, "QGSP_BERT with quasi-elastic processes removed")
00180 #endif
00181 #ifdef HAVE_QGSP_BERT_TRV
00182 BUILDER(QGSP_BERT_TRV, "QGSP_BERT with transition to Bertini at 5 GeV")
00183 #endif
00184 BUILDER(QGSP_BIC, "QGSP with Binary Cascade")
00185 BUILDER(QGSP_BIC_HP, "QGSP with Binary Cascade")
00186 BUILDER(QGSP_EMV, "LHEP with v 7.1 EM processes")
00187 #ifdef HAVE_QGSP_EMV_NQE
00188 BUILDER(QGSP_EMV_NQE, "QGSP with v 7.1 EM processes and quasi-elastic processes removed")
00189 #endif
00190 BUILDER(QGSP_EMX, "QGSP with v 7.2 EM processes")
00191 #ifdef HAVE_QGSP_NQE
00192 BUILDER(QGSP_NQE, "QGSP with quasi-elastic processes removed")
00193 #endif
00194 BUILDER(QGSP_QEL, "QGSP with elastic cross sections and model from CHIPS")
00195 #endif
00196 }
00197
00198 void PhysicsListFactory::addBuilder( VPhysicsListBuilder* builder)
00199 {
00200 const G4String& name = builder->getName();
00201
00202 if ( m_builders.find( name ) != m_builders.end() ) {
00203 log() << LOG::warning << "Ignoring duplicate physics list builder for <" << name << "> ." << LOG::done;
00204 }
00205 else {
00206 m_builders[ name ] = builder;
00207 }
00208 }
00209 }
00210
00211
00212
00213
00214
00215