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 // $Id: PhysicsList.cc,v 1.19 2007/11/13 14:44:26 vnivanch Exp $ 27 /// \brief Implementation of the PhysicsList c << 27 // GEANT4 tag $Name: geant4-09-01-patch-03 $ 28 // << 29 // 28 // 30 //-------------------------------------------- 29 //--------------------------------------------------------------------------- 31 // 30 // 32 // ClassName: PhysicsList 31 // ClassName: PhysicsList 33 // 32 // 34 // Author: V.Ivanchenko 14.10.2002 33 // Author: V.Ivanchenko 14.10.2002 35 // 34 // 36 // Modified: 35 // Modified: 37 // 17.11.06 Use components from physics_lists 36 // 17.11.06 Use components from physics_lists subdirectory (V.Ivanchenko) 38 // 24.10.12 Migrated to new stopping and ion p << 39 // 37 // 40 //-------------------------------------------- 38 //---------------------------------------------------------------------------- 41 // 39 // 42 40 43 //....oooOO0OOooo........oooOO0OOooo........oo 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 43 46 #include "PhysicsList.hh" 44 #include "PhysicsList.hh" 47 << 48 #include "PhysListEmStandard.hh" << 49 #include "PhysicsListMessenger.hh" 45 #include "PhysicsListMessenger.hh" 50 #include "StepMax.hh" << 51 46 52 #include "G4DecayPhysics.hh" << 47 #include "PhysListEmStandard.hh" 53 #include "G4Electron.hh" << 48 #include "PhysListEmStandardIG.hh" 54 #include "G4EmExtraPhysics.hh" << 55 #include "G4EmLivermorePhysics.hh" << 56 #include "G4EmLowEPPhysics.hh" << 57 #include "G4EmPenelopePhysics.hh" << 58 #include "G4EmStandardPhysics.hh" 49 #include "G4EmStandardPhysics.hh" 59 #include "G4EmStandardPhysicsGS.hh" << 60 #include "G4EmStandardPhysicsSS.hh" << 61 #include "G4EmStandardPhysicsWVI.hh" << 62 #include "G4EmStandardPhysics_option1.hh" 50 #include "G4EmStandardPhysics_option1.hh" 63 #include "G4EmStandardPhysics_option2.hh" 51 #include "G4EmStandardPhysics_option2.hh" 64 #include "G4EmStandardPhysics_option3.hh" << 52 #include "PhysListEmLivermore.hh" 65 #include "G4EmStandardPhysics_option4.hh" << 53 #include "PhysListEmPenelope.hh" 66 #include "G4Gamma.hh" << 54 #include "G4DecayPhysics.hh" 67 #include "G4HadronElasticPhysics.hh" 55 #include "G4HadronElasticPhysics.hh" 68 #include "G4HadronInelasticQBBC.hh" 56 #include "G4HadronInelasticQBBC.hh" 69 #include "G4IonPhysics.hh" << 57 #include "G4IonBinaryCascadePhysics.hh" 70 #include "G4LossTableManager.hh" << 58 #include "G4EmExtraPhysics.hh" 71 #include "G4ParticleTable.hh" << 59 #include "G4QStoppingPhysics.hh" >> 60 >> 61 #include "G4RegionStore.hh" >> 62 #include "G4Region.hh" >> 63 #include "G4ProductionCuts.hh" >> 64 #include "G4ProcessManager.hh" 72 #include "G4ParticleTypes.hh" 65 #include "G4ParticleTypes.hh" >> 66 #include "G4ParticleTable.hh" >> 67 >> 68 #include "G4Gamma.hh" >> 69 #include "G4Electron.hh" 73 #include "G4Positron.hh" 70 #include "G4Positron.hh" 74 #include "G4ProcessManager.hh" << 71 75 #include "G4Proton.hh" << 76 #include "G4RegionStore.hh" << 77 #include "G4StoppingPhysics.hh" << 78 #include "G4SystemOfUnits.hh" << 79 #include "G4UnitsTable.hh" 72 #include "G4UnitsTable.hh" >> 73 #include "G4LossTableManager.hh" >> 74 #include "StepMax.hh" >> 75 >> 76 #include "G4EmProcessOptions.hh" 80 77 81 //....oooOO0OOooo........oooOO0OOooo........oo 78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 82 79 83 PhysicsList::PhysicsList() << 80 PhysicsList::PhysicsList() : G4VModularPhysicsList() 84 : G4VModularPhysicsList(), << 85 fEmPhysicsList(nullptr), << 86 fDecayPhysicsList(nullptr), << 87 fStepMaxProcess(nullptr), << 88 fMessenger(nullptr) << 89 { 81 { 90 G4LossTableManager::Instance(); 82 G4LossTableManager::Instance(); 91 SetDefaultCutValue(1 * mm); << 83 defaultCutValue = 1.*mm; >> 84 cutForGamma = defaultCutValue; >> 85 cutForElectron = defaultCutValue; >> 86 cutForPositron = defaultCutValue; 92 87 93 fMessenger = new PhysicsListMessenger(this); << 88 vertexDetectorCuts = 0; 94 fStepMaxProcess = new StepMax(); << 89 muonDetectorCuts = 0; >> 90 >> 91 pMessenger = new PhysicsListMessenger(this); >> 92 stepMaxProcess = new StepMax(); 95 93 96 // Initilise flags 94 // Initilise flags 97 95 98 SetVerboseLevel(1); 96 SetVerboseLevel(1); 99 97 100 fHelIsRegisted = false; << 98 mscStepLimit = true; 101 fBicIsRegisted = false; << 99 helIsRegisted = false; 102 fGnucIsRegisted = false; << 100 bicIsRegisted = false; 103 fStopIsRegisted = false; << 101 gnucIsRegisted = false; 104 << 102 stopIsRegisted = false; 105 // EM physics << 106 fEmName = G4String("emstandard"); << 107 fEmPhysicsList = new G4EmStandardPhysics(); << 108 103 109 // Decay Physics is always defined 104 // Decay Physics is always defined 110 fDecayPhysicsList = new G4DecayPhysics(); << 105 generalPhysicsList = new G4DecayPhysics(); >> 106 >> 107 // EM physics >> 108 emName = G4String("standard"); >> 109 emPhysicsList = new PhysListEmStandard(emName); 111 } 110 } 112 111 113 //....oooOO0OOooo........oooOO0OOooo........oo 112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 114 113 115 PhysicsList::~PhysicsList() 114 PhysicsList::~PhysicsList() 116 { 115 { 117 delete fMessenger; << 116 delete pMessenger; 118 delete fDecayPhysicsList; << 117 delete generalPhysicsList; 119 delete fEmPhysicsList; << 118 delete emPhysicsList; 120 delete fStepMaxProcess; << 119 delete stepMaxProcess; 121 for (size_t i = 0; i < fHadronPhys.size(); i << 120 for(size_t i=0; i<hadronPhys.size(); i++) { 122 delete fHadronPhys[i]; << 121 delete hadronPhys[i]; 123 } 122 } 124 } 123 } 125 124 126 //....oooOO0OOooo........oooOO0OOooo........oo 125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 127 126 128 void PhysicsList::ConstructParticle() 127 void PhysicsList::ConstructParticle() 129 { 128 { 130 fDecayPhysicsList->ConstructParticle(); << 129 generalPhysicsList->ConstructParticle(); 131 } 130 } 132 131 133 //....oooOO0OOooo........oooOO0OOooo........oo 132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 134 133 135 void PhysicsList::ConstructProcess() 134 void PhysicsList::ConstructProcess() 136 { 135 { 137 AddTransportation(); 136 AddTransportation(); 138 fEmPhysicsList->ConstructProcess(); << 137 emPhysicsList->ConstructProcess(); 139 fDecayPhysicsList->ConstructProcess(); << 138 generalPhysicsList->ConstructProcess(); 140 for (size_t i = 0; i < fHadronPhys.size(); + << 139 for(size_t i=0; i<hadronPhys.size(); i++) { 141 fHadronPhys[i]->ConstructProcess(); << 140 hadronPhys[i]->ConstructProcess(); 142 } 141 } 143 AddStepMax(); 142 AddStepMax(); 144 } 143 } 145 144 146 //....oooOO0OOooo........oooOO0OOooo........oo 145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 147 146 148 void PhysicsList::AddPhysicsList(const G4Strin 147 void PhysicsList::AddPhysicsList(const G4String& name) 149 { 148 { 150 if (verboseLevel > 1) G4cout << "PhysicsList << 149 if (verboseLevel > 1) >> 150 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 151 151 152 if (name == fEmName) return; << 152 if (name == emName) return; 153 153 154 if (name == "emstandard") { 154 if (name == "emstandard") { 155 fEmName = name; << 155 emName = name; 156 delete fEmPhysicsList; << 156 delete emPhysicsList; 157 fEmPhysicsList = new G4EmStandardPhysics(v << 157 emPhysicsList = new G4EmStandardPhysics(); 158 if (verboseLevel > 0) G4cout << "PhysicsLi << 158 if (verboseLevel > 0) 159 } << 159 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl; 160 else if (name == "emstandard_opt1") { << 160 161 fEmName = name; << 161 } else if (name == "emstandard_opt1") { 162 delete fEmPhysicsList; << 162 emName = name; 163 fEmPhysicsList = new G4EmStandardPhysics_o << 163 delete emPhysicsList; 164 if (verboseLevel > 0) G4cout << "PhysicsLi << 164 emPhysicsList = new G4EmStandardPhysics_option1(); 165 } << 165 if (verboseLevel > 0) 166 else if (name == "emstandard_opt2") { << 166 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl; 167 fEmName = name; << 167 168 delete fEmPhysicsList; << 168 } else if (name == "emstandard_opt2") { 169 fEmPhysicsList = new G4EmStandardPhysics_o << 169 emName = name; 170 if (verboseLevel > 0) G4cout << "PhysicsLi << 170 delete emPhysicsList; 171 } << 171 emPhysicsList = new G4EmStandardPhysics_option2(); 172 else if (name == "emstandard_opt3") { << 172 if (verboseLevel > 0) 173 fEmName = name; << 173 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl; 174 delete fEmPhysicsList; << 174 175 fEmPhysicsList = new G4EmStandardPhysics_o << 175 } else if (name == "standard") { 176 if (verboseLevel > 0) G4cout << "PhysicsLi << 176 emName = name; 177 } << 177 delete emPhysicsList; 178 else if (name == "emstandard_opt4") { << 178 emPhysicsList = new PhysListEmStandard(); 179 fEmName = name; << 179 if (verboseLevel > 0) 180 delete fEmPhysicsList; << 180 G4cout << "PhysicsList::Set " << name << " EM physics" << G4endl; 181 fEmPhysicsList = new G4EmStandardPhysics_o << 181 182 if (verboseLevel > 0) G4cout << "PhysicsLi << 182 } else if (name == "standardIG") { 183 } << 183 emName = name; 184 else if (name == "local") { << 184 delete emPhysicsList; 185 fEmName = name; << 185 emPhysicsList = new PhysListEmStandardIG(); 186 delete fEmPhysicsList; << 186 if (verboseLevel > 0) 187 fEmPhysicsList = new PhysListEmStandard(ve << 187 G4cout << "PhysicsList::Set StandardIG EM physics" << G4endl; 188 if (verboseLevel > 0) G4cout << "PhysicsLi << 188 189 } << 189 } else if (name == "livermore") { 190 else if (name == "emlivermore") { << 190 emName = name; 191 fEmName = name; << 191 delete emPhysicsList; 192 delete fEmPhysicsList; << 192 emPhysicsList = new PhysListEmLivermore(); 193 fEmPhysicsList = new G4EmLivermorePhysics( << 193 if (verboseLevel > 0) 194 } << 194 G4cout << "PhysicsList::Set Livermore EM physics" << G4endl; 195 else if (name == "empenelope") { << 195 196 fEmName = name; << 196 } else if (name == "penelope") { 197 delete fEmPhysicsList; << 197 emName = name; 198 fEmPhysicsList = new G4EmPenelopePhysics(v << 198 delete emPhysicsList; 199 } << 199 emPhysicsList = new PhysListEmPenelope(); 200 else if (name == "emlowenergy") { << 200 if (verboseLevel > 0) 201 fEmName = name; << 201 G4cout << "PhysicsList::Set Penelope EM physics" << G4endl; 202 delete fEmPhysicsList; << 202 203 fEmPhysicsList = new G4EmLowEPPhysics(verb << 203 } else if (name == "elastic" && !helIsRegisted) { 204 } << 204 hadronPhys.push_back( new G4HadronElasticPhysics(name)); 205 else if (name == "emstandardGS") { << 205 helIsRegisted = true; 206 fEmName = name; << 206 if (verboseLevel > 0) 207 delete fEmPhysicsList; << 207 G4cout << "PhysicsList::Add hadron elastic physics" << G4endl; 208 fEmPhysicsList = new G4EmStandardPhysicsGS << 208 209 } << 209 } else if (name == "binary" && !bicIsRegisted) { 210 else if (name == "emstandardSS") { << 210 hadronPhys.push_back(new G4HadronInelasticQBBC()); 211 fEmName = name; << 211 hadronPhys.push_back(new G4IonBinaryCascadePhysics()); 212 delete fEmPhysicsList; << 212 bicIsRegisted = true; 213 fEmPhysicsList = new G4EmStandardPhysicsSS << 213 if (verboseLevel > 0) 214 } << 215 else if (name == "emstandardWVI") { << 216 fEmName = name; << 217 delete fEmPhysicsList; << 218 fEmPhysicsList = new G4EmStandardPhysicsWV << 219 } << 220 else if (name == "elastic" && !fHelIsRegiste << 221 fHadronPhys.push_back(new G4HadronElasticP << 222 fHelIsRegisted = true; << 223 if (verboseLevel > 0) G4cout << "PhysicsLi << 224 } << 225 else if (name == "binary" && !fBicIsRegisted << 226 fHadronPhys.push_back(new G4HadronInelasti << 227 fHadronPhys.push_back(new G4IonPhysics()); << 228 fBicIsRegisted = true; << 229 if (verboseLevel > 0) << 230 G4cout << "PhysicsList::Add hadron inela 214 G4cout << "PhysicsList::Add hadron inelastic physics from <QBBC>" << G4endl; 231 } << 215 232 else if (name == "gamma_nuc" && !fGnucIsRegi << 216 } else if (name == "gamma_nuc" && !gnucIsRegisted) { 233 fHadronPhys.push_back(new G4EmExtraPhysics << 217 hadronPhys.push_back(new G4EmExtraPhysics()); 234 fGnucIsRegisted = true; << 218 gnucIsRegisted = true; 235 if (verboseLevel > 0) G4cout << "PhysicsLi << 219 if (verboseLevel > 0) 236 } << 220 G4cout << "PhysicsList::Add gamma- and electro-nuclear physics" << G4endl; 237 else if (name == "stopping" && !fStopIsRegis << 221 238 fHadronPhys.push_back(new G4StoppingPhysic << 222 } else if (name == "stopping" && !stopIsRegisted) { 239 fStopIsRegisted = true; << 223 hadronPhys.push_back(new G4QStoppingPhysics()); 240 if (verboseLevel > 0) G4cout << "PhysicsLi << 224 gnucIsRegisted = true; 241 } << 225 if (verboseLevel > 0) 242 else { << 226 G4cout << "PhysicsList::Add stopping physics" << G4endl; >> 227 >> 228 } else { 243 G4cout << "PhysicsList::AddPhysicsList: <" 229 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 244 << " is not defined" << G4endl; << 230 << " is not defined" >> 231 << G4endl; 245 } 232 } 246 } 233 } 247 234 248 //....oooOO0OOooo........oooOO0OOooo........oo 235 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 249 236 250 void PhysicsList::AddStepMax() 237 void PhysicsList::AddStepMax() 251 { 238 { 252 // Step limitation seen as a process 239 // Step limitation seen as a process 253 240 254 auto particleIterator = GetParticleIterator( << 241 theParticleIterator->reset(); 255 particleIterator->reset(); << 242 while ((*theParticleIterator)()){ 256 while ((*particleIterator)()) { << 243 G4ParticleDefinition* particle = theParticleIterator->value(); 257 G4ParticleDefinition* particle = particleI << 244 G4ProcessManager* pmanager = particle->GetProcessManager(); 258 G4ProcessManager* pmanager = particle->Get << 245 259 << 246 if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived()) 260 if (fStepMaxProcess->IsApplicable(*particl << 247 { 261 pmanager->AddDiscreteProcess(fStepMaxPro << 248 pmanager ->AddDiscreteProcess(stepMaxProcess); 262 } << 249 } 263 } 250 } 264 } 251 } 265 252 266 //....oooOO0OOooo........oooOO0OOooo........oo 253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 254 >> 255 void PhysicsList::SetCuts() >> 256 { >> 257 >> 258 SetCutValue(cutForGamma, "gamma", "DefaultRegionForTheWorld"); >> 259 SetCutValue(cutForElectron, "e-", "DefaultRegionForTheWorld"); >> 260 SetCutValue(cutForPositron, "e+", "DefaultRegionForTheWorld"); >> 261 G4cout << "PhysicsList: world cuts are set cutG= " << cutForGamma/mm >> 262 << " mm cutE= " << cutForElectron/mm << " mm " << G4endl; >> 263 >> 264 if( !vertexDetectorCuts ) SetVertexCut(cutForElectron); >> 265 G4Region* region = (G4RegionStore::GetInstance())->GetRegion("VertexDetector"); >> 266 region->SetProductionCuts(vertexDetectorCuts); >> 267 G4cout << "Vertex cuts are set" << G4endl; >> 268 >> 269 if( !muonDetectorCuts ) SetMuonCut(cutForElectron); >> 270 region = (G4RegionStore::GetInstance())->GetRegion("MuonDetector"); >> 271 region->SetProductionCuts(muonDetectorCuts); >> 272 G4cout << "Muon cuts are set" << G4endl; >> 273 >> 274 if (verboseLevel>0) DumpCutValuesTable(); >> 275 } >> 276 >> 277 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 278 >> 279 void PhysicsList::SetCutForGamma(G4double cut) >> 280 { >> 281 cutForGamma = cut; >> 282 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); >> 283 } >> 284 >> 285 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 286 >> 287 void PhysicsList::SetCutForElectron(G4double cut) >> 288 { >> 289 cutForElectron = cut; >> 290 SetParticleCuts(cutForElectron, G4Electron::Electron()); >> 291 } >> 292 >> 293 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 294 >> 295 void PhysicsList::SetCutForPositron(G4double cut) >> 296 { >> 297 cutForPositron = cut; >> 298 SetParticleCuts(cutForPositron, G4Positron::Positron()); >> 299 } >> 300 >> 301 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 302 >> 303 void PhysicsList::SetVertexCut(G4double cut) >> 304 { >> 305 if( !vertexDetectorCuts ) vertexDetectorCuts = new G4ProductionCuts(); >> 306 >> 307 vertexDetectorCuts->SetProductionCut(cut, idxG4GammaCut); >> 308 vertexDetectorCuts->SetProductionCut(cut, idxG4ElectronCut); >> 309 vertexDetectorCuts->SetProductionCut(cut, idxG4PositronCut); >> 310 >> 311 } >> 312 >> 313 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 314 >> 315 void PhysicsList::SetMuonCut(G4double cut) >> 316 { >> 317 if( !muonDetectorCuts ) muonDetectorCuts = new G4ProductionCuts(); >> 318 >> 319 muonDetectorCuts->SetProductionCut(cut, idxG4GammaCut); >> 320 muonDetectorCuts->SetProductionCut(cut, idxG4ElectronCut); >> 321 muonDetectorCuts->SetProductionCut(cut, idxG4PositronCut); >> 322 } >> 323 >> 324 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 325 >> 326 void PhysicsList::SetMscStepLimit(G4bool val) >> 327 { >> 328 mscStepLimit = val; >> 329 } >> 330 >> 331 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 332 267 333