Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HadrontherapyPhysicsList.cc
Go to the documentation of this file.
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 Hadrontherapy, a Geant4-based application
27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
28 //
29 // Visit the Hadrontherapy web site (http://www.lns.infn.it/link/Hadrontherapy) to request
30 // the *COMPLETE* version of this program, together with its documentation;
31 // Hadrontherapy (both basic and full version) are supported by the Italian INFN
32 // Institute in the framework of the MC-INFN Group
33 //
34 //
35 // Hadrontherapy Users are recommended to use the prepared macro files in order to activate the
36 // most appropriate physics for hadrontherapy applications.
37 // As one can easily see the physics we suggest is contained in the
38 // 'QGSP_BIC_EMY' list adding to the decay processes (activated as default).
39 //
40 //
41 // ****** SUGGESTED PHYSICS *********
42 //
43 // AT MOMENT, IF ACCURATE RESULTS ARE NEEDED, WE STRONGLY RECOMMEND:
44 // 1. The use of the macro 'hadron_therapy.mac', that is connected with the HadrontherapyPhysicsList.cc file.
45 // 2. the QGSP_BIC_EMY Reference Physics Lists (define the PHYSLIST eviroment variable):
46 // export PHYSLIST=QGSP_BIC_EMY
47 // User must considered that, in this second case, radioactive processes are not activated
48 
49 #include "G4SystemOfUnits.hh"
50 #include "G4RunManager.hh"
51 #include "G4Region.hh"
52 #include "G4RegionStore.hh"
55 #include "HadrontherapyStepMax.hh"
56 #include "G4PhysListFactory.hh"
57 #include "G4VPhysicsConstructor.hh"
58 
59 // Local physic directly implemented in the Hadronthrapy directory
60 #include "LocalIonIonInelasticPhysic.hh" // Physic dedicated to the ion-ion inelastic processes
61 
62 // Physic lists (contained inside the Geant4 source code, in the 'physicslists folder')
63 #include "HadronPhysicsQGSP_BIC.hh"
65 #include "G4EmLivermorePhysics.hh"
66 #include "G4EmPenelopePhysics.hh"
67 #include "G4EmExtraPhysics.hh"
68 #include "G4StoppingPhysics.hh"
69 #include "G4DecayPhysics.hh"
74 #include "G4DecayPhysics.hh"
75 #include "G4NeutronTrackingCut.hh"
76 #include "G4LossTableManager.hh"
77 #include "G4UnitsTable.hh"
78 #include "G4ProcessManager.hh"
79 #include "G4IonFluctuations.hh"
81 #include "G4EmProcessOptions.hh"
82 
85 {
87  defaultCutValue = 1.*mm;
88  cutForGamma = defaultCutValue;
89  cutForElectron = defaultCutValue;
90  cutForPositron = defaultCutValue;
91 
92  helIsRegistered = false;
93  bicIsRegistered = false;
94  biciIsRegistered = false;
95  locIonIonInelasticIsRegistered = false;
96  radioactiveDecayIsRegistered = false;
97 
98  stepMaxProcess = 0;
99 
100  pMessenger = new HadrontherapyPhysicsListMessenger(this);
101 
102  SetVerboseLevel(1);
103 
104  // ****** Definition of some defaults for the physics *****
105  // ****** in case no physics is called by the macro file *****
106  // EM physics
107  emPhysicsList = new G4EmStandardPhysics_option3(1);
108  emName = G4String("emstandard_opt3");
109 
110  // Decay physics and all particles
111  decPhysicsList = new G4DecayPhysics();
112  raddecayList = new G4RadioactiveDecayPhysics();
113 }
114 
117 {
118  delete pMessenger;
119  delete emPhysicsList;
120  delete decPhysicsList;
121  delete raddecayList;
122 
123  for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];}
124 }
125 
128 {
129  decPhysicsList->ConstructParticle();
130 }
131 
134 {
135  // transportation
137 
138  // electromagnetic physics list
139  emPhysicsList->ConstructProcess();
140  em_config.AddModels();
141 
142  // decay physics list
143  decPhysicsList->ConstructProcess();
144  raddecayList->ConstructProcess();
145 
146  // hadronic physics lists
147  for(size_t i=0; i<hadronPhys.size(); i++) {
148  hadronPhys[i] -> ConstructProcess();
149  }
150 
151  // step limitation (as a full process)
152  //
153  AddStepMax();
154 }
155 
158 {
159 
160  if (verboseLevel>1) {
161  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
162  }
163  if (name == emName) return;
164 
166  // ELECTROMAGNETIC MODELS
168  if (name == "standard_opt3") {
169  emName = name;
170  delete emPhysicsList;
171  emPhysicsList = new G4EmStandardPhysics_option3();
172  G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
173  G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl;
174 
175  } else if (name == "LowE_Livermore") {
176  emName = name;
177  delete emPhysicsList;
178  emPhysicsList = new G4EmLivermorePhysics();
179  G4RunManager::GetRunManager()-> PhysicsHasBeenModified();
180  G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl;
181 
182  } else if (name == "LowE_Penelope") {
183  emName = name;
184  delete emPhysicsList;
185  emPhysicsList = new G4EmPenelopePhysics();
186  G4RunManager::GetRunManager()-> PhysicsHasBeenModified();
187  G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmPenelopePhysics" << G4endl;
188 
189  } else if (name == "local_ion_ion_inelastic") {
190  hadronPhys.push_back(new LocalIonIonInelasticPhysic());
191  locIonIonInelasticIsRegistered = true;
192 
193  } else if (name == "QGSP_BIC_EMY") {
194  AddPhysicsList("emstandard_opt3");
195  hadronPhys.push_back( new HadronPhysicsQGSP_BIC());
196  hadronPhys.push_back( new G4EmExtraPhysics());
197  hadronPhys.push_back( new G4HadronElasticPhysics());
198  hadronPhys.push_back( new G4StoppingPhysics());
199  hadronPhys.push_back( new G4IonBinaryCascadePhysics());
200  hadronPhys.push_back( new G4NeutronTrackingCut());
201 
202  } else {
203  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
204  << " is not defined"
205  << G4endl;
206  }
207 }
208 
211 {
212  // Step limitation seen as a process
213  stepMaxProcess = new HadrontherapyStepMax();
214 
216  while ((*theParticleIterator)()){
218  G4ProcessManager* pmanager = particle->GetProcessManager();
219 
220  if (stepMaxProcess->IsApplicable(*particle) && pmanager)
221  {
222  pmanager ->AddDiscreteProcess(stepMaxProcess);
223  }
224  }
225 }
226 
229 {
230 
231  if (verboseLevel >0){
232  G4cout << "PhysicsList::SetCuts:";
233  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
234  }
235 
236  // set cut values for gamma at first and for e- second and next for e+,
237  // because some processes for e+/e- need cut values for gamma
238  SetCutValue(cutForGamma, "gamma");
239  SetCutValue(cutForElectron, "e-");
240  SetCutValue(cutForPositron, "e+");
241 
242  // Set cuts for detector
245 }
246 
249 {
250  cutForGamma = cut;
251  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
252 }
253 
256 {
257  cutForElectron = cut;
258  SetParticleCuts(cutForElectron, G4Electron::Electron());
259 }
260 
263 {
264  cutForPositron = cut;
265  SetParticleCuts(cutForPositron, G4Positron::Positron());
266 }
267 
269 {
270  G4String regionName = "DetectorLog";
271  G4Region* region = G4RegionStore::GetInstance()->GetRegion(regionName);
272 
273  G4ProductionCuts* cuts = new G4ProductionCuts ;
274  cuts -> SetProductionCut(cut,G4ProductionCuts::GetIndex("gamma"));
275  cuts -> SetProductionCut(cut,G4ProductionCuts::GetIndex("e-"));
276  cuts -> SetProductionCut(cut,G4ProductionCuts::GetIndex("e+"));
277  region -> SetProductionCuts(cuts);
278 }
279