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