File indexing completed on 2026-09-14 08:28:45
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 #include "PhysicsList.hh"
0030
0031 #include "PhysicsListMessenger.hh"
0032 #include "StepMax.hh"
0033
0034 #include "G4Decay.hh"
0035 #include "G4EmBuilder.hh"
0036 #include "G4EmLivermorePhysics.hh"
0037 #include "G4EmLowEPPhysics.hh"
0038 #include "G4EmPenelopePhysics.hh"
0039 #include "G4EmStandardPhysics.hh"
0040 #include "G4EmStandardPhysicsGS.hh"
0041 #include "G4EmStandardPhysicsSS.hh"
0042 #include "G4EmStandardPhysicsWVI.hh"
0043 #include "G4EmStandardPhysics_option1.hh"
0044 #include "G4EmStandardPhysics_option2.hh"
0045 #include "G4EmStandardPhysics_option3.hh"
0046 #include "G4EmStandardPhysics_option4.hh"
0047 #include "G4LossTableManager.hh"
0048 #include "G4ParticleDefinition.hh"
0049 #include "G4ProcessManager.hh"
0050 #include "G4SystemOfUnits.hh"
0051 #include "G4UnitsTable.hh"
0052
0053
0054
0055 PhysicsList::PhysicsList() : G4VModularPhysicsList()
0056 {
0057 fMessenger = new PhysicsListMessenger(this);
0058
0059
0060 fEmName = G4String("emstandard_opt4");
0061 fEmPhysicsList = new G4EmStandardPhysics_option4(1);
0062 if (verboseLevel > -1) {
0063 G4cout << "PhysicsList::Constructor with default list: <" << fEmName << ">" << G4endl;
0064 }
0065
0066 G4LossTableManager::Instance();
0067 SetVerboseLevel(1);
0068 }
0069
0070
0071
0072 PhysicsList::~PhysicsList()
0073 {
0074 delete fEmPhysicsList;
0075 delete fMessenger;
0076 }
0077
0078
0079
0080 void PhysicsList::ConstructParticle()
0081 {
0082
0083 G4EmBuilder::ConstructMinimalEmSet();
0084 }
0085
0086
0087
0088 void PhysicsList::ConstructProcess()
0089 {
0090 AddTransportation();
0091 fEmPhysicsList->ConstructProcess();
0092 AddDecay();
0093 AddStepMax();
0094 }
0095
0096
0097
0098 void PhysicsList::AddDecay()
0099 {
0100
0101
0102 G4Decay* fDecayProcess = new G4Decay();
0103
0104 auto particleIterator = GetParticleIterator();
0105 particleIterator->reset();
0106 while ((*particleIterator)()) {
0107 G4ParticleDefinition* particle = particleIterator->value();
0108 G4ProcessManager* pmanager = particle->GetProcessManager();
0109
0110 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) {
0111 pmanager->AddProcess(fDecayProcess);
0112
0113
0114 pmanager->SetProcessOrdering(fDecayProcess, idxPostStep);
0115 pmanager->SetProcessOrdering(fDecayProcess, idxAtRest);
0116 }
0117 }
0118 }
0119
0120
0121
0122 void PhysicsList::AddStepMax()
0123 {
0124
0125 StepMax* stepMaxProcess = new StepMax();
0126
0127 auto particleIterator = GetParticleIterator();
0128 particleIterator->reset();
0129 while ((*particleIterator)()) {
0130 G4ParticleDefinition* particle = particleIterator->value();
0131 G4ProcessManager* pmanager = particle->GetProcessManager();
0132
0133 if (stepMaxProcess->IsApplicable(*particle)) {
0134 pmanager->AddDiscreteProcess(stepMaxProcess);
0135 }
0136 }
0137 }
0138
0139
0140
0141 void PhysicsList::AddPhysicsList(const G4String& name)
0142 {
0143 if (verboseLevel > -1) {
0144 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
0145 }
0146
0147 if (name == fEmName) return;
0148
0149 if (name == "emstandard_opt0") {
0150 fEmName = name;
0151 delete fEmPhysicsList;
0152 fEmPhysicsList = new G4EmStandardPhysics(1);
0153 }
0154 else if (name == "emstandard_opt1") {
0155 fEmName = name;
0156 delete fEmPhysicsList;
0157 fEmPhysicsList = new G4EmStandardPhysics_option1(1);
0158 }
0159 else if (name == "emstandard_opt2") {
0160 fEmName = name;
0161 delete fEmPhysicsList;
0162 fEmPhysicsList = new G4EmStandardPhysics_option2(1);
0163 }
0164 else if (name == "emstandard_opt3") {
0165 fEmName = name;
0166 delete fEmPhysicsList;
0167 fEmPhysicsList = new G4EmStandardPhysics_option3(1);
0168 }
0169 else if (name == "emstandard_opt4") {
0170 fEmName = name;
0171 delete fEmPhysicsList;
0172 fEmPhysicsList = new G4EmStandardPhysics_option4(1);
0173 }
0174 else if (name == "emlowenergy") {
0175 fEmName = name;
0176 delete fEmPhysicsList;
0177 fEmPhysicsList = new G4EmLowEPPhysics(1);
0178 }
0179 else if (name == "emstandardSS") {
0180 fEmName = name;
0181 delete fEmPhysicsList;
0182 fEmPhysicsList = new G4EmStandardPhysicsSS(1);
0183 }
0184 else if (name == "emstandardWVI") {
0185 fEmName = name;
0186 delete fEmPhysicsList;
0187 fEmPhysicsList = new G4EmStandardPhysicsWVI(1);
0188 }
0189 else if (name == "emstandardGS") {
0190 fEmName = name;
0191 delete fEmPhysicsList;
0192 fEmPhysicsList = new G4EmStandardPhysicsGS(1);
0193 }
0194 else if (name == "emlivermore") {
0195 fEmName = name;
0196 delete fEmPhysicsList;
0197 fEmPhysicsList = new G4EmLivermorePhysics(1);
0198 }
0199 else if (name == "empenelope") {
0200 fEmName = name;
0201 delete fEmPhysicsList;
0202 fEmPhysicsList = new G4EmPenelopePhysics(1);
0203 }
0204 else {
0205 G4ExceptionDescription description;
0206 description << " "
0207 << "PhysicsList::AddPhysicsList: <" << name << "> is not defined";
0208 G4Exception("PhysicsList::AddPhysicsList", "electronScattering2_F001", FatalException,
0209 description);
0210 }
0211 }
0212
0213