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p3 ] [ 10.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/gammaray_telescope/src/GammaRayTelPhysicsList.cc (Version 11.3.0) and /examples/advanced/gammaray_telescope/src/GammaRayTelPhysicsList.cc (Version 10.2.p2)


  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 // Authors: Francesco Longo, franzlongo1969@gm << 
 27 //                                                 26 //
 28 // Code based on the hadrontherapy && radiopro <<  27 // $Id: GammaRayTelPhysicsList.cc 66508 2012-12-19 10:16:45Z gcosmo $
                                                   >>  28 //
                                                   >>  29 // 
                                                   >>  30 #include <iomanip>   
 29                                                    31 
 30 #include "GammaRayTelPhysicsList.hh"               32 #include "GammaRayTelPhysicsList.hh"
 31 #include "GammaRayTelPhysicsListMessenger.hh"  <<  33 
                                                   >>  34 #include "globals.hh"
                                                   >>  35 #include "G4SystemOfUnits.hh"
                                                   >>  36 #include "G4ParticleDefinition.hh"
                                                   >>  37 #include "G4ParticleWithCuts.hh"
                                                   >>  38 #include "G4ProcessManager.hh"
                                                   >>  39 #include "G4ProcessVector.hh"
                                                   >>  40 #include "G4ParticleTypes.hh"
                                                   >>  41 #include "G4ParticleTable.hh"
                                                   >>  42 
                                                   >>  43 #include "G4Material.hh"
                                                   >>  44 #include "G4MaterialTable.hh"
                                                   >>  45 #include "G4ios.hh"
                                                   >>  46 
                                                   >>  47 #include "GammaRayTelParticles.hh"
                                                   >>  48 #include "GammaRayTelGeneralPhysics.hh"
                                                   >>  49 #include "GammaRayTelEMstdPhysics.hh"
                                                   >>  50 #include "GammaRayTelEMlowePhysics.hh"
                                                   >>  51 #include "GammaRayTelMuonPhysics.hh"
                                                   >>  52 #include "GammaRayTelHadronPhysics.hh"
                                                   >>  53 #include "GammaRayTelIonPhysics.hh"
                                                   >>  54 
 32 #include "G4PhysListFactory.hh"                    55 #include "G4PhysListFactory.hh"
 33 #include "G4VPhysicsConstructor.hh"                56 #include "G4VPhysicsConstructor.hh"
                                                   >>  57 #include "G4EmProcessOptions.hh"
 34                                                    58 
 35 // Physics lists (contained inside the Geant4  << 
 36 #include "G4EmLivermorePhysics.hh"             << 
 37 #include "G4EmLivermorePolarizedPhysics.hh"    << 
 38 #include "G4EmPenelopePhysics.hh"              << 
 39 #include "G4EmStandardPhysics_option3.hh"      << 
 40 #include "G4EmStandardPhysics_option4.hh" // t << 
 41                                                << 
 42 #include "G4Decay.hh"                          << 
 43 #include "G4DecayPhysics.hh"                   << 
 44 #include "G4HadronDElasticPhysics.hh"          << 
 45 #include "G4HadronElasticPhysics.hh"           << 
 46 #include "G4HadronElasticPhysicsHP.hh"         << 
 47 #include "G4HadronPhysicsQGSP_BIC_HP.hh"       << 
 48 #include "G4IonBinaryCascadePhysics.hh"        << 
 49 #include "G4IonFluctuations.hh"                << 
 50 #include "G4IonParametrisedLossModel.hh"       << 
 51 #include "G4LossTableManager.hh"               << 
 52 #include "G4ProcessManager.hh"                 << 
 53 #include "G4RadioactiveDecayPhysics.hh"        << 
 54 #include "G4StepLimiter.hh"                    << 
 55 #include "G4SystemOfUnits.hh"                  << 
 56 #include "G4UnitsTable.hh"                     << 
 57                                                    59 
 58 //....oooOO0OOooo........oooOO0OOooo........oo <<  60 #include "GammaRayTelPhysicsListMessenger.hh"
 59                                                    61 
 60 GammaRayTelPhysicsList::GammaRayTelPhysicsList <<  62 GammaRayTelPhysicsList::GammaRayTelPhysicsList():  G4VModularPhysicsList()
 61     G4LossTableManager::Instance();            <<  63 {
                                                   >>  64   // default cut value  (1.0mm) 
                                                   >>  65   defaultCutValue = 1.0*mm;
                                                   >>  66   SetVerboseLevel(1);
 62                                                    67 
 63     constexpr auto DEFAULT_CUT_VALUE{100 * mic <<  68   pMessenger = new GammaRayTelPhysicsListMessenger(this);
 64     defaultCutValue = DEFAULT_CUT_VALUE;       << 
 65                                                    69 
 66     SetVerboseLevel(1);                        <<  70   // Particles
 67                                                    71 
 68     constexpr auto ENERGY_LOWER_BOUND{250 * eV <<  72  
 69     constexpr auto ENERGY_UPPER_BOUND{1 * GeV} <<  73   RegisterPhysics( new GammaRayTelParticles("particles") );
 70                                                    74 
 71     G4ProductionCutsTable::GetProductionCutsTa <<  75   G4cout << "PARTICLES DONE" << G4endl;
 72     SetDefaultCutValue (defaultCutValue);      << 
 73     DumpCutValuesTable();                      << 
 74                                                    76 
 75     helIsRegisted = false;                     <<  77   // EM physics
 76     bicIsRegisted = false;                     << 
 77     biciIsRegisted = false;                    << 
 78     locIonIonInelasticIsRegistered = false;    << 
 79     radioactiveDecayIsRegisted = false;        << 
 80                                                    78 
 81     pMessenger = new GammaRayTelPhysicsListMes <<  79   emPhysicsList = new GammaRayTelEMstdPhysics;
                                                   >>  80   emName = G4String("Standard EM");
 82                                                    81 
 83     SetVerboseLevel(1);                        << 
 84                                                    82 
 85     // EM physics                              <<  83   // General Physics
 86     emPhysicsList = new G4EmStandardPhysics_op << 
 87     emName = G4String("emstandard_opt3");      << 
 88                                                    84 
 89     // Decay physics and all particles         <<  85   RegisterPhysics( new GammaRayTelGeneralPhysics("general") );
 90     decPhysicsList = new G4DecayPhysics();     << 
 91 }                                              << 
 92                                                    86 
 93 //....oooOO0OOooo........oooOO0OOooo........oo <<  87   G4cout << "GENERAL DONE" << G4endl;
 94                                                    88 
 95 GammaRayTelPhysicsList::~GammaRayTelPhysicsLis << 
 96     delete pMessenger;                         << 
 97     delete emPhysicsList;                      << 
 98     delete decPhysicsList;                     << 
 99                                                    89 
100     for (auto &hadronPhy : hadronPhys) {       <<  90   // Muon Physics
101         delete hadronPhy;                      << 
102     }                                          << 
103 }                                              << 
104                                                    91 
105 //....oooOO0OOooo........oooOO0OOooo........oo <<  92   RegisterPhysics(  new GammaRayTelMuonPhysics("muon"));
106                                                    93 
107 void GammaRayTelPhysicsList::AddPackage(const  << 
108     G4PhysListFactory factory;                 << 
109     auto *phys = factory.GetReferencePhysList( << 
110                                                << 
111     G4int i = 0;                               << 
112     const G4VPhysicsConstructor *element = phy << 
113     auto *tmp = const_cast<G4VPhysicsConstruct << 
114                                                << 
115     while (element != nullptr) {               << 
116         RegisterPhysics(tmp);                  << 
117         element = phys->GetPhysics(++i);       << 
118         tmp = const_cast<G4VPhysicsConstructor << 
119     }                                          << 
120 }                                              << 
121                                                    94 
122 //....oooOO0OOooo........oooOO0OOooo........oo <<  95   G4cout << "MUON DONE" << G4endl;
123                                                    96 
124 void GammaRayTelPhysicsList::ConstructParticle <<  97    // Hadron Physics
125     decPhysicsList->ConstructParticle();       <<  98   RegisterPhysics(  new GammaRayTelHadronPhysics("hadron"));
126 }                                              << 
127                                                    99 
128 //....oooOO0OOooo........oooOO0OOooo........oo << 100   G4cout << "HADRONS DONE" << G4endl;
129                                                   101 
130 void GammaRayTelPhysicsList::ConstructProcess( << 102   // Ion Physics
131     // transportation                          << 103   RegisterPhysics( new GammaRayTelIonPhysics("ion"));
132     //                                         << 
133     AddTransportation();                       << 
134                                                << 
135     // electromagnetic physics list            << 
136     //                                         << 
137     emPhysicsList->ConstructProcess();         << 
138     emConfigurator.AddModels();                << 
139                                                << 
140     // decay physics list                      << 
141     //                                         << 
142     decPhysicsList->ConstructProcess();        << 
143                                                << 
144     // hadronic physics lists                  << 
145     for (auto &hadronPhy : hadronPhys) {       << 
146         hadronPhy->ConstructProcess();         << 
147     }                                          << 
148                                                   104 
149     // step limitation (as a full process)     << 
150     // AddStepMax();                           << 
151 }                                              << 
152                                                   105 
153 //....oooOO0OOooo........oooOO0OOooo........oo << 106   G4cout << "IONS DONE" << G4endl;
154                                                   107 
155 void GammaRayTelPhysicsList::AddPhysicsList(co << 
156     if (verboseLevel > 1) {                    << 
157         G4cout << "PhysicsList::AddPhysicsList << 
158     }                                          << 
159     if (name == emName) {                      << 
160         return;                                << 
161     }                                          << 
162                                                << 
163     ////////////////////////////////           << 
164     //   ELECTROMAGNETIC MODELS   //           << 
165     ////////////////////////////////           << 
166                                                << 
167     if (name == "standard_opt3") {             << 
168         emName = name;                         << 
169         delete emPhysicsList;                  << 
170         emPhysicsList = new G4EmStandardPhysic << 
171         G4cout << "THE FOLLOWING ELECTROMAGNET << 
172     } else if (name == "LowE_Livermore") {     << 
173         emName = name;                         << 
174         delete emPhysicsList;                  << 
175         emPhysicsList = new G4EmLivermorePhysi << 
176         G4cout << "THE FOLLOWING ELECTROMAGNET << 
177     } else if (name == "LowE_Penelope") {      << 
178         emName = name;                         << 
179         delete emPhysicsList;                  << 
180         emPhysicsList = new G4EmPenelopePhysic << 
181         G4cout << "THE FOLLOWING ELECTROMAGNET << 
182     } else if (name == "LowE_Polarized") {     << 
183         emName = name;                         << 
184         delete emPhysicsList;                  << 
185         emPhysicsList = new G4EmLivermorePolar << 
186         G4cout << "THE FOLLOWING ELECTROMAGNET << 
187     } else if (name == "standard_opt4") {      << 
188         emName = name;                         << 
189         delete emPhysicsList;                  << 
190         emPhysicsList = new G4EmStandardPhysic << 
191         G4cout << "THE FOLLOWING ELECTROMAGNET << 
192                                                << 
193         /////////////////////////              << 
194         //   HADRONIC MODELS   //              << 
195         /////////////////////////              << 
196                                                << 
197     } else if (name == "elastic" && !helIsRegi << 
198         G4cout << "THE FOLLOWING HADRONIC ELAS << 
199         hadronPhys.push_back(new G4HadronElast << 
200         helIsRegisted = true;                  << 
201     } else if (name == "DElastic" && !helIsReg << 
202         hadronPhys.push_back(new G4HadronDElas << 
203         helIsRegisted = true;                  << 
204     } else if (name == "HPElastic" && !helIsRe << 
205         hadronPhys.push_back(new G4HadronElast << 
206         helIsRegisted = true;                  << 
207     } else if (name == "binary" && !bicIsRegis << 
208         hadronPhys.push_back(new G4HadronPhysi << 
209         bicIsRegisted = true;                  << 
210         G4cout << "THE FOLLOWING HADRONIC INEL << 
211     } else if (name == "binary_ion" && !biciIs << 
212         hadronPhys.push_back(new G4IonBinaryCa << 
213         biciIsRegisted = true;                 << 
214         G4cout << "THE FOLLOWING HADRONIC INEL << 
215     } else if (name == "radioactive_decay" &&  << 
216         hadronPhys.push_back(new G4Radioactive << 
217         radioactiveDecayIsRegisted = true;     << 
218         G4cout << "THE FOLLOWING HADRONIC INEL << 
219     } else {                                   << 
220         G4cout << "PhysicsList::AddPhysicsList << 
221     }                                          << 
222 }                                                 108 }
223                                                   109 
224 //....oooOO0OOooo........oooOO0OOooo........oo << 110 GammaRayTelPhysicsList::~GammaRayTelPhysicsList()
                                                   >> 111 {
                                                   >> 112   delete pMessenger;
                                                   >> 113   //  delete emPhysicsList;
                                                   >> 114 }
                                                   >> 115 
                                                   >> 116 #include "G4Region.hh"
                                                   >> 117 #include "G4RegionStore.hh"
                                                   >> 118 #include "G4ProductionCuts.hh"
                                                   >> 119 
                                                   >> 120 void GammaRayTelPhysicsList::SetCuts()
                                                   >> 121 {
                                                   >> 122   if (verboseLevel >0){
                                                   >> 123     G4cout << "GammaRayTelPhysicsList::SetCuts: default cut length : "
                                                   >> 124          << G4BestUnit(defaultCutValue,"Length") << G4endl;
                                                   >> 125   }  
                                                   >> 126 
                                                   >> 127   // These values are used as the default production thresholds
                                                   >> 128   // for the world volume.
                                                   >> 129 
                                                   >> 130   G4cout << "CUT STD" << G4endl;
                                                   >> 131 
                                                   >> 132   SetCutsWithDefault();
                                                   >> 133 
225                                                   134 
226 void GammaRayTelPhysicsList::SetCutForGamma(G4 << 
227     SetParticleCuts(cut, G4Gamma::Gamma());    << 
228 }                                                 135 }
229                                                   136 
230 //....oooOO0OOooo........oooOO0OOooo........oo << 137 void GammaRayTelPhysicsList::SetRegionCut(G4double cutvalue)
                                                   >> 138 {
                                                   >> 139 
                                                   >> 140  SetCutsWithDefault();
                                                   >> 141 
                                                   >> 142   if (verboseLevel >0){
                                                   >> 143     G4cout << "GammaRayTelPhysicsList::SetCuts: default cut length : "
                                                   >> 144          << G4BestUnit(defaultCutValue,"Length") << G4endl;
                                                   >> 145   }
                                                   >> 146   
                                                   >> 147   G4cout << "CUTS NEW" << G4endl;
                                                   >> 148   
                                                   >> 149   // Production thresholds for detector regions
                                                   >> 150 
                                                   >> 151   G4String regName[] = {"Calorimeter","Tracker"};
                                                   >> 152   //  G4double cutValue[] = {1*mm, 0.1*mm};
                                                   >> 153   G4double cutValue[] = {cutvalue, cutvalue/10.};
                                                   >> 154 
                                                   >> 155 
                                                   >> 156   
                                                   >> 157   for(G4int i=0;i<2;i++)
                                                   >> 158   { 
                                                   >> 159     G4Region* reg = G4RegionStore::GetInstance()->GetRegion(regName[i]);
                                                   >> 160     G4ProductionCuts* cuts = new G4ProductionCuts;
                                                   >> 161     cuts->SetProductionCut(cutValue[i]);
                                                   >> 162     reg->SetProductionCuts(cuts);
                                                   >> 163   }
231                                                   164 
232 void GammaRayTelPhysicsList::SetCutForElectron << 
233     SetParticleCuts(cut, G4Electron::Electron( << 
234 }                                                 165 }
235                                                   166 
236 //....oooOO0OOooo........oooOO0OOooo........oo << 
237                                                   167 
238 void GammaRayTelPhysicsList::SetCutForPositron << 168 /////////////////////////////////////////////////////////////////////////////
239     SetParticleCuts(cut, G4Positron::Positron( << 169 
                                                   >> 170 void GammaRayTelPhysicsList::AddPhysicsList(const G4String& name)
                                                   >> 171 {
                                                   >> 172 
                                                   >> 173   if (verboseLevel>1) {
                                                   >> 174     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
                                                   >> 175   }
                                                   >> 176 
                                                   >> 177   if (name == "Standard EM") {
                                                   >> 178 
                                                   >> 179     emName = name;
                                                   >> 180     delete emPhysicsList;
                                                   >> 181     emPhysicsList = new GammaRayTelEMstdPhysics();
                                                   >> 182     G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: EM Standard" << G4endl;
                                                   >> 183     
                                                   >> 184   } else if (name == "LowE EM") {
                                                   >> 185     emName = name;
                                                   >> 186     delete emPhysicsList;
                                                   >> 187     emPhysicsList = new GammaRayTelEMlowePhysics();;
                                                   >> 188      G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: EM LowE" << G4endl;
                                                   >> 189   } 
                                                   >> 190   else {
                                                   >> 191     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
                                                   >> 192            << " is not defined"
                                                   >> 193            << G4endl;
                                                   >> 194   }
                                                   >> 195 
                                                   >> 196 
                                                   >> 197   G4cout << "REGISTRATION DONE " << G4endl;
                                                   >> 198 
                                                   >> 199     RegisterPhysics(emPhysicsList);
                                                   >> 200 
240 }                                                 201 }
241                                                   202