Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ML2PhysicsList.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 // The code was written by :
27 // ^Claudio Andenna claudio.andenna@ispesl.it, claudio.andenna@iss.infn.it
28 // *Barbara Caccia barbara.caccia@iss.it
29 // with the support of Pablo Cirrone (LNS, INFN Catania Italy)
30 // with the contribute of Alessandro Occhigrossi*
31 //
32 // ^INAIL DIPIA - ex ISPESL and INFN Roma, gruppo collegato Sanità, Italy
33 // *Istituto Superiore di Sanità and INFN Roma, gruppo collegato Sanità, Italy
34 // Viale Regina Elena 299, 00161 Roma (Italy)
35 // tel (39) 06 49902246
36 // fax (39) 06 49387075
37 //
38 // more information:
39 // http://g4advancedexamples.lngs.infn.it/Examples/medical-linac
40 //
41 //*******************************************************//
42 //
43 // This class provides all the physic models that can be activated inside ML2;
44 // Each model can be setted via macro commands;
45 // Inside ML2 the models can be activate with three different complementar methods:
46 //
47 // 1. Use of the *Packages*.
48 // Packages (that are contained inside the
49 // Geant4 distribution at $G4INSTALL/source/physics_lists/lists) provide a full set
50 // of models (both electromagnetic and hadronic).
51 // The User can use this method simply add the line /physic/addPackage <nameOfPackage>
52 // in his/her macro file. No other action is required.
53 // For ML2 applications we suggest the use of the QGSP_BIC package
54 // for proton beams. The same can be used
55 // also for ligth ion beam.
56 //
57 //
58 // 2. Use of the *Physic Lists*.
59 // Physic lists are also already ready to use inside the Geant4 distribution
60 // ($G4INSTALL/source/physics_lists/builders). To use them the simple
61 // /physic/addPhysics <nameOfPhysicList> command must be used in the macro.
62 // In ML2 we provide physics list to activate Electromagnetic,
63 // Hadronic elastic and Hadronic inelastic models.
64 //
65 // For ML2 we suggest the use of:
66 //
67 // /physic/addPhysic/emstandard_option3 (electromagnetic model)
68 // /physic/addPhysic/QElastic (hadronic elastic model)
69 // /physic/addPhysic/binary (hadronic inelastic models for proton and neutrons)
70 // /physic/addPhysic/binary_ion (hadronic inelastic models for ions)
71 //
72 // Example of the use of physics lists can be found in the macro files
73 //
74 
75 #include "ML2PhysicsList.hh"
77 #include "ML2StepMax.hh"
78 #include "G4SystemOfUnits.hh"
79 #include "G4PhysListFactory.hh"
80 #include "G4VPhysicsConstructor.hh"
81 
82 // Physic lists (contained inside the Geant4 distribution)
84 #include "G4EmLivermorePhysics.hh"
85 #include "G4EmPenelopePhysics.hh"
86 #include "G4DecayPhysics.hh"
89 #include "G4HadronInelasticQBBC.hh"
91 #include "G4Decay.hh"
92 
93 #include "G4LossTableManager.hh"
94 #include "G4UnitsTable.hh"
95 #include "G4ProcessManager.hh"
96 
97 #include "G4IonFluctuations.hh"
99 #include "G4EmProcessOptions.hh"
100 
103 {
105  defaultCutValue = 1.*mm;
106  cutForGamma = defaultCutValue;
107  cutForElectron = defaultCutValue;
108  cutForPositron = defaultCutValue;
109 
110  helIsRegisted = false;
111  bicIsRegisted = false;
112  biciIsRegisted = false;
113  locIonIonInelasticIsRegistered = false;
114 
115  stepMaxProcess = 0;
116 
117  pMessenger = new ML2PhysicsListMessenger(this);
118 
119  SetVerboseLevel(1);
120 
121  // EM physics
122  emPhysicsList = new G4EmStandardPhysics_option3(1);
123  emName = G4String("emstandard_opt3");
124 
125 // emPhysicsList = new G4EmLivermorePhysics();
126 // emName = G4String("LowE_Livermore");
127 
128  // Deacy physics and all particles
129  decPhysicsList = new G4DecayPhysics();
130 }
131 
134 {
135  delete pMessenger;
136  delete emPhysicsList;
137  delete decPhysicsList;
138  for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];}
139 }
140 
143 {
144  G4PhysListFactory factory;
145  G4VModularPhysicsList* phys =factory.GetReferencePhysList(name);
146  G4int i=0;
147  const G4VPhysicsConstructor* elem= phys->GetPhysics(i);
148  G4VPhysicsConstructor* tmp = const_cast<G4VPhysicsConstructor*> (elem);
149  while (elem !=0)
150  {
151  RegisterPhysics(tmp);
152  elem= phys->GetPhysics(++i) ;
153  tmp = const_cast<G4VPhysicsConstructor*> (elem);
154  }
155  G4cout << "THE FOLLOWING PHYSICS PACKEGE LIST HAS BEEN ACTIVATED: "<<name<< G4endl;
156 }
157 
160 {
161  decPhysicsList->ConstructParticle();
162 }
163 
166 {
167  // transportation
168  //
170 
171  // electromagnetic physics list
172  //
173  emPhysicsList->ConstructProcess();
174  em_config.AddModels();
175 
176  // decay physics list
177  //
178  decPhysicsList->ConstructProcess();
179 
180  // hadronic physics lists
181  for(size_t i=0; i<hadronPhys.size(); i++) {
182  hadronPhys[i]->ConstructProcess();
183  }
184 
185  // step limitation (as a full process)
186  //
187  AddStepMax();
188 }
189 
192 {
193 
194  if (verboseLevel>1) {
195  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
196  }
197  if (name == emName) return;
198 
200  // ELECTROMAGNETIC MODELS
202 
203  if (name == "standard_opt3") {
204  emName = name;
205  delete emPhysicsList;
206  emPhysicsList = new G4EmStandardPhysics_option3();
207  G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl;
208 
209  } else if (name == "LowE_Livermore") {
210  emName = name;
211  delete emPhysicsList;
212  emPhysicsList = new G4EmLivermorePhysics();
213  G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl;
214 
215  } else if (name == "LowE_Penelope") {
216  emName = name;
217  delete emPhysicsList;
218  emPhysicsList = new G4EmPenelopePhysics();
219  G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl;
220 
222  // HADRONIC MODELS
224  } else if (name == "elastic" && !helIsRegisted) {
225  G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronElasticPhysics()" << G4endl;
226  hadronPhys.push_back( new G4HadronElasticPhysics());
227  helIsRegisted = true;
228 
229  } else if (name == "QElastic" && !helIsRegisted) {
230  hadronPhys.push_back( new G4HadronQElasticPhysics());
231  helIsRegisted = true;
232 
233  } else if (name == "binary" && !bicIsRegisted) {
234  hadronPhys.push_back(new G4HadronInelasticQBBC());
235  bicIsRegisted = true;
236  G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronInelasticQBBC()" << G4endl;
237 
238  } else if (name == "binary_ion" && !biciIsRegisted) {
239  hadronPhys.push_back(new G4IonBinaryCascadePhysics());
240  biciIsRegisted = true;
241 
242  } else {
243 
244  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
245  << " is not defined"
246  << G4endl;
247  }
248 }
249 
252 {
253  // Step limitation seen as a process
254  stepMaxProcess = new ML2StepMax();
255 
257  while ((*theParticleIterator)()){
259  G4ProcessManager* pmanager = particle->GetProcessManager();
260 
261  if (stepMaxProcess->IsApplicable(*particle) && pmanager)
262  {
263  pmanager ->AddDiscreteProcess(stepMaxProcess);
264  }
265  }
266 }
267 
270 {
271 
272  if (verboseLevel >0){
273  G4cout << "PhysicsList::SetCuts:";
274  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
275  }
276 
277  // set cut values for gamma at first and for e- second and next for e+,
278  // because some processes for e+/e- need cut values for gamma
279  SetCutValue(cutForGamma, "gamma");
280  SetCutValue(cutForElectron, "e-");
281  SetCutValue(cutForPositron, "e+");
282 
284 }
285 
288 {
289  cutForGamma = cut;
290  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
291 }
292 
295 {
296  cutForElectron = cut;
297  SetParticleCuts(cutForElectron, G4Electron::Electron());
298 }
299 
302 {
303  cutForPositron = cut;
304  SetParticleCuts(cutForPositron, G4Positron::Positron());
305 }
306 
307