ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimPhysicsList.cc
Go to the documentation of this file.
1 // - AUTHOR: Hector Alvarez-Pol 11/2004
2 /******************************************************************
3  * Copyright (C) 2005-2016, Hector Alvarez-Pol *
4  * All rights reserved. *
5  * *
6  * License according to GNU LESSER GPL (see lgpl-3.0.txt). *
7  * For the list of contributors see CREDITS. *
8  ******************************************************************/
9 //////////////////////////////////////////////////////////////////
10 /// \class ActarSimPhysicsList
11 /// Physics List
12 /////////////////////////////////////////////////////////////////
13 
14 #include "ActarSimPhysicsList.hh"
16 
17 #include "G4EmStandardPhysics.hh"
18 #include "G4EmStandardPhysics_option1.hh"
19 #include "G4EmStandardPhysics_option2.hh"
20 #include "G4EmStandardPhysics_option3.hh"
21 #include "G4EmStandardPhysics_option4.hh"
22 #include "G4EmLivermorePhysics.hh"
23 #include "G4EmPenelopePhysics.hh"
24 #include "G4DecayPhysics.hh"
25 #include "G4HadronElasticPhysics.hh"
26 #include "G4HadronInelasticQBBC.hh"
27 #include "G4IonBinaryCascadePhysics.hh"
28 #include "G4EmExtraPhysics.hh"
29 #include "G4StoppingPhysics.hh"
30 
31 #include "PhysListEmStandard.hh"
32 #include "PhysListEmStandardWVI.hh"
33 #include "PhysListEmStandardSS.hh"
34 #include "PhysListEmStandardGS.hh"
36 
37 //#include "ActarSimParticlesBuilder.hh"
39 
40 #include "G4UnitsTable.hh"
41 #include "G4LossTableManager.hh"
42 #include "G4EmProcessOptions.hh"
43 
44 #include "G4PhysicalConstants.hh"
45 #include "G4SystemOfUnits.hh"
46 
47 #include "G4EmConfigurator.hh"
48 
49 #include "G4IonFluctuations.hh"
50 #include "G4IonParametrisedLossModel.hh"
51 #include "G4UniversalFluctuation.hh"
52 
53 #include "G4BraggIonGasModel.hh"
54 #include "G4BetheBlochIonGasModel.hh"
55 
56 #include "G4IonPhysics.hh"
57 
58 //////////////////////////////////////////////////////////////////
59 /// Constructor. Initializing values
60 ActarSimPhysicsList::ActarSimPhysicsList(): G4VModularPhysicsList(){
61 
62  emBuilderIsRegisted = false;
63  stepLimiterIsRegisted = false;
64  helIsRegisted = false;
65  bicIsRegisted = false;
66  ionIsRegisted = false;
67  gnucIsRegisted = false;
68  gasIsRegisted = false;
69  stopIsRegisted = false;
70  verbose = 0;
71  G4LossTableManager::Instance()->SetVerbose(verbose);
72  //G4LossTableManager::Instance();
73  defaultCutValue = 1.*mm;
74  cutForGamma = defaultCutValue;
75  cutForElectron = defaultCutValue;
76  cutForPositron = defaultCutValue;
77 
79 
80  // EM physics
81  //emPhysicsList = new PhysListEmStandard("local");
82  //emPhysicsList = new G4EmStandardPhysics(1);
83 
84  // Add Physics builders
85  RegisterPhysics(new G4DecayPhysics());
86  //RegisterPhysics(new ActarSimParticlesBuilder());
88 }
89 
90 //////////////////////////////////////////////////////////////////
91 /// Destructor. Nothing to do
93  delete emPhysicsList;
94  delete pMessenger;
95 }
96 
97 //////////////////////////////////////////////////////////////////
98 /// Registering the physics processes
99 void ActarSimPhysicsList::AddPhysicsList(const G4String& name){
100  if(verbose > 0) {
101  G4cout << "Add Physics <" << name
102  << "> emBuilderIsRegisted= " << emBuilderIsRegisted
103  << G4endl;
104  }
105  if ((name == "emstandard") && !emBuilderIsRegisted) {
106  RegisterPhysics(new G4EmStandardPhysics(1));
107  emBuilderIsRegisted = true;
108  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
109  } else if (name == "local" && !emBuilderIsRegisted) {
110  emPhysicsList = new PhysListEmStandard(name);
111  emBuilderIsRegisted = true;
112  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
113  } else if (name == "emstandard_opt1" && !emBuilderIsRegisted) {
114  RegisterPhysics(new G4EmStandardPhysics_option1());
115  emBuilderIsRegisted = true;
116  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
117  } else if (name == "emstandard_opt2" && !emBuilderIsRegisted) {
118  RegisterPhysics(new G4EmStandardPhysics_option2());
119  emBuilderIsRegisted = true;
120  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
121  } else if (name == "emstandard_opt3" && !emBuilderIsRegisted) {
122  RegisterPhysics(new G4EmStandardPhysics_option3());
123  emBuilderIsRegisted = true;
124  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
125  } else if (name == "emstandard_opt4" && !emBuilderIsRegisted) {
126  RegisterPhysics(new G4EmStandardPhysics_option4());
127  emBuilderIsRegisted = true;
128  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
129  } else if (name == "emlivermore" && !emBuilderIsRegisted) {
130  RegisterPhysics(new G4EmLivermorePhysics());
131  emBuilderIsRegisted = true;
132  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
133  } else if (name == "empenelope" && !emBuilderIsRegisted) {
134  RegisterPhysics(new G4EmPenelopePhysics());
135  emBuilderIsRegisted = true;
136  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
137  } else if (name == "standardSS" && !emBuilderIsRegisted) {
139  emBuilderIsRegisted = true;
140  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
141  } else if (name == "standardWVI" && !emBuilderIsRegisted) {
143  emBuilderIsRegisted = true;
144  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
145  } else if (name == "standardGS" && !emBuilderIsRegisted) {
147  emBuilderIsRegisted = true;
148  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
149  }
150 
151  // Register Low Energy processes for protons and ions
152  // Stopping power parameterisation: ICRU49 (default model)
153  // Register Standard processes for protons and ions
154 
155  else if (name == "ion-standard") {
156  if (ionIsRegisted)
157  G4cout << "ActarSimPhysicsList::AddPhysicsList: " << name
158  << " cannot be registered ---- ion List already existing"
159  << G4endl;
160  else {
161  RegisterPhysics( new HadrontherapyIonStandard(name) );
162  ionIsRegisted = true;
163  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
164  }
165  } else if (name == "ionGasModels" && !gasIsRegisted && emBuilderIsRegisted) {
166  //AddPhysicsList("emstandard");
167  AddIonGasModels();
168  gasIsRegisted = true;
169  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
170  } else if (name == "elastic" && !helIsRegisted && emBuilderIsRegisted) {
171  RegisterPhysics(new G4HadronElasticPhysics());
172  helIsRegisted = true;
173  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
174  } else if (name == "binary" && !bicIsRegisted && emBuilderIsRegisted) {
175  RegisterPhysics(new G4HadronInelasticQBBC());
176  bicIsRegisted = true;
177  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
178  } else if (name == "binary_ion" && !ionIsRegisted && emBuilderIsRegisted) {
179  RegisterPhysics(new G4IonBinaryCascadePhysics());
180  ionIsRegisted = true;
181  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
182  } else if (name == "gamma_nuc" && !gnucIsRegisted && emBuilderIsRegisted) {
183  RegisterPhysics(new G4EmExtraPhysics());
184  gnucIsRegisted = true;
185  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
186  } else if (name == "stopping" && !stopIsRegisted && emBuilderIsRegisted) {
187  RegisterPhysics(new G4StoppingPhysics());
188  stopIsRegisted = true;
189  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">" << G4endl;
190  } else if(!emBuilderIsRegisted) {
191  G4cout << "PhysicsList::AddPhysicsList <" << name << ">"
192  << " fail - EM physics should be registered first " << G4endl;
193  } else {
194  G4cout << "ActarSimPhysicsList::AddPhysicsList <" << name << ">"
195  << " fail - module is already regitered or is unknown " << G4endl;
196  }
197 }
198 
199 // Bosons
200 #include "G4ChargedGeantino.hh"
201 #include "G4Geantino.hh"
202 #include "G4Gamma.hh"
203 #include "G4OpticalPhoton.hh"
204 
205 // leptons
206 #include "G4Electron.hh"
207 #include "G4Positron.hh"
208 #include "G4NeutrinoE.hh"
209 #include "G4AntiNeutrinoE.hh"
210 #include "G4MuonPlus.hh"
211 #include "G4MuonMinus.hh"
212 #include "G4NeutrinoMu.hh"
213 #include "G4AntiNeutrinoMu.hh"
214 
215 // Hadrons
216 #include "G4MesonConstructor.hh"
217 #include "G4BaryonConstructor.hh"
218 #include "G4IonConstructor.hh"
219 
220 //////////////////////////////////////////////////////////////////
221 /// Construct Particles
223 
224  if(verbose > 0)
225  G4cout << "Construct Particles" << G4endl;
226 
227  // pseudo-particles
228  G4Geantino::GeantinoDefinition();
229  G4ChargedGeantino::ChargedGeantinoDefinition();
230 
231  // gamma
232  G4Gamma::GammaDefinition();
233 
234  // optical photon
235  G4OpticalPhoton::OpticalPhotonDefinition();
236 
237  // leptons
238  G4Electron::ElectronDefinition();
239  G4Positron::PositronDefinition();
240  G4MuonPlus::MuonPlusDefinition();
241  G4MuonMinus::MuonMinusDefinition();
242 
243  G4NeutrinoE::NeutrinoEDefinition();
244  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
245  G4NeutrinoMu::NeutrinoMuDefinition();
246  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
247 
248  // mesons
249  G4MesonConstructor mConstructor;
250  mConstructor.ConstructParticle();
251 
252  // barions
253  G4BaryonConstructor bConstructor;
254  bConstructor.ConstructParticle();
255 
256  // ions
257  G4IonConstructor iConstructor;
258  iConstructor.ConstructParticle();
259 
260  //G4VModularPhysicsList::ConstructParticle();
261 }
262 
263 //////////////////////////////////////////////////////////////////
264 /// Construct Processes
266 
267  if(verbose > 0)
268  G4cout << "Construct Processes" << G4endl;
269 
270  if(!emBuilderIsRegisted) { AddPhysicsList("standard"); }
271  if(!emPhysicsList) { G4VModularPhysicsList::ConstructProcess(); }
272  else{
273  AddTransportation();
274  emPhysicsList->ConstructProcess();
275  }
276  // Define energy interval for loss processes
277  G4EmProcessOptions emOptions;
278  emOptions.SetMinEnergy(0.1*keV);
279  emOptions.SetMaxEnergy(100.*GeV);
280  emOptions.SetDEDXBinning(90);
281  emOptions.SetLambdaBinning(90);
282  //emOptions.SetBuildPreciseRange(false);
283  //emOptions.SetApplyCuts(true);
284  //emOptions.SetVerbose(0);
285 }
286 
287 //////////////////////////////////////////////////////////////////
288 /// Sets the cut on the physics interaction calculations.
289 /// "G4VUserPhysicsList::SetCutsWithDefault" method sets
290 /// the default cut value for all particle types
292  SetCutValue(cutForGamma, "gamma");
293  SetCutValue(cutForElectron, "e-");
294  SetCutValue(cutForPositron, "e+");
295 
296  if (verbose>0) DumpCutValuesTable();
297 }
298 
299 //////////////////////////////////////////////////////////////////
300 /// Selecting verbosity
302  verbose = val;
303 }
304 
305 //////////////////////////////////////////////////////////////////
306 /// Setting cut value for the gammas
308  cutForGamma = cut;
309  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
310 }
311 
312 //////////////////////////////////////////////////////////////////
313 /// Setting cut value for the electron
315  cutForElectron = cut;
316  SetParticleCuts(cutForElectron, G4Electron::Electron());
317 }
318 
319 //////////////////////////////////////////////////////////////////
320 /// Setting cut value for the positron
322  cutForPositron = cut;
323  SetParticleCuts(cutForPositron, G4Positron::Positron());
324 }
325 
326 //////////////////////////////////////////////////////////////////
327 /// Adds the ion gas model
329  G4EmConfigurator* em_config = G4LossTableManager::Instance()->EmConfigurator();
330  theParticleIterator->reset();
331  while ((*theParticleIterator)()) {
332  G4ParticleDefinition* particle = theParticleIterator->value();
333  G4String partname = particle->GetParticleName();
334  if(partname == "alpha" || partname == "He3" || partname == "GenericIon") {
335  G4BraggIonGasModel* mod1 = new G4BraggIonGasModel();
336  G4BetheBlochIonGasModel* mod2 = new G4BetheBlochIonGasModel();
337  G4double eth = 2.*MeV*particle->GetPDGMass()/proton_mass_c2;
338  em_config->SetExtraEmModel(partname,"ionIoni",mod1,"",0.0,eth,
339  new G4IonFluctuations());
340  em_config->SetExtraEmModel(partname,"ionIoni",mod2,"",eth,100*TeV,
341  new G4UniversalFluctuation());
342  }
343  }
344 }
G4bool stopIsRegisted
Register control parameter for library.
G4int verbose
Verbose control.
G4VPhysicsConstructor * emPhysicsList
Pointer to Physics list.
void SetVerbose(G4int val)
Selecting verbosity.
G4bool bicIsRegisted
Register control parameter for library.
ActarSimPhysicsList()
Constructor. Initializing values.
void AddIonGasModels()
Adds the ion gas model.
G4double cutForPositron
Cut energy parameter for gammas.
G4bool emBuilderIsRegisted
Register control parameter for library.
void SetCutForElectron(G4double)
Setting cut value for the electron.
G4double cutForGamma
Cut energy parameter for gammas.
G4double cutForElectron
Cut energy parameter for gammas.
void ConstructParticle()
Construct Particles.
G4bool ionIsRegisted
Register control parameter for library.
ActarSimStepLimiterBuilder * steplimiter
Pointer to step limiter.
G4bool gasIsRegisted
Register control parameter for library.
G4bool gnucIsRegisted
Register control parameter for library.
void ConstructProcess()
Construct Processes.
void AddPhysicsList(const G4String &)
Registering the physics processes.
G4bool stepLimiterIsRegisted
Register control parameter for library.
ActarSimPhysicsListMessenger * pMessenger
Pointer to messenger.
void SetCutForGamma(G4double)
Setting cut value for the gammas.
G4bool helIsRegisted
Register control parameter for library.
void SetCutForPositron(G4double)
Setting cut value for the positron.
~ActarSimPhysicsList()
Destructor. Nothing to do.