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5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/medical_linac/src/PhysicsList.cc (Version 11.3.0) and /examples/advanced/medical_linac/src/PhysicsList.cc (Version 11.2.1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // Code developed by                               26 // Code developed by
 27 // Silvia Pozzi (1), silvia.pozzi@iss.it           27 // Silvia Pozzi (1), silvia.pozzi@iss.it
 28 // Barbara Caccia (1), barbara.caccia@iss.it       28 // Barbara Caccia (1), barbara.caccia@iss.it
 29 // Carlo Mancini Terracciano (2), carlo.mancin     29 // Carlo Mancini Terracciano (2), carlo.mancini.terracciano@roma1.infn.it
 30 // (1) Istituto Superiore di Sanita' and INFN      30 // (1) Istituto Superiore di Sanita' and INFN Roma, Italy
 31 // (2) Univ. La Sapienza and INFN Roma, Italy      31 // (2) Univ. La Sapienza and INFN Roma, Italy
 32                                                    32 
 33 #include "PhysicsList.hh"                          33 #include "PhysicsList.hh"
 34 #include "PhysicsListMessenger.hh"                 34 #include "PhysicsListMessenger.hh"
 35 #include "StepMax.hh"                              35 #include "StepMax.hh"
 36                                                    36 
 37 #include <G4EmStandardPhysics.hh>                  37 #include <G4EmStandardPhysics.hh>
 38 #include <G4eBremsstrahlung.hh>                    38 #include <G4eBremsstrahlung.hh>
 39                                                    39 
 40 #include <G4DecayPhysics.hh>                       40 #include <G4DecayPhysics.hh> 
 41 #include <G4ProductionCutsTable.hh>                41 #include <G4ProductionCutsTable.hh>
 42 #include <G4SystemOfUnits.hh>                      42 #include <G4SystemOfUnits.hh>
 43                                                    43 
 44 #include "G4SystemOfUnits.hh"                      44 #include "G4SystemOfUnits.hh"
 45 #include "G4VPhysicsConstructor.hh"                45 #include "G4VPhysicsConstructor.hh"
 46                                                    46 
 47 // Physics lists                                   47 // Physics lists
 48 #include "G4EmStandardPhysics_option4.hh"          48 #include "G4EmStandardPhysics_option4.hh"
 49 #include "G4EmStandardPhysics_option3.hh"          49 #include "G4EmStandardPhysics_option3.hh"
 50 #include "G4EmLivermorePhysics.hh"                 50 #include "G4EmLivermorePhysics.hh"
 51 #include "G4EmPenelopePhysics.hh"                  51 #include "G4EmPenelopePhysics.hh"
 52 #include "G4DecayPhysics.hh"                       52 #include "G4DecayPhysics.hh"
 53 #include "G4HadronElasticPhysics.hh"               53 #include "G4HadronElasticPhysics.hh"
 54 #include "G4HadronInelasticQBBC.hh"                54 #include "G4HadronInelasticQBBC.hh"
 55 #include "G4IonBinaryCascadePhysics.hh"            55 #include "G4IonBinaryCascadePhysics.hh"
 56 #include "G4Decay.hh"                              56 #include "G4Decay.hh"
 57                                                    57 
 58 #include "G4UnitsTable.hh"                         58 #include "G4UnitsTable.hh"
 59 #include "G4ProcessManager.hh"                     59 #include "G4ProcessManager.hh"
 60                                                    60 
 61 //////////////////////////////////////////////     61 /////////////////////////////////////////////////////////////////////////////
 62 PhysicsList::PhysicsList() : G4VModularPhysics     62 PhysicsList::PhysicsList() : G4VModularPhysicsList()
 63 {                                                  63 {
 64   defaultCutValue = 1.*mm;                         64   defaultCutValue = 1.*mm;
 65   helIsRegistered  = false;                        65   helIsRegistered  = false;
 66   bicIsRegistered  = false;                        66   bicIsRegistered  = false;
 67   biciIsRegistered = false;                        67   biciIsRegistered = false;
 68   locIonIonInelasticIsRegistered = false;          68   locIonIonInelasticIsRegistered = false;
 69                                                    69 
 70   stepMaxProcess = nullptr;                        70   stepMaxProcess = nullptr;
 71                                                    71 
 72   pMessenger = new PhysicsListMessenger(this);     72   pMessenger = new PhysicsListMessenger(this);
 73                                                    73 
 74   SetVerboseLevel(1);                              74   SetVerboseLevel(1);
 75                                                    75 
 76   // EM physics                                    76   // EM physics
 77   emPhysicsList = new G4EmStandardPhysics_opti     77   emPhysicsList = new G4EmStandardPhysics_option3(1);
 78   emName = G4String("emstandard_opt3");            78   emName = G4String("emstandard_opt3");
 79                                                    79 
 80   //  emPhysicsList = new G4EmLivermorePhysics     80   //  emPhysicsList = new G4EmLivermorePhysics();
 81   //  emName = G4String("LowE_Livermore");         81   //  emName = G4String("LowE_Livermore");
 82                                                    82 
 83   // Decay physics and all particles               83   // Decay physics and all particles
 84   decPhysicsList = new G4DecayPhysics();           84   decPhysicsList = new G4DecayPhysics();
 85 }                                                  85 }
 86                                                    86 
 87 void PhysicsList::SetCuts()                        87 void PhysicsList::SetCuts()
 88 {                                                  88 {
 89   G4VUserPhysicsList::SetVerboseLevel(2);          89   G4VUserPhysicsList::SetVerboseLevel(2);
 90   G4VUserPhysicsList::SetCuts();                   90   G4VUserPhysicsList::SetCuts();
 91 }                                                  91 }
 92                                                    92 
 93 //////////////////////////////////////////////     93 /////////////////////////////////////////////////////////////////////////////
 94 PhysicsList::~PhysicsList()                        94 PhysicsList::~PhysicsList()
 95 {                                                  95 {
 96   delete pMessenger;                               96   delete pMessenger;
 97   delete emPhysicsList;                            97   delete emPhysicsList;
 98   delete decPhysicsList;                           98   delete decPhysicsList;
 99   for(size_t i=0; i<hadronPhys.size(); i++) {d     99   for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];}
100 }                                                 100 }
101                                                   101 
102 void PhysicsList::ConstructParticle()             102 void PhysicsList::ConstructParticle()
103 {                                                 103 {
104   decPhysicsList->ConstructParticle();            104   decPhysicsList->ConstructParticle();
105 }                                                 105 }
106                                                   106 
107 void PhysicsList::ConstructProcess()              107 void PhysicsList::ConstructProcess()
108 {                                                 108 {
109   // transportation                               109   // transportation
110   AddTransportation();                            110   AddTransportation();
111                                                   111 
112   // electromagnetic physics list                 112   // electromagnetic physics list
113   emPhysicsList->ConstructProcess();              113   emPhysicsList->ConstructProcess();
114                                                   114 
115   // decay physics list                           115   // decay physics list
116   decPhysicsList->ConstructProcess();             116   decPhysicsList->ConstructProcess();
117                                                   117 
118   // hadronic physics lists                       118   // hadronic physics lists
119   for(size_t i=0; i<hadronPhys.size(); i++)       119   for(size_t i=0; i<hadronPhys.size(); i++)
120   {                                               120   {
121     hadronPhys[i]->ConstructProcess();            121     hadronPhys[i]->ConstructProcess();
122   }                                               122   }
123                                                   123 
124   // step limitation (as a full process)          124   // step limitation (as a full process)
125   AddStepMax();                                   125   AddStepMax();
126 }                                                 126 }
127                                                   127 
128 void PhysicsList::AddPhysicsList(const G4Strin    128 void PhysicsList::AddPhysicsList(const G4String& name)
129 {                                                 129 {
130   if (verboseLevel>1)                             130   if (verboseLevel>1)
131   {                                               131   {
132     G4cout << "PhysicsList::AddPhysicsList: <"    132     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
133   }                                               133   }
134   if (name == emName) return;                     134   if (name == emName) return;
135                                                   135 
136   //   Electromagnetic Models                     136   //   Electromagnetic Models
137   if (name == "standard_opt3")                    137   if (name == "standard_opt3")
138   {                                               138   {
139     emName = name;                                139     emName = name;
140     delete emPhysicsList;                         140     delete emPhysicsList;
141     emPhysicsList = new G4EmStandardPhysics_op    141     emPhysicsList = new G4EmStandardPhysics_option3();
142     G4cout << "THE FOLLOWING ELECTROMAGNETIC P    142     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
143         << "G4EmStandardPhysics_option3" << G4    143         << "G4EmStandardPhysics_option3" << G4endl;
144   }                                               144   }
145   else if (name == "standard_opt4")               145   else if (name == "standard_opt4")
146   {                                               146   {
147     emName = name;                                147     emName = name;
148     delete emPhysicsList;                         148     delete emPhysicsList;
149     emPhysicsList = new G4EmStandardPhysics_op    149     emPhysicsList = new G4EmStandardPhysics_option4();
150     G4cout << "THE FOLLOWING ELECTROMAGNETIC P    150     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
151         << "G4EmStandardPhysics_option4" << G4    151         << "G4EmStandardPhysics_option4" << G4endl;
152   }                                               152   }
153   else if (name == "LowE_Livermore")              153   else if (name == "LowE_Livermore")
154   {                                               154   {
155     emName = name;                                155     emName = name;
156     delete emPhysicsList;                         156     delete emPhysicsList;
157     emPhysicsList = new G4EmLivermorePhysics()    157     emPhysicsList = new G4EmLivermorePhysics();
158     G4cout << "THE FOLLOWING ELECTROMAGNETIC P    158     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
159         << "G4EmLivermorePhysics" << G4endl;      159         << "G4EmLivermorePhysics" << G4endl;
160   }                                               160   }
161   else if (name == "LowE_Penelope")               161   else if (name == "LowE_Penelope")
162   {                                               162   {
163     emName = name;                                163     emName = name;
164     delete emPhysicsList;                         164     delete emPhysicsList;
165     emPhysicsList = new G4EmPenelopePhysics();    165     emPhysicsList = new G4EmPenelopePhysics();
166     G4cout << "THE FOLLOWING ELECTROMAGNETIC P    166     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
167         << "G4EmLivermorePhysics" << G4endl;      167         << "G4EmLivermorePhysics" << G4endl;
168                                                   168 
169   //   Hadronic Models                            169   //   Hadronic Models
170   }                                               170   }
171   else if (name == "elastic" && !helIsRegister    171   else if (name == "elastic" && !helIsRegistered)
172   {                                               172   {
173                                                   173 
174     hadronPhys.push_back( new G4HadronElasticP    174     hadronPhys.push_back( new G4HadronElasticPhysics());
175     helIsRegistered = true;                       175     helIsRegistered = true;
176     G4cout << "THE FOLLOWING HADRONIC ELASTIC     176     G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: "
177         << "G4HadronElasticPhysics()" << G4end    177         << "G4HadronElasticPhysics()" << G4endl;
178   }                                               178   }
179   else if (name == "binary" && !bicIsRegistere    179   else if (name == "binary" && !bicIsRegistered)
180   {                                               180   {
181     hadronPhys.push_back(new G4HadronInelastic    181     hadronPhys.push_back(new G4HadronInelasticQBBC());
182     bicIsRegistered = true;                       182     bicIsRegistered = true;
183     G4cout << "THE FOLLOWING HADRONIC INELASTI    183     G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: "
184         << "G4HadronInelasticQBBC()" << G4endl    184         << "G4HadronInelasticQBBC()" << G4endl;
185   }                                               185   }
186   else if (name == "binary_ion" && !biciIsRegi    186   else if (name == "binary_ion" && !biciIsRegistered)
187   {                                               187   {
188     hadronPhys.push_back(new G4IonBinaryCascad    188     hadronPhys.push_back(new G4IonBinaryCascadePhysics());
189     biciIsRegistered = true;                      189     biciIsRegistered = true;
190   }                                               190   }
191   else                                            191   else
192   {                                               192   {
193     G4cout << "PhysicsList::AddPhysicsList: <"    193     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
194          << " is not defined"                     194          << " is not defined"
195          << G4endl;                               195          << G4endl;
196   }                                               196   }
197 }                                                 197 }
198                                                   198 
199 void PhysicsList::AddStepMax()                    199 void PhysicsList::AddStepMax()
200 {                                                 200 {
201   // Step limitation seen as a process            201   // Step limitation seen as a process
202   stepMaxProcess = new StepMax();                 202   stepMaxProcess = new StepMax();
203                                                   203 
204   auto particleIterator=GetParticleIterator();    204   auto particleIterator=GetParticleIterator();
205   particleIterator->reset();                      205   particleIterator->reset();
206   while ((*particleIterator)())                   206   while ((*particleIterator)())
207   {                                               207   {
208     G4ParticleDefinition* particle = particleI    208     G4ParticleDefinition* particle = particleIterator->value();
209     G4ProcessManager* pmanager = particle->Get    209     G4ProcessManager* pmanager = particle->GetProcessManager();
210                                                   210 
211     if (stepMaxProcess->IsApplicable(*particle    211     if (stepMaxProcess->IsApplicable(*particle) && pmanager)
212     {                                             212     {
213       pmanager ->AddDiscreteProcess(stepMaxPro    213       pmanager ->AddDiscreteProcess(stepMaxProcess);
214     }                                             214     }
215   }                                               215   }
216 }                                                 216 }
217                                                   217