Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file medical/electronScattering2/src/Phys 27 /// \file medical/electronScattering2/src/PhysicsList.cc 28 /// \brief Implementation of the PhysicsList c 28 /// \brief Implementation of the PhysicsList class 29 29 30 #include "PhysicsList.hh" 30 #include "PhysicsList.hh" 31 << 32 #include "PhysicsListMessenger.hh" 31 #include "PhysicsListMessenger.hh" 33 #include "StepMax.hh" << 34 32 35 #include "G4Decay.hh" << 36 #include "G4EmBuilder.hh" << 37 #include "G4EmLivermorePhysics.hh" << 38 #include "G4EmLowEPPhysics.hh" << 39 #include "G4EmPenelopePhysics.hh" << 40 #include "G4EmStandardPhysics.hh" 33 #include "G4EmStandardPhysics.hh" 41 #include "G4EmStandardPhysicsGS.hh" << 42 #include "G4EmStandardPhysicsSS.hh" << 43 #include "G4EmStandardPhysicsWVI.hh" << 44 #include "G4EmStandardPhysics_option1.hh" 34 #include "G4EmStandardPhysics_option1.hh" 45 #include "G4EmStandardPhysics_option2.hh" 35 #include "G4EmStandardPhysics_option2.hh" 46 #include "G4EmStandardPhysics_option3.hh" 36 #include "G4EmStandardPhysics_option3.hh" 47 #include "G4EmStandardPhysics_option4.hh" 37 #include "G4EmStandardPhysics_option4.hh" >> 38 #include "G4EmStandardPhysicsSS.hh" >> 39 #include "G4EmStandardPhysicsWVI.hh" >> 40 #include "G4EmStandardPhysicsGS.hh" >> 41 #include "G4EmLivermorePhysics.hh" >> 42 #include "G4EmPenelopePhysics.hh" >> 43 #include "G4EmLowEPPhysics.hh" >> 44 48 #include "G4LossTableManager.hh" 45 #include "G4LossTableManager.hh" >> 46 #include "G4UnitsTable.hh" >> 47 49 #include "G4ParticleDefinition.hh" 48 #include "G4ParticleDefinition.hh" 50 #include "G4ProcessManager.hh" 49 #include "G4ProcessManager.hh" >> 50 #include "G4EmBuilder.hh" >> 51 >> 52 #include "G4Decay.hh" >> 53 #include "StepMax.hh" >> 54 51 #include "G4SystemOfUnits.hh" 55 #include "G4SystemOfUnits.hh" 52 #include "G4UnitsTable.hh" << 53 56 54 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 55 58 56 PhysicsList::PhysicsList() : G4VModularPhysics 59 PhysicsList::PhysicsList() : G4VModularPhysicsList() 57 { 60 { 58 fMessenger = new PhysicsListMessenger(this); << 61 fMessenger = new PhysicsListMessenger(this); 59 << 62 60 // EM physics << 63 // EM physics 61 fEmName = G4String("emstandard_opt4"); << 64 fEmName = G4String("emstandard_opt4"); 62 fEmPhysicsList = new G4EmStandardPhysics_opt << 65 fEmPhysicsList = new G4EmStandardPhysics_option4(1); 63 if (verboseLevel > -1) { << 66 if (verboseLevel>-1) { 64 G4cout << "PhysicsList::Constructor with d << 67 G4cout << "PhysicsList::Constructor with default list: <" 65 } << 68 << fEmName << ">" << G4endl; >> 69 } 66 70 67 G4LossTableManager::Instance(); << 71 G4LossTableManager::Instance(); 68 SetVerboseLevel(1); << 72 SetVerboseLevel(1); 69 } 73 } 70 74 71 //....oooOO0OOooo........oooOO0OOooo........oo 75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 72 76 73 PhysicsList::~PhysicsList() 77 PhysicsList::~PhysicsList() 74 { 78 { 75 delete fEmPhysicsList; << 79 delete fEmPhysicsList; 76 delete fMessenger; << 80 delete fMessenger; 77 } 81 } 78 82 79 //....oooOO0OOooo........oooOO0OOooo........oo 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 80 84 81 void PhysicsList::ConstructParticle() 85 void PhysicsList::ConstructParticle() 82 { 86 { 83 // minimal set of particles for EM physics << 87 // minimal set of particles for EM physics 84 G4EmBuilder::ConstructMinimalEmSet(); << 88 G4EmBuilder::ConstructMinimalEmSet(); 85 } 89 } 86 90 87 //....oooOO0OOooo........oooOO0OOooo........oo 91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 88 92 89 void PhysicsList::ConstructProcess() 93 void PhysicsList::ConstructProcess() 90 { 94 { 91 AddTransportation(); << 95 AddTransportation(); 92 fEmPhysicsList->ConstructProcess(); << 96 fEmPhysicsList->ConstructProcess(); 93 AddDecay(); << 97 AddDecay(); 94 AddStepMax(); << 98 AddStepMax(); 95 } 99 } 96 100 97 //....oooOO0OOooo........oooOO0OOooo........oo 101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 98 102 99 void PhysicsList::AddDecay() 103 void PhysicsList::AddDecay() 100 { 104 { 101 // Add Decay Process << 105 // Add Decay Process 102 << 106 103 G4Decay* fDecayProcess = new G4Decay(); << 107 G4Decay* fDecayProcess = new G4Decay(); 104 << 108 105 auto particleIterator = GetParticleIterator( << 109 auto particleIterator=GetParticleIterator(); 106 particleIterator->reset(); << 110 particleIterator->reset(); 107 while ((*particleIterator)()) { << 111 while( (*particleIterator)() ){ 108 G4ParticleDefinition* particle = particleI << 112 G4ParticleDefinition* particle = particleIterator->value(); 109 G4ProcessManager* pmanager = particle->Get << 113 G4ProcessManager* pmanager = particle->GetProcessManager(); 110 << 114 111 if (fDecayProcess->IsApplicable(*particle) << 115 if (fDecayProcess->IsApplicable(*particle) && 112 pmanager->AddProcess(fDecayProcess); << 116 !particle->IsShortLived()) { 113 << 117 114 // set ordering for PostStepDoIt and AtR << 118 pmanager ->AddProcess(fDecayProcess); 115 pmanager->SetProcessOrdering(fDecayProce << 119 116 pmanager->SetProcessOrdering(fDecayProce << 120 // set ordering for PostStepDoIt and AtRestDoIt >> 121 pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep); >> 122 pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest); >> 123 >> 124 } 117 } 125 } 118 } << 119 } 126 } 120 127 121 //....oooOO0OOooo........oooOO0OOooo........oo 128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 122 129 123 void PhysicsList::AddStepMax() 130 void PhysicsList::AddStepMax() 124 { 131 { 125 // Step limitation seen as a process << 132 // Step limitation seen as a process 126 StepMax* stepMaxProcess = new StepMax(); << 133 StepMax* stepMaxProcess = new StepMax(); 127 << 134 128 auto particleIterator = GetParticleIterator( << 135 auto particleIterator=GetParticleIterator(); 129 particleIterator->reset(); << 136 particleIterator->reset(); 130 while ((*particleIterator)()) { << 137 while ((*particleIterator)()){ 131 G4ParticleDefinition* particle = particleI << 138 G4ParticleDefinition* particle = particleIterator->value(); 132 G4ProcessManager* pmanager = particle->Get << 139 G4ProcessManager* pmanager = particle->GetProcessManager(); 133 << 140 134 if (stepMaxProcess->IsApplicable(*particle << 141 if (stepMaxProcess->IsApplicable(*particle)) 135 pmanager->AddDiscreteProcess(stepMaxProc << 142 { >> 143 pmanager ->AddDiscreteProcess(stepMaxProcess); >> 144 } 136 } 145 } 137 } << 138 } 146 } 139 147 140 //....oooOO0OOooo........oooOO0OOooo........oo 148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 141 149 142 void PhysicsList::AddPhysicsList(const G4Strin 150 void PhysicsList::AddPhysicsList(const G4String& name) 143 { 151 { 144 if (verboseLevel > -1) { << 152 if (verboseLevel>-1) { 145 G4cout << "PhysicsList::AddPhysicsList: <" << 153 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 146 } << 154 } 147 << 155 148 if (name == fEmName) return; << 156 if (name == fEmName) return; 149 << 157 150 if (name == "emstandard_opt0") { << 158 if (name == "emstandard_opt0") { 151 fEmName = name; << 159 152 delete fEmPhysicsList; << 160 fEmName = name; 153 fEmPhysicsList = new G4EmStandardPhysics(1 << 161 delete fEmPhysicsList; 154 } << 162 fEmPhysicsList = new G4EmStandardPhysics(1); 155 else if (name == "emstandard_opt1") { << 163 156 fEmName = name; << 164 } else if (name == "emstandard_opt1") { 157 delete fEmPhysicsList; << 165 158 fEmPhysicsList = new G4EmStandardPhysics_o << 166 fEmName = name; 159 } << 167 delete fEmPhysicsList; 160 else if (name == "emstandard_opt2") { << 168 fEmPhysicsList = new G4EmStandardPhysics_option1(1); 161 fEmName = name; << 169 162 delete fEmPhysicsList; << 170 } else if (name == "emstandard_opt2") { 163 fEmPhysicsList = new G4EmStandardPhysics_o << 171 164 } << 172 fEmName = name; 165 else if (name == "emstandard_opt3") { << 173 delete fEmPhysicsList; 166 fEmName = name; << 174 fEmPhysicsList = new G4EmStandardPhysics_option2(1); 167 delete fEmPhysicsList; << 175 168 fEmPhysicsList = new G4EmStandardPhysics_o << 176 } else if (name == "emstandard_opt3") { 169 } << 177 170 else if (name == "emstandard_opt4") { << 178 fEmName = name; 171 fEmName = name; << 179 delete fEmPhysicsList; 172 delete fEmPhysicsList; << 180 fEmPhysicsList = new G4EmStandardPhysics_option3(1); 173 fEmPhysicsList = new G4EmStandardPhysics_o << 181 174 } << 182 } else if (name == "emstandard_opt4") { 175 else if (name == "emlowenergy") { << 183 176 fEmName = name; << 184 fEmName = name; 177 delete fEmPhysicsList; << 185 delete fEmPhysicsList; 178 fEmPhysicsList = new G4EmLowEPPhysics(1); << 186 fEmPhysicsList = new G4EmStandardPhysics_option4(1); 179 } << 187 180 else if (name == "emstandardSS") { << 188 } else if (name == "emlowenergy") { 181 fEmName = name; << 189 fEmName = name; 182 delete fEmPhysicsList; << 190 delete fEmPhysicsList; 183 fEmPhysicsList = new G4EmStandardPhysicsSS << 191 fEmPhysicsList = new G4EmLowEPPhysics(1); 184 } << 192 185 else if (name == "emstandardWVI") { << 193 } else if (name == "emstandardSS") { 186 fEmName = name; << 194 fEmName = name; 187 delete fEmPhysicsList; << 195 delete fEmPhysicsList; 188 fEmPhysicsList = new G4EmStandardPhysicsWV << 196 fEmPhysicsList = new G4EmStandardPhysicsSS(1); 189 } << 197 190 else if (name == "emstandardGS") { << 198 } else if (name == "emstandardWVI") { 191 fEmName = name; << 199 fEmName = name; 192 delete fEmPhysicsList; << 200 delete fEmPhysicsList; 193 fEmPhysicsList = new G4EmStandardPhysicsGS << 201 fEmPhysicsList = new G4EmStandardPhysicsWVI(1); 194 } << 202 195 else if (name == "emlivermore") { << 203 } else if (name == "emstandardGS") { 196 fEmName = name; << 204 fEmName = name; 197 delete fEmPhysicsList; << 205 delete fEmPhysicsList; 198 fEmPhysicsList = new G4EmLivermorePhysics( << 206 fEmPhysicsList = new G4EmStandardPhysicsGS(1); 199 } << 207 200 else if (name == "empenelope") { << 208 } else if (name == "emlivermore") { 201 fEmName = name; << 209 fEmName = name; 202 delete fEmPhysicsList; << 210 delete fEmPhysicsList; 203 fEmPhysicsList = new G4EmPenelopePhysics(1 << 211 fEmPhysicsList = new G4EmLivermorePhysics(1); 204 } << 212 205 else { << 213 } else if (name == "empenelope") { 206 G4ExceptionDescription description; << 214 fEmName = name; 207 description << " " << 215 delete fEmPhysicsList; 208 << "PhysicsList::AddPhysicsLis << 216 fEmPhysicsList = new G4EmPenelopePhysics(1); 209 G4Exception("PhysicsList::AddPhysicsList", << 217 210 description); << 218 } else { 211 } << 219 >> 220 G4ExceptionDescription description; >> 221 description >> 222 << " " >> 223 << "PhysicsList::AddPhysicsList: <" << name << "> is not defined"; >> 224 G4Exception("PhysicsList::AddPhysicsList", >> 225 "electronScattering2_F001", FatalException, description); >> 226 } 212 } 227 } 213 228 214 //....oooOO0OOooo........oooOO0OOooo........oo 229 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 215 230