19 #include "G4LossTableManager.hh" 20 #include "G4PhysListFactory.hh" 22 #include "G4Electron.hh" 23 #include "G4Positron.hh" 24 #include "G4Proton.hh" 27 #include "G4DecayPhysics.hh" 28 #include "G4EmStandardPhysics.hh" 29 #include "G4EmStandardPhysics_option1.hh" 30 #include "G4EmStandardPhysics_option2.hh" 31 #include "G4EmStandardPhysics_option3.hh" 32 #include "G4EmStandardPhysics_option4.hh" 33 #include "G4EmLivermorePhysics.hh" 34 #include "G4EmPenelopePhysics.hh" 35 #include "G4EmExtraPhysics.hh" 36 #include "G4HadronElasticPhysics.hh" 37 #include "G4HadronElasticPhysicsHP.hh" 38 #include "G4IonBinaryCascadePhysics.hh" 39 #include "G4IonPhysics.hh" 40 #include "G4NeutronTrackingCut.hh" 43 #include "CLHEP/Units/PhysicalConstants.h" 44 using namespace CLHEP;
50 verbosity = gemcOpt.
optMap[
"PHYS_VERBOSITY"].arg ;
51 ingredientsList = gemcOpt.
optMap[
"PHYSICS"].args ;
54 hadronicPhys =
"none";
60 G4PhysListFactory factory;
61 g4HadronicList = factory.AvailablePhysLists();
63 vector<G4String> allEM = factory.AvailablePhysListsEM();
64 g4EMList.push_back(
"STD");
65 for(
unsigned i=0; i<allEM.size(); i++)
67 vector<string> emstripped =
get_strings(allEM[i],
"_");
70 if(emstripped.size() == 2) stripped =
TrimSpaces(emstripped[1]);
72 g4EMList.push_back(stripped);
75 G4LossTableManager::Instance();
76 defaultCutValue = gemcOpt.
optMap[
"PRODUCTIONCUT"].arg;
77 cutForGamma = defaultCutValue;
78 cutForElectron = defaultCutValue;
79 cutForPositron = defaultCutValue;
80 cutForProton = defaultCutValue;
85 g4ParticleList = NULL;
86 g4HadronicPhysics.clear();
91 cout <<
" !!! Error: physics ingredients list not valid: >" << ingredientsList <<
"<" << endl;
94 cout <<
" Exiting." << endl;
113 cout <<
" > Available hadronic physics list: " << endl;
114 for(
unsigned i=0; i<g4HadronicList.size(); i++)
115 cout <<
" - " << g4HadronicList[i] << endl;
118 cout <<
" > Available EM physics list: " << endl;
119 for(
unsigned i=0; i<g4EMList.size(); i++)
120 cout <<
" - " << g4EMList[i] << endl;
122 cout <<
" > Optica: optical" << endl;
130 unsigned isHadronicLegit = 0;
131 unsigned isEMLegit = 0;
132 unsigned isOpticalLegit = 0;
133 unsigned isHPLegit = 0;
135 G4PhysListFactory factory;
140 if(factory.IsReferencePhysList(ingredient))
143 hadronicPhys = ingredient;
146 for(
unsigned i=0; i<g4EMList.size(); i++)
147 if(ingredient == g4EMList[i])
153 if(ingredient ==
"Optical")
158 if(ingredient ==
"HP")
167 cout <<
" >> Physics: " << ingredientsList << endl;
168 cout <<
" > Hadronic: " << hadronicPhys << endl;
169 cout <<
" > EM: " << EMPhys << endl;
170 cout <<
" > HP: " << HPPhys << endl;
171 cout <<
" > Optical: " << opticalPhys << endl << endl;
174 if(
physIngredients.size() == (isHadronicLegit + isEMLegit + isOpticalLegit + isHPLegit))
188 cout <<
"PhysicsList::SetCuts:";
189 cout <<
"CutLength : " << G4BestUnit(defaultCutValue,
"Length") << endl;
194 SetCutValue(cutForGamma,
"gamma");
195 SetCutValue(cutForElectron,
"e-");
196 SetCutValue(cutForPositron,
"e+");
197 SetCutValue(cutForProton,
"proton");
199 if (verbosity>0) DumpCutValuesTable();
206 SetParticleCuts(cutForGamma, G4Gamma::Gamma());
211 cutForElectron = cut;
212 SetParticleCuts(cutForElectron, G4Electron::Electron());
217 cutForPositron = cut;
218 SetParticleCuts(cutForPositron, G4Positron::Positron());
224 SetParticleCuts(cutForProton, G4Proton::Proton());
228 #include "FTFP_BERT.hh" 229 #include "FTFP_BERT_TRV.hh" 230 #include "FTFP_BERT_HP.hh" 231 #include "FTF_BIC.hh" 234 #include "QGSP_BERT.hh" 235 #include "QGSP_BERT_HP.hh" 236 #include "QGSP_BIC.hh" 237 #include "QGSP_BIC_HP.hh" 238 #include "QGSP_FTFP_BERT.hh" 239 #include "QGS_BIC.hh" 240 #include "QGSP_INCLXX.hh" 241 #include "Shielding.hh" 242 #include "G4OpticalPhysics.hh" 244 #include "G4StepLimiter.hh" 246 void PhysicsList::cookPhysics()
249 g4ParticleList =
new G4DecayPhysics(
"decays");
252 if(g4EMPhysics)
delete g4EMPhysics;
253 if(EMPhys ==
"STD") g4EMPhysics =
new G4EmStandardPhysics();
254 else if(EMPhys ==
"EMV") g4EMPhysics =
new G4EmStandardPhysics_option1();
255 else if(EMPhys ==
"EMX") g4EMPhysics =
new G4EmStandardPhysics_option2();
256 else if(EMPhys ==
"EMY") g4EMPhysics =
new G4EmStandardPhysics_option3();
257 else if(EMPhys ==
"EMZ") g4EMPhysics =
new G4EmStandardPhysics_option4();
258 else if(EMPhys ==
"LIV") g4EMPhysics =
new G4EmLivermorePhysics();
259 else if(EMPhys ==
"PEN") g4EMPhysics =
new G4EmPenelopePhysics();
262 cout <<
" !! Wrong EMPhys " << EMPhys << endl <<
"Exiting." << endl;
273 if(hadronicPhys !=
"none")
275 g4HadronicPhysics.push_back(
new G4EmExtraPhysics(verbosity));
279 cout <<
" > Loading High Precision Cross Sections... this may take a while..." << endl;
280 g4HadronicPhysics.push_back(
new G4HadronElasticPhysicsHP(verbosity) );
283 g4HadronicPhysics.push_back(
new G4HadronElasticPhysics(verbosity) );
287 if(hadronicPhys.find(
"BIC") != string::npos)
288 g4HadronicPhysics.push_back(
new G4IonBinaryCascadePhysics(verbosity));
289 else if(hadronicPhys.find(
"BERT") != string::npos)
290 g4HadronicPhysics.push_back(
new G4IonPhysics(verbosity));
293 g4HadronicPhysics.push_back(
new G4NeutronTrackingCut(verbosity));
300 if(hadronicPhys ==
"FTFP_BERT") {g4HadronicPhysics.push_back(
new G4HadronPhysicsFTFP_BERT());}
301 else if(hadronicPhys ==
"FTFP_BERT_TRV") {g4HadronicPhysics.push_back(
new G4HadronPhysicsFTFP_BERT_TRV());}
302 else if(hadronicPhys ==
"FTFP_BERT_HP") {g4HadronicPhysics.push_back(
new G4HadronPhysicsFTFP_BERT_HP());}
303 else if(hadronicPhys ==
"FTF_BIC") {g4HadronicPhysics.push_back(
new G4HadronPhysicsFTF_BIC());}
304 else if(hadronicPhys ==
"QGSP_BERT") {g4HadronicPhysics.push_back(
new G4HadronPhysicsQGSP_BERT());}
305 else if(hadronicPhys ==
"QGSP_BERT_HP") {g4HadronicPhysics.push_back(
new G4HadronPhysicsQGSP_BERT_HP());}
306 else if(hadronicPhys ==
"QGSP_BIC") {g4HadronicPhysics.push_back(
new G4HadronPhysicsQGSP_BIC());}
307 else if(hadronicPhys ==
"QGSP_BIC_HP") {g4HadronicPhysics.push_back(
new G4HadronPhysicsQGSP_BIC_HP());}
308 else if(hadronicPhys ==
"QGSP_FTFP_BERT") {g4HadronicPhysics.push_back(
new G4HadronPhysicsQGSP_FTFP_BERT());}
309 else if(hadronicPhys ==
"QGS_BIC") {g4HadronicPhysics.push_back(
new G4HadronPhysicsQGS_BIC());}
310 else if(hadronicPhys ==
"none") {;}
312 else {cout <<
"Wrong hadronicPhys " << hadronicPhys << endl <<
"Exiting." << endl; exit(0);}
316 if(opticalPhys ==
"yes")
320 G4OpticalPhysics* opticalPhysics =
new G4OpticalPhysics();
321 opticalPhysics->SetWLSTimeProfile(
"delta");
323 g4HadronicPhysics.push_back(opticalPhysics);
329 void PhysicsList::ConstructParticle()
331 g4ParticleList->ConstructParticle();
335 void PhysicsList::ConstructProcess()
338 g4EMPhysics->ConstructProcess();
339 g4ParticleList->ConstructProcess();
340 for(
size_t i=0; i<g4HadronicPhysics.size(); i++)
341 g4HadronicPhysics[i]->ConstructProcess();
346 theParticleIterator->reset();
348 while( (*theParticleIterator)() )
350 G4ParticleDefinition* particle = theParticleIterator->value();
351 G4ProcessManager* pmanager = particle->GetProcessManager();
352 string pname = particle->GetParticleName();
355 if ((!particle->IsShortLived()) && (particle->GetPDGCharge() != 0.0) && (pname !=
"chargedgeantino"))
358 cout <<
" > Adding Step Limiter for " << pname << endl;
360 pmanager->AddProcess(
new G4StepLimiter, -1,-1,3);
vector< string > get_strings(string input)
returns a vector of strings from a stringstream, space is delimiter
bool validateIngredients()
void SetCutForElectron(double)
map< string, aopt > optMap
Options map.
void SetCutForGamma(double)
vector< string > physIngredients
void SetCutForProton(double)
string TrimSpaces(string in)
Removes leading and trailing spaces.
void SetCutForPositron(double)