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" 80 52 81 //....oooOO0OOooo........oooOO0OOooo........oo 53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 82 54 83 PhysicsList::PhysicsList() << 55 PhysicsList::PhysicsList() : G4VModularPhysicsList() 84 : G4VModularPhysicsList(), << 85 fEmPhysicsList(nullptr), << 86 fDecayPhysicsList(nullptr), << 87 fStepMaxProcess(nullptr), << 88 fMessenger(nullptr) << 89 { 56 { 90 G4LossTableManager::Instance(); 57 G4LossTableManager::Instance(); 91 SetDefaultCutValue(1 * mm); << 58 defaultCutValue = 1.*mm; >> 59 cutForGamma = defaultCutValue; >> 60 cutForElectron = defaultCutValue; >> 61 cutForPositron = defaultCutValue; 92 62 93 fMessenger = new PhysicsListMessenger(this); << 63 vertexDetectorCuts = 0; 94 fStepMaxProcess = new StepMax(); << 64 muonDetectorCuts = 0; 95 65 96 // Initilise flags << 66 stepMaxProcess = 0; >> 67 >> 68 pMessenger = new PhysicsListMessenger(this); >> 69 stepMaxProcess = new StepMax(); 97 70 98 SetVerboseLevel(1); 71 SetVerboseLevel(1); 99 72 100 fHelIsRegisted = false; << 73 // Particles 101 fBicIsRegisted = false; << 74 particleList = new PhysListParticles("particles"); 102 fGnucIsRegisted = false; << 75 103 fStopIsRegisted = false; << 76 // General Physics >> 77 generalPhysicsList = new PhysListGeneral("general"); 104 78 105 // EM physics 79 // EM physics 106 fEmName = G4String("emstandard"); << 80 emName = G4String("standard"); 107 fEmPhysicsList = new G4EmStandardPhysics(); << 81 emPhysicsList = new PhysListEmStandard(emName); 108 82 109 // Decay Physics is always defined << 110 fDecayPhysicsList = new G4DecayPhysics(); << 111 } 83 } 112 84 113 //....oooOO0OOooo........oooOO0OOooo........oo 85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 114 86 115 PhysicsList::~PhysicsList() 87 PhysicsList::~PhysicsList() 116 { 88 { 117 delete fMessenger; << 89 delete pMessenger; 118 delete fDecayPhysicsList; << 90 delete generalPhysicsList; 119 delete fEmPhysicsList; << 91 delete emPhysicsList; 120 delete fStepMaxProcess; << 92 delete stepMaxProcess; 121 for (size_t i = 0; i < fHadronPhys.size(); i << 93 for(size_t i=0; i<hadronPhys.size(); i++) { 122 delete fHadronPhys[i]; << 94 delete hadronPhys[i]; 123 } 95 } 124 } 96 } 125 97 126 //....oooOO0OOooo........oooOO0OOooo........oo 98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 127 99 128 void PhysicsList::ConstructParticle() 100 void PhysicsList::ConstructParticle() 129 { 101 { 130 fDecayPhysicsList->ConstructParticle(); << 102 particleList->ConstructParticle(); 131 } 103 } 132 104 133 //....oooOO0OOooo........oooOO0OOooo........oo 105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 134 106 135 void PhysicsList::ConstructProcess() 107 void PhysicsList::ConstructProcess() 136 { 108 { 137 AddTransportation(); 109 AddTransportation(); 138 fEmPhysicsList->ConstructProcess(); << 110 generalPhysicsList->ConstructProcess(); 139 fDecayPhysicsList->ConstructProcess(); << 111 emPhysicsList->ConstructProcess(); 140 for (size_t i = 0; i < fHadronPhys.size(); + << 112 for(size_t i=0; i<hadronPhys.size(); i++) { 141 fHadronPhys[i]->ConstructProcess(); << 113 hadronPhys[i]->ConstructProcess(); 142 } 114 } 143 AddStepMax(); 115 AddStepMax(); 144 } 116 } 145 117 146 //....oooOO0OOooo........oooOO0OOooo........oo 118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 147 119 148 void PhysicsList::AddPhysicsList(const G4Strin 120 void PhysicsList::AddPhysicsList(const G4String& name) 149 { 121 { 150 if (verboseLevel > 1) G4cout << "PhysicsList << 122 if (verboseLevel>-1) { >> 123 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; >> 124 } 151 125 152 if (name == fEmName) return; << 126 if (name == emName) return; >> 127 >> 128 if (name == "standard") { >> 129 >> 130 emName = name; >> 131 delete emPhysicsList; >> 132 emPhysicsList = new PhysListEmStandard(name); >> 133 >> 134 } else if (name == "g4v52") { >> 135 >> 136 emName = name; >> 137 delete emPhysicsList; >> 138 emPhysicsList = new PhysListEmG4v52(name); >> 139 >> 140 } else if (name == "elastic") { >> 141 >> 142 hadronPhys.push_back( new PhysListHadronElastic(name)); >> 143 >> 144 } else if (name == "binary") { >> 145 >> 146 hadronPhys.push_back( new PhysListBinaryCascade(name)); >> 147 >> 148 } else if (name == "binary_ion") { >> 149 >> 150 hadronPhys.push_back( new PhysListIonBinaryCascade(name)); >> 151 >> 152 } else { 153 153 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: <" 154 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 244 << " is not defined" << G4endl; << 155 << " is not defined" >> 156 << G4endl; 245 } 157 } 246 } 158 } 247 159 248 //....oooOO0OOooo........oooOO0OOooo........oo 160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 249 161 250 void PhysicsList::AddStepMax() 162 void PhysicsList::AddStepMax() 251 { 163 { 252 // Step limitation seen as a process 164 // Step limitation seen as a process 253 165 254 auto particleIterator = GetParticleIterator( << 166 theParticleIterator->reset(); 255 particleIterator->reset(); << 167 while ((*theParticleIterator)()){ 256 while ((*particleIterator)()) { << 168 G4ParticleDefinition* particle = theParticleIterator->value(); 257 G4ParticleDefinition* particle = particleI << 169 G4ProcessManager* pmanager = particle->GetProcessManager(); 258 G4ProcessManager* pmanager = particle->Get << 170 259 << 171 if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived()) 260 if (fStepMaxProcess->IsApplicable(*particl << 172 { 261 pmanager->AddDiscreteProcess(fStepMaxPro << 173 pmanager ->AddDiscreteProcess(stepMaxProcess); 262 } << 174 } 263 } 175 } >> 176 } >> 177 >> 178 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 179 >> 180 void PhysicsList::SetCuts() >> 181 { >> 182 >> 183 SetCutValue(cutForGamma, "gamma"); >> 184 SetCutValue(cutForElectron, "e-"); >> 185 SetCutValue(cutForPositron, "e+"); >> 186 G4cout << "world cuts are set" << G4endl; >> 187 >> 188 if( !vertexDetectorCuts ) SetVertexCut(cutForElectron); >> 189 G4Region* region = (G4RegionStore::GetInstance())->GetRegion("VertexDetector"); >> 190 region->SetProductionCuts(vertexDetectorCuts); >> 191 G4cout << "Vertex cuts are set" << G4endl; >> 192 >> 193 if( !muonDetectorCuts ) SetMuonCut(cutForElectron); >> 194 region = (G4RegionStore::GetInstance())->GetRegion("MuonDetector"); >> 195 region->SetProductionCuts(muonDetectorCuts); >> 196 G4cout << "Muon cuts are set" << G4endl; >> 197 >> 198 if (verboseLevel>0) DumpCutValuesTable(); >> 199 } >> 200 >> 201 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 202 >> 203 void PhysicsList::SetCutForGamma(G4double cut) >> 204 { >> 205 cutForGamma = cut; >> 206 } >> 207 >> 208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 209 >> 210 void PhysicsList::SetCutForElectron(G4double cut) >> 211 { >> 212 cutForElectron = cut; >> 213 } >> 214 >> 215 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 216 >> 217 void PhysicsList::SetCutForPositron(G4double cut) >> 218 { >> 219 cutForPositron = cut; >> 220 } >> 221 >> 222 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 223 >> 224 void PhysicsList::SetVertexCut(G4double cut) >> 225 { >> 226 if( !vertexDetectorCuts ) vertexDetectorCuts = new G4ProductionCuts(); >> 227 >> 228 vertexDetectorCuts->SetProductionCut(cut, idxG4GammaCut); >> 229 vertexDetectorCuts->SetProductionCut(cut, idxG4ElectronCut); >> 230 vertexDetectorCuts->SetProductionCut(cut, idxG4PositronCut); >> 231 >> 232 } >> 233 >> 234 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 235 >> 236 void PhysicsList::SetMuonCut(G4double cut) >> 237 { >> 238 if( !muonDetectorCuts ) muonDetectorCuts = new G4ProductionCuts(); >> 239 >> 240 muonDetectorCuts->SetProductionCut(cut, idxG4GammaCut); >> 241 muonDetectorCuts->SetProductionCut(cut, idxG4ElectronCut); >> 242 muonDetectorCuts->SetProductionCut(cut, idxG4PositronCut); 264 } 243 } 265 244 266 //....oooOO0OOooo........oooOO0OOooo........oo 245 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 267 246