File indexing completed on 2025-02-23 09:21:06
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
0045
0046 #include "PhysicsList.hh"
0047
0048 #include "PhysListEmStandard.hh"
0049 #include "PhysicsListMessenger.hh"
0050 #include "StepMax.hh"
0051
0052 #include "G4DecayPhysics.hh"
0053 #include "G4Electron.hh"
0054 #include "G4EmExtraPhysics.hh"
0055 #include "G4EmLivermorePhysics.hh"
0056 #include "G4EmLowEPPhysics.hh"
0057 #include "G4EmPenelopePhysics.hh"
0058 #include "G4EmStandardPhysics.hh"
0059 #include "G4EmStandardPhysicsGS.hh"
0060 #include "G4EmStandardPhysicsSS.hh"
0061 #include "G4EmStandardPhysicsWVI.hh"
0062 #include "G4EmStandardPhysics_option1.hh"
0063 #include "G4EmStandardPhysics_option2.hh"
0064 #include "G4EmStandardPhysics_option3.hh"
0065 #include "G4EmStandardPhysics_option4.hh"
0066 #include "G4Gamma.hh"
0067 #include "G4HadronElasticPhysics.hh"
0068 #include "G4HadronInelasticQBBC.hh"
0069 #include "G4IonPhysics.hh"
0070 #include "G4LossTableManager.hh"
0071 #include "G4ParticleTable.hh"
0072 #include "G4ParticleTypes.hh"
0073 #include "G4Positron.hh"
0074 #include "G4ProcessManager.hh"
0075 #include "G4Proton.hh"
0076 #include "G4RegionStore.hh"
0077 #include "G4StoppingPhysics.hh"
0078 #include "G4SystemOfUnits.hh"
0079 #include "G4UnitsTable.hh"
0080
0081
0082
0083 PhysicsList::PhysicsList()
0084 : G4VModularPhysicsList(),
0085 fEmPhysicsList(nullptr),
0086 fDecayPhysicsList(nullptr),
0087 fStepMaxProcess(nullptr),
0088 fMessenger(nullptr)
0089 {
0090 G4LossTableManager::Instance();
0091 SetDefaultCutValue(1 * mm);
0092
0093 fMessenger = new PhysicsListMessenger(this);
0094 fStepMaxProcess = new StepMax();
0095
0096
0097
0098 SetVerboseLevel(1);
0099
0100 fHelIsRegisted = false;
0101 fBicIsRegisted = false;
0102 fGnucIsRegisted = false;
0103 fStopIsRegisted = false;
0104
0105
0106 fEmName = G4String("emstandard");
0107 fEmPhysicsList = new G4EmStandardPhysics();
0108
0109
0110 fDecayPhysicsList = new G4DecayPhysics();
0111 }
0112
0113
0114
0115 PhysicsList::~PhysicsList()
0116 {
0117 delete fMessenger;
0118 delete fDecayPhysicsList;
0119 delete fEmPhysicsList;
0120 delete fStepMaxProcess;
0121 for (size_t i = 0; i < fHadronPhys.size(); i++) {
0122 delete fHadronPhys[i];
0123 }
0124 }
0125
0126
0127
0128 void PhysicsList::ConstructParticle()
0129 {
0130 fDecayPhysicsList->ConstructParticle();
0131 }
0132
0133
0134
0135 void PhysicsList::ConstructProcess()
0136 {
0137 AddTransportation();
0138 fEmPhysicsList->ConstructProcess();
0139 fDecayPhysicsList->ConstructProcess();
0140 for (size_t i = 0; i < fHadronPhys.size(); ++i) {
0141 fHadronPhys[i]->ConstructProcess();
0142 }
0143 AddStepMax();
0144 }
0145
0146
0147
0148 void PhysicsList::AddPhysicsList(const G4String& name)
0149 {
0150 if (verboseLevel > 1) G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0151
0152 if (name == fEmName) return;
0153
0154 if (name == "emstandard") {
0155 fEmName = name;
0156 delete fEmPhysicsList;
0157 fEmPhysicsList = new G4EmStandardPhysics(verboseLevel);
0158 if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0159 }
0160 else if (name == "emstandard_opt1") {
0161 fEmName = name;
0162 delete fEmPhysicsList;
0163 fEmPhysicsList = new G4EmStandardPhysics_option1(verboseLevel);
0164 if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0165 }
0166 else if (name == "emstandard_opt2") {
0167 fEmName = name;
0168 delete fEmPhysicsList;
0169 fEmPhysicsList = new G4EmStandardPhysics_option2(verboseLevel);
0170 if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0171 }
0172 else if (name == "emstandard_opt3") {
0173 fEmName = name;
0174 delete fEmPhysicsList;
0175 fEmPhysicsList = new G4EmStandardPhysics_option3(verboseLevel);
0176 if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0177 }
0178 else if (name == "emstandard_opt4") {
0179 fEmName = name;
0180 delete fEmPhysicsList;
0181 fEmPhysicsList = new G4EmStandardPhysics_option4(verboseLevel);
0182 if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0183 }
0184 else if (name == "local") {
0185 fEmName = name;
0186 delete fEmPhysicsList;
0187 fEmPhysicsList = new PhysListEmStandard(verboseLevel);
0188 if (verboseLevel > 0) G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl;
0189 }
0190 else if (name == "emlivermore") {
0191 fEmName = name;
0192 delete fEmPhysicsList;
0193 fEmPhysicsList = new G4EmLivermorePhysics(verboseLevel);
0194 }
0195 else if (name == "empenelope") {
0196 fEmName = name;
0197 delete fEmPhysicsList;
0198 fEmPhysicsList = new G4EmPenelopePhysics(verboseLevel);
0199 }
0200 else if (name == "emlowenergy") {
0201 fEmName = name;
0202 delete fEmPhysicsList;
0203 fEmPhysicsList = new G4EmLowEPPhysics(verboseLevel);
0204 }
0205 else if (name == "emstandardGS") {
0206 fEmName = name;
0207 delete fEmPhysicsList;
0208 fEmPhysicsList = new G4EmStandardPhysicsGS(verboseLevel);
0209 }
0210 else if (name == "emstandardSS") {
0211 fEmName = name;
0212 delete fEmPhysicsList;
0213 fEmPhysicsList = new G4EmStandardPhysicsSS(verboseLevel);
0214 }
0215 else if (name == "emstandardWVI") {
0216 fEmName = name;
0217 delete fEmPhysicsList;
0218 fEmPhysicsList = new G4EmStandardPhysicsWVI();
0219 }
0220 else if (name == "elastic" && !fHelIsRegisted) {
0221 fHadronPhys.push_back(new G4HadronElasticPhysics());
0222 fHelIsRegisted = true;
0223 if (verboseLevel > 0) G4cout << "PhysicsList::Add hadron elastic physics" << G4endl;
0224 }
0225 else if (name == "binary" && !fBicIsRegisted) {
0226 fHadronPhys.push_back(new G4HadronInelasticQBBC());
0227 fHadronPhys.push_back(new G4IonPhysics());
0228 fBicIsRegisted = true;
0229 if (verboseLevel > 0)
0230 G4cout << "PhysicsList::Add hadron inelastic physics from <QBBC>" << G4endl;
0231 }
0232 else if (name == "gamma_nuc" && !fGnucIsRegisted) {
0233 fHadronPhys.push_back(new G4EmExtraPhysics());
0234 fGnucIsRegisted = true;
0235 if (verboseLevel > 0) G4cout << "PhysicsList::Add gamma- and electro-nuclear physics" << G4endl;
0236 }
0237 else if (name == "stopping" && !fStopIsRegisted) {
0238 fHadronPhys.push_back(new G4StoppingPhysics());
0239 fStopIsRegisted = true;
0240 if (verboseLevel > 0) G4cout << "PhysicsList::Add stopping physics" << G4endl;
0241 }
0242 else {
0243 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
0244 << " is not defined" << G4endl;
0245 }
0246 }
0247
0248
0249
0250 void PhysicsList::AddStepMax()
0251 {
0252
0253
0254 auto particleIterator = GetParticleIterator();
0255 particleIterator->reset();
0256 while ((*particleIterator)()) {
0257 G4ParticleDefinition* particle = particleIterator->value();
0258 G4ProcessManager* pmanager = particle->GetProcessManager();
0259
0260 if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
0261 pmanager->AddDiscreteProcess(fStepMaxProcess);
0262 }
0263 }
0264 }
0265
0266