Geant4  10.03.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/elastic (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"
88 #include "G4HadronInelasticQBBC.hh"
90 #include "G4Decay.hh"
91 
92 #include "G4LossTableManager.hh"
93 #include "G4UnitsTable.hh"
94 #include "G4ProcessManager.hh"
95 
96 #include "G4IonFluctuations.hh"
98 #include "G4EmProcessOptions.hh"
99 
102 {
104  defaultCutValue = 1.*mm;
105  cutForGamma = defaultCutValue;
106  cutForElectron = defaultCutValue;
107  cutForPositron = defaultCutValue;
108 
109  helIsRegisted = false;
110  bicIsRegisted = false;
111  biciIsRegisted = false;
112  locIonIonInelasticIsRegistered = false;
113 
114  stepMaxProcess = 0;
115 
116  pMessenger = new ML2PhysicsListMessenger(this);
117 
118  SetVerboseLevel(1);
119 
120  // EM physics
121  emPhysicsList = new G4EmStandardPhysics_option3(1);
122  emName = G4String("emstandard_opt3");
123 
124 // emPhysicsList = new G4EmLivermorePhysics();
125 // emName = G4String("LowE_Livermore");
126 
127  // Deacy physics and all particles
128  decPhysicsList = new G4DecayPhysics();
129 }
130 
133 {
134  delete pMessenger;
135  delete emPhysicsList;
136  delete decPhysicsList;
137  for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];}
138 }
139 
142 {
143  G4PhysListFactory factory;
144  G4VModularPhysicsList* phys =factory.GetReferencePhysList(name);
145  G4int i=0;
146  const G4VPhysicsConstructor* elem= phys->GetPhysics(i);
147  G4VPhysicsConstructor* tmp = const_cast<G4VPhysicsConstructor*> (elem);
148  while (elem !=0)
149  {
150  RegisterPhysics(tmp);
151  elem= phys->GetPhysics(++i) ;
152  tmp = const_cast<G4VPhysicsConstructor*> (elem);
153  }
154  G4cout << "THE FOLLOWING PHYSICS PACKEGE LIST HAS BEEN ACTIVATED: "<<name<< G4endl;
155 }
156 
159 {
160  decPhysicsList->ConstructParticle();
161 }
162 
165 {
166  // transportation
167  //
169 
170  // electromagnetic physics list
171  //
172  emPhysicsList->ConstructProcess();
173  em_config.AddModels();
174 
175  // decay physics list
176  //
177  decPhysicsList->ConstructProcess();
178 
179  // hadronic physics lists
180  for(size_t i=0; i<hadronPhys.size(); i++) {
181  hadronPhys[i]->ConstructProcess();
182  }
183 
184  // step limitation (as a full process)
185  //
186  AddStepMax();
187 }
188 
191 {
192 
193  if (verboseLevel>1) {
194  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
195  }
196  if (name == emName) return;
197 
199  // ELECTROMAGNETIC MODELS
201 
202  if (name == "standard_opt3") {
203  emName = name;
204  delete emPhysicsList;
205  emPhysicsList = new G4EmStandardPhysics_option3();
206  G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl;
207 
208  } else if (name == "LowE_Livermore") {
209  emName = name;
210  delete emPhysicsList;
211  emPhysicsList = new G4EmLivermorePhysics();
212  G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl;
213 
214  } else if (name == "LowE_Penelope") {
215  emName = name;
216  delete emPhysicsList;
217  emPhysicsList = new G4EmPenelopePhysics();
218  G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl;
219 
221  // HADRONIC MODELS
223  } else if (name == "elastic" && !helIsRegisted) {
224  G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronElasticPhysics()" << G4endl;
225  hadronPhys.push_back( new G4HadronElasticPhysics());
226  helIsRegisted = true;
227 
228  } else if (name == "binary" && !bicIsRegisted) {
229  hadronPhys.push_back(new G4HadronInelasticQBBC());
230  bicIsRegisted = true;
231  G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronInelasticQBBC()" << G4endl;
232 
233  } else if (name == "binary_ion" && !biciIsRegisted) {
234  hadronPhys.push_back(new G4IonBinaryCascadePhysics());
235  biciIsRegisted = true;
236 
237  } else {
238 
239  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
240  << " is not defined"
241  << G4endl;
242  }
243 }
244 
247 {
248  // Step limitation seen as a process
249  stepMaxProcess = new ML2StepMax();
250 
252  particleIterator->reset();
253  while ((*particleIterator)()){
254  G4ParticleDefinition* particle = particleIterator->value();
255  G4ProcessManager* pmanager = particle->GetProcessManager();
256 
257  if (stepMaxProcess->IsApplicable(*particle) && pmanager)
258  {
259  pmanager ->AddDiscreteProcess(stepMaxProcess);
260  }
261  }
262 }
263 
266 {
267 
268  if (verboseLevel >0){
269  G4cout << "PhysicsList::SetCuts:";
270  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
271  }
272 
273  // set cut values for gamma at first and for e- second and next for e+,
274  // because some processes for e+/e- need cut values for gamma
275  SetCutValue(cutForGamma, "gamma");
276  SetCutValue(cutForElectron, "e-");
277  SetCutValue(cutForPositron, "e+");
278 
280 }
281 
284 {
285  cutForGamma = cut;
286  SetParticleCuts(cutForGamma, G4Gamma::Gamma());
287 }
288 
291 {
292  cutForElectron = cut;
293  SetParticleCuts(cutForElectron, G4Electron::Electron());
294 }
295 
298 {
299  cutForPositron = cut;
300  SetParticleCuts(cutForPositron, G4Positron::Positron());
301 }
302 
303 
void SetCutForElectron(G4double)
const XML_Char * name
Definition: expat.h:151
void RegisterPhysics(G4VPhysicsConstructor *)
static G4LossTableManager * Instance()
static constexpr double mm
Definition: G4SIunits.hh:115
void SetCutValue(G4double aCut, const G4String &pname)
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
void AddPackage(const G4String &name)
void ConstructParticle()
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
int G4int
Definition: G4Types.hh:78
void AddPhysicsList(const G4String &name)
virtual void ConstructParticle()=0
void SetParticleCuts(G4double cut, G4ParticleDefinition *particle, G4Region *region=0)
void DumpCutValuesTable(G4int flag=1)
G4GLOB_DLL std::ostream G4cout
const G4VPhysicsConstructor * GetPhysics(G4int index) const
G4VModularPhysicsList * GetReferencePhysList(const G4String &)
void SetCutForPositron(G4double)
void SetVerboseLevel(G4int value)
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
static G4Positron * Positron()
Definition: G4Positron.cc:94
void SetCutForGamma(G4double)
G4ProcessManager * GetProcessManager() const
virtual ~ML2PhysicsList()
virtual void ConstructProcess()=0
std::vector< G4InuclElementaryParticle >::iterator particleIterator
Definition: G4BigBanger.cc:65
static G4Electron * Electron()
Definition: G4Electron.cc:94
G4bool IsApplicable(const G4ParticleDefinition &)
Definition: ML2StepMax.cc:72
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76