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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 ]

  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 // Code developed by
 27 // Silvia Pozzi (1), silvia.pozzi@iss.it
 28 // Barbara Caccia (1), barbara.caccia@iss.it
 29 // Carlo Mancini Terracciano (2), carlo.mancini.terracciano@roma1.infn.it
 30 // (1) Istituto Superiore di Sanita' and INFN Roma, Italy
 31 // (2) Univ. La Sapienza and INFN Roma, Italy
 32 
 33 #include "PhysicsList.hh"
 34 #include "PhysicsListMessenger.hh"
 35 #include "StepMax.hh"
 36 
 37 #include <G4EmStandardPhysics.hh>
 38 #include <G4eBremsstrahlung.hh>
 39 
 40 #include <G4DecayPhysics.hh> 
 41 #include <G4ProductionCutsTable.hh>
 42 #include <G4SystemOfUnits.hh>
 43 
 44 #include "G4SystemOfUnits.hh"
 45 #include "G4VPhysicsConstructor.hh"
 46 
 47 // Physics lists
 48 #include "G4EmStandardPhysics_option4.hh"
 49 #include "G4EmStandardPhysics_option3.hh"
 50 #include "G4EmLivermorePhysics.hh"
 51 #include "G4EmPenelopePhysics.hh"
 52 #include "G4DecayPhysics.hh"
 53 #include "G4HadronElasticPhysics.hh"
 54 #include "G4HadronInelasticQBBC.hh"
 55 #include "G4IonBinaryCascadePhysics.hh"
 56 #include "G4Decay.hh"
 57 
 58 #include "G4UnitsTable.hh"
 59 #include "G4ProcessManager.hh"
 60 
 61 /////////////////////////////////////////////////////////////////////////////
 62 PhysicsList::PhysicsList() : G4VModularPhysicsList()
 63 {
 64   defaultCutValue = 1.*mm;
 65   helIsRegistered  = false;
 66   bicIsRegistered  = false;
 67   biciIsRegistered = false;
 68   locIonIonInelasticIsRegistered = false;
 69 
 70   stepMaxProcess = nullptr;
 71 
 72   pMessenger = new PhysicsListMessenger(this);
 73 
 74   SetVerboseLevel(1);
 75 
 76   // EM physics
 77   emPhysicsList = new G4EmStandardPhysics_option3(1);
 78   emName = G4String("emstandard_opt3");
 79 
 80   //  emPhysicsList = new G4EmLivermorePhysics();
 81   //  emName = G4String("LowE_Livermore");
 82 
 83   // Decay physics and all particles
 84   decPhysicsList = new G4DecayPhysics();
 85 }
 86 
 87 void PhysicsList::SetCuts()
 88 {
 89   G4VUserPhysicsList::SetVerboseLevel(2);
 90   G4VUserPhysicsList::SetCuts();
 91 }
 92 
 93 /////////////////////////////////////////////////////////////////////////////
 94 PhysicsList::~PhysicsList()
 95 {
 96   delete pMessenger;
 97   delete emPhysicsList;
 98   delete decPhysicsList;
 99   for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];}
100 }
101 
102 void PhysicsList::ConstructParticle()
103 {
104   decPhysicsList->ConstructParticle();
105 }
106 
107 void PhysicsList::ConstructProcess()
108 {
109   // transportation
110   AddTransportation();
111 
112   // electromagnetic physics list
113   emPhysicsList->ConstructProcess();
114 
115   // decay physics list
116   decPhysicsList->ConstructProcess();
117 
118   // hadronic physics lists
119   for(size_t i=0; i<hadronPhys.size(); i++)
120   {
121     hadronPhys[i]->ConstructProcess();
122   }
123 
124   // step limitation (as a full process)
125   AddStepMax();
126 }
127 
128 void PhysicsList::AddPhysicsList(const G4String& name)
129 {
130   if (verboseLevel>1)
131   {
132     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
133   }
134   if (name == emName) return;
135 
136   //   Electromagnetic Models
137   if (name == "standard_opt3")
138   {
139     emName = name;
140     delete emPhysicsList;
141     emPhysicsList = new G4EmStandardPhysics_option3();
142     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
143         << "G4EmStandardPhysics_option3" << G4endl;
144   }
145   else if (name == "standard_opt4")
146   {
147     emName = name;
148     delete emPhysicsList;
149     emPhysicsList = new G4EmStandardPhysics_option4();
150     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
151         << "G4EmStandardPhysics_option4" << G4endl;
152   }
153   else if (name == "LowE_Livermore")
154   {
155     emName = name;
156     delete emPhysicsList;
157     emPhysicsList = new G4EmLivermorePhysics();
158     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
159         << "G4EmLivermorePhysics" << G4endl;
160   }
161   else if (name == "LowE_Penelope")
162   {
163     emName = name;
164     delete emPhysicsList;
165     emPhysicsList = new G4EmPenelopePhysics();
166     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: "
167         << "G4EmLivermorePhysics" << G4endl;
168 
169   //   Hadronic Models
170   }
171   else if (name == "elastic" && !helIsRegistered)
172   {
173 
174     hadronPhys.push_back( new G4HadronElasticPhysics());
175     helIsRegistered = true;
176     G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: "
177         << "G4HadronElasticPhysics()" << G4endl;
178   }
179   else if (name == "binary" && !bicIsRegistered)
180   {
181     hadronPhys.push_back(new G4HadronInelasticQBBC());
182     bicIsRegistered = true;
183     G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: "
184         << "G4HadronInelasticQBBC()" << G4endl;
185   }
186   else if (name == "binary_ion" && !biciIsRegistered)
187   {
188     hadronPhys.push_back(new G4IonBinaryCascadePhysics());
189     biciIsRegistered = true;
190   }
191   else
192   {
193     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
194          << " is not defined"
195          << G4endl;
196   }
197 }
198 
199 void PhysicsList::AddStepMax()
200 {
201   // Step limitation seen as a process
202   stepMaxProcess = new StepMax();
203 
204   auto particleIterator=GetParticleIterator();
205   particleIterator->reset();
206   while ((*particleIterator)())
207   {
208     G4ParticleDefinition* particle = particleIterator->value();
209     G4ProcessManager* pmanager = particle->GetProcessManager();
210 
211     if (stepMaxProcess->IsApplicable(*particle) && pmanager)
212     {
213       pmanager ->AddDiscreteProcess(stepMaxProcess);
214     }
215   }
216 }
217