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 // This example is provided by the Geant4-DNA 26 // This example is provided by the Geant4-DNA collaboration 27 // Any report or published results obtained us 27 // Any report or published results obtained using the Geant4-DNA software 28 // shall cite the following Geant4-DNA collabo 28 // shall cite the following Geant4-DNA collaboration publication: 29 // Med. Phys. 37 (2010) 4692-4708 29 // Med. Phys. 37 (2010) 4692-4708 30 // The Geant4-DNA web site is available at htt 30 // The Geant4-DNA web site is available at http://geant4-dna.org 31 // 31 // 32 // If you use this example, please cite the fo 32 // If you use this example, please cite the following publication: 33 // Rad. Prot. Dos. 133 (2009) 2-11 33 // Rad. Prot. Dos. 133 (2009) 2-11 34 34 35 #include "PhysicsList.hh" 35 #include "PhysicsList.hh" 36 #include "PhysicsListMessenger.hh" 36 #include "PhysicsListMessenger.hh" 37 37 38 #include "G4SystemOfUnits.hh" 38 #include "G4SystemOfUnits.hh" 39 #include "StepMax.hh" << 39 #include "G4StepLimiter.hh" >> 40 40 #include "G4EmStandardPhysics.hh" 41 #include "G4EmStandardPhysics.hh" 41 #include "G4EmStandardPhysics_option1.hh" 42 #include "G4EmStandardPhysics_option1.hh" 42 #include "G4EmStandardPhysics_option2.hh" 43 #include "G4EmStandardPhysics_option2.hh" 43 #include "G4EmStandardPhysics_option3.hh" 44 #include "G4EmStandardPhysics_option3.hh" 44 #include "G4EmStandardPhysics_option4.hh" 45 #include "G4EmStandardPhysics_option4.hh" 45 #include "G4EmLivermorePhysics.hh" 46 #include "G4EmLivermorePhysics.hh" 46 #include "G4EmPenelopePhysics.hh" 47 #include "G4EmPenelopePhysics.hh" 47 #include "G4DecayPhysics.hh" 48 #include "G4DecayPhysics.hh" >> 49 #include "G4LossTableManager.hh" >> 50 48 #include "G4ProcessManager.hh" 51 #include "G4ProcessManager.hh" >> 52 49 #include "G4Gamma.hh" 53 #include "G4Gamma.hh" 50 #include "G4Electron.hh" 54 #include "G4Electron.hh" 51 #include "G4Positron.hh" 55 #include "G4Positron.hh" 52 56 >> 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 58 53 PhysicsList::PhysicsList() : G4VModularPhysics 59 PhysicsList::PhysicsList() : G4VModularPhysicsList() 54 { 60 { >> 61 G4LossTableManager::Instance(); >> 62 defaultCutValue = 0.01*micrometer; >> 63 fCutForGamma = defaultCutValue; >> 64 fCutForElectron = defaultCutValue; >> 65 fCutForPositron = defaultCutValue; >> 66 55 fMessenger = new PhysicsListMessenger(this); 67 fMessenger = new PhysicsListMessenger(this); 56 68 57 SetVerboseLevel(1); 69 SetVerboseLevel(1); 58 70 59 // EM physics 71 // EM physics 60 fEmName = G4String("emlivermore"); 72 fEmName = G4String("emlivermore"); 61 73 62 fEmPhysicsList = new G4EmLivermorePhysics(); 74 fEmPhysicsList = new G4EmLivermorePhysics(); 63 75 64 // Deacy physics and all particles 76 // Deacy physics and all particles 65 fDecPhysicsList = new G4DecayPhysics(); 77 fDecPhysicsList = new G4DecayPhysics(); 66 } 78 } 67 79 >> 80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 81 68 PhysicsList::~PhysicsList() 82 PhysicsList::~PhysicsList() 69 { 83 { 70 delete fMessenger; 84 delete fMessenger; 71 delete fEmPhysicsList; 85 delete fEmPhysicsList; 72 delete fDecPhysicsList; 86 delete fDecPhysicsList; 73 } 87 } 74 88 >> 89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 90 75 void PhysicsList::ConstructParticle() 91 void PhysicsList::ConstructParticle() 76 { 92 { 77 fDecPhysicsList->ConstructParticle(); 93 fDecPhysicsList->ConstructParticle(); 78 } 94 } 79 95 >> 96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 97 80 void PhysicsList::ConstructProcess() 98 void PhysicsList::ConstructProcess() 81 { 99 { 82 // transportation 100 // transportation 83 AddTransportation(); 101 AddTransportation(); 84 102 85 // electromagnetic physics list 103 // electromagnetic physics list 86 fEmPhysicsList->ConstructProcess(); 104 fEmPhysicsList->ConstructProcess(); 87 105 88 // decay physics list 106 // decay physics list 89 fDecPhysicsList->ConstructProcess(); 107 fDecPhysicsList->ConstructProcess(); 90 108 91 // step limitation (as a full process) 109 // step limitation (as a full process) 92 AddStepMax(); 110 AddStepMax(); 93 111 94 } 112 } 95 113 >> 114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 115 96 void PhysicsList::AddPhysicsList(const G4Strin 116 void PhysicsList::AddPhysicsList(const G4String& name) 97 { 117 { 98 if (verboseLevel>1) { 118 if (verboseLevel>1) { 99 G4cout << "PhysicsList::AddPhysicsList: <" 119 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 100 } 120 } 101 121 102 if (name == fEmName) return; 122 if (name == fEmName) return; 103 123 104 if (name == "emstandard_opt0") { 124 if (name == "emstandard_opt0") { 105 125 106 fEmName = name; 126 fEmName = name; 107 delete fEmPhysicsList; 127 delete fEmPhysicsList; 108 fEmPhysicsList = new G4EmStandardPhysics(1 128 fEmPhysicsList = new G4EmStandardPhysics(1); 109 129 110 } else if (name == "emstandard_opt1") { 130 } else if (name == "emstandard_opt1") { 111 131 112 fEmName = name; 132 fEmName = name; 113 delete fEmPhysicsList; 133 delete fEmPhysicsList; 114 fEmPhysicsList = new G4EmStandardPhysics_o 134 fEmPhysicsList = new G4EmStandardPhysics_option1(); 115 135 116 } else if (name == "emstandard_opt2") { 136 } else if (name == "emstandard_opt2") { 117 137 118 fEmName = name; 138 fEmName = name; 119 delete fEmPhysicsList; 139 delete fEmPhysicsList; 120 fEmPhysicsList = new G4EmStandardPhysics_o 140 fEmPhysicsList = new G4EmStandardPhysics_option2(); 121 141 122 } else if (name == "emstandard_opt3") { 142 } else if (name == "emstandard_opt3") { 123 143 124 fEmName = name; 144 fEmName = name; 125 delete fEmPhysicsList; 145 delete fEmPhysicsList; 126 fEmPhysicsList = new G4EmStandardPhysics_o 146 fEmPhysicsList = new G4EmStandardPhysics_option3(); 127 147 128 } else if (name == "emstandard_opt4") { 148 } else if (name == "emstandard_opt4") { 129 149 130 fEmName = name; 150 fEmName = name; 131 delete fEmPhysicsList; 151 delete fEmPhysicsList; 132 fEmPhysicsList = new G4EmStandardPhysics_o 152 fEmPhysicsList = new G4EmStandardPhysics_option4(); 133 153 134 } else if (name == "emlivermore") { 154 } else if (name == "emlivermore") { 135 155 136 fEmName = name; 156 fEmName = name; 137 delete fEmPhysicsList; 157 delete fEmPhysicsList; 138 fEmPhysicsList = new G4EmLivermorePhysics( 158 fEmPhysicsList = new G4EmLivermorePhysics(); 139 159 140 } else if (name == "empenelope") { 160 } else if (name == "empenelope") { 141 161 142 fEmName = name; 162 fEmName = name; 143 delete fEmPhysicsList; 163 delete fEmPhysicsList; 144 fEmPhysicsList = new G4EmPenelopePhysics() 164 fEmPhysicsList = new G4EmPenelopePhysics(); 145 165 146 } 166 } 147 } 167 } 148 168 >> 169 >> 170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 171 149 void PhysicsList::AddStepMax() 172 void PhysicsList::AddStepMax() 150 { 173 { 151 // Step limitation seen as a process 174 // Step limitation seen as a process 152 StepMax* stepMaxProcess = new StepMax(fMesse << 153 175 154 auto particleIterator=GetParticleIterator(); << 176 fStepMaxProcess = new G4StepLimiter(); 155 particleIterator->reset(); << 177 156 while ((*particleIterator)()){ << 178 theParticleIterator->reset(); 157 G4ParticleDefinition* particle = particleI << 179 while ((*theParticleIterator)()){ >> 180 G4ParticleDefinition* particle = theParticleIterator->value(); 158 G4ProcessManager* pmanager = particle->Get 181 G4ProcessManager* pmanager = particle->GetProcessManager(); 159 182 160 if (stepMaxProcess->IsApplicable(*particle << 183 if (fStepMaxProcess->IsApplicable(*particle) && pmanager) 161 { 184 { 162 pmanager ->AddDiscreteProcess(stepMaxP << 185 pmanager ->AddDiscreteProcess(fStepMaxProcess); 163 } 186 } 164 } 187 } 165 } 188 } >> 189 >> 190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 191 >> 192 void PhysicsList::SetCuts() >> 193 { >> 194 >> 195 if (verboseLevel >0){ >> 196 G4cout << "PhysicsList::SetCuts:"; >> 197 G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl; >> 198 } >> 199 >> 200 SetCutValue(fCutForGamma, "gamma"); >> 201 SetCutValue(fCutForElectron, "e-"); >> 202 SetCutValue(fCutForPositron, "e+"); >> 203 >> 204 if (verboseLevel>0) DumpCutValuesTable(); >> 205 } >> 206 >> 207 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 208 >> 209 void PhysicsList::SetCutForGamma(G4double cut) >> 210 { >> 211 fCutForGamma = cut; >> 212 SetParticleCuts(fCutForGamma, G4Gamma::Gamma()); >> 213 } >> 214 >> 215 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 216 >> 217 void PhysicsList::SetCutForElectron(G4double cut) >> 218 { >> 219 fCutForElectron = cut; >> 220 SetParticleCuts(fCutForElectron, G4Electron::Electron()); >> 221 } >> 222 >> 223 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 224 >> 225 void PhysicsList::SetCutForPositron(G4double cut) >> 226 { >> 227 fCutForPositron = cut; >> 228 SetParticleCuts(fCutForPositron, G4Positron::Positron()); >> 229 } >> 230 >> 231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 232 166 233