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 << 27 /// \brief Implementation of the PhysicsList c << 28 // << 29 // << 30 //-------------------------------------------- << 31 // << 32 // ClassName: PhysicsList << 33 // << 34 // Author: V.Ivanchenko 14.10.2002 << 35 // << 36 // Modified: << 37 // 17.11.06 Use components from physics_lists << 38 // 24.10.12 Migrated to new stopping and ion p << 39 // << 40 //-------------------------------------------- << 41 // 26 // 42 27 43 //....oooOO0OOooo........oooOO0OOooo........oo 28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 //....oooOO0OOooo........oooOO0OOooo........oo 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 30 46 #include "PhysicsList.hh" 31 #include "PhysicsList.hh" >> 32 #include "PhysicsListMessenger.hh" 47 33 >> 34 #include "PhysListParticles.hh" >> 35 #include "PhysListGeneral.hh" 48 #include "PhysListEmStandard.hh" 36 #include "PhysListEmStandard.hh" 49 #include "PhysicsListMessenger.hh" << 37 #include "PhysListEmG4v52.hh" 50 #include "StepMax.hh" << 38 #include "PhysListHadronElastic.hh" >> 39 #include "PhysListBinaryCascade.hh" >> 40 #include "PhysListIonBinaryCascade.hh" >> 41 #include "G4RegionStore.hh" >> 42 #include "G4Region.hh" >> 43 #include "G4ProductionCuts.hh" >> 44 #include "G4ProcessManager.hh" >> 45 #include "G4ParticleTypes.hh" >> 46 #include "G4ParticleTable.hh" 51 47 52 #include "G4DecayPhysics.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" << 59 #include "G4EmStandardPhysicsGS.hh" << 60 #include "G4EmStandardPhysicsSS.hh" << 61 #include "G4EmStandardPhysicsWVI.hh" << 62 #include "G4EmStandardPhysics_option1.hh" << 63 #include "G4EmStandardPhysics_option2.hh" << 64 #include "G4EmStandardPhysics_option3.hh" << 65 #include "G4EmStandardPhysics_option4.hh" << 66 #include "G4Gamma.hh" 48 #include "G4Gamma.hh" 67 #include "G4HadronElasticPhysics.hh" << 49 #include "G4Electron.hh" 68 #include "G4HadronInelasticQBBC.hh" << 69 #include "G4IonPhysics.hh" << 70 #include "G4LossTableManager.hh" << 71 #include "G4ParticleTable.hh" << 72 #include "G4ParticleTypes.hh" << 73 #include "G4Positron.hh" 50 #include "G4Positron.hh" 74 #include "G4ProcessManager.hh" << 51 75 #include "G4Proton.hh" << 76 #include "G4RegionStore.hh" << 77 #include "G4StoppingPhysics.hh" << 78 #include "G4SystemOfUnits.hh" << 79 #include "G4UnitsTable.hh" 52 #include "G4UnitsTable.hh" >> 53 #include "G4LossTableManager.hh" >> 54 #include "StepMax.hh" >> 55 >> 56 #include "G4EmProcessOptions.hh" 80 57 81 //....oooOO0OOooo........oooOO0OOooo........oo 58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 82 59 83 PhysicsList::PhysicsList() << 60 PhysicsList::PhysicsList() : G4VModularPhysicsList() 84 : G4VModularPhysicsList(), << 85 fEmPhysicsList(nullptr), << 86 fDecayPhysicsList(nullptr), << 87 fStepMaxProcess(nullptr), << 88 fMessenger(nullptr) << 89 { 61 { 90 G4LossTableManager::Instance(); 62 G4LossTableManager::Instance(); 91 SetDefaultCutValue(1 * mm); << 63 defaultCutValue = 1.*mm; >> 64 cutForGamma = defaultCutValue; >> 65 cutForElectron = defaultCutValue; >> 66 cutForPositron = defaultCutValue; >> 67 >> 68 vertexDetectorCuts = 0; >> 69 muonDetectorCuts = 0; 92 70 93 fMessenger = new PhysicsListMessenger(this); << 71 stepMaxProcess = 0; 94 fStepMaxProcess = new StepMax(); << 95 72 96 // Initilise flags << 73 mscStepLimit = true; >> 74 >> 75 pMessenger = new PhysicsListMessenger(this); >> 76 stepMaxProcess = new StepMax(); 97 77 98 SetVerboseLevel(1); 78 SetVerboseLevel(1); 99 79 100 fHelIsRegisted = false; << 80 // Particles 101 fBicIsRegisted = false; << 81 particleList = new PhysListParticles("particles"); 102 fGnucIsRegisted = false; << 82 103 fStopIsRegisted = false; << 83 // General Physics >> 84 generalPhysicsList = new PhysListGeneral("general"); 104 85 105 // EM physics 86 // EM physics 106 fEmName = G4String("emstandard"); << 87 emName = G4String("standard"); 107 fEmPhysicsList = new G4EmStandardPhysics(); << 88 emPhysicsList = new PhysListEmStandard(emName); 108 89 109 // Decay Physics is always defined << 110 fDecayPhysicsList = new G4DecayPhysics(); << 111 } 90 } 112 91 113 //....oooOO0OOooo........oooOO0OOooo........oo 92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 114 93 115 PhysicsList::~PhysicsList() 94 PhysicsList::~PhysicsList() 116 { 95 { 117 delete fMessenger; << 96 delete pMessenger; 118 delete fDecayPhysicsList; << 97 delete generalPhysicsList; 119 delete fEmPhysicsList; << 98 delete emPhysicsList; 120 delete fStepMaxProcess; << 99 delete stepMaxProcess; 121 for (size_t i = 0; i < fHadronPhys.size(); i << 100 for(size_t i=0; i<hadronPhys.size(); i++) { 122 delete fHadronPhys[i]; << 101 delete hadronPhys[i]; 123 } 102 } 124 } 103 } 125 104 126 //....oooOO0OOooo........oooOO0OOooo........oo 105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 127 106 128 void PhysicsList::ConstructParticle() 107 void PhysicsList::ConstructParticle() 129 { 108 { 130 fDecayPhysicsList->ConstructParticle(); << 109 particleList->ConstructParticle(); 131 } 110 } 132 111 133 //....oooOO0OOooo........oooOO0OOooo........oo 112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 134 113 135 void PhysicsList::ConstructProcess() 114 void PhysicsList::ConstructProcess() 136 { 115 { 137 AddTransportation(); 116 AddTransportation(); 138 fEmPhysicsList->ConstructProcess(); << 117 generalPhysicsList->ConstructProcess(); 139 fDecayPhysicsList->ConstructProcess(); << 118 emPhysicsList->ConstructProcess(); 140 for (size_t i = 0; i < fHadronPhys.size(); + << 119 for(size_t i=0; i<hadronPhys.size(); i++) { 141 fHadronPhys[i]->ConstructProcess(); << 120 hadronPhys[i]->ConstructProcess(); 142 } 121 } 143 AddStepMax(); 122 AddStepMax(); >> 123 if(!mscStepLimit) { >> 124 G4EmProcessOptions opt; >> 125 opt.SetMscStepLimitation(false); >> 126 } 144 } 127 } 145 128 146 //....oooOO0OOooo........oooOO0OOooo........oo 129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 147 130 148 void PhysicsList::AddPhysicsList(const G4Strin 131 void PhysicsList::AddPhysicsList(const G4String& name) 149 { 132 { 150 if (verboseLevel > 1) G4cout << "PhysicsList << 133 if (verboseLevel>-1) { >> 134 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; >> 135 } 151 136 152 if (name == fEmName) return; << 137 if (name == emName) return; >> 138 >> 139 if (name == "standard") { >> 140 >> 141 emName = name; >> 142 delete emPhysicsList; >> 143 emPhysicsList = new PhysListEmStandard(name); >> 144 >> 145 } else if (name == "g4v52") { >> 146 >> 147 emName = name; >> 148 delete emPhysicsList; >> 149 emPhysicsList = new PhysListEmG4v52(name); >> 150 >> 151 } else if (name == "elastic") { >> 152 >> 153 hadronPhys.push_back( new PhysListHadronElastic(name)); >> 154 >> 155 } else if (name == "binary") { >> 156 >> 157 hadronPhys.push_back( new PhysListBinaryCascade(name)); >> 158 >> 159 } else if (name == "binary_ion") { >> 160 >> 161 hadronPhys.push_back( new PhysListIonBinaryCascade(name)); >> 162 >> 163 } else { 153 164 154 if (name == "emstandard") { << 155 fEmName = name; << 156 delete fEmPhysicsList; << 157 fEmPhysicsList = new G4EmStandardPhysics(v << 158 if (verboseLevel > 0) G4cout << "PhysicsLi << 159 } << 160 else if (name == "emstandard_opt1") { << 161 fEmName = name; << 162 delete fEmPhysicsList; << 163 fEmPhysicsList = new G4EmStandardPhysics_o << 164 if (verboseLevel > 0) G4cout << "PhysicsLi << 165 } << 166 else if (name == "emstandard_opt2") { << 167 fEmName = name; << 168 delete fEmPhysicsList; << 169 fEmPhysicsList = new G4EmStandardPhysics_o << 170 if (verboseLevel > 0) G4cout << "PhysicsLi << 171 } << 172 else if (name == "emstandard_opt3") { << 173 fEmName = name; << 174 delete fEmPhysicsList; << 175 fEmPhysicsList = new G4EmStandardPhysics_o << 176 if (verboseLevel > 0) G4cout << "PhysicsLi << 177 } << 178 else if (name == "emstandard_opt4") { << 179 fEmName = name; << 180 delete fEmPhysicsList; << 181 fEmPhysicsList = new G4EmStandardPhysics_o << 182 if (verboseLevel > 0) G4cout << "PhysicsLi << 183 } << 184 else if (name == "local") { << 185 fEmName = name; << 186 delete fEmPhysicsList; << 187 fEmPhysicsList = new PhysListEmStandard(ve << 188 if (verboseLevel > 0) G4cout << "PhysicsLi << 189 } << 190 else if (name == "emlivermore") { << 191 fEmName = name; << 192 delete fEmPhysicsList; << 193 fEmPhysicsList = new G4EmLivermorePhysics( << 194 } << 195 else if (name == "empenelope") { << 196 fEmName = name; << 197 delete fEmPhysicsList; << 198 fEmPhysicsList = new G4EmPenelopePhysics(v << 199 } << 200 else if (name == "emlowenergy") { << 201 fEmName = name; << 202 delete fEmPhysicsList; << 203 fEmPhysicsList = new G4EmLowEPPhysics(verb << 204 } << 205 else if (name == "emstandardGS") { << 206 fEmName = name; << 207 delete fEmPhysicsList; << 208 fEmPhysicsList = new G4EmStandardPhysicsGS << 209 } << 210 else if (name == "emstandardSS") { << 211 fEmName = name; << 212 delete fEmPhysicsList; << 213 fEmPhysicsList = new G4EmStandardPhysicsSS << 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 << 231 } << 232 else if (name == "gamma_nuc" && !fGnucIsRegi << 233 fHadronPhys.push_back(new G4EmExtraPhysics << 234 fGnucIsRegisted = true; << 235 if (verboseLevel > 0) G4cout << "PhysicsLi << 236 } << 237 else if (name == "stopping" && !fStopIsRegis << 238 fHadronPhys.push_back(new G4StoppingPhysic << 239 fStopIsRegisted = true; << 240 if (verboseLevel > 0) G4cout << "PhysicsLi << 241 } << 242 else { << 243 G4cout << "PhysicsList::AddPhysicsList: <" 165 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 244 << " is not defined" << G4endl; << 166 << " is not defined" >> 167 << G4endl; 245 } 168 } 246 } 169 } 247 170 248 //....oooOO0OOooo........oooOO0OOooo........oo 171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 249 172 250 void PhysicsList::AddStepMax() 173 void PhysicsList::AddStepMax() 251 { 174 { 252 // Step limitation seen as a process 175 // Step limitation seen as a process 253 176 254 auto particleIterator = GetParticleIterator( << 177 theParticleIterator->reset(); 255 particleIterator->reset(); << 178 while ((*theParticleIterator)()){ 256 while ((*particleIterator)()) { << 179 G4ParticleDefinition* particle = theParticleIterator->value(); 257 G4ParticleDefinition* particle = particleI << 180 G4ProcessManager* pmanager = particle->GetProcessManager(); 258 G4ProcessManager* pmanager = particle->Get << 181 259 << 182 if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived()) 260 if (fStepMaxProcess->IsApplicable(*particl << 183 { 261 pmanager->AddDiscreteProcess(fStepMaxPro << 184 pmanager ->AddDiscreteProcess(stepMaxProcess); 262 } << 185 } 263 } 186 } 264 } 187 } 265 188 266 //....oooOO0OOooo........oooOO0OOooo........oo 189 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 190 >> 191 void PhysicsList::SetCuts() >> 192 { >> 193 >> 194 SetCutValue(cutForGamma, "gamma", "DefaultRegionForTheWorld"); >> 195 SetCutValue(cutForElectron, "e-", "DefaultRegionForTheWorld"); >> 196 SetCutValue(cutForPositron, "e+", "DefaultRegionForTheWorld"); >> 197 G4cout << "PhysicsList: world cuts are set cutG= " << cutForGamma/mm >> 198 << " mm cutE= " << cutForElectron/mm << " mm " << G4endl; >> 199 >> 200 if( !vertexDetectorCuts ) SetVertexCut(cutForElectron); >> 201 G4Region* region = (G4RegionStore::GetInstance())->GetRegion("VertexDetector"); >> 202 region->SetProductionCuts(vertexDetectorCuts); >> 203 G4cout << "Vertex cuts are set" << G4endl; >> 204 >> 205 if( !muonDetectorCuts ) SetMuonCut(cutForElectron); >> 206 region = (G4RegionStore::GetInstance())->GetRegion("MuonDetector"); >> 207 region->SetProductionCuts(muonDetectorCuts); >> 208 G4cout << "Muon cuts are set" << G4endl; >> 209 >> 210 if (verboseLevel>0) DumpCutValuesTable(); >> 211 } >> 212 >> 213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 214 >> 215 void PhysicsList::SetCutForGamma(G4double cut) >> 216 { >> 217 cutForGamma = cut; >> 218 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); >> 219 } >> 220 >> 221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 222 >> 223 void PhysicsList::SetCutForElectron(G4double cut) >> 224 { >> 225 cutForElectron = cut; >> 226 SetParticleCuts(cutForElectron, G4Electron::Electron()); >> 227 } >> 228 >> 229 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 230 >> 231 void PhysicsList::SetCutForPositron(G4double cut) >> 232 { >> 233 cutForPositron = cut; >> 234 SetParticleCuts(cutForPositron, G4Positron::Positron()); >> 235 } >> 236 >> 237 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 238 >> 239 void PhysicsList::SetVertexCut(G4double cut) >> 240 { >> 241 if( !vertexDetectorCuts ) vertexDetectorCuts = new G4ProductionCuts(); >> 242 >> 243 vertexDetectorCuts->SetProductionCut(cut, idxG4GammaCut); >> 244 vertexDetectorCuts->SetProductionCut(cut, idxG4ElectronCut); >> 245 vertexDetectorCuts->SetProductionCut(cut, idxG4PositronCut); >> 246 >> 247 } >> 248 >> 249 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 250 >> 251 void PhysicsList::SetMuonCut(G4double cut) >> 252 { >> 253 if( !muonDetectorCuts ) muonDetectorCuts = new G4ProductionCuts(); >> 254 >> 255 muonDetectorCuts->SetProductionCut(cut, idxG4GammaCut); >> 256 muonDetectorCuts->SetProductionCut(cut, idxG4ElectronCut); >> 257 muonDetectorCuts->SetProductionCut(cut, idxG4PositronCut); >> 258 } >> 259 >> 260 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 261 >> 262 void PhysicsList::SetMscStepLimit(G4bool val) >> 263 { >> 264 mscStepLimit = val; >> 265 } >> 266 >> 267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 268 267 269