ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ErrorPhysicsList.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ErrorPhysicsList.cc
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 //
27 // ------------------------------------------------------------
28 // GEANT 4 class implementation file
29 // ------------------------------------------------------------
30 
31 #include "globals.hh"
32 
33 #include "G4PhysicalConstants.hh"
34 #include "G4SystemOfUnits.hh"
35 
36 #include "G4ErrorPhysicsList.hh"
37 #include "G4ComptonScattering.hh"
38 #include "G4GammaConversion.hh"
39 #include "G4PhotoElectricEffect.hh"
40 
41 #include "G4eIonisation.hh"
42 #include "G4eBremsstrahlung.hh"
43 #include "G4eplusAnnihilation.hh"
44 
45 #include "G4MuIonisation.hh"
46 #include "G4MuBremsstrahlung.hh"
47 #include "G4MuPairProduction.hh"
48 
49 #include "G4hIonisation.hh"
50 
51 #include "G4MuIonisation.hh"
52 #include "G4MuBremsstrahlung.hh"
53 #include "G4MuPairProduction.hh"
54 
55 #include "G4hIonisation.hh"
56 
57 #include "G4ParticleDefinition.hh"
58 #include "G4ProcessManager.hh"
59 #include "G4ProcessVector.hh"
60 #include "G4ParticleTypes.hh"
61 #include "G4ParticleTable.hh"
62 #include "G4Material.hh"
63 #include "G4MaterialTable.hh"
64 #include "G4ios.hh"
65 #include "G4PhysicsTable.hh"
66 #include "G4Transportation.hh"
67 
68 #include "G4ErrorEnergyLoss.hh"
69 
70 //------------------------------------------------------------------------
72 {
73  defaultCutValue = 1.0E+9*cm; // set big step so that AlongStep computes all the energy
74 }
75 
76 
77 //------------------------------------------------------------------------
79 {
80 }
81 
82 
83 //------------------------------------------------------------------------
85 {
86 // In this method, static member functions should be called
87  // for all particles which you want to use.
88  // This ensures that objects of these particle types will be
89  // created in the program.
90  // gamma
92  // e+/-
95  // mu+/-
98 
99  // pi+/-
102 
103  // proton
105 
106 }
107 
108 
109 //------------------------------------------------------------------------
111 {
112  G4Transportation* theTransportationProcess= new G4Transportation();
113 
114 #ifdef G4VERBOSE
115  if (verboseLevel >= 4){
116  G4cout << "G4VUserPhysicsList::ConstructProcess() "<< G4endl;
117  }
118 #endif
119 
120  // loop over all particles in G4ParticleTable
121  auto myParticleIterator=GetParticleIterator();
122  myParticleIterator->reset();
123  while( (*myParticleIterator)() ) { // Loop checking, 06.08.2015, G.Cosmo
124  G4ParticleDefinition* particle = myParticleIterator->value();
125  G4ProcessManager* pmanager = particle->GetProcessManager();
126  if (!particle->IsShortLived()) {
127  G4cout << particle << "G4ErrorPhysicsList:: particle process manager " << particle->GetParticleName() << " = " << particle->GetProcessManager() << G4endl;
128  // Add transportation process for all particles other than "shortlived"
129  if ( pmanager == 0) {
130  // Error !! no process manager
131  G4String particleName = particle->GetParticleName();
132  G4Exception("G4ErrorPhysicsList::ConstructProcess","No process manager",
133  RunMustBeAborted, particleName );
134  } else {
135  // add transportation with ordering = ( -1, "first", "first" )
136  pmanager ->AddProcess(theTransportationProcess);
137  pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxAlongStep);
138  pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxPostStep);
139  }
140  } else {
141  // shortlived particle case
142  }
143  }
144 
145  ConstructEM();
146 }
147 
148 
149 //------------------------------------------------------------------------
150 #include "G4eBremsstrahlung.hh"
151 #include "G4eIonisation.hh"
152 
153 #include "G4eIonisation.hh"
154 
155 #include "G4MuBremsstrahlung.hh"
156 #include "G4MuIonisation.hh"
157 #include "G4MuPairProduction.hh"
158 
159 #include "G4PhysicsTable.hh"
160 
161 #include "G4MuIonisation.hh"
162 
165 #include "G4ErrorMessenger.hh"
166 
168 {
169 
170  G4ErrorEnergyLoss* eLossProcess = new G4ErrorEnergyLoss;
171  G4ErrorStepLengthLimitProcess* stepLengthLimitProcess = new G4ErrorStepLengthLimitProcess;
172  G4ErrorMagFieldLimitProcess* magFieldLimitProcess = new G4ErrorMagFieldLimitProcess;
173  new G4ErrorMessenger( stepLengthLimitProcess, magFieldLimitProcess, eLossProcess );
174 
175  auto myParticleIterator=GetParticleIterator();
176  myParticleIterator->reset();
177  while( (*myParticleIterator)() ) { // Loop checking, 06.08.2015, G.Cosmo
178  G4ParticleDefinition* particle = myParticleIterator->value();
179  G4ProcessManager* pmanager = particle->GetProcessManager();
180  G4String particleName = particle->GetParticleName();
181 
182  if (particleName == "gamma") {
183  // gamma
184  pmanager->AddDiscreteProcess(new G4GammaConversion());
185  pmanager->AddDiscreteProcess(new G4ComptonScattering());
186  pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
187 
188  // } else if (particleName == "e-" || particleName == "e+"
189  // || particleName == "mu+" || particleName == "mu-" ) {
190  }else if (!particle->IsShortLived() && particle->GetPDGCharge() != 0 ) {
191 
192  pmanager->AddContinuousProcess(eLossProcess,1);
193  pmanager->AddDiscreteProcess( stepLengthLimitProcess, 2 );
194  pmanager->AddDiscreteProcess( magFieldLimitProcess, 3 );
195 
196  /* } else if ((!particle->IsShortLived()) &&
197  (particle->GetPDGCharge() != 0.0) &&
198  (particle->GetParticleName() != "chargedgeantino")) {
199  // all others charged particles except geantino
200  // G4VProcess* aMultipleScattering = new G4MultipleScattering();
201  G4VProcess* anIonisation = new G4hIonisation();
203 
204  //
205  // add processes
206  pmanager->AddProcess(anIonisation);
207  // pmanager->AddProcess(aMultipleScattering);
209 
210  //
211  // set ordering for AlongStepDoIt
212  // pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
213  pmanager->SetProcessOrdering(anIonisation, idxAlongStep,1);
214 
215  //
216  // set ordering for PostStepDoIt
217  // pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
218  pmanager->SetProcessOrdering(anIonisation, idxPostStep,1);
220  */
221  }
222  }
223 }
224 
225 
226 //------------------------------------------------------------------------
228 {
229  // " G4VUserPhysicsList::SetCutsWithDefault" method sets
230  // the default cut value or all particle types
232  // if (verboseLevel>0)
233  // DumpCutValuesTable();
234 }
235