File indexing completed on 2026-04-16 07:41:38
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #include "PhysicsList.hh"
0045 #include "PhysicsListMessenger.hh"
0046
0047 #include "G4EmDNAChemistry.hh"
0048 #include "G4EmDNAChemistry_option1.hh"
0049 #include "G4EmDNAChemistry_option2.hh"
0050 #include "G4EmDNAChemistry_option3.hh"
0051 #include "G4EmDNAPhysics.hh"
0052 #include "G4EmDNAPhysics_option1.hh"
0053 #include "G4EmDNAPhysics_option2.hh"
0054 #include "G4EmDNAPhysics_option3.hh"
0055 #include "G4EmDNAPhysics_option4.hh"
0056 #include "G4EmDNAPhysics_option5.hh"
0057 #include "G4EmDNAPhysics_option6.hh"
0058 #include "G4EmDNAPhysics_option7.hh"
0059 #include "G4EmDNAPhysics_option8.hh"
0060 #include "G4EmParameters.hh"
0061 #include "G4SystemOfUnits.hh"
0062 #include "G4ProductionCutsTable.hh"
0063 #include <map>
0064 #include <functional>
0065 #include <string>
0066
0067
0068 PhysicsList::PhysicsList() : G4VModularPhysicsList() {
0069 constexpr G4double currentDefaultCut = 0.001 * mm;
0070 G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(100 * eV, 1 * GeV);
0071 SetDefaultCutValue(currentDefaultCut);
0072 SetVerboseLevel(1);
0073
0074 fMessenger = std::make_unique<PhysicsListMessenger>(this);
0075
0076 fEmDNAPhysicsList = std::make_unique<G4EmDNAPhysics_option2>();
0077 fEmDNAChemistryList = std::make_unique<G4EmDNAChemistry_option3>();
0078 fChemDNAName = "G4EmDNAChemistry_option3";
0079 fPhysDNAName = "G4EmDNAPhysics_option2";
0080 }
0081
0082
0083
0084 PhysicsList::~PhysicsList() = default;
0085
0086
0087
0088 void PhysicsList::ConstructParticle() {
0089 if (fEmDNAPhysicsList != nullptr) {
0090 fEmDNAPhysicsList->ConstructParticle();
0091 }
0092 if (fEmDNAChemistryList != nullptr) {
0093 fEmDNAChemistryList->ConstructParticle();
0094 }
0095 }
0096
0097
0098
0099 void PhysicsList::ConstructProcess() {
0100 AddTransportation();
0101 if (fEmDNAPhysicsList != nullptr) {
0102 fEmDNAPhysicsList->ConstructProcess();
0103 }
0104 if (fEmDNAChemistryList != nullptr) {
0105 fEmDNAChemistryList->ConstructProcess();
0106 }
0107 }
0108
0109
0110
0111 void PhysicsList::RegisterConstructor(const G4String &name) {
0112
0113 using PhysFactory = std::function<std::unique_ptr<G4VPhysicsConstructor>(G4int)>;
0114 using ChemFactory = std::function<std::unique_ptr<G4VPhysicsConstructor>()>;
0115
0116 static const std::map<std::string, PhysFactory> physFactories = {
0117 {"G4EmDNAPhysics", [](G4int v) { return std::make_unique<G4EmDNAPhysics>(v); }},
0118 {"G4EmDNAPhysics_option1", [](G4int v) { return std::make_unique<G4EmDNAPhysics_option1>(v); }},
0119 {"G4EmDNAPhysics_option2", [](G4int v) { return std::make_unique<G4EmDNAPhysics_option2>(v); }},
0120 {"G4EmDNAPhysics_option3", [](G4int v) { return std::make_unique<G4EmDNAPhysics_option3>(v); }},
0121 {"G4EmDNAPhysics_option4", [](G4int v) { return std::make_unique<G4EmDNAPhysics_option4>(v); }},
0122 {"G4EmDNAPhysics_option5", [](G4int v) { return std::make_unique<G4EmDNAPhysics_option5>(v); }},
0123 {"G4EmDNAPhysics_option6", [](G4int v) { return std::make_unique<G4EmDNAPhysics_option6>(v); }},
0124 {"G4EmDNAPhysics_option7", [](G4int v) { return std::make_unique<G4EmDNAPhysics_option7>(v); }},
0125 {"G4EmDNAPhysics_option8", [](G4int v) { return std::make_unique<G4EmDNAPhysics_option8>(v); }}
0126 };
0127
0128 static const std::map<std::string, ChemFactory> chemFactories = {
0129 {"G4EmDNAChemistry", [] { return std::make_unique<G4EmDNAChemistry>(); }},
0130 {"G4EmDNAChemistry_option1", [] { return std::make_unique<G4EmDNAChemistry_option1>(); }},
0131 {"G4EmDNAChemistry_option2", [] { return std::make_unique<G4EmDNAChemistry_option2>(); }},
0132 {"G4EmDNAChemistry_option3", [] { return std::make_unique<G4EmDNAChemistry_option3>(); }}
0133 };
0134
0135
0136 if (const auto it = physFactories.find(name); it != physFactories.end()) {
0137 if (name == fPhysDNAName) {
0138 if (verboseLevel > 0) {
0139 G4cout << "PhysicsList: EM constructor '" << name << "' already active, no change" <<
0140 G4endl;
0141 }
0142 return;
0143 }
0144 if (verboseLevel > 0) {
0145 G4cout << "===== Register EM constructor ==== '" << name << "'" << G4endl;
0146 }
0147 fEmDNAPhysicsList = it->second(verboseLevel);
0148 fPhysDNAName = name;
0149 return;
0150 }
0151
0152
0153 if (const auto it = chemFactories.find(name); it != chemFactories.end()) {
0154 if (name == fChemDNAName) {
0155 if (verboseLevel > 0) {
0156 G4cout << "PhysicsList: Chemistry constructor '" << name << "' already active, no change" <<
0157 G4endl;
0158 }
0159 return;
0160 }
0161 if (verboseLevel > 0) {
0162 G4cout << "===== Register Chemistry constructor ==== '" << name << "'" << G4endl;
0163 }
0164 fEmDNAChemistryList = it->second();
0165 if (fEmDNAChemistryList) {
0166 fEmDNAChemistryList->SetVerboseLevel(verboseLevel);
0167 }
0168 fChemDNAName = name;
0169 return;
0170 }
0171
0172
0173 G4cout << "PhysicsList::RegisterConstructor: <" << name << "> fails - name is not defined" <<
0174 G4endl;
0175 }
0176
0177