[815] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // $Id: G4ErrorPhysicsList.cc,v 1.2 2007/05/29 14:41:35 gcosmo Exp $ |
---|
[850] | 27 | // GEANT4 tag $Name: HEAD $ |
---|
[815] | 28 | // |
---|
| 29 | // ------------------------------------------------------------ |
---|
| 30 | // GEANT 4 class implementation file |
---|
| 31 | // ------------------------------------------------------------ |
---|
| 32 | |
---|
| 33 | #include "globals.hh" |
---|
| 34 | |
---|
| 35 | #include "G4ErrorPhysicsList.hh" |
---|
| 36 | #include "G4ComptonScattering.hh" |
---|
| 37 | #include "G4GammaConversion.hh" |
---|
| 38 | #include "G4PhotoElectricEffect.hh" |
---|
| 39 | |
---|
| 40 | #include "G4eIonisation.hh" |
---|
| 41 | #include "G4eBremsstrahlung.hh" |
---|
| 42 | #include "G4eplusAnnihilation.hh" |
---|
| 43 | |
---|
| 44 | #include "G4MuIonisation.hh" |
---|
| 45 | #include "G4MuBremsstrahlung.hh" |
---|
| 46 | #include "G4MuPairProduction.hh" |
---|
| 47 | |
---|
| 48 | #include "G4hIonisation.hh" |
---|
| 49 | |
---|
| 50 | #include "G4MuIonisation.hh" |
---|
| 51 | #include "G4MuBremsstrahlung.hh" |
---|
| 52 | #include "G4MuPairProduction.hh" |
---|
| 53 | |
---|
| 54 | #include "G4hIonisation.hh" |
---|
| 55 | |
---|
| 56 | #include "G4ParticleDefinition.hh" |
---|
| 57 | #include "G4ProcessManager.hh" |
---|
| 58 | #include "G4ProcessVector.hh" |
---|
| 59 | #include "G4ParticleTypes.hh" |
---|
| 60 | #include "G4ParticleTable.hh" |
---|
| 61 | #include "G4Material.hh" |
---|
| 62 | #include "G4MaterialTable.hh" |
---|
| 63 | #include "G4ios.hh" |
---|
| 64 | #include "G4PhysicsTable.hh" |
---|
| 65 | #include "G4Transportation.hh" |
---|
| 66 | |
---|
| 67 | #include "G4ErrorEnergyLoss.hh" |
---|
| 68 | |
---|
| 69 | //------------------------------------------------------------------------ |
---|
| 70 | G4ErrorPhysicsList::G4ErrorPhysicsList(): G4VUserPhysicsList() |
---|
| 71 | { |
---|
| 72 | defaultCutValue = 1.0E+9*cm; // set big step so that AlongStep computes all the energy |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | //------------------------------------------------------------------------ |
---|
| 77 | G4ErrorPhysicsList::~G4ErrorPhysicsList() |
---|
| 78 | { |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | //------------------------------------------------------------------------ |
---|
| 83 | void G4ErrorPhysicsList::ConstructParticle() |
---|
| 84 | { |
---|
| 85 | // In this method, static member functions should be called |
---|
| 86 | // for all particles which you want to use. |
---|
| 87 | // This ensures that objects of these particle types will be |
---|
| 88 | // created in the program. |
---|
| 89 | // gamma |
---|
| 90 | G4Gamma::GammaDefinition(); |
---|
| 91 | // e+/- |
---|
| 92 | G4Electron::ElectronDefinition(); |
---|
| 93 | G4Positron::PositronDefinition(); |
---|
| 94 | // mu+/- |
---|
| 95 | G4MuonPlus::MuonPlusDefinition(); |
---|
| 96 | G4MuonMinus::MuonMinusDefinition(); |
---|
| 97 | |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | //------------------------------------------------------------------------ |
---|
| 102 | void G4ErrorPhysicsList::ConstructProcess() |
---|
| 103 | { |
---|
| 104 | G4Transportation* theTransportationProcess= new G4Transportation(); |
---|
| 105 | |
---|
| 106 | #ifdef G4VERBOSE |
---|
| 107 | if (verboseLevel >= 4){ |
---|
| 108 | G4cout << "G4VUserPhysicsList::ConstructProcess() "<< G4endl; |
---|
| 109 | } |
---|
| 110 | #endif |
---|
| 111 | |
---|
| 112 | // loop over all particles in G4ParticleTable |
---|
| 113 | theParticleIterator->reset(); |
---|
| 114 | while( (*theParticleIterator)() ){ |
---|
| 115 | G4ParticleDefinition* particle = theParticleIterator->value(); |
---|
| 116 | G4ProcessManager* pmanager = particle->GetProcessManager(); |
---|
| 117 | if (!particle->IsShortLived()) { |
---|
| 118 | G4cout << particle << "G4ErrorPhysicsList:: particle process manager " << particle->GetParticleName() << " = " << particle->GetProcessManager() << G4endl; |
---|
| 119 | // Add transportation process for all particles other than "shortlived" |
---|
| 120 | if ( pmanager == 0) { |
---|
| 121 | // Error !! no process manager |
---|
| 122 | G4String particleName = particle->GetParticleName(); |
---|
| 123 | G4Exception("G4ErrorPhysicsList::ConstructProcess","No process manager", |
---|
| 124 | RunMustBeAborted, particleName ); |
---|
| 125 | } else { |
---|
| 126 | // add transportation with ordering = ( -1, "first", "first" ) |
---|
| 127 | pmanager ->AddProcess(theTransportationProcess); |
---|
| 128 | pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxAlongStep); |
---|
| 129 | pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxPostStep); |
---|
| 130 | } |
---|
| 131 | } else { |
---|
| 132 | // shortlived particle case |
---|
| 133 | } |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | ConstructEM(); |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | //------------------------------------------------------------------------ |
---|
| 141 | #include "G4eBremsstrahlung.hh" |
---|
| 142 | #include "G4eIonisation.hh" |
---|
| 143 | |
---|
| 144 | #include "G4eIonisation.hh" |
---|
| 145 | |
---|
| 146 | #include "G4MuBremsstrahlung.hh" |
---|
| 147 | #include "G4MuIonisation.hh" |
---|
| 148 | #include "G4MuPairProduction.hh" |
---|
| 149 | |
---|
| 150 | #include "G4PhysicsTable.hh" |
---|
| 151 | |
---|
| 152 | #include "G4VEnergyLoss.hh" |
---|
| 153 | |
---|
| 154 | #include "G4MuIonisation.hh" |
---|
| 155 | |
---|
| 156 | #include "G4ErrorStepLengthLimitProcess.hh" |
---|
| 157 | #include "G4ErrorMagFieldLimitProcess.hh" |
---|
| 158 | #include "G4ErrorMessenger.hh" |
---|
| 159 | |
---|
| 160 | void G4ErrorPhysicsList::ConstructEM() |
---|
| 161 | { |
---|
| 162 | |
---|
| 163 | G4ErrorEnergyLoss* eLossProcess = new G4ErrorEnergyLoss; |
---|
| 164 | G4ErrorStepLengthLimitProcess* stepLengthLimitProcess = new G4ErrorStepLengthLimitProcess; |
---|
| 165 | G4ErrorMagFieldLimitProcess* magFieldLimitProcess = new G4ErrorMagFieldLimitProcess; |
---|
| 166 | new G4ErrorMessenger( stepLengthLimitProcess, magFieldLimitProcess, eLossProcess ); |
---|
| 167 | |
---|
| 168 | theParticleIterator->reset(); |
---|
| 169 | while( (*theParticleIterator)() ){ |
---|
| 170 | G4ParticleDefinition* particle = theParticleIterator->value(); |
---|
| 171 | G4ProcessManager* pmanager = particle->GetProcessManager(); |
---|
| 172 | G4String particleName = particle->GetParticleName(); |
---|
| 173 | |
---|
| 174 | if (particleName == "gamma") { |
---|
| 175 | // gamma |
---|
| 176 | pmanager->AddDiscreteProcess(new G4GammaConversion()); |
---|
| 177 | pmanager->AddDiscreteProcess(new G4ComptonScattering()); |
---|
| 178 | pmanager->AddDiscreteProcess(new G4PhotoElectricEffect()); |
---|
| 179 | |
---|
| 180 | // } else if (particleName == "e-" || particleName == "e+" |
---|
| 181 | // || particleName == "mu+" || particleName == "mu-" ) { |
---|
| 182 | }else if (!particle->IsShortLived() && particle->GetPDGCharge() != 0 ) { |
---|
| 183 | |
---|
| 184 | pmanager->AddContinuousProcess(eLossProcess,1); |
---|
| 185 | pmanager->AddDiscreteProcess( stepLengthLimitProcess, 2 ); |
---|
| 186 | pmanager->AddDiscreteProcess( magFieldLimitProcess, 3 ); |
---|
| 187 | |
---|
| 188 | } else if ((!particle->IsShortLived()) && |
---|
| 189 | (particle->GetPDGCharge() != 0.0) && |
---|
| 190 | (particle->GetParticleName() != "chargedgeantino")) { |
---|
| 191 | // all others charged particles except geantino |
---|
| 192 | // G4VProcess* aMultipleScattering = new G4MultipleScattering(); |
---|
| 193 | G4VProcess* anIonisation = new G4hIonisation(); |
---|
| 194 | ////G4VProcess* theUserCuts = new G4UserSpecialCuts(); |
---|
| 195 | |
---|
| 196 | // |
---|
| 197 | // add processes |
---|
| 198 | pmanager->AddProcess(anIonisation); |
---|
| 199 | // pmanager->AddProcess(aMultipleScattering); |
---|
| 200 | ////pmanager->AddProcess(theUserCuts); |
---|
| 201 | |
---|
| 202 | // |
---|
| 203 | // set ordering for AlongStepDoIt |
---|
| 204 | // pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1); |
---|
| 205 | pmanager->SetProcessOrdering(anIonisation, idxAlongStep,1); |
---|
| 206 | |
---|
| 207 | // |
---|
| 208 | // set ordering for PostStepDoIt |
---|
| 209 | // pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1); |
---|
| 210 | pmanager->SetProcessOrdering(anIonisation, idxPostStep,1); |
---|
| 211 | ////pmanager->SetProcessOrdering(theUserCuts, idxPostStep,2); |
---|
| 212 | } |
---|
| 213 | } |
---|
| 214 | } |
---|
| 215 | |
---|
| 216 | |
---|
| 217 | //------------------------------------------------------------------------ |
---|
| 218 | void G4ErrorPhysicsList::SetCuts() |
---|
| 219 | { |
---|
| 220 | // " G4VUserPhysicsList::SetCutsWithDefault" method sets |
---|
| 221 | // the default cut value or all particle types |
---|
| 222 | SetCutsWithDefault(); |
---|
| 223 | // if (verboseLevel>0) |
---|
| 224 | // DumpCutValuesTable(); |
---|
| 225 | } |
---|
| 226 | |
---|