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 /// \file electromagnetic/TestEm9/src/PhysicsL 26 /// \file electromagnetic/TestEm9/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // 28 // 29 // 29 // 30 //-------------------------------------------- 30 //--------------------------------------------------------------------------- 31 // 31 // 32 // ClassName: PhysicsList 32 // ClassName: PhysicsList 33 // 33 // 34 // Author: V.Ivanchenko 14.10.2002 34 // Author: V.Ivanchenko 14.10.2002 35 // 35 // 36 // Modified: 36 // Modified: 37 // 17.11.06 Use components from physics_lists 37 // 17.11.06 Use components from physics_lists subdirectory (V.Ivanchenko) 38 // 24.10.12 Migrated to new stopping and ion p 38 // 24.10.12 Migrated to new stopping and ion physics (A.Ribon) 39 // 39 // 40 //-------------------------------------------- 40 //---------------------------------------------------------------------------- 41 // 41 // 42 42 43 //....oooOO0OOooo........oooOO0OOooo........oo 43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 //....oooOO0OOooo........oooOO0OOooo........oo 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 45 46 #include "PhysicsList.hh" 46 #include "PhysicsList.hh" 47 << 48 #include "PhysListEmStandard.hh" << 49 #include "PhysicsListMessenger.hh" 47 #include "PhysicsListMessenger.hh" 50 #include "StepMax.hh" << 51 48 52 #include "G4DecayPhysics.hh" << 49 #include "PhysListEmStandard.hh" 53 #include "G4Electron.hh" << 54 #include "G4EmExtraPhysics.hh" << 55 #include "G4EmLivermorePhysics.hh" << 56 #include "G4EmLowEPPhysics.hh" << 57 #include "G4EmPenelopePhysics.hh" << 58 #include "G4EmStandardPhysics.hh" 50 #include "G4EmStandardPhysics.hh" 59 #include "G4EmStandardPhysicsGS.hh" << 60 #include "G4EmStandardPhysicsSS.hh" << 61 #include "G4EmStandardPhysicsWVI.hh" << 62 #include "G4EmStandardPhysics_option1.hh" 51 #include "G4EmStandardPhysics_option1.hh" 63 #include "G4EmStandardPhysics_option2.hh" 52 #include "G4EmStandardPhysics_option2.hh" 64 #include "G4EmStandardPhysics_option3.hh" 53 #include "G4EmStandardPhysics_option3.hh" 65 #include "G4EmStandardPhysics_option4.hh" 54 #include "G4EmStandardPhysics_option4.hh" 66 #include "G4Gamma.hh" << 55 #include "G4EmLivermorePhysics.hh" >> 56 #include "G4EmPenelopePhysics.hh" >> 57 #include "G4EmLowEPPhysics.hh" >> 58 #include "G4EmStandardPhysicsGS.hh" >> 59 #include "G4EmStandardPhysicsSS.hh" >> 60 #include "G4EmStandardPhysicsWVI.hh" >> 61 #include "G4DecayPhysics.hh" 67 #include "G4HadronElasticPhysics.hh" 62 #include "G4HadronElasticPhysics.hh" 68 #include "G4HadronInelasticQBBC.hh" 63 #include "G4HadronInelasticQBBC.hh" 69 #include "G4IonPhysics.hh" 64 #include "G4IonPhysics.hh" 70 #include "G4LossTableManager.hh" << 65 #include "G4EmExtraPhysics.hh" 71 #include "G4ParticleTable.hh" << 66 #include "G4StoppingPhysics.hh" >> 67 >> 68 #include "G4RegionStore.hh" >> 69 #include "G4ProcessManager.hh" 72 #include "G4ParticleTypes.hh" 70 #include "G4ParticleTypes.hh" >> 71 #include "G4ParticleTable.hh" >> 72 >> 73 #include "G4Gamma.hh" >> 74 #include "G4Electron.hh" 73 #include "G4Positron.hh" 75 #include "G4Positron.hh" 74 #include "G4ProcessManager.hh" << 75 #include "G4Proton.hh" 76 #include "G4Proton.hh" 76 #include "G4RegionStore.hh" << 77 77 #include "G4StoppingPhysics.hh" << 78 #include "G4SystemOfUnits.hh" << 79 #include "G4UnitsTable.hh" 78 #include "G4UnitsTable.hh" >> 79 #include "G4SystemOfUnits.hh" >> 80 #include "G4LossTableManager.hh" >> 81 #include "StepMax.hh" >> 82 >> 83 #include "G4EmProcessOptions.hh" 80 84 81 //....oooOO0OOooo........oooOO0OOooo........oo 85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 82 86 83 PhysicsList::PhysicsList() << 87 PhysicsList::PhysicsList() : G4VModularPhysicsList(), 84 : G4VModularPhysicsList(), << 88 fEmPhysicsList(0), 85 fEmPhysicsList(nullptr), << 89 fDecayPhysicsList(0), 86 fDecayPhysicsList(nullptr), << 90 fStepMaxProcess(0), 87 fStepMaxProcess(nullptr), << 91 fMessenger(0) 88 fMessenger(nullptr) << 89 { 92 { 90 G4LossTableManager::Instance(); 93 G4LossTableManager::Instance(); 91 SetDefaultCutValue(1 * mm); << 94 SetDefaultCutValue(1*mm); 92 95 93 fMessenger = new PhysicsListMessenger(this); 96 fMessenger = new PhysicsListMessenger(this); 94 fStepMaxProcess = new StepMax(); 97 fStepMaxProcess = new StepMax(); 95 98 96 // Initilise flags 99 // Initilise flags 97 100 98 SetVerboseLevel(1); 101 SetVerboseLevel(1); 99 102 100 fHelIsRegisted = false; << 103 fHelIsRegisted = false; 101 fBicIsRegisted = false; << 104 fBicIsRegisted = false; 102 fGnucIsRegisted = false; 105 fGnucIsRegisted = false; 103 fStopIsRegisted = false; 106 fStopIsRegisted = false; 104 107 105 // EM physics 108 // EM physics 106 fEmName = G4String("emstandard"); 109 fEmName = G4String("emstandard"); 107 fEmPhysicsList = new G4EmStandardPhysics(); 110 fEmPhysicsList = new G4EmStandardPhysics(); 108 111 109 // Decay Physics is always defined 112 // Decay Physics is always defined 110 fDecayPhysicsList = new G4DecayPhysics(); 113 fDecayPhysicsList = new G4DecayPhysics(); 111 } 114 } 112 115 113 //....oooOO0OOooo........oooOO0OOooo........oo 116 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 114 117 115 PhysicsList::~PhysicsList() 118 PhysicsList::~PhysicsList() 116 { 119 { 117 delete fMessenger; 120 delete fMessenger; 118 delete fDecayPhysicsList; 121 delete fDecayPhysicsList; 119 delete fEmPhysicsList; 122 delete fEmPhysicsList; 120 delete fStepMaxProcess; 123 delete fStepMaxProcess; 121 for (size_t i = 0; i < fHadronPhys.size(); i << 124 for(size_t i=0; i<fHadronPhys.size(); i++) { 122 delete fHadronPhys[i]; 125 delete fHadronPhys[i]; 123 } 126 } 124 } 127 } 125 128 126 //....oooOO0OOooo........oooOO0OOooo........oo 129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 127 130 128 void PhysicsList::ConstructParticle() 131 void PhysicsList::ConstructParticle() 129 { 132 { 130 fDecayPhysicsList->ConstructParticle(); 133 fDecayPhysicsList->ConstructParticle(); 131 } 134 } 132 135 133 //....oooOO0OOooo........oooOO0OOooo........oo 136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 134 137 135 void PhysicsList::ConstructProcess() 138 void PhysicsList::ConstructProcess() 136 { 139 { 137 AddTransportation(); 140 AddTransportation(); 138 fEmPhysicsList->ConstructProcess(); 141 fEmPhysicsList->ConstructProcess(); 139 fDecayPhysicsList->ConstructProcess(); 142 fDecayPhysicsList->ConstructProcess(); 140 for (size_t i = 0; i < fHadronPhys.size(); + << 143 for(size_t i=0; i<fHadronPhys.size(); ++i) { 141 fHadronPhys[i]->ConstructProcess(); 144 fHadronPhys[i]->ConstructProcess(); 142 } 145 } 143 AddStepMax(); 146 AddStepMax(); 144 } 147 } 145 148 146 //....oooOO0OOooo........oooOO0OOooo........oo 149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 147 150 148 void PhysicsList::AddPhysicsList(const G4Strin 151 void PhysicsList::AddPhysicsList(const G4String& name) 149 { 152 { 150 if (verboseLevel > 1) G4cout << "PhysicsList << 153 if (verboseLevel > 1) >> 154 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 151 155 152 if (name == fEmName) return; 156 if (name == fEmName) return; 153 157 154 if (name == "emstandard") { 158 if (name == "emstandard") { 155 fEmName = name; 159 fEmName = name; 156 delete fEmPhysicsList; 160 delete fEmPhysicsList; 157 fEmPhysicsList = new G4EmStandardPhysics(v << 161 fEmPhysicsList = new G4EmStandardPhysics(); 158 if (verboseLevel > 0) G4cout << "PhysicsLi << 162 if (verboseLevel > 0) 159 } << 163 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl; 160 else if (name == "emstandard_opt1") { << 164 >> 165 } else if (name == "emstandard_opt1") { 161 fEmName = name; 166 fEmName = name; 162 delete fEmPhysicsList; 167 delete fEmPhysicsList; 163 fEmPhysicsList = new G4EmStandardPhysics_o << 168 fEmPhysicsList = new G4EmStandardPhysics_option1(); 164 if (verboseLevel > 0) G4cout << "PhysicsLi << 169 if (verboseLevel > 0) 165 } << 170 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl; 166 else if (name == "emstandard_opt2") { << 171 >> 172 } else if (name == "emstandard_opt2") { 167 fEmName = name; 173 fEmName = name; 168 delete fEmPhysicsList; 174 delete fEmPhysicsList; 169 fEmPhysicsList = new G4EmStandardPhysics_o << 175 fEmPhysicsList = new G4EmStandardPhysics_option2(); 170 if (verboseLevel > 0) G4cout << "PhysicsLi << 176 if (verboseLevel > 0) 171 } << 177 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl; 172 else if (name == "emstandard_opt3") { << 178 >> 179 } else if (name == "emstandard_opt3") { 173 fEmName = name; 180 fEmName = name; 174 delete fEmPhysicsList; 181 delete fEmPhysicsList; 175 fEmPhysicsList = new G4EmStandardPhysics_o << 182 fEmPhysicsList = new G4EmStandardPhysics_option3(); 176 if (verboseLevel > 0) G4cout << "PhysicsLi << 183 if (verboseLevel > 0) 177 } << 184 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl; 178 else if (name == "emstandard_opt4") { << 185 >> 186 } else if (name == "emstandard_opt4") { 179 fEmName = name; 187 fEmName = name; 180 delete fEmPhysicsList; 188 delete fEmPhysicsList; 181 fEmPhysicsList = new G4EmStandardPhysics_o << 189 fEmPhysicsList = new G4EmStandardPhysics_option4(); 182 if (verboseLevel > 0) G4cout << "PhysicsLi << 190 if (verboseLevel > 0) 183 } << 191 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl; 184 else if (name == "local") { << 192 >> 193 } else if (name == "emstandard_local") { 185 fEmName = name; 194 fEmName = name; 186 delete fEmPhysicsList; 195 delete fEmPhysicsList; 187 fEmPhysicsList = new PhysListEmStandard(ve << 196 fEmPhysicsList = new PhysListEmStandard(); 188 if (verboseLevel > 0) G4cout << "PhysicsLi << 197 if (verboseLevel > 0) 189 } << 198 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl; 190 else if (name == "emlivermore") { << 199 >> 200 } else if (name == "emlivermore") { 191 fEmName = name; 201 fEmName = name; 192 delete fEmPhysicsList; 202 delete fEmPhysicsList; 193 fEmPhysicsList = new G4EmLivermorePhysics( << 203 fEmPhysicsList = new G4EmLivermorePhysics(); 194 } << 204 195 else if (name == "empenelope") { << 205 } else if (name == "empenelope") { 196 fEmName = name; 206 fEmName = name; 197 delete fEmPhysicsList; 207 delete fEmPhysicsList; 198 fEmPhysicsList = new G4EmPenelopePhysics(v << 208 fEmPhysicsList = new G4EmPenelopePhysics(); 199 } << 209 200 else if (name == "emlowenergy") { << 210 } else if (name == "emlowenergy") { 201 fEmName = name; 211 fEmName = name; 202 delete fEmPhysicsList; 212 delete fEmPhysicsList; 203 fEmPhysicsList = new G4EmLowEPPhysics(verb << 213 fEmPhysicsList = new G4EmLowEPPhysics(); 204 } << 214 205 else if (name == "emstandardGS") { << 215 } else if (name == "emstandardGS") { 206 fEmName = name; 216 fEmName = name; 207 delete fEmPhysicsList; 217 delete fEmPhysicsList; 208 fEmPhysicsList = new G4EmStandardPhysicsGS << 218 fEmPhysicsList = new G4EmStandardPhysicsGS(); 209 } << 219 210 else if (name == "emstandardSS") { << 220 } else if (name == "emstandardSS") { 211 fEmName = name; 221 fEmName = name; 212 delete fEmPhysicsList; 222 delete fEmPhysicsList; 213 fEmPhysicsList = new G4EmStandardPhysicsSS << 223 fEmPhysicsList = new G4EmStandardPhysicsSS(); 214 } << 224 215 else if (name == "emstandardWVI") { << 225 } else if (name == "emstandardWVI") { 216 fEmName = name; 226 fEmName = name; 217 delete fEmPhysicsList; 227 delete fEmPhysicsList; 218 fEmPhysicsList = new G4EmStandardPhysicsWV 228 fEmPhysicsList = new G4EmStandardPhysicsWVI(); 219 } << 229 220 else if (name == "elastic" && !fHelIsRegiste << 230 } else if (name == "elastic" && !fHelIsRegisted) { 221 fHadronPhys.push_back(new G4HadronElasticP << 231 fHadronPhys.push_back( new G4HadronElasticPhysics()); 222 fHelIsRegisted = true; 232 fHelIsRegisted = true; 223 if (verboseLevel > 0) G4cout << "PhysicsLi << 233 if (verboseLevel > 0) 224 } << 234 G4cout << "PhysicsList::Add hadron elastic physics" << G4endl; 225 else if (name == "binary" && !fBicIsRegisted << 235 >> 236 } else if (name == "binary" && !fBicIsRegisted) { 226 fHadronPhys.push_back(new G4HadronInelasti 237 fHadronPhys.push_back(new G4HadronInelasticQBBC()); 227 fHadronPhys.push_back(new G4IonPhysics()); 238 fHadronPhys.push_back(new G4IonPhysics()); 228 fBicIsRegisted = true; 239 fBicIsRegisted = true; 229 if (verboseLevel > 0) << 240 if (verboseLevel > 0) 230 G4cout << "PhysicsList::Add hadron inela << 241 G4cout << "PhysicsList::Add hadron inelastic physics from <QBBC>" 231 } << 242 << G4endl; 232 else if (name == "gamma_nuc" && !fGnucIsRegi << 243 >> 244 } else if (name == "gamma_nuc" && !fGnucIsRegisted) { 233 fHadronPhys.push_back(new G4EmExtraPhysics 245 fHadronPhys.push_back(new G4EmExtraPhysics()); 234 fGnucIsRegisted = true; 246 fGnucIsRegisted = true; 235 if (verboseLevel > 0) G4cout << "PhysicsLi << 247 if (verboseLevel > 0) 236 } << 248 G4cout << "PhysicsList::Add gamma- and electro-nuclear physics" 237 else if (name == "stopping" && !fStopIsRegis << 249 << G4endl; >> 250 >> 251 } else if (name == "stopping" && !fStopIsRegisted) { 238 fHadronPhys.push_back(new G4StoppingPhysic 252 fHadronPhys.push_back(new G4StoppingPhysics()); 239 fStopIsRegisted = true; 253 fStopIsRegisted = true; 240 if (verboseLevel > 0) G4cout << "PhysicsLi << 254 if (verboseLevel > 0) 241 } << 255 G4cout << "PhysicsList::Add stopping physics" << G4endl; 242 else { << 256 >> 257 } else { 243 G4cout << "PhysicsList::AddPhysicsList: <" 258 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 244 << " is not defined" << G4endl; << 259 << " is not defined" >> 260 << G4endl; 245 } 261 } 246 } 262 } 247 263 248 //....oooOO0OOooo........oooOO0OOooo........oo 264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 249 265 250 void PhysicsList::AddStepMax() 266 void PhysicsList::AddStepMax() 251 { 267 { 252 // Step limitation seen as a process 268 // Step limitation seen as a process 253 269 254 auto particleIterator = GetParticleIterator( << 270 auto particleIterator=GetParticleIterator(); 255 particleIterator->reset(); 271 particleIterator->reset(); 256 while ((*particleIterator)()) { << 272 while ((*particleIterator)()){ 257 G4ParticleDefinition* particle = particleI 273 G4ParticleDefinition* particle = particleIterator->value(); 258 G4ProcessManager* pmanager = particle->Get 274 G4ProcessManager* pmanager = particle->GetProcessManager(); 259 275 260 if (fStepMaxProcess->IsApplicable(*particl << 276 if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived()) 261 pmanager->AddDiscreteProcess(fStepMaxPro << 277 { 262 } << 278 pmanager ->AddDiscreteProcess(fStepMaxProcess); >> 279 } 263 } 280 } 264 } 281 } 265 282 266 //....oooOO0OOooo........oooOO0OOooo........oo 283 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 284 267 285