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 // Code developed by: 26 // Code developed by: 27 // S.Larsson 27 // S.Larsson 28 // 28 // 29 // ******************************** 29 // ******************************** 30 // * * 30 // * * 31 // * PurgMagPhysicsList.cc * 31 // * PurgMagPhysicsList.cc * 32 // * * 32 // * * 33 // ******************************** 33 // ******************************** 34 // 34 // >> 35 // >> 36 // $Id: PurgMagPhysicsList.cc,v 1.6 2010/11/18 13:10:08 allison Exp $ >> 37 // GEANT4 tag $Name: geant4-09-04 $ >> 38 // >> 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 35 40 36 #include "PurgMagPhysicsList.hh" 41 #include "PurgMagPhysicsList.hh" 37 #include "G4SystemOfUnits.hh" << 42 38 #include "G4ParticleDefinition.hh" 43 #include "G4ParticleDefinition.hh" 39 #include "G4ParticleWithCuts.hh" 44 #include "G4ParticleWithCuts.hh" 40 #include "G4ProcessManager.hh" 45 #include "G4ProcessManager.hh" 41 #include "G4ParticleTypes.hh" 46 #include "G4ParticleTypes.hh" 42 #include "G4ParticleTable.hh" 47 #include "G4ParticleTable.hh" 43 #include "G4Material.hh" 48 #include "G4Material.hh" 44 #include "G4UnitsTable.hh" 49 #include "G4UnitsTable.hh" 45 #include "G4ios.hh" 50 #include "G4ios.hh" 46 #include "G4EmStandardPhysics_option4.hh" << 51 47 #include "G4VPhysicsConstructor.hh" << 52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 48 #include "G4DecayPhysics.hh" << 49 53 50 PurgMagPhysicsList::PurgMagPhysicsList(): G4V 54 PurgMagPhysicsList::PurgMagPhysicsList(): G4VUserPhysicsList() 51 { 55 { 52 defaultCutValue = 1*micrometer; 56 defaultCutValue = 1*micrometer; 53 cutForGamma = defaultCutValue; 57 cutForGamma = defaultCutValue; 54 cutForElectron = defaultCutValue; 58 cutForElectron = defaultCutValue; 55 cutForPositron = defaultCutValue; 59 cutForPositron = defaultCutValue; 56 cutForProton = defaultCutValue; 60 cutForProton = defaultCutValue; 57 << 61 58 fEmPhysicsList = new G4EmStandardPhysics_opt << 59 fDecPhysicsList = new G4DecayPhysics(); << 60 SetVerboseLevel(1); 62 SetVerboseLevel(1); 61 } 63 } 62 64 >> 65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 66 63 PurgMagPhysicsList::~PurgMagPhysicsList() 67 PurgMagPhysicsList::~PurgMagPhysicsList() >> 68 {} >> 69 >> 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 71 >> 72 void PurgMagPhysicsList::ConstructParticle() >> 73 { >> 74 // In this method, static member functions should be called >> 75 // for all particles which you want to use. >> 76 // This ensures that objects of these particle types will be >> 77 // created in the program. >> 78 >> 79 ConstructBosons(); >> 80 ConstructLeptons(); >> 81 ConstructBarions(); >> 82 } >> 83 >> 84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 85 >> 86 void PurgMagPhysicsList::ConstructBosons() >> 87 { >> 88 >> 89 // gamma >> 90 G4Gamma::GammaDefinition(); >> 91 >> 92 // optical photon >> 93 G4OpticalPhoton::OpticalPhotonDefinition(); >> 94 } >> 95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 96 >> 97 void PurgMagPhysicsList::ConstructLeptons() 64 { 98 { 65 delete fDecPhysicsList; << 99 // leptons 66 delete fEmPhysicsList; << 100 G4Electron::ElectronDefinition(); >> 101 G4Positron::PositronDefinition(); 67 } 102 } 68 103 69 void PurgMagPhysicsList::ConstructParticle() << 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 105 >> 106 void PurgMagPhysicsList::ConstructBarions() 70 { 107 { 71 fDecPhysicsList -> ConstructParticle(); << 108 // barions 72 } << 109 G4Proton::ProtonDefinition(); >> 110 G4AntiProton::AntiProtonDefinition(); >> 111 } >> 112 >> 113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 73 114 74 void PurgMagPhysicsList::ConstructProcess() 115 void PurgMagPhysicsList::ConstructProcess() 75 { 116 { 76 AddTransportation(); 117 AddTransportation(); 77 fEmPhysicsList -> ConstructProcess(); << 118 ConstructEM(); 78 << 119 ConstructGeneral(); 79 // Deexcitation << 80 // Both Fluorescence and Auger e- emission act << 81 //G4VAtomDeexcitation* de = new G4UAtomicDeexc << 82 //G4LossTableManager::Instance()->SetAtomDeexc << 83 //de -> SetFluo(true); << 84 //de -> SetAuger(true); << 85 } 120 } 86 121 >> 122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 123 >> 124 #include "G4eMultipleScattering.hh" >> 125 #include "G4hMultipleScattering.hh" >> 126 // Bosons >> 127 #include "G4PhotoElectricEffect.hh" >> 128 #include "G4ComptonScattering.hh" >> 129 #include "G4GammaConversion.hh" >> 130 // Leptons >> 131 #include "G4eIonisation.hh" >> 132 #include "G4eBremsstrahlung.hh" >> 133 #include "G4eplusAnnihilation.hh" >> 134 >> 135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 136 >> 137 void PurgMagPhysicsList::ConstructEM() >> 138 { >> 139 theParticleIterator->reset(); >> 140 while( (*theParticleIterator)() ) >> 141 { >> 142 G4ParticleDefinition* particle = theParticleIterator->value(); >> 143 G4ProcessManager* pmanager = particle->GetProcessManager(); >> 144 G4String particleName = particle->GetParticleName(); >> 145 >> 146 >> 147 if (particleName == "gamma") { >> 148 //gamma >> 149 pmanager->AddDiscreteProcess(new G4GammaConversion); >> 150 pmanager->AddDiscreteProcess(new G4ComptonScattering); >> 151 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect); >> 152 >> 153 } else if (particleName == "e-") { >> 154 //electron >> 155 pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3); >> 156 pmanager->AddProcess(new G4eIonisation, -1, 2,2); >> 157 pmanager->AddProcess(new G4eMultipleScattering, -1, 1,1); >> 158 >> 159 } else if (particleName == "e+") { >> 160 //positron >> 161 pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3); >> 162 pmanager->AddProcess(new G4eIonisation, -1, 2,2); >> 163 pmanager->AddProcess(new G4eMultipleScattering, -1, 1,1); >> 164 pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4); >> 165 >> 166 } else if (particleName == "proton") { >> 167 //proton >> 168 pmanager->AddProcess(new G4hMultipleScattering, -1,1,1); >> 169 >> 170 } else if (particleName == "anti_proton") { >> 171 //antiproton >> 172 pmanager->AddProcess(new G4hMultipleScattering, -1,1,1); >> 173 } >> 174 } >> 175 } >> 176 >> 177 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 178 >> 179 void PurgMagPhysicsList::ConstructGeneral() >> 180 { } >> 181 >> 182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 183 87 void PurgMagPhysicsList::SetCuts() 184 void PurgMagPhysicsList::SetCuts() 88 { 185 { 89 if (verboseLevel >0){ 186 if (verboseLevel >0){ 90 G4cout << "PurgMagPhysicsList::SetCuts:"; 187 G4cout << "PurgMagPhysicsList::SetCuts:"; 91 G4cout << "CutLength : " << G4BestUnit(def 188 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; 92 } 189 } 93 190 94 // set cut values for gamma at first and for 191 // set cut values for gamma at first and for e- second and next for e+, 95 // because some processes for e+/e- need cut 192 // because some processes for e+/e- need cut values for gamma 96 SetCutValue(cutForGamma, "gamma"); 193 SetCutValue(cutForGamma, "gamma"); 97 SetCutValue(cutForElectron, "e-"); 194 SetCutValue(cutForElectron, "e-"); 98 SetCutValue(cutForPositron, "e+"); 195 SetCutValue(cutForPositron, "e+"); 99 196 100 // set cut values for proton and anti_proton 197 // set cut values for proton and anti_proton before all other hadrons 101 // because some processes for hadrons need c 198 // because some processes for hadrons need cut values for proton/anti_proton 102 SetCutValue(cutForProton, "proton"); 199 SetCutValue(cutForProton, "proton"); 103 SetCutValue(cutForProton, "anti_proton"); 200 SetCutValue(cutForProton, "anti_proton"); 104 201 105 // SetCutValueForOthers(defaultCutValue); << 202 // SetCutValueForOthers(defaultCutValue); 106 203 107 if (verboseLevel>0) DumpCutValuesTable(); 204 if (verboseLevel>0) DumpCutValuesTable(); 108 } 205 } 109 206 >> 207 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 208 110 void PurgMagPhysicsList::SetGammaLowLimit(G4do 209 void PurgMagPhysicsList::SetGammaLowLimit(G4double lowcut) 111 { 210 { 112 if (verboseLevel >0){ 211 if (verboseLevel >0){ 113 G4cout << "PurgMagPhysicsList::SetCuts:"; 212 G4cout << "PurgMagPhysicsList::SetCuts:"; 114 G4cout << "Gamma cut in energy: " << lowcu 213 G4cout << "Gamma cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; 115 } 214 } 116 215 117 // G4Gamma::SetEnergyRange(lowcut,1e5); 216 // G4Gamma::SetEnergyRange(lowcut,1e5); 118 SetGELowLimit(lowcut); 217 SetGELowLimit(lowcut); 119 } 218 } 120 219 >> 220 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 221 121 void PurgMagPhysicsList::SetElectronLowLimit(G 222 void PurgMagPhysicsList::SetElectronLowLimit(G4double lowcut) 122 { 223 { 123 if (verboseLevel >0){ 224 if (verboseLevel >0){ 124 225 125 G4cout << "PurgMagPhysicsList::SetCuts:"; 226 G4cout << "PurgMagPhysicsList::SetCuts:"; 126 G4cout << "Electron cut in energy: " << lo 227 G4cout << "Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; 127 } 228 } 128 229 129 // G4Electron::SetEnergyRange(lowcut,1e5); 230 // G4Electron::SetEnergyRange(lowcut,1e5); 130 SetGELowLimit(lowcut); 231 SetGELowLimit(lowcut); 131 } 232 } 132 233 >> 234 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 235 133 void PurgMagPhysicsList::SetPositronLowLimit(G 236 void PurgMagPhysicsList::SetPositronLowLimit(G4double lowcut) 134 { 237 { 135 if (verboseLevel >0){ 238 if (verboseLevel >0){ 136 239 137 G4cout << "PurgMagPhysicsList::SetCuts:"; 240 G4cout << "PurgMagPhysicsList::SetCuts:"; 138 G4cout << "Positron cut in energy: " << lo 241 G4cout << "Positron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; 139 } 242 } 140 243 141 G4cerr << "PurgMagPhysicsList::SetPositronLo 244 G4cerr << "PurgMagPhysicsList::SetPositronLowLimit: Not currently able to set Positron LowLimit." << G4endl; 142 G4Exception("PurgMagPhysicsList::SetPositron << 245 G4Exception("Positron Low Limit: not implemented in PurgMagPhysicsList"); 143 FatalException,"Positron Low Limit: no << 144 // 246 // 145 // G4Positron::SetEnergyRange(lowcut,1e5); 247 // G4Positron::SetEnergyRange(lowcut,1e5); 146 } 248 } 147 249 >> 250 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 148 251 149 void PurgMagPhysicsList::SetProtonLowLimit(G4d 252 void PurgMagPhysicsList::SetProtonLowLimit(G4double lowcut) 150 { 253 { 151 if (verboseLevel >0){ 254 if (verboseLevel >0){ 152 255 153 G4cout << "PurgMagPhysicsList::SetCuts:"; 256 G4cout << "PurgMagPhysicsList::SetCuts:"; 154 G4cout << "Proton cut in energy: " << lowc 257 G4cout << "Proton cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; 155 } 258 } 156 259 157 G4cerr << "PurgMagPhysicsList::SetProtonLowL 260 G4cerr << "PurgMagPhysicsList::SetProtonLowLimit: Not currently able to set Proton LowLimit." << G4endl; 158 G4Exception("PurgMagPhysicsList::SetProtonLo << 261 G4Exception("Proton Low Limit: not implemented in PurgMagPhysicsList"); 159 FatalException,"Proton Low Limit: not << 160 // 262 // 161 // G4Proton::SetEnergyRange(lowcut,1e5); 263 // G4Proton::SetEnergyRange(lowcut,1e5); 162 // G4AntiProton::SetEnergyRange(lowcut,1e5); 264 // G4AntiProton::SetEnergyRange(lowcut,1e5); 163 } 265 } 164 266 >> 267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 268 165 void PurgMagPhysicsList::SetGEPLowLimit(G4doub 269 void PurgMagPhysicsList::SetGEPLowLimit(G4double lowcut) 166 { 270 { 167 if (verboseLevel >0){ 271 if (verboseLevel >0){ 168 G4cout << "PurgMagPhysicsList::SetGEPLowLi 272 G4cout << "PurgMagPhysicsList::SetGEPLowLimit:"; 169 G4cout << "Gamma and Electron cut in energ 273 G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; 170 } 274 } 171 275 172 // G4Gamma::SetEnergyRange(lowcut,1e5); 276 // G4Gamma::SetEnergyRange(lowcut,1e5); 173 // G4Electron::SetEnergyRange(lowcut,1e5); 277 // G4Electron::SetEnergyRange(lowcut,1e5); 174 // G4Positron::SetEnergyRange(lowcut,1e5); 278 // G4Positron::SetEnergyRange(lowcut,1e5); 175 this->SetGELowLimit(lowcut); 279 this->SetGELowLimit(lowcut); 176 280 177 G4cerr << " SetGEPLowLimit : Uncertain wheth 281 G4cerr << " SetGEPLowLimit : Uncertain whether setting Positron low limit " << G4endl; 178 } 282 } >> 283 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 179 284 >> 285 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 180 void PurgMagPhysicsList::SetGELowLimit(G4doubl 286 void PurgMagPhysicsList::SetGELowLimit(G4double lowcut) 181 { 287 { 182 if (verboseLevel >0){ 288 if (verboseLevel >0){ 183 G4cout << "PurgMagPhysicsList::SetGELowLim 289 G4cout << "PurgMagPhysicsList::SetGELowLimit:"; 184 G4cout << "Gamma and Electron cut in energ 290 G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl; 185 } 291 } 186 292 187 G4ProductionCutsTable::GetProductionCutsTabl 293 G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowcut,1e5); 188 } 294 } 189 void PurgMagPhysicsList::SetGammaCut(G4double 295 void PurgMagPhysicsList::SetGammaCut(G4double val) 190 { 296 { >> 297 ResetCuts(); 191 cutForGamma = val; 298 cutForGamma = val; 192 } 299 } 193 300 >> 301 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 302 194 void PurgMagPhysicsList::SetElectronCut(G4doub 303 void PurgMagPhysicsList::SetElectronCut(G4double val) 195 { 304 { >> 305 // ResetCuts(); 196 cutForElectron = val; 306 cutForElectron = val; 197 } 307 } 198 308 >> 309 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 310 199 void PurgMagPhysicsList::SetPositronCut(G4doub 311 void PurgMagPhysicsList::SetPositronCut(G4double val) 200 { 312 { >> 313 // ResetCuts(); 201 cutForPositron = val; 314 cutForPositron = val; 202 } 315 } 203 316 >> 317 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... >> 318 204 void PurgMagPhysicsList::SetProtonCut(G4double 319 void PurgMagPhysicsList::SetProtonCut(G4double val) 205 { 320 { >> 321 //ResetCuts(); 206 cutForProton = val; 322 cutForProton = val; 207 } 323 } >> 324 >> 325 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 208 326 209 327 210 328 211 329 212 330 213 331 214 332