Geant4 Cross Reference |
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 // This is the *BASIC* version of IORT, a Geant4-based application 27 // 28 // Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d) 29 // Contributor Authors: S.Guatelli(e) 30 // Past Authors: G.Arnetta(c), S.E.Mazzaglia(d) 31 // 32 // (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy 33 // (b) IBFM-CNR , Segrate (Milano), Italy 34 // (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy 35 // (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy 36 // (e) University of Wollongong, Australia 37 // 38 // *Corresponding author, email to carlo.casarino@polooncologicocefalu.it 39 ////////////////////////////////////////////////////////////////////////////////////////////// 40 // 41 42 #include "G4SystemOfUnits.hh" 43 #include "G4RunManager.hh" 44 #include "G4Region.hh" 45 #include "G4RegionStore.hh" 46 #include "IORTPhysicsList.hh" 47 #include "IORTPhysicsListMessenger.hh" 48 #include "IORTStepMax.hh" 49 #include "G4VPhysicsConstructor.hh" 50 51 // Physic lists (contained inside the Geant4 source code, in the 'physicslists folder') 52 #include "G4EmStandardPhysics_option3.hh" 53 #include "G4EmStandardPhysics_option4.hh" 54 #include "G4EmLivermorePhysics.hh" 55 #include "G4EmPenelopePhysics.hh" 56 #include "G4EmExtraPhysics.hh" 57 #include "G4ParticleDefinition.hh" 58 #include "G4ProductionCutsTable.hh" 59 #include "G4ProcessManager.hh" 60 #include "globals.hh" 61 #include "G4Electron.hh" 62 #include "G4Gamma.hh" 63 #include "G4Positron.hh" 64 #include "G4UnitsTable.hh" 65 #include "G4DecayPhysics.hh" 66 67 IORTPhysicsList::IORTPhysicsList() : G4VModularPhysicsList() 68 { 69 defaultCutValue = 0.1 *mm; 70 cutForGamma = defaultCutValue; 71 cutForElectron = defaultCutValue; 72 cutForPositron = defaultCutValue; 73 74 // set cut values for gamma at first and for e- second and next for e+, 75 // because some processes for e+/e- need cut values for gamma 76 SetCutValue(cutForGamma, "gamma"); 77 SetCutValue(cutForElectron, "e-"); 78 SetCutValue(cutForPositron, "e+"); 79 80 DumpCutValuesTable(); 81 82 stepMaxProcess = 0; 83 84 pMessenger = new IORTPhysicsListMessenger(this); 85 86 SetVerboseLevel(1); 87 88 // EM physics 89 emPhysicsList = new G4EmStandardPhysics_option4(1); 90 emName = G4String("emstandard_opt4"); 91 decPhysicsList = new G4DecayPhysics(); 92 } 93 94 IORTPhysicsList::~IORTPhysicsList() 95 { 96 delete pMessenger; 97 delete emPhysicsList; 98 delete decPhysicsList; 99 } 100 101 void IORTPhysicsList::ConstructParticle() 102 { 103 decPhysicsList->ConstructParticle(); 104 } 105 106 void IORTPhysicsList::ConstructProcess() 107 { 108 // transportation 109 AddTransportation(); 110 111 // electromagnetic physics list 112 emPhysicsList->ConstructProcess(); 113 em_config.AddModels(); 114 115 // Set cuts for detector 116 SetDetectorCut(defaultCutValue); 117 // step limitation (as a full process) 118 // 119 AddStepMax(); 120 } 121 122 void IORTPhysicsList::AddPhysicsList(const G4String& name) 123 { 124 125 if (verboseLevel>1) { 126 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl; 127 } 128 if (name == emName) return; 129 130 if (name == "standard_opt3") { 131 emName = name; 132 delete emPhysicsList; 133 emPhysicsList = new G4EmStandardPhysics_option3(); 134 G4RunManager::GetRunManager() -> PhysicsHasBeenModified(); 135 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl; 136 137 138 } else if (name == "livermore") { 139 emName = name; 140 delete emPhysicsList; 141 emPhysicsList = new G4EmLivermorePhysics(); 142 G4RunManager::GetRunManager()-> PhysicsHasBeenModified(); 143 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl; 144 145 } else if (name == "penelope") { 146 emName = name; 147 delete emPhysicsList; 148 emPhysicsList = new G4EmPenelopePhysics(); 149 G4RunManager::GetRunManager()-> PhysicsHasBeenModified(); 150 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmPenelopePhysics" << G4endl;} 151 152 else if (name == "standard_opt4") { 153 emName = name; 154 delete emPhysicsList; 155 emPhysicsList = new G4EmStandardPhysics_option4(); 156 G4RunManager::GetRunManager() -> PhysicsHasBeenModified(); 157 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option4" << G4endl; 158 } 159 160 else { 161 162 G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" 163 << " is not defined" 164 << G4endl; 165 } 166 } 167 168 void IORTPhysicsList::AddStepMax() 169 { 170 // Step limitation seen as a process 171 stepMaxProcess = new IORTStepMax(); 172 173 auto particleIterator=GetParticleIterator(); 174 particleIterator->reset(); 175 while ((*particleIterator)()){ 176 G4ParticleDefinition* particle = particleIterator->value(); 177 G4ProcessManager* pmanager = particle->GetProcessManager(); 178 179 if (stepMaxProcess->IsApplicable(*particle) && pmanager) 180 { 181 pmanager ->AddDiscreteProcess(stepMaxProcess); 182 } 183 } 184 } 185 186 void IORTPhysicsList::SetCutForGamma(G4double cut) 187 { 188 cutForGamma = cut; 189 SetParticleCuts(cutForGamma, G4Gamma::Gamma()); 190 } 191 192 void IORTPhysicsList::SetCutForElectron(G4double cut) 193 { 194 cutForElectron = cut; 195 SetParticleCuts(cutForElectron, G4Electron::Electron()); 196 } 197 198 void IORTPhysicsList::SetCutForPositron(G4double cut) 199 { 200 cutForPositron = cut; 201 SetParticleCuts(cutForPositron, G4Positron::Positron()); 202 } 203 204 void IORTPhysicsList::SetDetectorCut(G4double cut) 205 { 206 G4String regionName = "DetectorLog"; 207 G4Region* region = G4RegionStore::GetInstance()->GetRegion(regionName); 208 209 G4ProductionCuts* cuts = new G4ProductionCuts ; 210 cuts -> SetProductionCut(cut,"gamma"); 211 cuts -> SetProductionCut(cut,"e-"); 212 cuts -> SetProductionCut(cut,"e+"); 213 region -> SetProductionCuts(cuts); 214 } 215 216