BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSModularPhysicsList.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#include "BDSDebug.hh"
19#include "BDSException.hh"
20#include "BDSGlobalConstants.hh"
21#include "BDSIonDefinition.hh"
22#include "BDSModularPhysicsList.hh"
23#include "BDSParticleDefinition.hh"
24#include "BDSPhysicalConstants.hh"
25#include "BDSPhysicsAnnihiToMuMu.hh"
26#include "BDSPhysicsCherenkov.hh"
27#include "BDSPhysicsCutsAndLimits.hh"
28#include "BDSPhysicsEMDissociation.hh"
29#include "BDSPhysicsGammaToMuMu.hh"
30#include "BDSPhysicsIonisation.hh"
31#include "BDSPhysicsLaserWire.hh"
32#include "BDSPhysicsMuon.hh"
33#include "BDSPhysicsMuonInelastic.hh"
34#include "BDSPhysicsSynchRad.hh"
35#include "BDSPhysicsUtilities.hh"
36#include "BDSUtilities.hh"
37#include "BDSPhysicsLaserPhotoDetachment.hh"
38#include "BDSPhysicsLaserIonExcitation.hh"
39#include "BDSPhysicsLaserComptonScattering.hh"
40#include "BDSPhysicsLaserCumulativePhotodetachment.hh"
41#include "BDSPhysicsLaserCumulativeCompton.hh"
42#include "BDSPhysicsLaserWire.hh"
43#include "BDSPhysicsMuon.hh"
44#include "BDSPhysicsSynchRad.hh"
45#include "BDSPhysicsUtilities.hh"
46#include "BDSUtilities.hh"
47
48#include "parser/fastlist.h"
49#include "parser/physicsbiasing.h"
50
51// general geant4
52#include "globals.hh"
53#include "G4GenericBiasingPhysics.hh"
54#include "G4ParticleTable.hh"
55#include "G4ProcessManager.hh"
56#include "G4ProcessVector.hh"
57#include "G4String.hh"
58#include "G4Version.hh"
59
60// physics processes / builders (assumed Geant4.10.0 and upwards)
61#include "G4ChargeExchangePhysics.hh"
62#include "G4DecayPhysics.hh"
63#include "G4EmExtraPhysics.hh"
64#include "G4EmLivermorePhysics.hh"
65#include "G4EmLivermorePolarizedPhysics.hh"
66#include "G4EmLowEPPhysics.hh"
67#include "G4EmPenelopePhysics.hh"
68#include "G4EmStandardPhysics.hh"
69#include "G4EmStandardPhysicsSS.hh"
70#include "G4EmStandardPhysicsWVI.hh"
71#include "G4EmStandardPhysics_option1.hh"
72#include "G4EmStandardPhysics_option2.hh"
73#include "G4EmStandardPhysics_option3.hh"
74#include "G4EmStandardPhysics_option4.hh"
75#include "G4HadronDElasticPhysics.hh"
76#include "G4HadronElasticPhysics.hh"
77#include "G4HadronElasticPhysicsHP.hh"
78#include "G4HadronElasticPhysicsLEND.hh"
79#include "G4HadronElasticPhysicsXS.hh"
80#include "G4HadronHElasticPhysics.hh"
81#include "G4HadronPhysicsFTFP_BERT.hh"
82#include "G4HadronPhysicsFTFP_BERT_HP.hh"
83#include "G4HadronPhysicsFTF_BIC.hh"
84#include "G4HadronPhysicsQGSP_BERT.hh"
85#include "G4HadronPhysicsQGSP_BERT_HP.hh"
86#include "G4HadronPhysicsQGSP_BIC.hh"
87#include "G4HadronPhysicsQGSP_BIC_HP.hh"
88#include "G4HadronPhysicsShielding.hh"
89#include "G4IonBinaryCascadePhysics.hh"
90#include "G4IonElasticPhysics.hh"
91#include "G4IonINCLXXPhysics.hh"
92#include "G4IonPhysics.hh"
93#include "G4IonQMDPhysics.hh"
94#include "G4NeutronTrackingCut.hh"
95#include "G4OpticalPhysics.hh"
96#include "G4RadioactiveDecayPhysics.hh"
97#include "G4StoppingPhysics.hh"
98#include "G4SynchrotronRadiation.hh"
99
100// version specific physics lists
101#if G4VERSION_NUMBER > 1009
102#include "G4HadronElasticPhysicsPHP.hh"
103#endif
104
105#if G4VERSION_NUMBER > 1019
106#include "G4EmStandardPhysicsGS.hh"
107#include "G4EmDNAChemistry.hh"
108#endif
109
110#if G4VERSION_NUMBER > 1020
111#include "G4SpinDecayPhysics.hh"
112#endif
113
114#if G4VERSION_NUMBER > 1022
115#include "G4IonPhysicsPHP.hh"
116#endif
117
118#if G4VERSION_NUMBER > 1029
119#include "G4MuonicAtomDecayPhysics.hh"
120#endif
121
122#if G4VERSION_NUMBER > 1039
123#include "BDSPhysicsChannelling.hh"
124#include "BDSPhysicsRadioactivation.hh"
125#include "G4EmDNAPhysics.hh"
126#include "G4EmDNAPhysics_option1.hh"
127#include "G4EmDNAPhysics_option2.hh"
128#include "G4EmDNAPhysics_option3.hh"
129#include "G4EmDNAPhysics_option4.hh"
130#include "G4EmDNAPhysics_option5.hh"
131#include "G4EmDNAPhysics_option6.hh"
132#include "G4EmDNAPhysics_option7.hh"
133#include "G4HadronPhysicsShieldingLEND.hh"
134#endif
135
136#if G4VERSION_NUMBER < 1070
137#include "G4OpticalProcessIndex.hh"
138#else
139#include "G4OpticalParameters.hh"
140#endif
141
142#if G4VERSION_NUMBER > 1069
143#include "G4EmDNAChemistry_option1.hh"
144#include "G4EmDNAChemistry_option2.hh"
145#include "G4EmDNAChemistry_option3.hh"
146#endif
147
148#if G4VERSION_NUMBER > 1119
149#include "BDSPhysicsXrayReflection.hh"
150#endif
151
152// particles
153#include "G4AntiNeutrinoE.hh"
154#include "G4AntiNeutron.hh"
155#include "G4AntiProton.hh"
156#include "G4BaryonConstructor.hh"
157#include "G4Electron.hh"
158#include "G4Gamma.hh"
159#include "G4IonConstructor.hh"
160#include "G4LeptonConstructor.hh"
161#include "G4MesonConstructor.hh"
162#include "G4NeutrinoE.hh"
163#include "G4Neutron.hh"
164#include "G4Positron.hh"
165#include "G4Proton.hh"
166#include "G4ShortLivedConstructor.hh"
167
168#include <iomanip>
169#include <iterator>
170#include <limits>
171#include <map>
172#include <ostream>
173#include <string>
174#include <sstream>
175#include <utility>
176#include <vector>
177
178BDSModularPhysicsList::BDSModularPhysicsList(const G4String& physicsList):
179 constructedAllLeptons(false),
180 constructedAllShortLived(false),
181 constructedAllMesons(false),
182 constructedAllBaryons(false),
183 constructedAllIons(false),
184 temporaryName(""),
185 opticalPhysics(nullptr),
186 emWillBeUsed(false),
187 usingIons(false),
188 particlesConstructed(false)
189{
191
192 SetVerboseLevel(1);
193
194 physicsConstructors.insert(std::make_pair("all_particles", &BDSModularPhysicsList::AllParticles));
195 physicsConstructors.insert(std::make_pair("annihi_to_mumu", &BDSModularPhysicsList::AnnihiToMuMu));
196 physicsConstructors.insert(std::make_pair("charge_exchange", &BDSModularPhysicsList::ChargeExchange));
197 physicsConstructors.insert(std::make_pair("cherenkov", &BDSModularPhysicsList::Cherenkov));
198 physicsConstructors.insert(std::make_pair("cuts_and_limits", &BDSModularPhysicsList::CutsAndLimits));
199 physicsConstructors.insert(std::make_pair("decay", &BDSModularPhysicsList::Decay));
200 physicsConstructors.insert(std::make_pair("decay_radioactive", &BDSModularPhysicsList::DecayRadioactive));
201 physicsConstructors.insert(std::make_pair("em", &BDSModularPhysicsList::Em));
202 physicsConstructors.insert(std::make_pair("em_extra", &BDSModularPhysicsList::EmExtra));
203 physicsConstructors.insert(std::make_pair("em_livermore", &BDSModularPhysicsList::EmLivermore));
204 physicsConstructors.insert(std::make_pair("em_livermore_polarised", &BDSModularPhysicsList::EmLivermorePolarised));
205 physicsConstructors.insert(std::make_pair("em_low_ep", &BDSModularPhysicsList::EmLowEP));
206 physicsConstructors.insert(std::make_pair("em_penelope", &BDSModularPhysicsList::EmPenelope));
207 physicsConstructors.insert(std::make_pair("em_ss", &BDSModularPhysicsList::EmSS));
208 physicsConstructors.insert(std::make_pair("em_wvi", &BDSModularPhysicsList::EmWVI));
209 physicsConstructors.insert(std::make_pair("em_1", &BDSModularPhysicsList::Em1));
210 physicsConstructors.insert(std::make_pair("em_2", &BDSModularPhysicsList::Em2));
211 physicsConstructors.insert(std::make_pair("em_3", &BDSModularPhysicsList::Em3));
212 physicsConstructors.insert(std::make_pair("em_4", &BDSModularPhysicsList::Em4));
213 physicsConstructors.insert(std::make_pair("ftfp_bert", &BDSModularPhysicsList::FTFPBERT));
214 physicsConstructors.insert(std::make_pair("ftfp_bert_hp", &BDSModularPhysicsList::FTFPBERTHP));
215 physicsConstructors.insert(std::make_pair("ftf_bic", &BDSModularPhysicsList::FTFBIC));
216 physicsConstructors.insert(std::make_pair("gamma_to_mumu", &BDSModularPhysicsList::GammaToMuMu));
217 physicsConstructors.insert(std::make_pair("hadronic_elastic", &BDSModularPhysicsList::HadronicElastic));
218 physicsConstructors.insert(std::make_pair("hadronic_elastic_d", &BDSModularPhysicsList::HadronicElasticD));
219 physicsConstructors.insert(std::make_pair("hadronic_elastic_h", &BDSModularPhysicsList::HadronicElasticH));
220 physicsConstructors.insert(std::make_pair("hadronic_elastic_hp", &BDSModularPhysicsList::HadronicElasticHP));
221 physicsConstructors.insert(std::make_pair("hadronic_elastic_lend", &BDSModularPhysicsList::HadronicElasticLEND));
222 physicsConstructors.insert(std::make_pair("hadronic_elastic_xs", &BDSModularPhysicsList::HadronicElasticXS));
223 physicsConstructors.insert(std::make_pair("ion", &BDSModularPhysicsList::Ion));
224 physicsConstructors.insert(std::make_pair("ion_binary", &BDSModularPhysicsList::IonBinary));
225 physicsConstructors.insert(std::make_pair("ion_elastic", &BDSModularPhysicsList::IonElastic));
226 physicsConstructors.insert(std::make_pair("ion_elastic_qmd", &BDSModularPhysicsList::IonElasticQMD));
227 physicsConstructors.insert(std::make_pair("ion_em_dissociation", &BDSModularPhysicsList::IonEMDissociation));
228 physicsConstructors.insert(std::make_pair("ion_inclxx", &BDSModularPhysicsList::IonINCLXX));
229 physicsConstructors.insert(std::make_pair("ionisation", &BDSModularPhysicsList::Ionisation));
230 physicsConstructors.insert(std::make_pair("lw", &BDSModularPhysicsList::LaserWire));
231 physicsConstructors.insert(std::make_pair("laser_photo_detachment", &BDSModularPhysicsList::LaserPhotoDetachment));
232 physicsConstructors.insert(std::make_pair("laser_compton_scattering", &BDSModularPhysicsList::LaserComptonScattering));
233 physicsConstructors.insert(std::make_pair("laser_cumulative_photo_detachment", &BDSModularPhysicsList::LaserCumulativePhotoDetachment));
234 physicsConstructors.insert(std::make_pair("laser_cumulative_compton_scattering", &BDSModularPhysicsList::LaserCumulativeCompton));
235 physicsConstructors.insert(std::make_pair("laser_ion_excitation", &BDSModularPhysicsList::LaserIonExcitation));
236 physicsConstructors.insert(std::make_pair("muon", &BDSModularPhysicsList::Muon));
237 physicsConstructors.insert(std::make_pair("muon_inelastic", &BDSModularPhysicsList::MuonInelastic));
238 physicsConstructors.insert(std::make_pair("neutron_tracking_cut", &BDSModularPhysicsList::NeutronTrackingCut));
239 physicsConstructors.insert(std::make_pair("optical", &BDSModularPhysicsList::Optical));
240 physicsConstructors.insert(std::make_pair("qgsp_bert", &BDSModularPhysicsList::QGSPBERT));
241 physicsConstructors.insert(std::make_pair("qgsp_bert_hp", &BDSModularPhysicsList::QGSPBERTHP));
242 physicsConstructors.insert(std::make_pair("qgsp_bic", &BDSModularPhysicsList::QGSPBIC));
243 physicsConstructors.insert(std::make_pair("qgsp_bic_hp", &BDSModularPhysicsList::QGSPBICHP));
244 physicsConstructors.insert(std::make_pair("shielding", &BDSModularPhysicsList::Shielding));
245 physicsConstructors.insert(std::make_pair("stopping", &BDSModularPhysicsList::Stopping));
246 physicsConstructors.insert(std::make_pair("synch_rad", &BDSModularPhysicsList::SynchRad));
247#if G4VERSION_NUMBER > 1019
248 physicsConstructors.insert(std::make_pair("em_gs", &BDSModularPhysicsList::EmGS));
249 physicsConstructors.insert(std::make_pair("dna_chemistry", &BDSModularPhysicsList::DNAChemistry));
250#endif
251#if G4VERSION_NUMBER > 1020
252 physicsConstructors.insert(std::make_pair("decay_spin", &BDSModularPhysicsList::DecaySpin));
253#endif
254#if G4VERSION_NUMBER > 1022
255 physicsConstructors.insert(std::make_pair("ion_php", &BDSModularPhysicsList::IonPHP));
256#endif
257#if G4VERSION_NUMBER > 1029
258 physicsConstructors.insert(std::make_pair("decay_muonic_atom", &BDSModularPhysicsList::DecayMuonicAtom));
259#endif
260#if G4VERSION_NUMBER > 1039
261 physicsConstructors.insert(std::make_pair("channelling", &BDSModularPhysicsList::Channelling));
262 physicsConstructors.insert(std::make_pair("dna", &BDSModularPhysicsList::DNA));
263 physicsConstructors.insert(std::make_pair("dna_1", &BDSModularPhysicsList::DNA));
264 physicsConstructors.insert(std::make_pair("dna_2", &BDSModularPhysicsList::DNA));
265 physicsConstructors.insert(std::make_pair("dna_3", &BDSModularPhysicsList::DNA));
266 physicsConstructors.insert(std::make_pair("dna_4", &BDSModularPhysicsList::DNA));
267 physicsConstructors.insert(std::make_pair("dna_5", &BDSModularPhysicsList::DNA));
268 physicsConstructors.insert(std::make_pair("dna_6", &BDSModularPhysicsList::DNA));
269 physicsConstructors.insert(std::make_pair("dna_7", &BDSModularPhysicsList::DNA));
270 physicsConstructors.insert(std::make_pair("radioactivation", &BDSModularPhysicsList::Radioactivation));
271 physicsConstructors.insert(std::make_pair("shielding_lend", &BDSModularPhysicsList::ShieldingLEND));
272#endif
273#if G4VERSION_NUMBER > 1069
274 physicsConstructors.insert(std::make_pair("dna_chemistry_1", &BDSModularPhysicsList::DNAChemistry));
275 physicsConstructors.insert(std::make_pair("dna_chemistry_2", &BDSModularPhysicsList::DNAChemistry));
276 physicsConstructors.insert(std::make_pair("dna_chemistry_3", &BDSModularPhysicsList::DNAChemistry));
277#endif
278#if G4VERSION_NUMBER > 1119
279 physicsConstructors.insert(std::make_pair("xray_reflection", &BDSModularPhysicsList::XrayReflection));
280#endif
281
282 // old names and aliases
283 aliasToOriginal["cerenkov"] = "cherenkov";
284 aliasToOriginal["cutsandlimits"] = "cuts_and_limits";
285 aliasToOriginal["em_low"] = "em_penelope";
286 aliasToOriginal["hadronic"] = "ftfp_bert";
287 aliasToOriginal["hadronic_hp"] = "ftfp_bert_hp";
288 aliasToOriginal["ionbinary"] = "ion_binary";
289 aliasToOriginal["ioninclxx"] = "ion_inclxx";
290 aliasToOriginal["ionphp"] = "ion_php";
291 aliasToOriginal["spindecay"] = "decay_spin";
292 aliasToOriginal["synchrad"] = "synch_rad";
293#if G4VERSION_NUMBER > 1039
294 aliasToOriginal["channeling"] = "channelling";
295#endif
296
297 // prepare vector of valid names for searching when parsing physics list string
298 for (const auto& constructor : physicsConstructors)
299 {
300 physicsLists.emplace_back(constructor.first);
301 physicsActivated[constructor.first] = false;
302 }
303
304 // setup a list of incompatible physics lists for each one - mostly based on experience
305 // initialise all to empty vectors and specify only ones that have some incompatible physics lists
306 for (const auto& kv : physicsConstructors)
307 {incompatible.insert(std::make_pair(kv.first, std::vector<G4String>()));}
308 incompatible["annihi_to_mumu"] = {"em_extra"};
309 incompatible["cherenkov"] = {"optical"};
310 incompatible["dna"] = {"dna_1", "dna_2", "dna_3", "dna_4", "dna_5", "dna_6", "dna_7", "dna_chemistry", "dna_chemistry_1", "dna_chemistry_2", "dna_chemistry_3"};
311 incompatible["dna_1"] = {"dna", "dna_2", "dna_3", "dna_4", "dna_5", "dna_6", "dna_7", "dna_chemistry", "dna_chemistry_1", "dna_chemistry_2", "dna_chemistry_3"};
312 incompatible["dna_2"] = {"dna_1", "dna", "dna_3", "dna_4", "dna_5", "dna_6", "dna_7", "dna_chemistry", "dna_chemistry_1", "dna_chemistry_2", "dna_chemistry_3"};
313 incompatible["dna_3"] = {"dna_1", "dna_2", "dna", "dna_4", "dna_5", "dna_6", "dna_7", "dna_chemistry", "dna_chemistry_1", "dna_chemistry_2", "dna_chemistry_3"};
314 incompatible["dna_4"] = {"dna_1", "dna_2", "dna_3", "dna", "dna_5", "dna_6", "dna_7", "dna_chemistry", "dna_chemistry_1", "dna_chemistry_2", "dna_chemistry_3"};
315 incompatible["dna_5"] = {"dna_1", "dna_2", "dna_3", "dna_4", "dna", "dna_6", "dna_7", "dna_chemistry", "dna_chemistry_1", "dna_chemistry_2", "dna_chemistry_3"};
316 incompatible["dna_6"] = {"dna_1", "dna_2", "dna_3", "dna_4", "dna_5", "dna", "dna_7", "dna_chemistry", "dna_chemistry_1", "dna_chemistry_2", "dna_chemistry_3"};
317 incompatible["dna_7"] = {"dna_1", "dna_2", "dna_3", "dna_4", "dna_5", "dna_6", "dna", "dna_chemistry", "dna_chemistry_1", "dna_chemistry_2", "dna_chemistry_3"};
318 incompatible["dna_chemistry"] = {"dna", "dna_1", "dna_2", "dna_3", "dna_4", "dna_5", "dna_6", "dna_7", "dna_chemistry_1", "dna_chemistry_2", "dna_chemistry_3"};
319 incompatible["dna_chemistry_1"] = {"dna", "dna_1", "dna_2", "dna_3", "dna_4", "dna_5", "dna_6", "dna_7", "dna_chemistry", "dna_chemistry_2", "dna_chemistry_3"};
320 incompatible["dna_chemistry_2"] = {"dna", "dna_1", "dna_2", "dna_3", "dna_4", "dna_5", "dna_6", "dna_7", "dna_chemistry_1", "dna_chemistry", "dna_chemistry_3"};
321 incompatible["dna_chemistry_3"] = {"dna", "dna_1", "dna_2", "dna_3", "dna_4", "dna_5", "dna_6", "dna_7", "dna_chemistry_1", "dna_chemistry_2", "dna_chemistry"};
322 incompatible["em"] = {"em_ss", "em_wvi", "em_1", "em_2", "em_3", "em_4"};
323 incompatible["em_ss"] = {"em", "em_wvi", "em_1", "em_2", "em_3", "em_4"};
324 incompatible["em_wvi"] = {"em", "em_ss", "em_1", "em_2", "em_3", "em_4"};
325 incompatible["em_1"] = {"em", "em_ss", "em_wvi", "em_2", "em_3", "em_4"};
326 incompatible["em_2"] = {"em", "em_ss", "em_wvi", "em_1", "em_3", "em_4"};
327 incompatible["em_3"] = {"em", "em_ss", "em_wvi", "em_1", "em_2", "em_4"};
328 incompatible["em_4"] = {"em", "em_ss", "em_wvi", "em_1", "em_2", "em_3"};
329 incompatible["em_livermore"] = {"em_livermore_polarised"};
330 incompatible["em_extra"] = {"muon", "muon_inelastic"};
331 incompatible["ftfp_bert"] = {"ftfp_bert_hp", "ftf_bic", "qgsp_bert", "qgsp_bert_hp", "qgsp_bic", "qgsp_bic_hp"};
332 incompatible["ftfp_bert_hp"] = {"ftfp_bert", "ftf_bic", "qgsp_bert", "qgsp_bert_hp", "qgsp_bic", "qgsp_bic_hp"};
333 incompatible["ftf_bic"] = {"ftfp_bert", "ftfp_bert_hp", "qgsp_bert", "qgsp_bert_hp", "qgsp_bic", "qgsp_bic_hp"};
334 incompatible["gamma_to_mumu"] = {"em_extra"};
335 incompatible["hadronic_elastic"] = {"hadronic_elastic_d", "hadronic_elastic_h", "hadronic_elastic_hp", "hadronic_elastic_lend", "hadronic_elastic_xs"};
336 incompatible["hadronic_elastic_d"] = {"hadronic_elastic", "hadronic_elastic_h", "hadronic_elastic_hp", "hadronic_elastic_lend", "hadronic_elastic_xs"};
337 incompatible["hadronic_elastic_h"] = {"hadronic_elastic", "hadronic_elastic_d", "hadronic_elastic_hp", "hadronic_elastic_lend", "hadronic_elastic_xs"};
338 incompatible["hadronic_elastic_hp"] = {"hadronic_elastic", "hadronic_elastic_d", "hadronic_elastic_h", "hadronic_elastic_lend", "hadronic_elastic_xs"};
339 incompatible["hadronic_elastic_lend"] = {"hadronic_elastic", "hadronic_elastic_d", "hadronic_elastic_h", "hadronic_elastic_hp", "hadronic_elastic_xs"};
340 incompatible["hadronic_elastic_xs"] = {"hadronic_elastic", "hadronic_elastic_d", "hadronic_elastic_h", "hadronic_elastic_hp", "hadronic_elastic_lend"};
341 incompatible["ion_elastic"] = {"ion_elastic_qmd"};
342 incompatible["ionisation"] = {"em", "em_ss", "em_1", "em_2", "em_3", "em_4", "em_livermore"};
343 incompatible["optical"] = {"cherenkov"};
344 incompatible["qgsp_bert"] = {"ftfp_bert", "ftfp_bert_hp", "ftf_bic", "qgsp_bert_hp", "qgsp_bic", "qgsp_bic_hp"};
345 incompatible["qgsp_bert_hp"] = {"ftfp_bert", "ftfp_bert_hp", "ftf_bic", "qgsp_bert", "qgsp_bic", "qgsp_bic_hp"};
346 incompatible["qgsp_bic"] = {"ftfp_bert", "ftfp_bert_hp", "ftf_bic", "qgsp_bert", "qgsp_bert_hp", "qgsp_bic_hp"};
347 incompatible["qgsp_bic_hp"] = {"ftfp_bert", "ftfp_bert_hp", "ftf_bic", "qgsp_bert", "qgsp_bert_hp", "qgsp_bic"};
348 incompatible["muon"] = {"em_extra"};
349 incompatible["muon_inelastic"] = {"em_extra", "muon"};
350
351#if G4VERSION_NUMBER > 1019
352 for (const auto& name : {"em", "em_ss", "em_wvi", "em_1", "em_2", "em_3", "em_4"})
353 {incompatible[name].emplace_back("em_gs");}
354 incompatible["em_gs"] = {"em", "em_ss", "em_wvi", "em_1", "em_2", "em_3", "em_4"};
355#endif
356#if G4VERSION_NUMBER > 1020
357 incompatible["decay"].emplace_back("decay_spin"); // append for safety in future
358 incompatible["decay_spin"] = {"decay"};
359#endif
360#if G4VERSION_NUMBER > 1039
361 incompatible["shielding"].emplace_back("shielding_lend");
362 incompatible["shielding_lend"] = {"shielding"};
363#endif
364
365 ParsePhysicsList(physicsList);
366 ConfigurePhysics();
367
368 // register the physics constructors with base class mechanics.
369 for (auto physics : constructors)
370 {RegisterPhysics(physics);}
371
372#ifdef BDSDEBUG
373 if (true)
374#else
375 if (globals->Verbose())
376#endif
377 {Print();}
378}
379
380BDSModularPhysicsList::~BDSModularPhysicsList()
381{;}
382
384{
385 if (particlesConstructed)
386 {return;}
388 G4VModularPhysicsList::ConstructParticle();
389 particlesConstructed = true;
390}
391
393{
394 G4VModularPhysicsList::ConstructProcess();
395 DumpCutValuesTable(100);
396}
397
399{
400 for (const auto& physics : physicsActivated)
401 {
402 G4String result = (physics.second ? "active" : "inactive");
403 G4cout << std::setw(27) << ("\"" + physics.first + "\": ") << result << G4endl;
404 }
405}
406
407void BDSModularPhysicsList::ParsePhysicsList(const G4String& physListName)
408{
409#ifdef BDSDEBUG
410 G4cout << __METHOD_NAME__ << "Physics list string: \"" << physListName << "\"" << G4endl;
411#endif
412 // string stream to vector will take a single string that contains words
413 // delimited by whitespace and split them on the whitespace
414 std::stringstream ss(physListName);
415 std::istream_iterator<std::string> begin(ss);
416 std::istream_iterator<std::string> end;
417 std::vector<std::string> physicsListNamesS(begin, end);
418
419 // convert to G4String for lower case convenience
420 std::vector<G4String> physicsListNames;
421 for (const auto& physicsListName : physicsListNamesS)
422 {
423 G4String name = G4String(physicsListName); // convert string to G4String.
424 name = BDS::LowerCase(name);
425 temporaryName = name; // copy to temporary variable
426
427 // search aliases
428 auto result = aliasToOriginal.find(name);
429 if (result != aliasToOriginal.end())
430 {
431 G4cout << __METHOD_NAME__ << "alias \"" << name << "\" forwarding to \""
432 << result->second << "\"" << G4endl;
433 name = result->second; // overwrite name with the correct one
434 }
435 physicsListNames.push_back(name);
436 }
437
438 // search for em physics (could be any order) - needed for different construction of muon phyiscs
439 if (std::find(physicsListNames.begin(), physicsListNames.end(), "em") != physicsListNames.end())
440 {emWillBeUsed = true;}
441
442 for (const auto& name : physicsListNames)
443 {
444 auto result = physicsConstructors.find(name);
445 if (result != physicsConstructors.end())
446 {
447 G4cout << __METHOD_NAME__ << "Constructing \"" << result->first << "\" physics list" << G4endl;
449 auto mem = result->second;
450 (this->*mem)(); // call the function pointer in this instance of the class
451 }
452 else
453 {
454 G4cout << "\"" << name << "\" is not a valid physics list. Available ones are: " << G4endl;
455 for (const auto& listName : physicsLists)
456 {G4cout << "\"" << listName << "\"" << G4endl;}
457 throw BDSException(__METHOD_NAME__, "Invalid physics list.");
458 }
459 }
460
461 //Always load cuts and limits.
463}
464
466{
468 {return;}
469 G4LeptonConstructor::ConstructParticle();
471}
472
474{
476 {return;}
477 G4ShortLivedConstructor::ConstructParticle();
479}
480
482{
484 {return;}
485 G4MesonConstructor::ConstructParticle();
487}
488
490{
492 {return;}
493 G4BaryonConstructor::ConstructParticle();
495}
496
498{
500 {return;}
501 usingIons = true; // all physics lists that use ions call this function so put this here
502 G4GenericIon::GenericIonDefinition();
503 G4IonConstructor::ConstructParticle();
504 constructedAllIons = true;
505}
506
508{
509 if (opticalPhysics)
511}
512
514{
515 G4long maxPhotonsPerStep = globals->MaximumPhotonsPerStep();
516 G4double maxBetaChangePerStep = globals->MaximumBetaChangePerStep();
517 if (maxBetaChangePerStep > 100.0)
518 {throw BDSException(__METHOD_NAME__, "the option 'maxBetaChangePerStep' must be less than 100 %");}
519#if G4VERSION_NUMBER < 1079
520 // cherenkov turned on with optical even if it's not on as separate list
521 opticalPhysics->Configure(G4OpticalProcessIndex::kCerenkov, true);
522 opticalPhysics->Configure(G4OpticalProcessIndex::kScintillation, true);
523 opticalPhysics->Configure(G4OpticalProcessIndex::kAbsorption, globals->TurnOnOpticalAbsorption());
524 opticalPhysics->Configure(G4OpticalProcessIndex::kRayleigh, globals->TurnOnRayleighScattering());
525 opticalPhysics->Configure(G4OpticalProcessIndex::kMieHG, globals->TurnOnMieScattering());
526 opticalPhysics->Configure(G4OpticalProcessIndex::kBoundary, globals->TurnOnOpticalSurface());
527 opticalPhysics->Configure(G4OpticalProcessIndex::kWLS, true);
528 opticalPhysics->SetScintillationYieldFactor(globals->ScintYieldFactor());
529 if (maxPhotonsPerStep >= 0)
530 {opticalPhysics->SetMaxNumPhotonsPerStep(maxPhotonsPerStep);}
531 opticalPhysics->SetMaxBetaChangePerStep(maxBetaChangePerStep);
532#else
533 G4OpticalParameters* opticalParameters = G4OpticalParameters::Instance();
534 opticalParameters->SetProcessActivation(G4OpticalProcessName(G4OpticalProcessIndex::kCerenkov), true);
535 opticalParameters->SetProcessActivation(G4OpticalProcessName(G4OpticalProcessIndex::kScintillation), true);
536 opticalParameters->SetProcessActivation(G4OpticalProcessName(G4OpticalProcessIndex::kAbsorption), globals->TurnOnOpticalAbsorption());
537 opticalParameters->SetProcessActivation(G4OpticalProcessName(G4OpticalProcessIndex::kRayleigh), globals->TurnOnRayleighScattering());
538 opticalParameters->SetProcessActivation(G4OpticalProcessName(G4OpticalProcessIndex::kMieHG), globals->TurnOnMieScattering());
539 opticalParameters->SetProcessActivation(G4OpticalProcessName(G4OpticalProcessIndex::kBoundary), globals->TurnOnOpticalSurface());
540 opticalParameters->SetProcessActivation(G4OpticalProcessName(G4OpticalProcessIndex::kWLS), true);
541 if (maxPhotonsPerStep >= 0)
542 {opticalParameters->SetCerenkovMaxPhotonsPerStep((G4int)maxPhotonsPerStep);}
543 opticalParameters->SetCerenkovMaxBetaChange(maxBetaChangePerStep);
544#endif
545}
546
547void BDSModularPhysicsList::CheckIncompatiblePhysics(const G4String& singlePhysicsIn) const
548{
549 // no need to check if key is present as we control both maps in the constructor
550 const std::vector<G4String>& forbidden = incompatible.at(singlePhysicsIn);
551
552 for (const auto& key : forbidden)
553 {// for each forbidden physics list, check if it's activated
554 if (physicsActivated.at(key))
555 {
556 G4cerr << __METHOD_NAME__ << "Incompatible physics list \"" << singlePhysicsIn
557 << "\" being used with already used \"" << key << "\"" << G4endl;
558 G4cout << "\"" << singlePhysicsIn << "\" cannot be used with the following:" << G4endl;
559 for (const auto& v : forbidden)
560 {G4cout << "\"" << v << "\"" << G4endl;}
561 throw BDSException(__METHOD_NAME__, "Incompatible physics list.");
562 }
563 }
564}
565
574
576{
577 if (!physicsActivated["annihi_to_mumu"])
578 {
579 constructors.push_back(new BDSPhysicsAnnihiToMuMu());
580 physicsActivated["annihi_to_mumu"] = true;
581 }
582}
583
585{
587 if (!physicsActivated["charge_exchange"])
588 {
589 constructors.push_back(new G4ChargeExchangePhysics());
590 physicsActivated["charge_exchange"] = true;
591 }
592}
593
595{
596 if (!physicsActivated["cherenkov"])
597 {
598 constructors.push_back(new BDSPhysicsCherenkov(BDSGlobalConstants::Instance()->MaximumPhotonsPerStep(),
599 BDSGlobalConstants::Instance()->MaximumBetaChangePerStep()));
600 physicsActivated["cherenkov"] = true;
601 if (!physicsActivated["em"])
602 {Em();} // requires em physics to work (found empirically)
603 }
604}
605
607{
608 if (!physicsActivated["cuts_and_limits"])
609 {
610 constructors.push_back(new BDSPhysicsCutsAndLimits(BDSGlobalConstants::Instance()->ParticlesToExcludeFromCutsAsSet()));
611 physicsActivated["cuts_and_limits"] = true;
612 }
613}
614
616{
617 if (!physicsActivated["decay"])
618 {
619 constructors.push_back(new G4DecayPhysics());
620 physicsActivated["decay"] = true;
621 }
622}
623
625{
626 if (!physicsActivated["decay_radioactive"])
627 {
628 constructors.push_back(new G4RadioactiveDecayPhysics());
629 physicsActivated["decay_radioactive"] = true;
630 }
631}
632
634{
636 if (!physicsActivated["em"])
637 {
638 constructors.push_back(new G4EmStandardPhysics());
639 physicsActivated["em"] = true;
640 }
641}
642
644{
646
647 // These are required by GammaNuclear and MuonNuclear which
648 // are activated by default in G4EmExtraPhysics.
653
654 if (!physicsActivated["em_extra"])
655 {
656 auto constructor = new G4EmExtraPhysics();
657#if G4VERSION_NUMBER > 1019
658 G4bool useMuonNuclear = BDSGlobalConstants::Instance()->UseMuonNuclear();
659 constructor->MuonNuclear(useMuonNuclear);
660 G4cout << __METHOD_NAME__ << "G4EmExtraPhysics> muon nuclear processes : " << BDS::BoolToString(useMuonNuclear) << G4endl;
661#endif
662#if G4VERSION_NUMBER > 1029
663 G4bool useGammaToMuMu = BDSGlobalConstants::Instance()->UseGammaToMuMu();
664 constructor->GammaToMuMu(useGammaToMuMu);
665 G4cout << __METHOD_NAME__ << "G4EmExtraPhysics> gamma to mu mu : " << BDS::BoolToString(useGammaToMuMu) << G4endl;
666 G4bool usePositronToMuMu = BDSGlobalConstants::Instance()->UsePositronToMuMu();
667 constructor->PositronToMuMu(usePositronToMuMu);
668 G4cout << __METHOD_NAME__ << "G4EmExtraPhysics> e+ to mu mu : " << BDS::BoolToString(usePositronToMuMu) << G4endl;
669 G4bool usePositronToHadrons = BDSGlobalConstants::Instance()->UsePositronToHadrons();
670 constructor->PositronToHadrons(usePositronToHadrons);
671 G4cout << __METHOD_NAME__ << "G4EmExtraPhysics> e+ to hadrons : " << BDS::BoolToString(usePositronToHadrons) << G4endl;
672#endif
673#if G4VERSION_NUMBER > 1039
674 G4bool useLENDGammaNuclear = BDSGlobalConstants::Instance()->UseLENDGammaNuclear();
675 if (useLENDGammaNuclear)
676 {
678 constructor->LENDGammaNuclear(true);
679 G4cout << __METHOD_NAME__ << "G4EmExtraPhysics> LEND gamma nuclear : " << BDS::BoolToString(useMuonNuclear) << G4endl;
680 }
681 G4bool useElectroNuclear = BDSGlobalConstants::Instance()->UseElectroNuclear();
682 constructor->ElectroNuclear(useElectroNuclear);
683#endif
684 constructors.push_back(constructor);
685 physicsActivated["em_extra"] = true;
686 }
687}
688
690{
692 if (!physicsActivated["em_livermore"])
693 {
694 constructors.push_back(new G4EmLivermorePhysics());
695 physicsActivated["em_livermore"] = true;
696 }
697}
698
700{
702 if (!physicsActivated["em_livermore_polarised"])
703 {
704 constructors.push_back(new G4EmLivermorePolarizedPhysics());
705 physicsActivated["em_livermore_polarised"] = true;
706 }
707}
708
710{
712 if (!physicsActivated["em_low_ep"])
713 {
714 constructors.push_back(new G4EmLowEPPhysics());
715 physicsActivated["em_low_ep"] = true;
716 }
717}
718
720{
722 if (!physicsActivated["em_penelope"])
723 {
724 constructors.push_back(new G4EmPenelopePhysics());
725 physicsActivated["em_penelope"] = true;
726 }
727}
728
730{
732 if (!physicsActivated["em_ss"])
733 {
734 constructors.push_back(new G4EmStandardPhysicsSS());
735 physicsActivated["em_ss"] = true;
736 }
737}
738
740{
742 if (!physicsActivated["em_wvi"])
743 {
744 constructors.push_back(new G4EmStandardPhysicsWVI());
745 physicsActivated["em_wvi"] = true;
746 }
747}
748
750{
752 if (!physicsActivated["em_1"])
753 {
754 constructors.push_back(new G4EmStandardPhysics_option1());
755 physicsActivated["em_1"] = true;
756 }
757}
758
760{
762 if (!physicsActivated["em_2"])
763 {
764 constructors.push_back(new G4EmStandardPhysics_option2());
765 physicsActivated["em_2"] = true;
766 }
767}
768
770{
772 if (!physicsActivated["em_3"])
773 {
774 constructors.push_back(new G4EmStandardPhysics_option3());
775 physicsActivated["em_3"] = true;
776 }
777}
778
780{
782 if (!physicsActivated["em_4"])
783 {
784 constructors.push_back(new G4EmStandardPhysics_option4());
785 physicsActivated["em_4"] = true;
786 }
787}
788
790{
792 HadronicElastic(); // has to be here to prevent G4 segfault
793 if (!physicsActivated["ftfp_bert"])
794 {
795 constructors.push_back(new G4HadronPhysicsFTFP_BERT());
796 physicsActivated["ftfp_bert"] = true;
797 }
798}
799
801{
803 HadronicElastic(); // has to be here to prevent G4 segfault
804 if (!physicsActivated["ftfp_bert_hp"])
805 {
806 constructors.push_back(new G4HadronPhysicsFTFP_BERT_HP());
807 physicsActivated["ftfp_bert_hp"] = true;
808 }
809}
810
812{
814 if (!physicsActivated["ftf_bic"])
815 {
816 constructors.push_back(new G4HadronPhysicsFTF_BIC());
817 physicsActivated["ftf_bic"] = true;
818 }
819}
820
822{
823 if (!physicsActivated["gamma_to_mumu"])
824 {
825 constructors.push_back(new BDSPhysicsGammaToMuMu());
826 physicsActivated["gamma_to_mumu"] = true;
827 }
828}
829
831{
833 if (!physicsActivated["hadronic_elastic"])
834 {
835 constructors.push_back(new G4HadronElasticPhysics());
836 physicsActivated["hadronic_elastic"] = true;
837 }
838}
839
841{
843 if (!physicsActivated["hadronic_elastic_d"])
844 {
845 constructors.push_back(new G4HadronDElasticPhysics());
846 physicsActivated["hadronic_elastic_d"] = true;
847 }
848}
849
851{
853 if (!physicsActivated["hadronic_elastic_h"])
854 {
855 constructors.push_back(new G4HadronHElasticPhysics());
856 physicsActivated["hadronic_elastic_h"] = true;
857 }
858}
859
861{
863 if (!physicsActivated["hadronic_elastic_hp"])
864 {
865 constructors.push_back(new G4HadronElasticPhysicsHP());
866 physicsActivated["hadronic_elastic_hp"] = true;
867 }
868}
869
871{
872 BDS::CheckLowEnergyNeutronDataExists("hadronic_elastic_lend");
874 if (!physicsActivated["hadronic_elastic_lend"])
875 {
876 constructors.push_back(new G4HadronElasticPhysicsLEND());
877 physicsActivated["hadronic_elastic_lend"] = true;
878 }
879}
880
882{
884 if (!physicsActivated["hadronic_elastic_xs"])
885 {
886 constructors.push_back(new G4HadronElasticPhysicsXS());
887 physicsActivated["hadronic_elastic_xs"] = true;
888 }
889}
890
892{
898
899 if (!physicsActivated["ion"])
900 {
901 constructors.push_back(new G4IonPhysics());
902 physicsActivated["ion"] = true;
903 }
904}
905
907{
914
915 if (!physicsActivated["ion_binary"])
916 {
917 constructors.push_back(new G4IonBinaryCascadePhysics());
918 physicsActivated["ion_binary"] = true;
919 }
920}
921
922
924{
930
931 if (!physicsActivated["ion_elastic"])
932 {
933 constructors.push_back(new G4IonElasticPhysics());
934 physicsActivated["ion_elastic"] = true;
935 }
936}
937
938
940{
946
947 if (!physicsActivated["ion_elastic_qmd"])
948 {
949 constructors.push_back(new G4IonQMDPhysics());
950 physicsActivated["ion_elastic_qmd"] = true;
951 }
952}
953
955{
961 if (!physicsActivated["ion_em_dissociation"])
962 {
963 constructors.push_back(new BDSPhysicsEMDissociation());
964 physicsActivated["ion_em_dissociation"] = true;
965 }
966}
967
969{
976
977 if (!physicsActivated["ion_inclxx"])
978 {
979 constructors.push_back(new G4IonINCLXXPhysics());
980 physicsActivated["ion_inclxx"] = true;
981 }
982}
983
985{
986 if (!physicsActivated["ionisation"])
987 {
988 constructors.push_back(new BDSPhysicsIonisation());
989 physicsActivated["ionisation"] = true;
990 }
991}
992
994{
995 if (!physicsActivated["lw"])
996 {
997 constructors.push_back(new BDSPhysicsLaserWire());
998 physicsActivated["lw"] = true;
999 }
1000}
1001
1003{
1004 if(!physicsActivated["laser_photo_detachment"])
1005 {
1006 constructors.push_back(new BDSPhysicsLaserPhotoDetachment());
1007 physicsActivated["laser_photo_detachment"] = true;
1008 }
1009}
1010
1012{
1013 if(!physicsActivated["laser_compton_scattering"])
1014 {
1015 constructors.push_back(new BDSPhysicsLaserComptonScattering());
1016 physicsActivated["laser_compton_scattering"] = true;
1017 }
1018}
1019
1021{
1022 if(!physicsActivated["laser_cumulative_photo_detachment"])
1023 {
1024 constructors.push_back(new BDSPhysicsLaserCumulativePhotodetachment());
1025 physicsActivated["laser_cumulative_photo_detachment"] = true;
1026 }
1027}
1028
1030{
1031 if(!physicsActivated["laser_cumulative_compton_scattering"])
1032 {
1033 constructors.push_back(new BDSPhysicsLaserCumulativeCompton());
1034 physicsActivated["laser_cumulative_compton_scattering"] = true;
1035 }
1036}
1037
1039{
1040 if(!physicsActivated["laser_ion_excitation"])
1041 {
1042 constructors.push_back(new BDSPhysicsLaserIonExcitation());
1043 physicsActivated["laser_ion_excitation"] = true;
1044 }
1045}
1046
1048{
1049 if (!physicsActivated["muon"])
1050 {
1051 constructors.push_back(new BDSPhysicsMuon(emWillBeUsed));
1052 physicsActivated["muon"] = true;
1053 }
1054}
1055
1057{
1058 if (!physicsActivated["muon_inelastic"])
1059 {
1060 constructors.push_back(new BDSPhysicsMuonInelastic());
1061 physicsActivated["muon_inelastic"] = true;
1062 }
1063}
1064
1066{
1067 if (!physicsActivated["neutron_tracking_cut"])
1068 {
1069 auto ntc = new G4NeutronTrackingCut();
1070 G4double timeLimit = BDSGlobalConstants::Instance()->NeutronTimeLimit();
1071 G4double eKinLimit = BDSGlobalConstants::Instance()->NeutronKineticEnergyLimit();
1072 G4cout << __METHOD_NAME__ << "Neutron time limit: " << timeLimit / CLHEP::s << " s" << G4endl;
1073 G4cout << __METHOD_NAME__ << "Neutron kinetic energy limit: " << eKinLimit / CLHEP::MeV << G4endl;
1074 ntc->SetTimeLimit(timeLimit);
1075 ntc->SetKineticEnergyLimit(eKinLimit);
1076 constructors.push_back(ntc);
1077 physicsActivated["neutron_tracking_cut"] = true;
1078 }
1079}
1080
1082{
1083 if (!physicsActivated["optical"])
1084 {
1085 opticalPhysics = new G4OpticalPhysics();
1086 constructors.push_back(opticalPhysics);
1087 physicsActivated["optical"] = true;
1088 }
1089}
1090
1092{
1094 if (!physicsActivated["qgsp_bert"])
1095 {
1096 constructors.push_back(new G4HadronPhysicsQGSP_BERT());
1097 physicsActivated["qgsp_bert"] = true;
1098 }
1099}
1100
1102{
1104 if (!physicsActivated["qgsp_bert_hp"])
1105 {
1106 constructors.push_back(new G4HadronPhysicsQGSP_BERT_HP());
1107 physicsActivated["qgsp_bert_hp"] = true;
1108 }
1109}
1110
1112{
1114 if (!physicsActivated["qgsp_bic"])
1115 {
1116 constructors.push_back(new G4HadronPhysicsQGSP_BIC());
1117 physicsActivated["qgsp_bic"] = true;
1118 }
1119}
1120
1122{
1124 if (!physicsActivated["qgsp_bic_hp"])
1125 {
1126 constructors.push_back(new G4HadronPhysicsQGSP_BIC_HP());
1127 physicsActivated["qgsp_bic_hp"] = true;
1128 }
1129}
1130
1132{
1133#if G4VERSION_NUMBER > 1059
1134 AllParticles();
1135#endif
1136 if (!physicsActivated["shielding"])
1137 {
1138 constructors.push_back(new G4HadronPhysicsShielding());
1139 physicsActivated["shielding"] = true;
1140 }
1141}
1142
1144{
1147 if (!physicsActivated["stopping"])
1148 {
1149 constructors.push_back(new G4StoppingPhysics());
1150 physicsActivated["stopping"] = true;
1151 }
1152}
1153
1155{
1157 if (!physicsActivated["synch_rad"])
1158 {
1159 constructors.push_back(new BDSPhysicsSynchRad());
1160 physicsActivated["synch_rad"] = true;
1161 }
1162}
1163
1164#if G4VERSION_NUMBER > 1019
1166{
1168 if (!physicsActivated["em_gs"])
1169 {
1170 constructors.push_back(new G4EmStandardPhysicsGS());
1171 physicsActivated["em_gs"] = true;
1172 }
1173}
1174
1176{
1177 if (!physicsActivated["dna_chemistry"])
1178 {
1179 // only one DNA chemistry physics list possible
1180 if (temporaryName == "dna_chemistry")
1181 {constructors.push_back(new G4EmDNAChemistry());}
1182#if G4VERSION_NUMBER > 1069
1183 else if (temporaryName == "dna_chemistry_1")
1184 {constructors.push_back(new G4EmDNAChemistry_option1());}
1185 else if (temporaryName == "dna_chemistry_2")
1186 {constructors.push_back(new G4EmDNAChemistry_option2());}
1187 else if (temporaryName == "dna_chemistry_3")
1188 {constructors.push_back(new G4EmDNAChemistry_option3());}
1189#endif
1190 physicsActivated["dna_chemistry"] = true;
1191 }
1192}
1193#endif
1194
1195#if G4VERSION_NUMBER > 1020
1197{
1198 if (!physicsActivated["decay_spin"])
1199 {// this will replace regular decay for various processes
1200 constructors.push_back(new G4SpinDecayPhysics());
1201 physicsActivated["decay_spin"] = true;
1202 }
1203}
1204#endif
1205
1206#if G4VERSION_NUMBER > 1022
1208{
1215
1216 if (!physicsActivated["ion_php"])
1217 {
1218 constructors.push_back(new G4IonPhysicsPHP());
1219 physicsActivated["ion_php"] = true;
1220 }
1221}
1222#endif
1223
1224#if G4VERSION_NUMBER > 1029
1226{
1230#if G4VERSION_NUMBER > 1059
1232#endif
1233 if (!physicsActivated["decay_muonic_atom"])
1234 {
1235 constructors.push_back(new G4MuonicAtomDecayPhysics());
1236 physicsActivated["decay_muonic_atom"] = true;
1237 }
1238}
1239#endif
1240
1241#if G4VERSION_NUMBER > 1039
1243{
1244 if (!physicsActivated["dna"])
1245 {
1246 if (temporaryName == "dna")
1247 {constructors.push_back(new G4EmDNAPhysics());}
1248 else if (temporaryName == "dna_1")
1249 {constructors.push_back(new G4EmDNAPhysics_option1());}
1250 else if (temporaryName == "dna_2")
1251 {constructors.push_back(new G4EmDNAPhysics_option2());}
1252 else if (temporaryName == "dna_3")
1253 {constructors.push_back(new G4EmDNAPhysics_option3());}
1254 else if (temporaryName == "dna_4")
1255 {constructors.push_back(new G4EmDNAPhysics_option4());}
1256 else if (temporaryName == "dna_5")
1257 {constructors.push_back(new G4EmDNAPhysics_option5());}
1258 else if (temporaryName == "dna_6")
1259 {constructors.push_back(new G4EmDNAPhysics_option6());}
1260 else if (temporaryName == "dna_7")
1261 {constructors.push_back(new G4EmDNAPhysics_option7());}
1262 physicsActivated["dna"] = true;
1263 }
1264}
1265
1266
1268{
1269 if (!physicsActivated["channelling"])
1270 {
1271 G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics();
1272 biasingPhysics->PhysicsBiasAllCharged();
1273 RegisterPhysics(biasingPhysics);
1274 constructors.push_back(new BDSPhysicsChannelling());
1275 physicsActivated["channelling"] = true;
1276 }
1277}
1278
1280{
1281 if (!physicsActivated["radioactivation"])
1282 {
1283 constructors.push_back(new BDSPhysicsRadioactivation());
1284 physicsActivated["radioactivation"] = true;
1285 }
1286}
1287
1289{
1290 BDS::CheckLowEnergyNeutronDataExists("shielding_lend");
1291 if (!physicsActivated["shielding_lend"])
1292 {
1293 constructors.push_back(new G4HadronPhysicsShieldingLEND());
1294 physicsActivated["shielding_lend"] = true;
1295 }
1296}
1297#endif
1298
1299#if G4VERSION_NUMBER > 1119
1301{
1302 if (!physicsActivated["xray_relfection"])
1303 {
1304 G4double sr = BDSGlobalConstants::Instance()->XrayAllSurfaceRoughness();
1305 constructors.push_back(new BDSPhysicsXrayReflection(sr));
1306 physicsActivated["xray_relfection"] = true;
1307 }
1308}
1309#endif
General exception with possible name of object and message.
static BDSGlobalConstants * Instance()
Access method.
void ConstructAllShortLived()
Construct resonances and quarks - sometimes required explicitly.
void ShieldingLEND()
Physics constructor loader.
void MuonInelastic()
Physics constructor loader.
G4bool constructedAllBaryons
Cached flag to avoid repeated construction.
void Em1()
Physics constructor loader.
void EmLivermorePolarised()
Physics constructor loader.
void Optical()
Physics constructor loader.
void HadronicElasticHP()
Physics constructor loader.
void Em2()
Physics constructor loader.
void IonBinary()
Physics constructor loader.
void ConstructAllIons()
Construct ions.
void HadronicElasticXS()
Physics constructor loader.
void IonINCLXX()
Physics constructor loader.
void LaserComptonScattering()
Physics constructor loader.
void ParsePhysicsList(const G4String &physListName)
Interpret the string of physics lists given from the user through the parser.
void Em3()
Physics constructor loader.
void Stopping()
Physics constructor loader.
void LaserWire()
Physics constructor loader.
void EmLowEP()
Physics constructor loader.
G4bool constructedAllIons
Cached flag to avoid repeated construction.
void EmWVI()
Physics constructor loader.
void DNAChemistry()
Physics constructor loader.
BDSGlobalConstants * globals
Keep a local reference to global constants to avoid getting it all the time.
G4bool usingIons
Flag telling whether ions are being used either in physics list or in beam particle.
void CheckIncompatiblePhysics(const G4String &singlePhysicsIn) const
void Ion()
Physics constructor loader.
void Cherenkov()
Physics constructor loader.
void ChargeExchange()
Physics constructor loader.
std::map< G4String, std::vector< G4String > > incompatible
Map of incompatible physics lists by our name for each individual list.
void DecayMuonicAtom()
Physics constructor loader.
void DecayRadioactive()
Physics constructor loader.
void DNA()
Physics constructor loader.
void HadronicElasticH()
Physics constructor loader.
G4String temporaryName
Temporary string used to pass name to constructor functions.
void IonEMDissociation()
Physics constructor loader.
std::map< G4String, G4bool > physicsActivated
void Em4()
Physics constructor loader.
void EmExtra()
Physics constructor loader.
void HadronicElasticLEND()
Physics constructor loader.
void Radioactivation()
Physics constructor loader.
void QGSPBICHP()
Physics constructor loader.
void IonElastic()
Physics constructor loader.
void Muon()
Physics constructor loader.
void LaserPhotoDetachment()
Physics constructor loader.
void NeutronTrackingCut()
Physics constructor loader.
void Ionisation()
Physics constructor loader.
void LaserCumulativePhotoDetachment()
Physics constructor loader.
void ConstructAllBaryons()
Construct baryons.
void QGSPBERTHP()
Physics constructor loader.
void IonPHP()
Physics constructor loader.
G4bool constructedAllLeptons
Cached flag to avoid repeated construction.
void Decay()
Physics constructor loader.
void FTFBIC()
Physics constructor loader.
void EmSS()
Physics constructor loader.
void FTFPBERT()
Physics constructor loader.
void XrayReflection()
Physics constructor loader.
void AnnihiToMuMu()
Physics constructor loader.
void QGSPBIC()
Physics constructor loader.
void LaserIonExcitation()
Physics constructor loader.
void GammaToMuMu()
Physics constructor loader.
void CutsAndLimits()
Physics constructor loader.
void Em()
Physics constructor loader.
void EmPenelope()
Physics constructor loader.
void HadronicElastic()
Physics constructor loader.
G4bool emWillBeUsed
Flag as to whether em will be used - avoids duplicate processes being registered.
void HadronicElasticD()
Physics constructor loader.
G4bool constructedAllShortLived
Cached flag to avoid repeated construction.
void DecaySpin()
Physics constructor loader.
void FTFPBERTHP()
Physics constructor loader.
void EmLivermore()
Physics constructor loader.
void IonElasticQMD()
Physics constructor loader.
std::map< std::string, Constructor > physicsConstructors
A map of physics list names to their constructors.
std::vector< G4String > physicsLists
void Channelling()
Physics constructor loader.
G4bool constructedAllMesons
Cached flag to avoid repeated construction.
void QGSPBERT()
Physics constructor loader.
void Shielding()
Physics constructor loader.
void EmGS()
Physics constructor loader.
void ConstructAllMesons()
Construct mesons.
void LaserCumulativeCompton()
Physics constructor loader.
void Print()
Print out which physics lists are activated.
std::map< G4String, G4String > aliasToOriginal
Map of possible aliases for a given physics list.
void SynchRad()
Physics constructor loader.
High energy muon processes.
Channelling physics process.
Cherenkov physics process constructor.
Physics processes required for user tracking limits.
Electromagnetic dissociation for high energy ions.
High energy muon processes.
Only ionisation from G4EmStandardPhysics.
Constructor for BDSLaserCompton process.
Only nuclear interactions for mu+-.
High energy muon processes.
A physics constructor that only constructs Synchrotron Radiation.
G4String LowerCase(const G4String &str)
Utility function to simplify lots of syntax changes for pedantic g4 changes.
void CheckHighPrecisionDataExists(const G4String &physicsListName)
void CheckLowEnergyNeutronDataExists(const G4String &phhysicsListName)
void ConstructMinimumParticleSet()