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/TestEm1/src/PhysicsL 26 /// \file electromagnetic/TestEm1/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // << 28 // 29 // 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 32 33 #include "PhysicsList.hh" 33 #include "PhysicsList.hh" 34 << 35 #include "DetectorConstruction.hh" << 36 #include "PhysListEmStandard.hh" << 37 #include "PhysicsListMessenger.hh" 34 #include "PhysicsListMessenger.hh" >> 35 >> 36 #include "PhysListEmStandard.hh" 38 37 39 #include "G4EmLivermorePhysics.hh" << 40 #include "G4EmLowEPPhysics.hh" << 41 #include "G4EmParameters.hh" << 42 #include "G4EmPenelopePhysics.hh" << 43 #include "G4EmStandardPhysics.hh" 38 #include "G4EmStandardPhysics.hh" 44 #include "G4EmStandardPhysicsGS.hh" << 45 #include "G4EmStandardPhysicsSS.hh" << 46 #include "G4EmStandardPhysicsWVI.hh" << 47 #include "G4EmStandardPhysics_option1.hh" 39 #include "G4EmStandardPhysics_option1.hh" 48 #include "G4EmStandardPhysics_option2.hh" 40 #include "G4EmStandardPhysics_option2.hh" 49 #include "G4EmStandardPhysics_option3.hh" 41 #include "G4EmStandardPhysics_option3.hh" 50 #include "G4EmStandardPhysics_option4.hh" 42 #include "G4EmStandardPhysics_option4.hh" >> 43 #include "G4EmStandardPhysicsSS.hh" >> 44 #include "G4EmStandardPhysicsGS.hh" >> 45 #include "G4EmStandardPhysicsWVI.hh" >> 46 #include "G4EmLivermorePhysics.hh" >> 47 #include "G4EmPenelopePhysics.hh" >> 48 #include "G4EmLowEPPhysics.hh" >> 49 >> 50 #include "DetectorConstruction.hh" >> 51 51 #include "G4LossTableManager.hh" 52 #include "G4LossTableManager.hh" 52 #include "G4SystemOfUnits.hh" << 53 #include "G4UnitsTable.hh" 53 #include "G4UnitsTable.hh" >> 54 #include "G4SystemOfUnits.hh" >> 55 #include "G4EmParameters.hh" 54 56 55 // particles 57 // particles 56 58 57 #include "StepMax.hh" << 58 << 59 #include "G4BaryonConstructor.hh" << 60 #include "G4BosonConstructor.hh" 59 #include "G4BosonConstructor.hh" 61 #include "G4Decay.hh" << 62 #include "G4Electron.hh" << 63 #include "G4Gamma.hh" << 64 #include "G4GenericIon.hh" << 65 #include "G4IonConstructor.hh" << 66 #include "G4LeptonConstructor.hh" 60 #include "G4LeptonConstructor.hh" 67 #include "G4Material.hh" << 68 #include "G4MesonConstructor.hh" 61 #include "G4MesonConstructor.hh" 69 #include "G4NuclideTable.hh" << 62 #include "G4BosonConstructor.hh" >> 63 #include "G4BaryonConstructor.hh" >> 64 #include "G4IonConstructor.hh" >> 65 #include "G4ShortLivedConstructor.hh" >> 66 70 #include "G4PhysicsListHelper.hh" 67 #include "G4PhysicsListHelper.hh" >> 68 #include "G4Decay.hh" >> 69 #include "G4RadioactiveDecay.hh" >> 70 #include "G4GenericIon.hh" >> 71 #include "G4NuclideTable.hh" >> 72 71 #include "G4ProcessManager.hh" 73 #include "G4ProcessManager.hh" >> 74 #include "StepMax.hh" >> 75 #include "G4Material.hh" >> 76 >> 77 #include "G4Gamma.hh" >> 78 #include "G4Electron.hh" 72 #include "G4Proton.hh" 79 #include "G4Proton.hh" 73 #include "G4RadioactiveDecay.hh" << 80 #include "G4GenericIon.hh" 74 #include "G4ShortLivedConstructor.hh" << 75 81 76 //....oooOO0OOooo........oooOO0OOooo........oo 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 77 83 78 PhysicsList::PhysicsList(DetectorConstruction* << 84 PhysicsList::PhysicsList(DetectorConstruction* det) >> 85 : fDet(det) 79 { 86 { 80 fMessenger = new PhysicsListMessenger(this); 87 fMessenger = new PhysicsListMessenger(this); 81 SetVerboseLevel(1); 88 SetVerboseLevel(1); 82 89 83 // EM physics 90 // EM physics 84 AddPhysicsList("emstandard_opt3"); << 91 AddPhysicsList("emstandard_opt3"); 85 << 92 86 // fix lower limit for cut 93 // fix lower limit for cut 87 G4ProductionCutsTable::GetProductionCutsTabl << 94 G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(10*eV, 1*GeV); 88 SetDefaultCutValue(1 * mm); << 95 SetDefaultCutValue(1*mm); 89 } 96 } 90 97 91 //....oooOO0OOooo........oooOO0OOooo........oo 98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 92 99 93 PhysicsList::~PhysicsList() 100 PhysicsList::~PhysicsList() 94 { 101 { 95 delete fMessenger; 102 delete fMessenger; 96 } 103 } 97 104 98 //....oooOO0OOooo........oooOO0OOooo........oo 105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 99 106 100 void PhysicsList::ConstructParticle() 107 void PhysicsList::ConstructParticle() 101 { 108 { 102 G4BosonConstructor pBosonConstructor; << 109 G4BosonConstructor pBosonConstructor; 103 pBosonConstructor.ConstructParticle(); << 110 pBosonConstructor.ConstructParticle(); 104 111 105 G4LeptonConstructor pLeptonConstructor; << 112 G4LeptonConstructor pLeptonConstructor; 106 pLeptonConstructor.ConstructParticle(); << 113 pLeptonConstructor.ConstructParticle(); 107 114 108 G4MesonConstructor pMesonConstructor; << 115 G4MesonConstructor pMesonConstructor; 109 pMesonConstructor.ConstructParticle(); << 116 pMesonConstructor.ConstructParticle(); 110 117 111 G4BaryonConstructor pBaryonConstructor; << 118 G4BaryonConstructor pBaryonConstructor; 112 pBaryonConstructor.ConstructParticle(); << 119 pBaryonConstructor.ConstructParticle(); 113 120 114 G4IonConstructor pIonConstructor; << 121 G4IonConstructor pIonConstructor; 115 pIonConstructor.ConstructParticle(); << 122 pIonConstructor.ConstructParticle(); 116 123 117 G4ShortLivedConstructor pShortLivedConstruct << 124 G4ShortLivedConstructor pShortLivedConstructor; 118 pShortLivedConstructor.ConstructParticle(); << 125 pShortLivedConstructor.ConstructParticle(); 119 } 126 } 120 127 121 //....oooOO0OOooo........oooOO0OOooo........oo 128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 122 129 123 void PhysicsList::ConstructProcess() 130 void PhysicsList::ConstructProcess() 124 { 131 { 125 // Transportation 132 // Transportation 126 // 133 // 127 AddTransportation(); 134 AddTransportation(); 128 135 129 // Electromagnetic physics list 136 // Electromagnetic physics list 130 // 137 // 131 fEmPhysicsList->ConstructProcess(); 138 fEmPhysicsList->ConstructProcess(); 132 << 139 133 // Decay Process 140 // Decay Process 134 // 141 // 135 AddDecay(); 142 AddDecay(); 136 << 143 137 // Decay Process 144 // Decay Process 138 // 145 // 139 AddRadioactiveDecay(); << 146 AddRadioactiveDecay(); 140 147 141 // step limitation (as a full process) 148 // step limitation (as a full process) 142 // << 149 // 143 AddStepMax(); 150 AddStepMax(); 144 << 151 145 // example of Get process 152 // example of Get process 146 auto process = GetProcess("RadioactiveDecay" 153 auto process = GetProcess("RadioactiveDecay"); 147 if (process != nullptr) { 154 if (process != nullptr) { 148 G4cout << "\n GetProcess : " << process-> 155 G4cout << "\n GetProcess : " << process->GetProcessName() << G4endl; 149 } 156 } 150 } 157 } 151 158 152 //....oooOO0OOooo........oooOO0OOooo........oo 159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 153 160 154 void PhysicsList::AddPhysicsList(const G4Strin 161 void PhysicsList::AddPhysicsList(const G4String& name) 155 { 162 { 156 if (verboseLevel > 0) { << 163 if (verboseLevel>0) { 157 G4cout << "PhysicsList::AddPhysicsList: <" 164 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 158 } 165 } 159 << 166 160 if (name == fEmName) return; 167 if (name == fEmName) return; 161 168 162 if (name == "local") { 169 if (name == "local") { 163 fEmName = name; 170 fEmName = name; 164 delete fEmPhysicsList; 171 delete fEmPhysicsList; 165 fEmPhysicsList = new PhysListEmStandard(na 172 fEmPhysicsList = new PhysListEmStandard(name); 166 } << 173 167 else if (name == "emstandard_opt0") { << 174 } else if (name == "emstandard_opt0") { 168 fEmName = name; 175 fEmName = name; 169 delete fEmPhysicsList; 176 delete fEmPhysicsList; 170 fEmPhysicsList = new G4EmStandardPhysics() 177 fEmPhysicsList = new G4EmStandardPhysics(); 171 } << 178 172 else if (name == "emstandard_opt1") { << 179 } else if (name == "emstandard_opt1") { 173 fEmName = name; 180 fEmName = name; 174 delete fEmPhysicsList; 181 delete fEmPhysicsList; 175 fEmPhysicsList = new G4EmStandardPhysics_o 182 fEmPhysicsList = new G4EmStandardPhysics_option1(); 176 } << 183 177 else if (name == "emstandard_opt2") { << 184 } else if (name == "emstandard_opt2") { 178 fEmName = name; 185 fEmName = name; 179 delete fEmPhysicsList; 186 delete fEmPhysicsList; 180 fEmPhysicsList = new G4EmStandardPhysics_o 187 fEmPhysicsList = new G4EmStandardPhysics_option2(); 181 } << 188 182 else if (name == "emstandard_opt3") { << 189 } else if (name == "emstandard_opt3") { 183 fEmName = name; 190 fEmName = name; 184 delete fEmPhysicsList; 191 delete fEmPhysicsList; 185 fEmPhysicsList = new G4EmStandardPhysics_o 192 fEmPhysicsList = new G4EmStandardPhysics_option3(); 186 } << 193 187 else if (name == "emstandard_opt4") { << 194 } else if (name == "emstandard_opt4") { 188 fEmName = name; 195 fEmName = name; 189 delete fEmPhysicsList; 196 delete fEmPhysicsList; 190 fEmPhysicsList = new G4EmStandardPhysics_o 197 fEmPhysicsList = new G4EmStandardPhysics_option4(); 191 } << 198 192 else if (name == "emstandardSS") { << 199 } else if (name == "emstandardSS") { 193 fEmName = name; 200 fEmName = name; 194 delete fEmPhysicsList; 201 delete fEmPhysicsList; 195 fEmPhysicsList = new G4EmStandardPhysicsSS 202 fEmPhysicsList = new G4EmStandardPhysicsSS(); 196 } << 203 197 else if (name == "emstandardGS") { << 204 } else if (name == "emstandardGS") { 198 fEmName = name; 205 fEmName = name; 199 delete fEmPhysicsList; 206 delete fEmPhysicsList; 200 fEmPhysicsList = new G4EmStandardPhysicsGS 207 fEmPhysicsList = new G4EmStandardPhysicsGS(); 201 } << 208 202 else if (name == "emstandardWVI") { << 209 } else if (name == "emstandardWVI") { 203 fEmName = name; 210 fEmName = name; 204 delete fEmPhysicsList; 211 delete fEmPhysicsList; 205 fEmPhysicsList = new G4EmStandardPhysicsWV 212 fEmPhysicsList = new G4EmStandardPhysicsWVI(); 206 } << 213 207 else if (name == "emlivermore") { << 214 } else if (name == "emlivermore") { 208 fEmName = name; 215 fEmName = name; 209 delete fEmPhysicsList; 216 delete fEmPhysicsList; 210 fEmPhysicsList = new G4EmLivermorePhysics( 217 fEmPhysicsList = new G4EmLivermorePhysics(); 211 } << 218 212 else if (name == "empenelope") { << 219 } else if (name == "empenelope") { 213 fEmName = name; 220 fEmName = name; 214 delete fEmPhysicsList; 221 delete fEmPhysicsList; 215 fEmPhysicsList = new G4EmPenelopePhysics() 222 fEmPhysicsList = new G4EmPenelopePhysics(); 216 } << 223 217 else if (name == "emlowenergy") { << 224 } else if (name == "emlowenergy") { 218 fEmName = name; 225 fEmName = name; 219 delete fEmPhysicsList; 226 delete fEmPhysicsList; 220 fEmPhysicsList = new G4EmLowEPPhysics(); 227 fEmPhysicsList = new G4EmLowEPPhysics(); 221 } << 228 222 else { << 229 } else { >> 230 223 G4cout << "PhysicsList::AddPhysicsList: <" 231 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 224 << " is not defined" << G4endl; << 232 << " is not defined" >> 233 << G4endl; 225 } 234 } 226 << 235 227 // Em options 236 // Em options 228 // 237 // 229 G4EmParameters::Instance()->SetBuildCSDARang << 238 G4EmParameters::Instance()->SetBuildCSDARange(true); 230 G4EmParameters::Instance()->SetGeneralProces 239 G4EmParameters::Instance()->SetGeneralProcessActive(false); 231 } 240 } 232 241 233 //....oooOO0OOooo........oooOO0OOooo........oo 242 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 234 243 235 void PhysicsList::AddDecay() 244 void PhysicsList::AddDecay() 236 { 245 { 237 G4PhysicsListHelper* ph = G4PhysicsListHelpe 246 G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); 238 << 247 239 // Decay Process 248 // Decay Process 240 // 249 // 241 G4Decay* fDecayProcess = new G4Decay(); 250 G4Decay* fDecayProcess = new G4Decay(); 242 251 243 auto particleIterator = GetParticleIterator( << 252 auto particleIterator=GetParticleIterator(); 244 particleIterator->reset(); 253 particleIterator->reset(); 245 while ((*particleIterator)()) { << 254 while( (*particleIterator)() ){ 246 G4ParticleDefinition* particle = particleI 255 G4ParticleDefinition* particle = particleIterator->value(); 247 if (fDecayProcess->IsApplicable(*particle) << 256 if (fDecayProcess->IsApplicable(*particle) && !particle->IsShortLived()) 248 ph->RegisterProcess(fDecayProcess, parti << 257 ph->RegisterProcess(fDecayProcess, particle); 249 } 258 } 250 } 259 } 251 260 252 //....oooOO0OOooo........oooOO0OOooo........oo 261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 253 262 254 void PhysicsList::AddRadioactiveDecay() 263 void PhysicsList::AddRadioactiveDecay() 255 { << 264 { 256 G4RadioactiveDecay* radioactiveDecay = new G 265 G4RadioactiveDecay* radioactiveDecay = new G4RadioactiveDecay(); 257 << 266 258 G4bool armFlag = false; 267 G4bool armFlag = false; 259 radioactiveDecay->SetARM(armFlag); // Atomi << 268 radioactiveDecay->SetARM(armFlag); //Atomic Rearangement 260 269 261 // atomic de-excitation module 270 // atomic de-excitation module 262 if (armFlag) { 271 if (armFlag) { 263 G4EmParameters::Instance()->SetAuger(true) 272 G4EmParameters::Instance()->SetAuger(true); 264 G4EmParameters::Instance()->SetDeexcitatio 273 G4EmParameters::Instance()->SetDeexcitationIgnoreCut(true); 265 } 274 } 266 << 275 267 G4PhysicsListHelper* ph = G4PhysicsListHelpe << 276 G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); 268 ph->RegisterProcess(radioactiveDecay, G4Gene 277 ph->RegisterProcess(radioactiveDecay, G4GenericIon::GenericIon()); 269 << 278 270 // mandatory for G4NuclideTable 279 // mandatory for G4NuclideTable 271 // 280 // 272 const G4double meanLife = 1 * picosecond, ha << 281 const G4double meanLife = 1*picosecond, halfLife = meanLife*std::log(2); 273 G4NuclideTable::GetInstance()->SetThresholdO 282 G4NuclideTable::GetInstance()->SetThresholdOfHalfLife(halfLife); 274 } 283 } 275 284 276 //....oooOO0OOooo........oooOO0OOooo........oo 285 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 277 286 278 void PhysicsList::AddStepMax() 287 void PhysicsList::AddStepMax() 279 { 288 { 280 // Step limitation seen as a process 289 // Step limitation seen as a process 281 StepMax* stepMaxProcess = new StepMax(); 290 StepMax* stepMaxProcess = new StepMax(); 282 291 283 auto particleIterator = GetParticleIterator( << 292 auto particleIterator=GetParticleIterator(); 284 particleIterator->reset(); 293 particleIterator->reset(); 285 while ((*particleIterator)()) { << 294 while ((*particleIterator)()){ 286 G4ParticleDefinition* particle = particleI 295 G4ParticleDefinition* particle = particleIterator->value(); 287 G4ProcessManager* pmanager = particle->Get 296 G4ProcessManager* pmanager = particle->GetProcessManager(); 288 297 289 if (stepMaxProcess->IsApplicable(*particle 298 if (stepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived()) 290 pmanager->AddDiscreteProcess(stepMaxProc 299 pmanager->AddDiscreteProcess(stepMaxProcess); 291 } 300 } 292 } 301 } 293 302 294 //....oooOO0OOooo........oooOO0OOooo........oo 303 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 295 304 296 void PhysicsList::GetRange(G4double val) 305 void PhysicsList::GetRange(G4double val) 297 { 306 { 298 G4LogicalVolume* lBox = fDet->GetWorld()->Ge 307 G4LogicalVolume* lBox = fDet->GetWorld()->GetLogicalVolume(); 299 const G4MaterialCutsCouple* couple = lBox->G 308 const G4MaterialCutsCouple* couple = lBox->GetMaterialCutsCouple(); 300 const G4Material* currMat = lBox->GetMateria 309 const G4Material* currMat = lBox->GetMaterial(); 301 310 302 G4ParticleDefinition* part; 311 G4ParticleDefinition* part; 303 G4double cut; 312 G4double cut; 304 part = G4Electron::Electron(); 313 part = G4Electron::Electron(); 305 cut = G4LossTableManager::Instance()->GetRan << 314 cut = G4LossTableManager::Instance()->GetRange(part,val,couple); 306 G4cout << "material : " << currMat->GetName( << 315 G4cout << "material : " << currMat->GetName() << G4endl; 307 G4cout << "particle : " << part->GetParticle << 316 G4cout << "particle : " << part->GetParticleName() << G4endl; 308 G4cout << "energy : " << G4BestUnit(val, " << 317 G4cout << "energy : " << G4BestUnit(val,"Energy") << G4endl; 309 G4cout << "range : " << G4BestUnit(cut, " << 318 G4cout << "range : " << G4BestUnit(cut,"Length") << G4endl; 310 } 319 } 311 320 312 //....oooOO0OOooo........oooOO0OOooo........oo 321 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 313 322 314 G4VProcess* PhysicsList::GetProcess(const G4St 323 G4VProcess* PhysicsList::GetProcess(const G4String& processName) const 315 { 324 { 316 G4ParticleDefinition* particle = G4GenericIo 325 G4ParticleDefinition* particle = G4GenericIon::GenericIon(); 317 G4ProcessVector* procList = particle->GetPro 326 G4ProcessVector* procList = particle->GetProcessManager()->GetProcessList(); 318 G4int nbProc = particle->GetProcessManager() 327 G4int nbProc = particle->GetProcessManager()->GetProcessListLength(); 319 for (G4int k = 0; k < nbProc; k++) { << 328 for (G4int k=0; k<nbProc; k++) { 320 G4VProcess* process = (*procList)[k]; 329 G4VProcess* process = (*procList)[k]; 321 if (process->GetProcessName() == processNa 330 if (process->GetProcessName() == processName) return process; 322 } 331 } 323 return nullptr; 332 return nullptr; 324 } 333 } 325 334 326 //....oooOO0OOooo........oooOO0OOooo........oo 335 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 327 336