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 // $Id: G4ErrorPhysicsList.cc,v 1.3 2009-05-14 13:54:34 arce Exp $ >> 27 // GEANT4 tag $Name: not supported by cvs2svn $ 26 // 28 // 27 // ------------------------------------------- 29 // ------------------------------------------------------------ 28 // GEANT 4 class implementation file << 30 // GEANT 4 class implementation file 29 // ------------------------------------------- 31 // ------------------------------------------------------------ 30 32 31 #include "globals.hh" 33 #include "globals.hh" 32 34 33 #include "G4PhysicalConstants.hh" << 34 #include "G4SystemOfUnits.hh" << 35 << 36 #include "G4ErrorPhysicsList.hh" 35 #include "G4ErrorPhysicsList.hh" 37 #include "G4ComptonScattering.hh" 36 #include "G4ComptonScattering.hh" 38 #include "G4GammaConversion.hh" 37 #include "G4GammaConversion.hh" 39 #include "G4PhotoElectricEffect.hh" 38 #include "G4PhotoElectricEffect.hh" 40 << 39 41 #include "G4eIonisation.hh" 40 #include "G4eIonisation.hh" 42 #include "G4eBremsstrahlung.hh" 41 #include "G4eBremsstrahlung.hh" 43 #include "G4eplusAnnihilation.hh" 42 #include "G4eplusAnnihilation.hh" 44 43 45 #include "G4MuIonisation.hh" 44 #include "G4MuIonisation.hh" 46 #include "G4MuBremsstrahlung.hh" 45 #include "G4MuBremsstrahlung.hh" 47 #include "G4MuPairProduction.hh" 46 #include "G4MuPairProduction.hh" 48 47 49 #include "G4hIonisation.hh" 48 #include "G4hIonisation.hh" 50 49 51 #include "G4MuIonisation.hh" 50 #include "G4MuIonisation.hh" 52 #include "G4MuBremsstrahlung.hh" 51 #include "G4MuBremsstrahlung.hh" 53 #include "G4MuPairProduction.hh" 52 #include "G4MuPairProduction.hh" 54 53 55 #include "G4hIonisation.hh" 54 #include "G4hIonisation.hh" 56 55 57 #include "G4ParticleDefinition.hh" 56 #include "G4ParticleDefinition.hh" 58 #include "G4ProcessManager.hh" 57 #include "G4ProcessManager.hh" 59 #include "G4ProcessVector.hh" 58 #include "G4ProcessVector.hh" 60 #include "G4ParticleTypes.hh" 59 #include "G4ParticleTypes.hh" 61 #include "G4ParticleTable.hh" 60 #include "G4ParticleTable.hh" 62 #include "G4Material.hh" 61 #include "G4Material.hh" 63 #include "G4MaterialTable.hh" 62 #include "G4MaterialTable.hh" 64 #include "G4ios.hh" 63 #include "G4ios.hh" 65 #include "G4PhysicsTable.hh" 64 #include "G4PhysicsTable.hh" 66 #include "G4Transportation.hh" 65 #include "G4Transportation.hh" 67 66 68 #include "G4ErrorEnergyLoss.hh" 67 #include "G4ErrorEnergyLoss.hh" 69 68 70 //-------------------------------------------- 69 //------------------------------------------------------------------------ 71 G4ErrorPhysicsList::G4ErrorPhysicsList() << 70 G4ErrorPhysicsList::G4ErrorPhysicsList(): G4VUserPhysicsList() 72 : G4VUserPhysicsList() << 73 { 71 { 74 defaultCutValue = << 72 defaultCutValue = 1.0E+9*cm; // set big step so that AlongStep computes all the energy 75 1.0E+9 * cm; // set big step so that Alon << 76 } 73 } 77 74 >> 75 78 //-------------------------------------------- 76 //------------------------------------------------------------------------ 79 G4ErrorPhysicsList::~G4ErrorPhysicsList() {} << 77 G4ErrorPhysicsList::~G4ErrorPhysicsList() >> 78 { >> 79 } >> 80 80 81 81 //-------------------------------------------- 82 //------------------------------------------------------------------------ 82 void G4ErrorPhysicsList::ConstructParticle() 83 void G4ErrorPhysicsList::ConstructParticle() 83 { 84 { 84 // In this method, static member functions s << 85 // In this method, static member functions should be called 85 // for all particles which you want to use. 86 // for all particles which you want to use. 86 // This ensures that objects of these partic 87 // This ensures that objects of these particle types will be 87 // created in the program. << 88 // created in the program. 88 // gamma 89 // gamma 89 G4Gamma::GammaDefinition(); << 90 G4Gamma::GammaDefinition(); 90 // e+/- 91 // e+/- 91 G4Electron::ElectronDefinition(); 92 G4Electron::ElectronDefinition(); 92 G4Positron::PositronDefinition(); 93 G4Positron::PositronDefinition(); 93 // mu+/- 94 // mu+/- 94 G4MuonPlus::MuonPlusDefinition(); 95 G4MuonPlus::MuonPlusDefinition(); 95 G4MuonMinus::MuonMinusDefinition(); 96 G4MuonMinus::MuonMinusDefinition(); 96 97 97 // pi+/- 98 // pi+/- 98 G4PionPlus::PionPlusDefinition(); 99 G4PionPlus::PionPlusDefinition(); 99 G4PionMinus::PionMinusDefinition(); 100 G4PionMinus::PionMinusDefinition(); 100 101 101 // proton 102 // proton 102 G4Proton::ProtonDefinition(); 103 G4Proton::ProtonDefinition(); >> 104 103 } 105 } 104 106 >> 107 105 //-------------------------------------------- 108 //------------------------------------------------------------------------ 106 void G4ErrorPhysicsList::ConstructProcess() 109 void G4ErrorPhysicsList::ConstructProcess() 107 { 110 { 108 G4Transportation* theTransportationProcess = << 111 G4Transportation* theTransportationProcess= new G4Transportation(); 109 112 110 #ifdef G4VERBOSE 113 #ifdef G4VERBOSE 111 if(verboseLevel >= 4) << 114 if (verboseLevel >= 4){ 112 { << 115 G4cout << "G4VUserPhysicsList::ConstructProcess() "<< G4endl; 113 G4cout << "G4VUserPhysicsList::ConstructPr << 116 } 114 } << 115 #endif 117 #endif 116 118 117 // loop over all particles in G4ParticleTabl 119 // loop over all particles in G4ParticleTable 118 auto myParticleIterator = GetParticleIterato << 120 theParticleIterator->reset(); 119 myParticleIterator->reset(); << 121 while( (*theParticleIterator)() ){ 120 while((*myParticleIterator)()) << 122 G4ParticleDefinition* particle = theParticleIterator->value(); 121 { // Loop checking, 06.08.2015, G.Cosmo << 123 G4ProcessManager* pmanager = particle->GetProcessManager(); 122 G4ParticleDefinition* particle = myParticl << 124 if (!particle->IsShortLived()) { 123 G4ProcessManager* pmanager = particle- << 125 G4cout << particle << "G4ErrorPhysicsList:: particle process manager " << particle->GetParticleName() << " = " << particle->GetProcessManager() << G4endl; 124 if(!particle->IsShortLived()) << 125 { << 126 G4cout << particle << "G4ErrorPhysicsLis << 127 << particle->GetParticleName() << << 128 << particle->GetProcessManager() << 129 // Add transportation process for all pa 126 // Add transportation process for all particles other than "shortlived" 130 if(pmanager == 0) << 127 if ( pmanager == 0) { 131 { << 132 // Error !! no process manager 128 // Error !! no process manager 133 G4String particleName = particle->GetP 129 G4String particleName = particle->GetParticleName(); 134 G4Exception("G4ErrorPhysicsList::Const << 130 G4Exception("G4ErrorPhysicsList::ConstructProcess","No process manager", 135 "No process manager", RunM << 131 RunMustBeAborted, particleName ); 136 } << 132 } else { 137 else << 138 { << 139 // add transportation with ordering = 133 // add transportation with ordering = ( -1, "first", "first" ) 140 pmanager->AddProcess(theTransportation << 134 pmanager ->AddProcess(theTransportationProcess); 141 pmanager->SetProcessOrderingToFirst(th << 135 pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxAlongStep); 142 id << 136 pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxPostStep); 143 pmanager->SetProcessOrderingToFirst(th << 144 id << 145 } 137 } 146 } << 138 } else { 147 else << 148 { << 149 // shortlived particle case 139 // shortlived particle case 150 } 140 } 151 } 141 } 152 142 153 ConstructEM(); 143 ConstructEM(); 154 } 144 } 155 145 >> 146 156 //-------------------------------------------- 147 //------------------------------------------------------------------------ 157 #include "G4eBremsstrahlung.hh" 148 #include "G4eBremsstrahlung.hh" 158 #include "G4eIonisation.hh" 149 #include "G4eIonisation.hh" 159 150 160 #include "G4eIonisation.hh" 151 #include "G4eIonisation.hh" 161 152 162 #include "G4MuBremsstrahlung.hh" 153 #include "G4MuBremsstrahlung.hh" 163 #include "G4MuIonisation.hh" 154 #include "G4MuIonisation.hh" 164 #include "G4MuPairProduction.hh" 155 #include "G4MuPairProduction.hh" 165 156 166 #include "G4PhysicsTable.hh" 157 #include "G4PhysicsTable.hh" 167 158 >> 159 #include "G4VEnergyLoss.hh" >> 160 168 #include "G4MuIonisation.hh" 161 #include "G4MuIonisation.hh" 169 162 170 #include "G4ErrorStepLengthLimitProcess.hh" 163 #include "G4ErrorStepLengthLimitProcess.hh" 171 #include "G4ErrorMagFieldLimitProcess.hh" 164 #include "G4ErrorMagFieldLimitProcess.hh" 172 #include "G4ErrorMessenger.hh" 165 #include "G4ErrorMessenger.hh" 173 166 174 void G4ErrorPhysicsList::ConstructEM() 167 void G4ErrorPhysicsList::ConstructEM() 175 { 168 { >> 169 176 G4ErrorEnergyLoss* eLossProcess = new G4Erro 170 G4ErrorEnergyLoss* eLossProcess = new G4ErrorEnergyLoss; 177 G4ErrorStepLengthLimitProcess* stepLengthLim << 171 G4ErrorStepLengthLimitProcess* stepLengthLimitProcess = new G4ErrorStepLengthLimitProcess; 178 new G4ErrorStepLengthLimitProcess; << 172 G4ErrorMagFieldLimitProcess* magFieldLimitProcess = new G4ErrorMagFieldLimitProcess; 179 G4ErrorMagFieldLimitProcess* magFieldLimitPr << 173 new G4ErrorMessenger( stepLengthLimitProcess, magFieldLimitProcess, eLossProcess ); 180 new G4ErrorMagFieldLimitProcess; << 174 181 new G4ErrorMessenger(stepLengthLimitProcess, << 175 theParticleIterator->reset(); 182 eLossProcess); << 176 while( (*theParticleIterator)() ){ 183 << 177 G4ParticleDefinition* particle = theParticleIterator->value(); 184 auto myParticleIterator = GetParticleIterato << 178 G4ProcessManager* pmanager = particle->GetProcessManager(); 185 myParticleIterator->reset(); << 179 G4String particleName = particle->GetParticleName(); 186 while((*myParticleIterator)()) << 180 187 { // Loop checking, 06.08.2015, G.Cosmo << 181 if (particleName == "gamma") { 188 G4ParticleDefinition* particle = myParticl << 182 // gamma 189 G4ProcessManager* pmanager = particle- << 190 G4String particleName = particle- << 191 << 192 if(particleName == "gamma") << 193 { << 194 // gamma << 195 pmanager->AddDiscreteProcess(new G4Gamma 183 pmanager->AddDiscreteProcess(new G4GammaConversion()); 196 pmanager->AddDiscreteProcess(new G4Compt << 184 pmanager->AddDiscreteProcess(new G4ComptonScattering()); 197 pmanager->AddDiscreteProcess(new G4Photo 185 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect()); 198 186 199 // } else if (particleName == "e-" || 187 // } else if (particleName == "e-" || particleName == "e+" 200 // || particleName == "mu+ 188 // || particleName == "mu+" || particleName == "mu-" ) { 201 } << 189 }else if (!particle->IsShortLived() && particle->GetPDGCharge() != 0 ) { 202 else if(!particle->IsShortLived() && parti << 190 203 { << 191 pmanager->AddContinuousProcess(eLossProcess,1); 204 pmanager->AddContinuousProcess(eLossProc << 192 pmanager->AddDiscreteProcess( stepLengthLimitProcess, 2 ); 205 pmanager->AddDiscreteProcess(stepLengthL << 193 pmanager->AddDiscreteProcess( magFieldLimitProcess, 3 ); 206 pmanager->AddDiscreteProcess(magFieldLim << 194 207 << 195 } else if ((!particle->IsShortLived()) && 208 /* } else if ((!particle->IsShortLiv << 196 (particle->GetPDGCharge() != 0.0) && 209 (particle->GetPDGCharge() != 0. << 210 (particle->GetParticleName() != 197 (particle->GetParticleName() != "chargedgeantino")) { 211 // all others charged particles except ge 198 // all others charged particles except geantino 212 // G4VProcess* aMultipleScattering = n 199 // G4VProcess* aMultipleScattering = new G4MultipleScattering(); 213 G4VProcess* anIonisation = new G4h << 200 G4VProcess* anIonisation = new G4hIonisation(); 214 ////G4VProcess* theUserCuts = new G4User 201 ////G4VProcess* theUserCuts = new G4UserSpecialCuts(); 215 << 202 216 // 203 // 217 // add processes 204 // add processes 218 pmanager->AddProcess(anIonisation); 205 pmanager->AddProcess(anIonisation); 219 // pmanager->AddProcess(aMultipleScatte << 206 // pmanager->AddProcess(aMultipleScattering); 220 ////pmanager->AddProcess(theUserCuts); 207 ////pmanager->AddProcess(theUserCuts); 221 << 208 222 // 209 // 223 // set ordering for AlongStepDoIt 210 // set ordering for AlongStepDoIt 224 // pmanager->SetProcessOrdering(aMultip 211 // pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1); 225 pmanager->SetProcessOrdering(anIonisation 212 pmanager->SetProcessOrdering(anIonisation, idxAlongStep,1); 226 << 213 227 // 214 // 228 // set ordering for PostStepDoIt 215 // set ordering for PostStepDoIt 229 // pmanager->SetProcessOrdering(aMultip 216 // pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1); 230 pmanager->SetProcessOrdering(anIonisation 217 pmanager->SetProcessOrdering(anIonisation, idxPostStep,1); 231 ////pmanager->SetProcessOrdering(theUserC 218 ////pmanager->SetProcessOrdering(theUserCuts, idxPostStep,2); 232 */ << 233 } 219 } 234 } 220 } 235 } 221 } 236 222 >> 223 237 //-------------------------------------------- 224 //------------------------------------------------------------------------ 238 void G4ErrorPhysicsList::SetCuts() 225 void G4ErrorPhysicsList::SetCuts() 239 { 226 { 240 // " G4VUserPhysicsList::SetCutsWithDefault << 227 // " G4VUserPhysicsList::SetCutsWithDefault" method sets 241 // the default cut value or all particle t << 228 // the default cut value or all particle types 242 SetCutsWithDefault(); << 229 SetCutsWithDefault(); 243 // if (verboseLevel>0) << 230 // if (verboseLevel>0) 244 // DumpCutValuesTable(); 231 // DumpCutValuesTable(); 245 } 232 } >> 233 246 234