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] [ 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/extended/electromagnetic/TestEm8/src/PhysicsList.cc (Version 11.3.0) and /examples/extended/electromagnetic/TestEm8/src/PhysicsList.cc (Version 9.0)


  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 /// \file electromagnetic/TestEm8/src/PhysicsL << 
 27 /// \brief Implementation of the PhysicsList c << 
 28 //                                                 26 //
 29 //                                             <<  27 
 30 //-------------------------------------------- <<  28 // $Id: PhysicsList.cc,v 1.9 2006/12/13 15:42:31 gunter Exp $
 31 //                                             <<  29 // GEANT4 tag $Name: geant4-09-00 $
 32 // ClassName:   PhysicsList                    << 
 33 //                                             << 
 34 // Description: EM physics with a possibility  << 
 35 //                                             << 
 36 // Author:      V.Ivanchenko 01.09.2010        << 
 37 //                                             << 
 38 //-------------------------------------------- << 
 39 //                                                 30 //
 40                                                    31 
 41 //....oooOO0OOooo........oooOO0OOooo........oo     32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 42 //....oooOO0OOooo........oooOO0OOooo........oo     33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 43                                                    34 
 44 #include "PhysicsList.hh"                          35 #include "PhysicsList.hh"
 45                                                << 
 46 #include "DetectorConstruction.hh"             << 
 47 #include "PhysicsListMessenger.hh"                 36 #include "PhysicsListMessenger.hh"
 48 #include "StepMax.hh"                          << 
 49                                                    37 
 50 #include "G4DecayPhysics.hh"                   <<  38 #include "PhysListParticles.hh"
 51 #include "G4Electron.hh"                       <<  39 #include "PhysListGeneral.hh"
 52 #include "G4EmConfigurator.hh"                 <<  40 #include "PhysListEmStandard.hh"
 53 #include "G4EmLivermorePhysics.hh"             <<  41 
 54 #include "G4EmLowEPPhysics.hh"                 <<  42 #include "PhysListEmModelPai.hh"
 55 #include "G4EmParameters.hh"                   <<  43 #include "PhysListEmPaiPhoton.hh"
 56 #include "G4EmPenelopePhysics.hh"              <<  44 
 57 #include "G4EmStandardPhysics.hh"              <<  45 #include "PhysListEmPAI.hh"
 58 #include "G4EmStandardPhysicsGS.hh"            <<  46 
 59 #include "G4EmStandardPhysicsSS.hh"            << 
 60 #include "G4EmStandardPhysicsWVI.hh"           << 
 61 #include "G4EmStandardPhysics_option1.hh"      << 
 62 #include "G4EmStandardPhysics_option2.hh"      << 
 63 #include "G4EmStandardPhysics_option3.hh"      << 
 64 #include "G4EmStandardPhysics_option4.hh"      << 
 65 #include "G4Gamma.hh"                              47 #include "G4Gamma.hh"
 66 #include "G4LossTableManager.hh"               <<  48 #include "G4Electron.hh"
 67 #include "G4PAIModel.hh"                       << 
 68 #include "G4PAIPhotModel.hh"                   << 
 69 #include "G4ParticleTable.hh"                  << 
 70 #include "G4ParticleTypes.hh"                  << 
 71 #include "G4Positron.hh"                           49 #include "G4Positron.hh"
 72 #include "G4ProcessManager.hh"                 <<  50 
 73 #include "G4ProductionCutsTable.hh"            << 
 74 #include "G4Proton.hh"                         << 
 75 #include "G4SystemOfUnits.hh"                  << 
 76 #include "G4UnitsTable.hh"                         51 #include "G4UnitsTable.hh"
                                                   >>  52 #include "G4LossTableManager.hh"
 77                                                    53 
 78 //....oooOO0OOooo........oooOO0OOooo........oo     54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 79                                                    55 
 80 PhysicsList::PhysicsList(DetectorConstruction* <<  56 PhysicsList::PhysicsList() : G4VModularPhysicsList()
 81 {                                                  57 {
 82   // set verbosity for zero to avoid double pr <<  58   G4LossTableManager::Instance();
 83   // on physics verbosity should be restored t <<  59   defaultCutValue = 1.*mm;
 84   // are set                                   <<  60   cutForGamma     = defaultCutValue;
 85   G4EmParameters::Instance()->SetVerbose(0);   <<  61   cutForElectron  = defaultCutValue;
                                                   >>  62   cutForPositron  = defaultCutValue;
                                                   >>  63 
                                                   >>  64   stepMaxProcess  = 0;
 86                                                    65 
 87   SetDefaultCutValue(1 * mm);                  <<  66   pMessenger = new PhysicsListMessenger(this);
                                                   >>  67 
                                                   >>  68   SetVerboseLevel(1);
 88                                                    69 
 89   fMessenger = new PhysicsListMessenger(this); <<  70    // Particles
                                                   >>  71   particleList = new PhysListParticles("particles");
 90                                                    72 
 91   // Decay Physics is always defined           <<  73   // General Physics
 92   fDecayPhysicsList = new G4DecayPhysics();    <<  74   generalPhysicsList = new PhysListGeneral("general");
 93                                                    75 
 94   // EM physics                                    76   // EM physics
 95   fEmName = G4String("emstandard_opt0");       <<  77   emName = G4String("standard");
 96   fEmPhysicsList = new G4EmStandardPhysics(0); <<  78   emPhysicsList = new PhysListEmStandard(emName);
 97                                                    79 
 98   SetVerboseLevel(1);                          << 
 99 }                                                  80 }
100                                                    81 
101 //....oooOO0OOooo........oooOO0OOooo........oo     82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102                                                    83 
103 PhysicsList::~PhysicsList()                        84 PhysicsList::~PhysicsList()
104 {                                                  85 {
105   delete fMessenger;                           <<  86   delete pMessenger;
106   delete fDecayPhysicsList;                    <<  87   delete generalPhysicsList;
107   delete fEmPhysicsList;                       <<  88   delete emPhysicsList;
                                                   >>  89   for(size_t i=0; i<hadronPhys.size(); i++) delete hadronPhys[i];
108 }                                                  90 }
109                                                    91 
110 //....oooOO0OOooo........oooOO0OOooo........oo     92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
111                                                    93 
112 void PhysicsList::ConstructParticle()              94 void PhysicsList::ConstructParticle()
113 {                                                  95 {
114   fDecayPhysicsList->ConstructParticle();      <<  96   particleList->ConstructParticle();
115 }                                                  97 }
116                                                    98 
117 //....oooOO0OOooo........oooOO0OOooo........oo     99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118                                                   100 
119 void PhysicsList::ConstructProcess()              101 void PhysicsList::ConstructProcess()
120 {                                                 102 {
121   AddTransportation();                            103   AddTransportation();
122   fEmPhysicsList->ConstructProcess();          << 104   generalPhysicsList->ConstructProcess();
123   fDecayPhysicsList->ConstructProcess();       << 105   emPhysicsList->ConstructProcess();
                                                   >> 106   for(size_t i=0; i<hadronPhys.size(); i++) hadronPhys[i]->ConstructProcess();
124   AddStepMax();                                   107   AddStepMax();
125 }                                                 108 }
126                                                   109 
127 //....oooOO0OOooo........oooOO0OOooo........oo    110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
128                                                   111 
129 void PhysicsList::AddPhysicsList(const G4Strin    112 void PhysicsList::AddPhysicsList(const G4String& name)
130 {                                                 113 {
131   if (verboseLevel > 1) {                      << 114   if (verboseLevel>-1) {
132     G4cout << "PhysicsList::AddPhysicsList: <"    115     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
133   }                                               116   }
134                                                   117 
135   if (name == fEmName) {                       << 118   if (name == emName) return;
136     return;                                    << 119 
137   }                                            << 120   if (name == "standard") 
138   else if (name == "emstandard_opt0") {        << 121   {
139     fEmName = name;                            << 122     emName = name;
140     delete fEmPhysicsList;                     << 123     delete emPhysicsList;
141     fEmPhysicsList = new G4EmStandardPhysics(0 << 124     emPhysicsList = new PhysListEmStandard(name);
142   }                                            << 125     G4cout<<"PhysListEmStandard is called"<<G4endl;
143   else if (name == "emstandard_opt1") {        << 126   } 
144     fEmName = name;                            << 127 
145     delete fEmPhysicsList;                     << 128   else if (name == "pai") 
146     fEmPhysicsList = new G4EmStandardPhysics_o << 129   {
147   }                                            << 130     emName = name;
148   else if (name == "emstandard_opt2") {        << 131     delete emPhysicsList;
149     fEmName = name;                            << 132     emPhysicsList = new PhysListEmModelPai(name);
150     delete fEmPhysicsList;                     << 133     G4cout<<"PhysListEmModelPai is called"<<G4endl;
151     fEmPhysicsList = new G4EmStandardPhysics_o << 134   }
152   }                                            << 135   else if (name == "pai_photon") 
153   else if (name == "emstandard_opt3") {        << 136   {
154     fEmName = name;                            << 137     emName = name;
155     delete fEmPhysicsList;                     << 138     delete emPhysicsList;
156     fEmPhysicsList = new G4EmStandardPhysics_o << 139     emPhysicsList = new PhysListEmPaiPhoton(name);
157   }                                            << 140     G4cout<<"PhysListEmModelPaiPhoton is called"<<G4endl;
158   else if (name == "emstandard_opt4") {        << 141   } 
159     fEmName = name;                            << 142   else 
160     delete fEmPhysicsList;                     << 143   {
161     fEmPhysicsList = new G4EmStandardPhysics_o << 
162   }                                            << 
163   else if (name == "emstandardWVI") {          << 
164     fEmName = name;                            << 
165     delete fEmPhysicsList;                     << 
166     fEmPhysicsList = new G4EmStandardPhysicsWV << 
167   }                                            << 
168   else if (name == "emstandardSS") {           << 
169     fEmName = name;                            << 
170     delete fEmPhysicsList;                     << 
171     fEmPhysicsList = new G4EmStandardPhysicsSS << 
172   }                                            << 
173   else if (name == "emstandardGS") {           << 
174     fEmName = name;                            << 
175     delete fEmPhysicsList;                     << 
176     fEmPhysicsList = new G4EmStandardPhysicsGS << 
177   }                                            << 
178   else if (name == "pai") {                    << 
179     G4EmParameters::Instance()->AddPAIModel("a << 
180   }                                            << 
181   else if (name == "pai_photon") {             << 
182     G4EmParameters::Instance()->AddPAIModel("a << 
183   }                                            << 
184   else if (name == "emlivermore") {            << 
185     fEmName = name;                            << 
186     delete fEmPhysicsList;                     << 
187     fEmPhysicsList = new G4EmLivermorePhysics( << 
188   }                                            << 
189   else if (name == "empenelope") {             << 
190     fEmName = name;                            << 
191     delete fEmPhysicsList;                     << 
192     fEmPhysicsList = new G4EmPenelopePhysics(0 << 
193   }                                            << 
194   else if (name == "emlowenergy") {            << 
195     fEmName = name;                            << 
196     delete fEmPhysicsList;                     << 
197     fEmPhysicsList = new G4EmLowEPPhysics(0);  << 
198   }                                            << 
199   else {                                       << 
200     G4cout << "PhysicsList::AddPhysicsList: <"    144     G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
201            << " is not defined" << G4endl;     << 145            << " is not defined"
                                                   >> 146            << G4endl;
202   }                                               147   }
203 }                                                 148 }
204                                                   149 
205 //....oooOO0OOooo........oooOO0OOooo........oo    150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
206                                                   151 
                                                   >> 152 #include "StepMax.hh"
                                                   >> 153 
                                                   >> 154 #include "G4ProcessManager.hh"
                                                   >> 155 #include "G4ParticleTypes.hh"
                                                   >> 156 #include "G4ParticleTable.hh"
                                                   >> 157 
                                                   >> 158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 159 
207 void PhysicsList::AddStepMax()                    160 void PhysicsList::AddStepMax()
208 {                                                 161 {
209   // Step limitation seen as a process            162   // Step limitation seen as a process
210   StepMax* stepMaxProcess = new StepMax(fDetec << 163   stepMaxProcess = new StepMax();
                                                   >> 164 
                                                   >> 165   theParticleIterator->reset();
211                                                   166 
212   auto particleIterator = GetParticleIterator( << 167   while ((*theParticleIterator)())
213   particleIterator->reset();                   << 168   {
214   while ((*particleIterator)()) {              << 169     G4ParticleDefinition* particle = theParticleIterator->value();
215     G4ParticleDefinition* particle = particleI << 
216     G4ProcessManager* pmanager = particle->Get    170     G4ProcessManager* pmanager = particle->GetProcessManager();
217                                                   171 
218     if (stepMaxProcess->IsApplicable(*particle << 172     if (stepMaxProcess->IsApplicable(*particle))
219       pmanager->AddDiscreteProcess(stepMaxProc << 173     {
                                                   >> 174       pmanager ->AddDiscreteProcess(stepMaxProcess);
220     }                                             175     }
221   }                                               176   }
222 }                                                 177 }
223                                                   178 
224 //....oooOO0OOooo........oooOO0OOooo........oo    179 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
225                                                   180 
226 void PhysicsList::SetCuts()                       181 void PhysicsList::SetCuts()
227 {                                                 182 {
228   G4ProductionCutsTable::GetProductionCutsTabl << 183 
229   if (verboseLevel > 0) {                      << 184   if ( verboseLevel > 0 )
230     DumpCutValuesTable();                      << 185   {
                                                   >> 186     G4cout << "PhysicsList::SetCuts:";
                                                   >> 187     G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
231   }                                               188   }
                                                   >> 189 
                                                   >> 190   // set cut values for gamma at first and for e- second and next for e+,
                                                   >> 191   // because some processes for e+/e- need cut values for gamma
                                                   >> 192 
                                                   >> 193   SetCutValue(cutForGamma, "gamma");
                                                   >> 194   SetCutValue(cutForElectron, "e-");
                                                   >> 195   SetCutValue(cutForPositron, "e+");
                                                   >> 196 
                                                   >> 197   if ( verboseLevel > 0 ) DumpCutValuesTable();
232 }                                                 198 }
233                                                   199 
234 //....oooOO0OOooo........oooOO0OOooo........oo    200 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 201 
                                                   >> 202 void PhysicsList::SetCutForGamma(G4double cut)
                                                   >> 203 {
                                                   >> 204   cutForGamma = cut;
                                                   >> 205   SetParticleCuts(cutForGamma, G4Gamma::Gamma());
                                                   >> 206 }
                                                   >> 207 
                                                   >> 208 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 209 
                                                   >> 210 void PhysicsList::SetCutForElectron(G4double cut)
                                                   >> 211 {
                                                   >> 212   cutForElectron = cut;
                                                   >> 213   SetParticleCuts(cutForElectron, G4Electron::Electron());
                                                   >> 214 }
                                                   >> 215 
                                                   >> 216 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 217 
                                                   >> 218 void PhysicsList::SetCutForPositron(G4double cut)
                                                   >> 219 {
                                                   >> 220   cutForPositron = cut;
                                                   >> 221   SetParticleCuts(cutForPositron, G4Positron::Positron());
                                                   >> 222 }
                                                   >> 223 
                                                   >> 224 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 225 
235                                                   226