[807] | 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 | // |
---|
| 27 | // $Id: PhysicsList.cc,v 1.14 2007/09/26 10:23:17 vnivanch Exp $ |
---|
| 28 | // GEANT4 tag $Name: $ |
---|
| 29 | // |
---|
| 30 | |
---|
| 31 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 32 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 33 | |
---|
| 34 | #include "PhysicsList.hh" |
---|
| 35 | #include "PhysicsListMessenger.hh" |
---|
| 36 | |
---|
| 37 | #include "G4EmStandardPhysics.hh" |
---|
| 38 | #include "G4DecayPhysics.hh" |
---|
| 39 | |
---|
| 40 | #include "PhysListEmModelPai.hh" |
---|
| 41 | #include "PhysListEmPaiPhoton.hh" |
---|
| 42 | #include "PhysListEmPAI.hh" |
---|
| 43 | |
---|
| 44 | #include "G4Gamma.hh" |
---|
| 45 | #include "G4Electron.hh" |
---|
| 46 | #include "G4Positron.hh" |
---|
| 47 | |
---|
| 48 | #include "G4UnitsTable.hh" |
---|
| 49 | #include "G4LossTableManager.hh" |
---|
| 50 | |
---|
| 51 | #include "StepMax.hh" |
---|
| 52 | |
---|
| 53 | #include "G4ProcessManager.hh" |
---|
| 54 | #include "G4ParticleTypes.hh" |
---|
| 55 | #include "G4ParticleTable.hh" |
---|
| 56 | |
---|
| 57 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 58 | |
---|
| 59 | PhysicsList::PhysicsList() : G4VModularPhysicsList() |
---|
| 60 | { |
---|
| 61 | G4LossTableManager::Instance(); |
---|
| 62 | defaultCutValue = 1.*mm; |
---|
| 63 | cutForGamma = defaultCutValue; |
---|
| 64 | cutForElectron = defaultCutValue; |
---|
| 65 | cutForPositron = defaultCutValue; |
---|
| 66 | |
---|
| 67 | stepMaxProcess = 0; |
---|
| 68 | |
---|
| 69 | pMessenger = new PhysicsListMessenger(this); |
---|
| 70 | |
---|
| 71 | SetVerboseLevel(1); |
---|
| 72 | |
---|
| 73 | // Decay Physics is always defined |
---|
| 74 | generalPhysicsList = new G4DecayPhysics(); |
---|
| 75 | |
---|
| 76 | // EM physics |
---|
| 77 | emName = G4String("emstandard"); |
---|
| 78 | emPhysicsList = new G4EmStandardPhysics(); |
---|
| 79 | |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 83 | |
---|
| 84 | PhysicsList::~PhysicsList() |
---|
| 85 | { |
---|
| 86 | delete pMessenger; |
---|
| 87 | delete generalPhysicsList; |
---|
| 88 | delete emPhysicsList; |
---|
| 89 | for(size_t i=0; i<hadronPhys.size(); i++) delete hadronPhys[i]; |
---|
| 90 | delete stepMaxProcess; |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 94 | |
---|
| 95 | void PhysicsList::ConstructParticle() |
---|
| 96 | { |
---|
| 97 | generalPhysicsList->ConstructParticle(); |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 101 | |
---|
| 102 | void PhysicsList::ConstructProcess() |
---|
| 103 | { |
---|
| 104 | AddTransportation(); |
---|
| 105 | emPhysicsList->ConstructProcess(); |
---|
| 106 | generalPhysicsList->ConstructProcess(); |
---|
| 107 | for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess(); |
---|
| 108 | AddStepMax(); |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 112 | |
---|
| 113 | void PhysicsList::AddPhysicsList(const G4String& name) |
---|
| 114 | { |
---|
| 115 | if (verboseLevel>-1) { |
---|
| 116 | G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | if (name == emName) return; |
---|
| 120 | |
---|
| 121 | if (name == "pai") |
---|
| 122 | { |
---|
| 123 | emName = name; |
---|
| 124 | delete emPhysicsList; |
---|
| 125 | emPhysicsList = new PhysListEmModelPai(name); |
---|
| 126 | G4cout<<"PhysListEmModelPai is called"<<G4endl; |
---|
| 127 | } |
---|
| 128 | else if (name == "pai_photon") |
---|
| 129 | { |
---|
| 130 | emName = name; |
---|
| 131 | delete emPhysicsList; |
---|
| 132 | emPhysicsList = new PhysListEmPaiPhoton(name); |
---|
| 133 | G4cout<<"PhysListEmModelPaiPhoton is called"<<G4endl; |
---|
| 134 | } |
---|
| 135 | else if (name == "pai_brem") |
---|
| 136 | { |
---|
| 137 | emName = name; |
---|
| 138 | delete emPhysicsList; |
---|
| 139 | emPhysicsList = new PhysListEmPAI(name); |
---|
| 140 | G4cout<<"PhysListEmPAI is called (bremsstrahlung dedx added)"<<G4endl; |
---|
| 141 | } |
---|
| 142 | else |
---|
| 143 | { |
---|
| 144 | G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" |
---|
| 145 | << " is not defined" |
---|
| 146 | << G4endl; |
---|
| 147 | } |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 151 | |
---|
| 152 | void PhysicsList::AddStepMax() |
---|
| 153 | { |
---|
| 154 | // Step limitation seen as a process |
---|
| 155 | stepMaxProcess = new StepMax(); |
---|
| 156 | |
---|
| 157 | theParticleIterator->reset(); |
---|
| 158 | |
---|
| 159 | while ((*theParticleIterator)()) |
---|
| 160 | { |
---|
| 161 | G4ParticleDefinition* particle = theParticleIterator->value(); |
---|
| 162 | G4ProcessManager* pmanager = particle->GetProcessManager(); |
---|
| 163 | |
---|
| 164 | if (stepMaxProcess->IsApplicable(*particle)) |
---|
| 165 | { |
---|
| 166 | pmanager ->AddDiscreteProcess(stepMaxProcess); |
---|
| 167 | } |
---|
| 168 | } |
---|
| 169 | } |
---|
| 170 | |
---|
| 171 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 172 | |
---|
| 173 | void PhysicsList::SetCuts() |
---|
| 174 | { |
---|
| 175 | |
---|
| 176 | if ( verboseLevel > 0 ) |
---|
| 177 | { |
---|
| 178 | G4cout << "PhysicsList::SetCuts:"; |
---|
| 179 | G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; |
---|
| 180 | } |
---|
| 181 | |
---|
| 182 | // set cut values for gamma at first and for e- second and next for e+, |
---|
| 183 | // because some processes for e+/e- need cut values for gamma |
---|
| 184 | |
---|
| 185 | SetCutValue(cutForGamma, "gamma"); |
---|
| 186 | SetCutValue(cutForElectron, "e-"); |
---|
| 187 | SetCutValue(cutForPositron, "e+"); |
---|
| 188 | |
---|
| 189 | if ( verboseLevel > 0 ) DumpCutValuesTable(); |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 193 | |
---|
| 194 | void PhysicsList::SetCutForGamma(G4double cut) |
---|
| 195 | { |
---|
| 196 | cutForGamma = cut; |
---|
| 197 | SetParticleCuts(cutForGamma, G4Gamma::Gamma()); |
---|
| 198 | } |
---|
| 199 | |
---|
| 200 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 201 | |
---|
| 202 | void PhysicsList::SetCutForElectron(G4double cut) |
---|
| 203 | { |
---|
| 204 | cutForElectron = cut; |
---|
| 205 | SetParticleCuts(cutForElectron, G4Electron::Electron()); |
---|
| 206 | } |
---|
| 207 | |
---|
| 208 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 209 | |
---|
| 210 | void PhysicsList::SetCutForPositron(G4double cut) |
---|
| 211 | { |
---|
| 212 | cutForPositron = cut; |
---|
| 213 | SetParticleCuts(cutForPositron, G4Positron::Positron()); |
---|
| 214 | } |
---|
| 215 | |
---|
| 216 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 217 | |
---|