Geant4  10.03.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 // Hadrontherapy advanced example for Geant4
27 // See more at: https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy
28 //
29 //
30 // ****** SUGGESTED PHYSICS FOR ACCURATE SIMULATIONS *********
31 //
32 // At moment, if accurate simulations are necessary, we suggest the use of the
33 // Physics Lists 'HADRONTHERAPY_1';
34 // It can be activated inside any macro file using the command:
35 // /Physics/addPhysics HADRONTHERAPY_1
36 
37 #include "G4SystemOfUnits.hh"
38 #include "G4RunManager.hh"
39 #include "G4Region.hh"
40 #include "G4RegionStore.hh"
43 #include "HadrontherapyStepMax.hh"
44 #include "G4PhysListFactory.hh"
45 #include "G4VPhysicsConstructor.hh"
46 
47 // Local physic directly implemented in the Hadronthrapy directory
48 // Physic dedicated to the ion-ion inelastic processes
49 //
51 
56 #include "G4EmExtraPhysics.hh"
57 #include "G4StoppingPhysics.hh"
58 #include "G4DecayPhysics.hh"
63 #include "G4DecayPhysics.hh"
64 #include "G4NeutronTrackingCut.hh"
65 #include "G4LossTableManager.hh"
66 #include "G4UnitsTable.hh"
67 #include "G4ProcessManager.hh"
68 #include "G4IonFluctuations.hh"
70 #include "G4EmProcessOptions.hh"
72 #include "G4EmLivermorePhysics.hh"
73 #include "G4AutoDelete.hh"
74 
77 {
79  defaultCutValue = 1.*mm;
80  cutForGamma = defaultCutValue;
81  cutForElectron = defaultCutValue;
82  cutForPositron = defaultCutValue;
83 
84  pMessenger = new HadrontherapyPhysicsListMessenger(this);
85 
86  SetVerboseLevel(1);
87 
88 
89  // ****** Definition of defaults for the physics processes *****
90  // ****** in case no physics is called by the macro file *****
91  //
92  // The default physics corresponds to the actual QGSP_BIC_HP list
93  // but with the following differences:
94  // --> G4EmStandardPhysics_option4 for the electromagnetic processes
95  // is used n place of the less accurate G4EmStandardPhysics
96  // --> The G4RadioactiveDecayPhysics is add
97  // --> G4HadronPhysicsQGSP_BIC is used in place of G4HadronPhysicsQGSP_BIC_HP
98  // --> G4HadronElasticPhysics is used in place of G4HadronElasticPhysics_HP
99 
100  // Elecromagnetic physics
101  //
102  emPhysicsList = new G4EmStandardPhysics_option4();
103  emName = G4String("emstandard_opt4");
104 
105  // Hadronic physics
106  //
107  hadronPhys.push_back( new G4DecayPhysics());
108  hadronPhys.push_back( new G4RadioactiveDecayPhysics());
109  hadronPhys.push_back( new G4IonBinaryCascadePhysics());
110  hadronPhys.push_back( new G4EmExtraPhysics());
111  hadronPhys.push_back( new G4HadronElasticPhysics());
112  hadronPhys.push_back( new G4StoppingPhysics());
113  hadronPhys.push_back( new G4HadronPhysicsQGSP_BIC());
114 
115  // Decay physics
116  //
117  decay_List = new G4DecayPhysics();
118  radioactiveDecay_List = new G4RadioactiveDecayPhysics();
119 }
120 
123 {
124  delete pMessenger;
125  delete emPhysicsList;
126  delete decay_List;
127  delete radioactiveDecay_List;
128  hadronPhys.clear();
129  for(size_t i=0; i<hadronPhys.size(); i++)
130  {
131  delete hadronPhys[i];
132  }
133 }
134 
137 {
138  decay_List -> ConstructParticle();
139 }
140 
143 {
144  // Transportation
145  //
147 
148  // Electromagnetic physics
149  //
150  emPhysicsList -> ConstructProcess();
151  em_config.AddModels();
152 
153  // Hadronic physics
154  //
155  for(size_t i=0; i < hadronPhys.size(); i++)
156  {
157  hadronPhys[i] -> ConstructProcess();
158  }
159 
160  // step limitation (as a full process)
161  //
162  AddStepMax();
163 
164  //Parallel world sensitivity
165  //
166  G4ParallelWorldPhysics* pWorld = new G4ParallelWorldPhysics("DetectorROGeometry");
167  pWorld->ConstructProcess();
168 
169  return;
170 }
171 
174 {
175  if (verboseLevel>1) {
176  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
177  }
178  if (name == emName) return;
179 
181  // ELECTROMAGNETIC MODELS
183  if (name == "standard_opt4") {
184  emName = name;
185  delete emPhysicsList;
186  hadronPhys.clear();
187  emPhysicsList = new G4EmStandardPhysics_option4();
188  G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
189  G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option4" << G4endl;
190 
191  // The following 'local_ion_ion_inelastic' is an example of implemenation of
192  // inelastic hadronic models to be used when
193  // mucleus-nulceus (ion-ion) interactions have to be
194  // taken into account;
195  // It must be used, of course, in connection with other lists: electromagnetic
196  // plus hadronic elastic plus nucleon-nulcleon hadronic inelastic
197  //
198  // An example of coplete physics list using the 'local_ion_ion_inelastic' physics
199  // is the one named HADRONTHERAPY_2, and defined below.
200  //
201  } else if (name == "standard_opt3") {
202  emName = name;
203  delete emPhysicsList;
204  hadronPhys.clear();
205  emPhysicsList = new G4EmStandardPhysics_option3();
206  G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
207  G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl;
208  } else if (name == "local_ion_ion_inelastic") {
209  hadronPhys.push_back(new LocalIonIonInelasticPhysic());
210  locIonIonInelasticIsRegistered = true;
211 
212  } else if (name == "HADRONTHERAPY_1") {
213 
214  // The HADRONTHERAPY_1 physics list corresponds to the actual QGSP_BIC_HP list
215  // but with the following differences:
216  // --> G4EmStandardPhysics_option4 for the electromagnetic processes
217  // is used in place of the less accurate G4EmStandardPhysics
218  // --> The G4RadioactiveDecayPhysics is added
219 
220  AddPhysicsList("standard_opt4");
221  hadronPhys.push_back( new G4DecayPhysics());
222  hadronPhys.push_back( new G4RadioactiveDecayPhysics());
223  hadronPhys.push_back( new G4IonBinaryCascadePhysics());
224  hadronPhys.push_back( new G4EmExtraPhysics());
225  hadronPhys.push_back( new G4HadronElasticPhysicsHP());
226  hadronPhys.push_back( new G4StoppingPhysics());
227  hadronPhys.push_back( new G4HadronPhysicsQGSP_BIC_HP());
228 
229  G4cout << "HADRONTHERAPY_1 PHYSICS LIST has been activated" << G4endl;
230 
231 
232  } else if (name == "HADRONTHERAPY_2") {
233 
234  // The HADRONTHERAPY_2 physics list corresponds to the actual QGSP_BIC_HP list
235  // but with the following differences:
236  // --> G4EmStandardPhysics_option4 for the electromagnetic processes
237  // is used in place of the less accurate G4EmStandardPhysics
238  // --> The G4RadioactiveDecayPhysics is added
239  // --> The 'local_ion_ion_inelastic' physics is used in place of the
240  // G4IonBinaryCascadePhysics(): it used the QMD model to treat
241  // the ion-ion inelastic interactions
242 
243  AddPhysicsList("standard_opt4");
244  AddPhysicsList("local_ion_ion_inelastic");
245  hadronPhys.push_back( new G4DecayPhysics());
246  hadronPhys.push_back( new G4RadioactiveDecayPhysics());
247  hadronPhys.push_back( new G4EmExtraPhysics());
248  hadronPhys.push_back( new G4HadronElasticPhysicsHP());
249  hadronPhys.push_back( new G4StoppingPhysics());
250  hadronPhys.push_back( new G4HadronPhysicsQGSP_BIC_HP());
251 
252  G4cout << "HADRONTHERAPY_2 PHYSICS LIST has been acivated" << G4endl;
253 
254  }
255  else if (name == "QGSP_BIC_EMY") {
256  AddPhysicsList("standard_opt3");
257  //emPhysicsList = new G4EmLivermorePhysics();
258  hadronPhys.push_back( new G4HadronPhysicsQGSP_BIC());
259  hadronPhys.push_back( new G4EmExtraPhysics());
260  hadronPhys.push_back( new G4HadronElasticPhysics());
261  hadronPhys.push_back( new G4StoppingPhysics());
262  hadronPhys.push_back( new G4IonBinaryCascadePhysics());
263  hadronPhys.push_back( new G4NeutronTrackingCut());
264  hadronPhys.push_back( new G4DecayPhysics());
265  }
266  else {
267  G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
268  << " is not defined"
269  << G4endl;
270  }
271 
272 }
273 
276 {
277  // Step limitation seen as a process
278  // This process must exist in all threads.
279  //
280  HadrontherapyStepMax* stepMaxProcess = new HadrontherapyStepMax();
281  G4AutoDelete::Register( stepMaxProcess );
282 
284  particleIterator->reset();
285  while ((*particleIterator)()){
286  G4ParticleDefinition* particle = particleIterator->value();
287  G4ProcessManager* pmanager = particle->GetProcessManager();
288 
289  if (stepMaxProcess->IsApplicable(*particle) && pmanager)
290  {
291  pmanager ->AddDiscreteProcess(stepMaxProcess);
292  }
293  }
294 }
295 
298 {
299 
300  if (verboseLevel >0){
301  G4cout << "PhysicsList::SetCuts:";
302  G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
303  }
304 
305  // Production thresholds for detector regions
306  // The G4Regions, for which you want define a given cut via de macro command
307  // '/run/setCutForRegion <G4Region name> <cut value>'
308  // must be defined here
309  //
310  SetCutValue(cutForGamma, "gamma");
311  SetCutValue(cutForElectron, "e-");
312  SetCutValue(cutForPositron, "e+");
313  // At moment, only 'DetectorLog' is defined as G4Region
314  //
315  G4String regName[] = {"DetectorLog"};
316  G4double fuc = 1.;
317  for(G4int i=0;i<1;i++)
318  {
322  reg->SetProductionCuts(cuts);
323  fuc *= 10.;
324  }
325 }
const XML_Char * name
Definition: expat.h:151
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
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 SetProductionCut(G4double cut, G4int index=-1)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4bool IsApplicable(const G4ParticleDefinition &)
int G4int
Definition: G4Types.hh:78
static const G4double reg
static G4RegionStore * GetInstance()
void Register(T *inst)
Definition: G4AutoDelete.hh:65
G4GLOB_DLL std::ostream G4cout
void AddPhysicsList(const G4String &name)
void SetVerboseLevel(G4int value)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
G4ProcessManager * GetProcessManager() const
std::vector< G4InuclElementaryParticle >::iterator particleIterator
Definition: G4BigBanger.cc:65
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const
#define G4endl
Definition: G4ios.hh:61
void SetProductionCuts(G4ProductionCuts *cut)
double G4double
Definition: G4Types.hh:76