source: trunk/examples/advanced/hadrontherapy/src/HadrontherapyPhysicsList.cc @ 1253

Last change on this file since 1253 was 1230, checked in by garnier, 15 years ago

update to geant4.9.3

File size: 12.6 KB
Line 
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// HadrontherapyPhysicsList.cc
27// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
28
29// This class provides all the physic models that can be activated inside Hadrontherapy;
30// Each model can be setted via macro commands;
31// Inside Hadrontherapy the models can be activate with three different complementar methods:
32//
33// 1. Use of the *Packages*.
34//    Packages (that are contained inside the
35//    Geant4 distribution at $G4INSTALL/source/physics_lists/lists) provide a full set
36//    of models (both electromagnetic and hadronic).
37//    The User can use this method simply add the line /physic/addPackage <nameOfPackage>
38//    in his/her macro file. No other action is required.
39//    For Hadrontherapy applications we suggest the use of the QGSP_BIC package
40//    for proton beams. The same can be used
41//    also for ligth ion beam.
42//    Example of use of package can be found in the packageQGSP_BIC.mac file.
43//
44// 2. Use of the *Physic Lists*.
45//    Physic lists are also already ready to use inside the Geant4 distribution
46//    ($G4INSTALL/source/physics_lists/builders). To use them the simple
47//    /physic/addPhysics <nameOfPhysicList> command must be used in the macro.
48//    In Hadrontherapy we provide physics list to activate Electromagnetic,
49//    Hadronic elastic and Hadronic inelastic models.
50//
51//    For Hadrontherapy we suggest the use of:
52//
53//    /physic/addPhysic/emstandard_option3 (electromagnetic model)
54//    /physic/addPhysic/QElastic (hadronic elastic model)
55//    /physic/addPhysic/binary (hadronic inelastic models for proton and neutrons)
56//    /physic/addPhysic/binary_ion (hadronic inelastic models for ions)
57//
58//    Example of the use of physics lists can be found in the macro files included in the
59//    'macro' folder .
60//
61// 3. Use of a *local* physics. In this case the models are implemented in local files
62//    contained in the Hadrontherapy folder. The use of local physic is recommended
63//    to more expert Users.
64//    We provide as local, only the LocalStandardICRU73EmPhysic.cc (an Elecromagnetic
65//    implementation containing the new ICRU73 data table for ions stopping powers)
66//    and the LocalIonIonInelasticPhysic.cc (physic list to use for the ion-ion interaction
67//    case)
68//    The *local* physics can be activated with the same /physic/addPhysic <nameOfPhysic> command;
69//
70//    While Packages approch must be used exclusively, Physics List and Local physics can
71//    be activated, if necessary, contemporaneously in the same simulation run.
72//
73//    AT MOMENT, IF ACCURATE RESULTS ARE NEDED, WE STRONGLY RECOMMEND THE USE OF THE MACROS:
74//    proton_therapy.mac: use of the built-in Geant4 physics list for proton beams)
75//    ion_therapy.mac   : use of mixed combination of native Geant4 physic lists
76//                        and local physic for ion-ion enelastic processes)
77
78#include "HadrontherapyPhysicsList.hh"
79#include "HadrontherapyPhysicsListMessenger.hh"
80#include "HadrontherapyStepMax.hh"
81#include "G4PhysListFactory.hh"
82#include "G4VPhysicsConstructor.hh"
83
84// Local physic directly implemented in the Hadronthrapy directory
85#include "LocalIonIonInelasticPhysic.hh"             // Physic dedicated to the ion-ion inelastic processes
86#include "LocalINCLIonIonInelasticPhysic.hh"         // Physic dedicated to the ion-ion inelastic processes using INCL/ABLA
87
88// Physic lists (contained inside the Geant4 distribution)
89#include "G4EmStandardPhysics_option3.hh"
90#include "G4EmLivermorePhysics.hh"
91#include "G4EmPenelopePhysics.hh"
92#include "G4DecayPhysics.hh"
93#include "G4HadronElasticPhysics.hh"
94#include "G4HadronDElasticPhysics.hh"
95#include "G4HadronHElasticPhysics.hh"
96#include "G4HadronQElasticPhysics.hh"
97#include "G4HadronInelasticQBBC.hh"
98#include "G4IonBinaryCascadePhysics.hh"
99#include "G4Decay.hh"
100
101#include "G4LossTableManager.hh"
102#include "G4UnitsTable.hh"
103#include "G4ProcessManager.hh"
104
105#include "G4IonFluctuations.hh"
106#include "G4IonParametrisedLossModel.hh"
107#include "G4EmProcessOptions.hh"
108
109#include "G4RadioactiveDecayPhysics.hh"
110
111/////////////////////////////////////////////////////////////////////////////
112HadrontherapyPhysicsList::HadrontherapyPhysicsList() : G4VModularPhysicsList()
113{
114  G4LossTableManager::Instance();
115  defaultCutValue = 1.*mm;
116  cutForGamma     = defaultCutValue;
117  cutForElectron  = defaultCutValue;
118  cutForPositron  = defaultCutValue;
119
120  helIsRegisted  = false;
121  bicIsRegisted  = false;
122  biciIsRegisted = false;
123  locIonIonInelasticIsRegistered = false;
124  radioactiveDecayIsRegisted = false;
125
126  stepMaxProcess  = 0;
127
128  pMessenger = new HadrontherapyPhysicsListMessenger(this);
129
130  SetVerboseLevel(1);
131
132  // EM physics
133  emPhysicsList = new G4EmStandardPhysics_option3(1);
134  emName = G4String("emstandard_opt3");
135
136  // Deacy physics and all particles
137  decPhysicsList = new G4DecayPhysics();
138}
139
140/////////////////////////////////////////////////////////////////////////////
141HadrontherapyPhysicsList::~HadrontherapyPhysicsList()
142{
143  delete pMessenger;
144  delete emPhysicsList;
145  delete decPhysicsList;
146  for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];}
147}
148
149/////////////////////////////////////////////////////////////////////////////
150void HadrontherapyPhysicsList::AddPackage(const G4String& name)
151{
152  G4PhysListFactory factory;
153  G4VModularPhysicsList* phys =factory.GetReferencePhysList(name);
154  G4int i=0;
155  const G4VPhysicsConstructor* elem= phys->GetPhysics(i);
156  G4VPhysicsConstructor* tmp = const_cast<G4VPhysicsConstructor*> (elem);
157  while (elem !=0)
158        {
159          RegisterPhysics(tmp);
160          elem= phys->GetPhysics(++i) ;
161          tmp = const_cast<G4VPhysicsConstructor*> (elem);
162        }
163}
164
165/////////////////////////////////////////////////////////////////////////////
166void HadrontherapyPhysicsList::ConstructParticle()
167{
168  decPhysicsList->ConstructParticle();
169}
170
171/////////////////////////////////////////////////////////////////////////////
172void HadrontherapyPhysicsList::ConstructProcess()
173{
174  // transportation
175  //
176  AddTransportation();
177
178  // electromagnetic physics list
179  //
180  emPhysicsList->ConstructProcess();
181  em_config.AddModels();
182
183  // decay physics list
184  //
185  decPhysicsList->ConstructProcess();
186
187  // hadronic physics lists
188  for(size_t i=0; i<hadronPhys.size(); i++) {
189    hadronPhys[i]->ConstructProcess();
190  }
191
192  // step limitation (as a full process)
193  //
194  AddStepMax();
195}
196
197/////////////////////////////////////////////////////////////////////////////
198void HadrontherapyPhysicsList::AddPhysicsList(const G4String& name)
199{
200
201  if (verboseLevel>1) {
202    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
203  }
204  if (name == emName) return;
205
206  /////////////////////////////////////////////////////////////////////////////
207  //   ELECTROMAGNETIC MODELS
208  /////////////////////////////////////////////////////////////////////////////
209
210  if (name == "standard_opt3") {
211    emName = name;
212    delete emPhysicsList;
213    emPhysicsList = new G4EmStandardPhysics_option3();
214    G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl;
215
216  } else if (name == "LowE_Livermore") {
217    emName = name;
218    delete emPhysicsList;
219    emPhysicsList = new G4EmLivermorePhysics();
220    G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl;
221
222  } else if (name == "LowE_Penelope") {
223    emName = name;
224    delete emPhysicsList;
225    emPhysicsList = new G4EmPenelopePhysics();
226    G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl;
227
228    /////////////////////////////////////////////////////////////////////////////
229    //   HADRONIC MODELS
230    /////////////////////////////////////////////////////////////////////////////
231  } else if (name == "elastic" && !helIsRegisted) {
232    G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronElasticPhysics()" << G4endl;
233    hadronPhys.push_back( new G4HadronElasticPhysics());
234    helIsRegisted = true;
235
236  } else if (name == "DElastic" && !helIsRegisted) {
237    hadronPhys.push_back( new G4HadronDElasticPhysics());
238    helIsRegisted = true;
239
240  } else if (name == "HElastic" && !helIsRegisted) {
241    hadronPhys.push_back( new G4HadronHElasticPhysics());
242    helIsRegisted = true;
243
244  } else if (name == "QElastic" && !helIsRegisted) {
245    hadronPhys.push_back( new G4HadronQElasticPhysics());
246    helIsRegisted = true;
247
248  } else if (name == "binary" && !bicIsRegisted) {
249    hadronPhys.push_back(new G4HadronInelasticQBBC());
250    bicIsRegisted = true;
251    G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronInelasticQBBC()" << G4endl;
252
253  } else if (name == "binary_ion" && !biciIsRegisted) {
254    hadronPhys.push_back(new G4IonBinaryCascadePhysics());
255    biciIsRegisted = true;
256
257  } else if (name == "local_ion_ion_inelastic" && !locIonIonInelasticIsRegistered) {
258    hadronPhys.push_back(new LocalIonIonInelasticPhysic());
259    locIonIonInelasticIsRegistered = true;
260
261  } else if (name == "local_incl_ion_ion_inelastic" && !locIonIonInelasticIsRegistered) {
262    hadronPhys.push_back(new LocalINCLIonIonInelasticPhysic());
263    locIonIonInelasticIsRegistered = true;
264
265  } else if (name == "radioactive_decay" && !radioactiveDecayIsRegisted ) {
266    hadronPhys.push_back(new G4RadioactiveDecayPhysics());
267    radioactiveDecayIsRegisted = true;
268
269  } else {
270
271    G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
272           << " is not defined"
273           << G4endl;
274  }
275}
276
277/////////////////////////////////////////////////////////////////////////////
278void HadrontherapyPhysicsList::AddStepMax()
279{
280  // Step limitation seen as a process
281  stepMaxProcess = new HadrontherapyStepMax();
282
283  theParticleIterator->reset();
284  while ((*theParticleIterator)()){
285    G4ParticleDefinition* particle = theParticleIterator->value();
286    G4ProcessManager* pmanager = particle->GetProcessManager();
287
288    if (stepMaxProcess->IsApplicable(*particle) && pmanager)
289      {
290        pmanager ->AddDiscreteProcess(stepMaxProcess);
291      }
292  }
293}
294
295/////////////////////////////////////////////////////////////////////////////
296void HadrontherapyPhysicsList::SetCuts()
297{
298
299  if (verboseLevel >0){
300    G4cout << "PhysicsList::SetCuts:";
301    G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
302  }
303
304  // set cut values for gamma at first and for e- second and next for e+,
305  // because some processes for e+/e- need cut values for gamma
306  SetCutValue(cutForGamma, "gamma");
307  SetCutValue(cutForElectron, "e-");
308  SetCutValue(cutForPositron, "e+");
309
310  if (verboseLevel>0) DumpCutValuesTable();
311}
312
313/////////////////////////////////////////////////////////////////////////////
314void HadrontherapyPhysicsList::SetCutForGamma(G4double cut)
315{
316  cutForGamma = cut;
317  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
318}
319
320/////////////////////////////////////////////////////////////////////////////
321void HadrontherapyPhysicsList::SetCutForElectron(G4double cut)
322{
323  cutForElectron = cut;
324  SetParticleCuts(cutForElectron, G4Electron::Electron());
325}
326
327/////////////////////////////////////////////////////////////////////////////
328void HadrontherapyPhysicsList::SetCutForPositron(G4double cut)
329{
330  cutForPositron = cut;
331  SetParticleCuts(cutForPositron, G4Positron::Positron());
332}
Note: See TracBrowser for help on using the repository browser.