Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 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 // 23 // 42 24 43 //....oooOO0OOooo........oooOO0OOooo........oo 25 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 //....oooOO0OOooo........oooOO0OOooo........oo 26 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 27 46 #include "PhysicsList.hh" 28 #include "PhysicsList.hh" >> 29 #include "PhysicsListMessenger.hh" 47 30 >> 31 #include "PhysListParticles.hh" >> 32 #include "PhysListGeneral.hh" 48 #include "PhysListEmStandard.hh" 33 #include "PhysListEmStandard.hh" 49 #include "PhysicsListMessenger.hh" << 34 #include "PhysListEmG4v52.hh" 50 #include "StepMax.hh" << 35 #include "PhysListHadronElastic.hh" >> 36 #include "PhysListBinaryCascade.hh" >> 37 #include "PhysListIonBinaryCascade.hh" >> 38 #include "G4RegionStore.hh" >> 39 #include "G4Region.hh" >> 40 #include "G4ProductionCuts.hh" >> 41 #include "G4ProcessManager.hh" >> 42 #include "G4ParticleTypes.hh" >> 43 #include "G4ParticleTable.hh" 51 44 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" 45 #include "G4Gamma.hh" 67 #include "G4HadronElasticPhysics.hh" << 46 #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" 47 #include "G4Positron.hh" 74 #include "G4ProcessManager.hh" << 48 75 #include "G4Proton.hh" << 76 #include "G4RegionStore.hh" << 77 #include "G4StoppingPhysics.hh" << 78 #include "G4SystemOfUnits.hh" << 79 #include "G4UnitsTable.hh" 49 #include "G4UnitsTable.hh" >> 50 #include "G4LossTableManager.hh" >> 51 #include "StepMax.hh" >> 52 >> 53 #include "G4EmProcessOptions.hh" 80 54 81 //....oooOO0OOooo........oooOO0OOooo........oo 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 82 56 83 PhysicsList::PhysicsList() << 57 PhysicsList::PhysicsList() : G4VModularPhysicsList() 84 : G4VModularPhysicsList(), << 85 fEmPhysicsList(nullptr), << 86 fDecayPhysicsList(nullptr), << 87 fStepMaxProcess(nullptr), << 88 fMessenger(nullptr) << 89 { 58 { 90 G4LossTableManager::Instance(); 59 G4LossTableManager::Instance(); 91 SetDefaultCutValue(1 * mm); << 60 defaultCutValue = 1.*mm; >> 61 cutForGamma = defaultCutValue; >> 62 cutForElectron = defaultCutValue; >> 63 cutForPositron = defaultCutValue; >> 64 >> 65 vertexDetectorCuts = 0; >> 66 muonDetectorCuts = 0; 92 67 93 fMessenger = new PhysicsListMessenger(this); << 68 stepMaxProcess = 0; 94 fStepMaxProcess = new StepMax(); << 95 69 96 // Initilise flags << 70 mscStepLimit = true; >> 71 >> 72 pMessenger = new PhysicsListMessenger(this); >> 73 stepMaxProcess = new StepMax(); 97 74 98 SetVerboseLevel(1); 75 SetVerboseLevel(1); 99 76 100 fHelIsRegisted = false; << 77 // Particles 101 fBicIsRegisted = false; << 78 particleList = new PhysListParticles("particles"); 102 fGnucIsRegisted = false; << 79 103 fStopIsRegisted = false; << 80 // General Physics >> 81 generalPhysicsList = new PhysListGeneral("general"); 104 82 105 // EM physics 83 // EM physics 106 fEmName = G4String("emstandard"); << 84 emName = G4String("standard"); 107 fEmPhysicsList = new G4EmStandardPhysics(); << 85 emPhysicsList = new PhysListEmStandard(emName); 108 86 109 // Decay Physics is always defined << 110 fDecayPhysicsList = new G4DecayPhysics(); << 111 } 87 } 112 88 113 //....oooOO0OOooo........oooOO0OOooo........oo 89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 114 90 115 PhysicsList::~PhysicsList() 91 PhysicsList::~PhysicsList() 116 { 92 { 117 delete fMessenger; << 93 delete pMessenger; 118 delete fDecayPhysicsList; << 94 delete generalPhysicsList; 119 delete fEmPhysicsList; << 95 delete emPhysicsList; 120 delete fStepMaxProcess; << 96 delete stepMaxProcess; 121 for (size_t i = 0; i < fHadronPhys.size(); i << 97 for(size_t i=0; i<hadronPhys.size(); i++) { 122 delete fHadronPhys[i]; << 98 delete hadronPhys[i]; 123 } 99 } 124 } 100 } 125 101 126 //....oooOO0OOooo........oooOO0OOooo........oo 102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 127 103 128 void PhysicsList::ConstructParticle() 104 void PhysicsList::ConstructParticle() 129 { 105 { 130 fDecayPhysicsList->ConstructParticle(); << 106 particleList->ConstructParticle(); 131 } 107 } 132 108 133 //....oooOO0OOooo........oooOO0OOooo........oo 109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 134 110 135 void PhysicsList::ConstructProcess() 111 void PhysicsList::ConstructProcess() 136 { 112 { 137 AddTransportation(); 113 AddTransportation(); 138 fEmPhysicsList->ConstructProcess(); << 114 generalPhysicsList->ConstructProcess(); 139 fDecayPhysicsList->ConstructProcess(); << 115 emPhysicsList->ConstructProcess(); 140 for (size_t i = 0; i < fHadronPhys.size(); + << 116 for(size_t i=0; i<hadronPhys.size(); i++) { 141 fHadronPhys[i]->ConstructProcess(); << 117 hadronPhys[i]->ConstructProcess(); 142 } 118 } 143 AddStepMax(); 119 AddStepMax(); >> 120 if(!mscStepLimit) { >> 121 G4EmProcessOptions opt; >> 122 opt.SetMscStepLimitation(false); >> 123 } 144 } 124 } 145 125 146 //....oooOO0OOooo........oooOO0OOooo........oo 126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 147 127 148 void PhysicsList::AddPhysicsList(const G4Strin 128 void PhysicsList::AddPhysicsList(const G4String& name) 149 { 129 { 150 if (verboseLevel > 1) G4cout << "PhysicsList << 130 if (verboseLevel>-1) { >> 131 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; >> 132 } 151 133 152 if (name == fEmName) return; << 134 if (name == emName) return; >> 135 >> 136 if (name == "standard") { >> 137 >> 138 emName = name; >> 139 delete emPhysicsList; >> 140 emPhysicsList = new PhysListEmStandard(name); >> 141 >> 142 } else if (name == "g4v52") { >> 143 >> 144 emName = name; >> 145 delete emPhysicsList; >> 146 emPhysicsList = new PhysListEmG4v52(name); >> 147 >> 148 } else if (name == "elastic") { >> 149 >> 150 hadronPhys.push_back( new PhysListHadronElastic(name)); >> 151 >> 152 } else if (name == "binary") { >> 153 >> 154 hadronPhys.push_back( new PhysListBinaryCascade(name)); >> 155 >> 156 } else if (name == "binary_ion") { >> 157 >> 158 hadronPhys.push_back( new PhysListIonBinaryCascade(name)); >> 159 >> 160 } else { 153 161 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: <" 162 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 244 << " is not defined" << G4endl; << 163 << " is not defined" >> 164 << G4endl; 245 } 165 } 246 } 166 } 247 167 248 //....oooOO0OOooo........oooOO0OOooo........oo 168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 249 169 250 void PhysicsList::AddStepMax() 170 void PhysicsList::AddStepMax() 251 { 171 { 252 // Step limitation seen as a process 172 // Step limitation seen as a process 253 173 254 auto particleIterator = GetParticleIterator( << 174 theParticleIterator->reset(); 255 particleIterator->reset(); << 175 while ((*theParticleIterator)()){ 256 while ((*particleIterator)()) { << 176 G4ParticleDefinition* particle = theParticleIterator->value(); 257 G4ParticleDefinition* particle = particleI << 177 G4ProcessManager* pmanager = particle->GetProcessManager(); 258 G4ProcessManager* pmanager = particle->Get << 178 259 << 179 if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived()) 260 if (fStepMaxProcess->IsApplicable(*particl << 180 { 261 pmanager->AddDiscreteProcess(fStepMaxPro << 181 pmanager ->AddDiscreteProcess(stepMaxProcess); 262 } << 182 } 263 } 183 } 264 } 184 } 265 185 266 //....oooOO0OOooo........oooOO0OOooo........oo 186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 187 >> 188 void PhysicsList::SetCuts() >> 189 { >> 190 >> 191 SetCutValue(cutForGamma, "gamma", "DefaultRegionForTheWorld"); >> 192 SetCutValue(cutForElectron, "e-", "DefaultRegionForTheWorld"); >> 193 SetCutValue(cutForPositron, "e+", "DefaultRegionForTheWorld"); >> 194 G4cout << "PhysicsList: world cuts are set cutG= " << cutForGamma/mm >> 195 << " mm cutE= " << cutForElectron/mm << " mm " << G4endl; >> 196 >> 197 if( !vertexDetectorCuts ) SetVertexCut(cutForElectron); >> 198 G4Region* region = (G4RegionStore::GetInstance())->GetRegion("VertexDetector"); >> 199 region->SetProductionCuts(vertexDetectorCuts); >> 200 G4cout << "Vertex cuts are set" << G4endl; >> 201 >> 202 if( !muonDetectorCuts ) SetMuonCut(cutForElectron); >> 203 region = (G4RegionStore::GetInstance())->GetRegion("MuonDetector"); >> 204 region->SetProductionCuts(muonDetectorCuts); >> 205 G4cout << "Muon cuts are set" << G4endl; >> 206 >> 207 if (verboseLevel>0) DumpCutValuesTable(); >> 208 } >> 209 >> 210 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 211 >> 212 void PhysicsList::SetCutForGamma(G4double cut) >> 213 { >> 214 cutForGamma = cut; >> 215 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); >> 216 } >> 217 >> 218 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 219 >> 220 void PhysicsList::SetCutForElectron(G4double cut) >> 221 { >> 222 cutForElectron = cut; >> 223 SetParticleCuts(cutForElectron, G4Electron::Electron()); >> 224 } >> 225 >> 226 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 227 >> 228 void PhysicsList::SetCutForPositron(G4double cut) >> 229 { >> 230 cutForPositron = cut; >> 231 SetParticleCuts(cutForPositron, G4Positron::Positron()); >> 232 } >> 233 >> 234 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 235 >> 236 void PhysicsList::SetVertexCut(G4double cut) >> 237 { >> 238 if( !vertexDetectorCuts ) vertexDetectorCuts = new G4ProductionCuts(); >> 239 >> 240 vertexDetectorCuts->SetProductionCut(cut, idxG4GammaCut); >> 241 vertexDetectorCuts->SetProductionCut(cut, idxG4ElectronCut); >> 242 vertexDetectorCuts->SetProductionCut(cut, idxG4PositronCut); >> 243 >> 244 } >> 245 >> 246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 247 >> 248 void PhysicsList::SetMuonCut(G4double cut) >> 249 { >> 250 if( !muonDetectorCuts ) muonDetectorCuts = new G4ProductionCuts(); >> 251 >> 252 muonDetectorCuts->SetProductionCut(cut, idxG4GammaCut); >> 253 muonDetectorCuts->SetProductionCut(cut, idxG4ElectronCut); >> 254 muonDetectorCuts->SetProductionCut(cut, idxG4PositronCut); >> 255 } >> 256 >> 257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 258 >> 259 void PhysicsList::SetMscStepLimit(G4bool val) >> 260 { >> 261 mscStepLimit = val; >> 262 } >> 263 >> 264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 265 267 266