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