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/TestEm6/src/PhysicsL 26 /// \file electromagnetic/TestEm6/src/PhysicsList.cc 27 /// \brief Implementation of the PhysicsList c 27 /// \brief Implementation of the PhysicsList class 28 // 28 // >> 29 // $Id: PhysicsList.cc 100285 2016-10-17 08:42:54Z 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 "PhysicsListMessenger.hh" 35 #include "PhysicsListMessenger.hh" 36 #include "StepMax.hh" << 37 36 38 #include "G4AnnihiToMuPair.hh" << 39 #include "G4DecayPhysics.hh" << 40 #include "G4Electron.hh" << 41 #include "G4EmLivermorePhysics.hh" << 42 #include "G4EmLowEPPhysics.hh" << 43 #include "G4EmPenelopePhysics.hh" << 44 #include "G4EmStandardPhysics.hh" 37 #include "G4EmStandardPhysics.hh" 45 #include "G4EmStandardPhysicsGS.hh" << 46 #include "G4EmStandardPhysicsSS.hh" << 47 #include "G4EmStandardPhysicsWVI.hh" << 48 #include "G4EmStandardPhysics_option1.hh" 38 #include "G4EmStandardPhysics_option1.hh" 49 #include "G4EmStandardPhysics_option2.hh" 39 #include "G4EmStandardPhysics_option2.hh" 50 #include "G4EmStandardPhysics_option3.hh" 40 #include "G4EmStandardPhysics_option3.hh" 51 #include "G4EmStandardPhysics_option4.hh" 41 #include "G4EmStandardPhysics_option4.hh" 52 #include "G4Gamma.hh" << 42 #include "G4EmStandardPhysicsGS.hh" 53 #include "G4GammaConversionToMuons.hh" << 43 #include "G4EmStandardPhysicsWVI.hh" 54 #include "G4LossTableManager.hh" << 44 #include "G4EmStandardPhysicsSS.hh" >> 45 #include "G4EmLivermorePhysics.hh" >> 46 #include "G4EmPenelopePhysics.hh" >> 47 #include "G4EmLowEPPhysics.hh" >> 48 >> 49 #include "G4DecayPhysics.hh" >> 50 55 #include "G4ParticleDefinition.hh" 51 #include "G4ParticleDefinition.hh" 56 #include "G4ParticleTable.hh" << 57 #include "G4Positron.hh" << 58 #include "G4ProcessManager.hh" 52 #include "G4ProcessManager.hh" >> 53 #include "G4ParticleTable.hh" 59 #include "G4ProcessTable.hh" 54 #include "G4ProcessTable.hh" >> 55 >> 56 #include "G4Gamma.hh" >> 57 #include "G4Electron.hh" >> 58 #include "G4Positron.hh" >> 59 >> 60 #include "G4GammaConversionToMuons.hh" >> 61 >> 62 #include "G4AnnihiToMuPair.hh" >> 63 #include "G4eeToHadrons.hh" >> 64 60 #include "G4SystemOfUnits.hh" 65 #include "G4SystemOfUnits.hh" 61 #include "G4UnitsTable.hh" 66 #include "G4UnitsTable.hh" 62 #include "G4eeToHadrons.hh" << 67 #include "G4LossTableManager.hh" >> 68 >> 69 #include "StepMax.hh" >> 70 63 71 64 //....oooOO0OOooo........oooOO0OOooo........oo 72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 73 66 PhysicsList::PhysicsList() << 74 PhysicsList::PhysicsList() : G4VModularPhysicsList(), 67 : G4VModularPhysicsList(), fEmPhysicsList(0) << 75 fEmPhysicsList(0), >> 76 fDecayPhysicsList(0), >> 77 fStepMaxProcess(0), >> 78 fMes(0) 68 { 79 { 69 G4LossTableManager::Instance()->SetVerbose(1 80 G4LossTableManager::Instance()->SetVerbose(1); 70 81 71 defaultCutValue = 1. * km; << 82 defaultCutValue = 1.*km; 72 fMes = new PhysicsListMessenger(this); 83 fMes = new PhysicsListMessenger(this); 73 84 74 fStepMaxProcess = new StepMax(); 85 fStepMaxProcess = new StepMax(); 75 86 76 fDecayPhysicsList = new G4DecayPhysics(); 87 fDecayPhysicsList = new G4DecayPhysics(); 77 88 78 SetVerboseLevel(2); 89 SetVerboseLevel(2); 79 } 90 } 80 91 81 //....oooOO0OOooo........oooOO0OOooo........oo 92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 82 93 83 PhysicsList::~PhysicsList() 94 PhysicsList::~PhysicsList() 84 { 95 { 85 delete fMes; 96 delete fMes; 86 delete fDecayPhysicsList; 97 delete fDecayPhysicsList; 87 delete fEmPhysicsList; 98 delete fEmPhysicsList; 88 delete fStepMaxProcess; 99 delete fStepMaxProcess; 89 } 100 } 90 101 91 //....oooOO0OOooo........oooOO0OOooo........oo 102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 92 103 93 void PhysicsList::ConstructParticle() 104 void PhysicsList::ConstructParticle() 94 { 105 { 95 fDecayPhysicsList->ConstructParticle(); 106 fDecayPhysicsList->ConstructParticle(); 96 } 107 } 97 108 98 //....oooOO0OOooo........oooOO0OOooo........oo 109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 99 110 100 void PhysicsList::ConstructProcess() 111 void PhysicsList::ConstructProcess() 101 { 112 { 102 AddTransportation(); 113 AddTransportation(); 103 114 104 if (fEmPhysicsList) fEmPhysicsList->Construc << 115 if(fEmPhysicsList) fEmPhysicsList->ConstructProcess(); 105 fDecayPhysicsList->ConstructProcess(); 116 fDecayPhysicsList->ConstructProcess(); 106 117 107 AddStepMax(); 118 AddStepMax(); 108 119 109 ConstructHighEnergy(); 120 ConstructHighEnergy(); 110 } 121 } 111 122 112 //....oooOO0OOooo........oooOO0OOooo........oo 123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 113 124 114 void PhysicsList::ConstructHighEnergy() 125 void PhysicsList::ConstructHighEnergy() 115 { 126 { 116 const G4ParticleDefinition* particle = G4Gam 127 const G4ParticleDefinition* particle = G4Gamma::Gamma(); 117 G4ProcessManager* pmanager = particle->GetPr 128 G4ProcessManager* pmanager = particle->GetProcessManager(); 118 129 119 pmanager->AddDiscreteProcess(new G4GammaConv 130 pmanager->AddDiscreteProcess(new G4GammaConversionToMuons); 120 131 121 particle = G4Positron::Positron(); 132 particle = G4Positron::Positron(); 122 pmanager = particle->GetProcessManager(); 133 pmanager = particle->GetProcessManager(); 123 134 124 pmanager->AddDiscreteProcess(new G4AnnihiToM 135 pmanager->AddDiscreteProcess(new G4AnnihiToMuPair); 125 pmanager->AddDiscreteProcess(new G4eeToHadro 136 pmanager->AddDiscreteProcess(new G4eeToHadrons); 126 } 137 } 127 138 128 //....oooOO0OOooo........oooOO0OOooo........oo 139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 129 140 130 void PhysicsList::SetGammaToMuPairFac(G4double 141 void PhysicsList::SetGammaToMuPairFac(G4double fac) 131 { 142 { 132 G4ProcessTable* theProcessTable = G4ProcessT 143 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 133 G4GammaConversionToMuons* gammaToMuPairProce << 144 G4GammaConversionToMuons* gammaToMuPairProcess = (G4GammaConversionToMuons*) 134 (G4GammaConversionToMuons*)theProcessTable << 145 theProcessTable->FindProcess("GammaToMuPair","gamma"); 135 if (gammaToMuPairProcess) << 146 if(gammaToMuPairProcess) gammaToMuPairProcess->SetCrossSecFactor(fac); 136 gammaToMuPairProcess->SetCrossSecFactor(fa << 147 else G4cout 137 else << 148 << "Warning. No process GammaToMuPair found, SetGammaToMuPairFac was ignored" 138 G4cout << "Warning. No process GammaToMuPa << 149 << G4endl; 139 } 150 } 140 151 141 //....oooOO0OOooo........oooOO0OOooo........oo 152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 142 153 143 void PhysicsList::SetAnnihiToMuPairFac(G4doubl 154 void PhysicsList::SetAnnihiToMuPairFac(G4double fac) 144 { 155 { 145 G4ProcessTable* theProcessTable = G4ProcessT 156 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 146 G4AnnihiToMuPair* annihiToMuPairProcess = << 157 G4AnnihiToMuPair* annihiToMuPairProcess = (G4AnnihiToMuPair*) 147 (G4AnnihiToMuPair*)theProcessTable->FindPr << 158 theProcessTable->FindProcess("AnnihiToMuPair","e+"); 148 if (annihiToMuPairProcess) << 159 if(annihiToMuPairProcess) annihiToMuPairProcess->SetCrossSecFactor(fac); 149 annihiToMuPairProcess->SetCrossSecFactor(f << 160 else G4cout 150 else << 161 << "Warning. No process AnnihiToMuPair found, SetAnnihiToMuPairFac ignored" 151 G4cout << "Warning. No process AnnihiToMuP << 162 << G4endl; 152 } 163 } 153 164 154 //....oooOO0OOooo........oooOO0OOooo........oo 165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 155 166 156 void PhysicsList::SetAnnihiToHadronFac(G4doubl 167 void PhysicsList::SetAnnihiToHadronFac(G4double fac) 157 { 168 { 158 G4ProcessTable* theProcessTable = G4ProcessT 169 G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable(); 159 G4eeToHadrons* eehadProcess = (G4eeToHadrons << 170 G4eeToHadrons* eehadProcess = (G4eeToHadrons*) 160 if (eehadProcess) << 171 theProcessTable->FindProcess("ee2hadr","e+"); 161 eehadProcess->SetCrossSecFactor(fac); << 172 if(eehadProcess) eehadProcess->SetCrossSecFactor(fac); 162 else << 173 else G4cout 163 G4cout << "Warning. No process ee2hadr fou << 174 << "Warning. No process ee2hadr found, SetAnnihiToHadronFac was ignored" >> 175 << G4endl; 164 } 176 } 165 177 166 //....oooOO0OOooo........oooOO0OOooo........oo 178 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 167 179 168 void PhysicsList::AddPhysicsList(const G4Strin 180 void PhysicsList::AddPhysicsList(const G4String& name) 169 { 181 { 170 if (verboseLevel > 1) { << 182 if (verboseLevel>1) { 171 G4cout << "PhysicsList::AddPhysicsList: <" 183 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 172 } 184 } 173 185 174 if (name == fEmName) { 186 if (name == fEmName) { 175 return; 187 return; 176 } << 188 177 else if (name == "emstandard_opt0") { << 189 } else if (name == "emstandard_opt0") { >> 190 178 fEmName = name; 191 fEmName = name; 179 delete fEmPhysicsList; 192 delete fEmPhysicsList; 180 fEmPhysicsList = new G4EmStandardPhysics() 193 fEmPhysicsList = new G4EmStandardPhysics(); 181 } << 194 182 else if (name == "emstandard_opt1") { << 195 } else if (name == "emstandard_opt1") { >> 196 183 fEmName = name; 197 fEmName = name; 184 delete fEmPhysicsList; 198 delete fEmPhysicsList; 185 fEmPhysicsList = new G4EmStandardPhysics_o 199 fEmPhysicsList = new G4EmStandardPhysics_option1(); 186 } << 200 187 else if (name == "emstandard_opt2") { << 201 } else if (name == "emstandard_opt2") { >> 202 188 fEmName = name; 203 fEmName = name; 189 delete fEmPhysicsList; 204 delete fEmPhysicsList; 190 fEmPhysicsList = new G4EmStandardPhysics_o 205 fEmPhysicsList = new G4EmStandardPhysics_option2(); 191 } << 206 192 else if (name == "emstandard_opt3") { << 207 } else if (name == "emstandard_opt3") { >> 208 193 fEmName = name; 209 fEmName = name; 194 delete fEmPhysicsList; 210 delete fEmPhysicsList; 195 fEmPhysicsList = new G4EmStandardPhysics_o 211 fEmPhysicsList = new G4EmStandardPhysics_option3(); 196 } << 212 197 else if (name == "emstandard_opt4") { << 213 } else if (name == "emstandard_opt4") { >> 214 198 fEmName = name; 215 fEmName = name; 199 delete fEmPhysicsList; 216 delete fEmPhysicsList; 200 fEmPhysicsList = new G4EmStandardPhysics_o 217 fEmPhysicsList = new G4EmStandardPhysics_option4(); 201 } << 218 202 else if (name == "emlivermore") { << 219 } else if (name == "emlivermore") { >> 220 203 fEmName = name; 221 fEmName = name; 204 delete fEmPhysicsList; 222 delete fEmPhysicsList; 205 fEmPhysicsList = new G4EmLivermorePhysics( 223 fEmPhysicsList = new G4EmLivermorePhysics(); 206 } << 224 207 else if (name == "empenelope") { << 225 } else if (name == "empenelope") { >> 226 208 fEmName = name; 227 fEmName = name; 209 delete fEmPhysicsList; 228 delete fEmPhysicsList; 210 fEmPhysicsList = new G4EmPenelopePhysics() 229 fEmPhysicsList = new G4EmPenelopePhysics(); 211 } << 230 212 else if (name == "emlowenergy") { << 231 } else if (name == "emlowenergy") { >> 232 213 fEmName = name; 233 fEmName = name; 214 delete fEmPhysicsList; 234 delete fEmPhysicsList; 215 fEmPhysicsList = new G4EmLowEPPhysics(); 235 fEmPhysicsList = new G4EmLowEPPhysics(); 216 } << 236 217 else if (name == "emstandardGS") { << 237 } else if (name == "emstandardGS") { >> 238 218 fEmName = name; 239 fEmName = name; 219 delete fEmPhysicsList; 240 delete fEmPhysicsList; 220 fEmPhysicsList = new G4EmStandardPhysicsGS 241 fEmPhysicsList = new G4EmStandardPhysicsGS(); 221 } << 242 222 else if (name == "emstandardSS") { << 243 } else if (name == "emstandardSS") { >> 244 223 fEmName = name; 245 fEmName = name; 224 delete fEmPhysicsList; 246 delete fEmPhysicsList; 225 fEmPhysicsList = new G4EmStandardPhysicsSS 247 fEmPhysicsList = new G4EmStandardPhysicsSS(); 226 } << 248 227 else if (name == "emstandardWVI") { << 249 } else if (name == "emstandardWVI") { >> 250 228 fEmName = name; 251 fEmName = name; 229 delete fEmPhysicsList; 252 delete fEmPhysicsList; 230 fEmPhysicsList = new G4EmStandardPhysicsWV 253 fEmPhysicsList = new G4EmStandardPhysicsWVI(); 231 } << 254 232 else { << 255 } else { >> 256 233 G4cout << "PhysicsList::AddPhysicsList: <" 257 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 234 << " is not defined" << G4endl; << 258 << " is not defined" >> 259 << G4endl; 235 } 260 } 236 } 261 } 237 262 238 //....oooOO0OOooo........oooOO0OOooo........oo 263 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 239 264 240 void PhysicsList::AddStepMax() 265 void PhysicsList::AddStepMax() 241 { 266 { 242 // Step limitation seen as a process << 267 //Step limitation seen as a process 243 268 244 auto particleIterator = GetParticleIterator( << 269 auto particleIterator=GetParticleIterator(); 245 particleIterator->reset(); 270 particleIterator->reset(); 246 while ((*particleIterator)()) { << 271 while ((*particleIterator)()) >> 272 { 247 G4ParticleDefinition* particle = particleI 273 G4ParticleDefinition* particle = particleIterator->value(); 248 G4ProcessManager* pmanager = particle->Get 274 G4ProcessManager* pmanager = particle->GetProcessManager(); 249 275 250 if (fStepMaxProcess->IsApplicable(*particl << 276 if (fStepMaxProcess->IsApplicable(*particle)) 251 pmanager->AddDiscreteProcess(fStepMaxPro << 277 { >> 278 pmanager ->AddDiscreteProcess(fStepMaxProcess); 252 } 279 } 253 } 280 } 254 } 281 } 255 282 256 //....oooOO0OOooo........oooOO0OOooo........oo 283 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 284 257 285