Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ErrorPhysicsList.cc
Go to the documentation of this file.
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
34#include "G4SystemOfUnits.hh"
35
36#include "G4ErrorPhysicsList.hh"
38#include "G4GammaConversion.hh"
40
41#include "G4eIonisation.hh"
42#include "G4eBremsstrahlung.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
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//------------------------------------------------------------------------
73{
75 1.0E+9 * cm; // set big step so that AlongStep computes all the energy
76}
77
78//------------------------------------------------------------------------
80
81//------------------------------------------------------------------------
83{
84 // In this method, static member functions should be called
85 // for all particles which you want to use.
86 // This ensures that objects of these particle types will be
87 // created in the program.
88 // gamma
90 // e+/-
93 // mu+/-
96
97 // pi+/-
100
101 // proton
103}
104
105//------------------------------------------------------------------------
107{
108 G4Transportation* theTransportationProcess = new G4Transportation();
109
110#ifdef G4VERBOSE
111 if(verboseLevel >= 4)
112 {
113 G4cout << "G4VUserPhysicsList::ConstructProcess() " << G4endl;
114 }
115#endif
116
117 // loop over all particles in G4ParticleTable
118 auto myParticleIterator = GetParticleIterator();
119 myParticleIterator->reset();
120 while((*myParticleIterator)())
121 { // Loop checking, 06.08.2015, G.Cosmo
122 G4ParticleDefinition* particle = myParticleIterator->value();
123 G4ProcessManager* pmanager = particle->GetProcessManager();
124 if(!particle->IsShortLived())
125 {
126 G4cout << particle << "G4ErrorPhysicsList:: particle process manager "
127 << particle->GetParticleName() << " = "
128 << particle->GetProcessManager() << G4endl;
129 // Add transportation process for all particles other than "shortlived"
130 if(pmanager == 0)
131 {
132 // Error !! no process manager
133 G4String particleName = particle->GetParticleName();
134 G4Exception("G4ErrorPhysicsList::ConstructProcess",
135 "No process manager", RunMustBeAborted, particleName);
136 }
137 else
138 {
139 // add transportation with ordering = ( -1, "first", "first" )
140 pmanager->AddProcess(theTransportationProcess);
141 pmanager->SetProcessOrderingToFirst(theTransportationProcess,
143 pmanager->SetProcessOrderingToFirst(theTransportationProcess,
145 }
146 }
147 else
148 {
149 // shortlived particle case
150 }
151 }
152
153 ConstructEM();
154}
155
156//------------------------------------------------------------------------
157#include "G4eBremsstrahlung.hh"
158#include "G4eIonisation.hh"
159
160#include "G4eIonisation.hh"
161
162#include "G4MuBremsstrahlung.hh"
163#include "G4MuIonisation.hh"
164#include "G4MuPairProduction.hh"
165
166#include "G4PhysicsTable.hh"
167
168#include "G4MuIonisation.hh"
169
172#include "G4ErrorMessenger.hh"
173
175{
176 G4ErrorEnergyLoss* eLossProcess = new G4ErrorEnergyLoss;
177 G4ErrorStepLengthLimitProcess* stepLengthLimitProcess =
179 G4ErrorMagFieldLimitProcess* magFieldLimitProcess =
181 new G4ErrorMessenger(stepLengthLimitProcess, magFieldLimitProcess,
182 eLossProcess);
183
184 auto myParticleIterator = GetParticleIterator();
185 myParticleIterator->reset();
186 while((*myParticleIterator)())
187 { // Loop checking, 06.08.2015, G.Cosmo
188 G4ParticleDefinition* particle = myParticleIterator->value();
189 G4ProcessManager* pmanager = particle->GetProcessManager();
190 G4String particleName = particle->GetParticleName();
191
192 if(particleName == "gamma")
193 {
194 // gamma
195 pmanager->AddDiscreteProcess(new G4GammaConversion());
198
199 // } else if (particleName == "e-" || particleName == "e+"
200 // || particleName == "mu+" || particleName == "mu-" ) {
201 }
202 else if(!particle->IsShortLived() && particle->GetPDGCharge() != 0)
203 {
204 pmanager->AddContinuousProcess(eLossProcess, 1);
205 pmanager->AddDiscreteProcess(stepLengthLimitProcess, 2);
206 pmanager->AddDiscreteProcess(magFieldLimitProcess, 3);
207
208 /* } else if ((!particle->IsShortLived()) &&
209 (particle->GetPDGCharge() != 0.0) &&
210 (particle->GetParticleName() != "chargedgeantino")) {
211 // all others charged particles except geantino
212 // G4VProcess* aMultipleScattering = new G4MultipleScattering();
213 G4VProcess* anIonisation = new G4hIonisation();
214 ////G4VProcess* theUserCuts = new G4UserSpecialCuts();
215
216 //
217 // add processes
218 pmanager->AddProcess(anIonisation);
219 // pmanager->AddProcess(aMultipleScattering);
220 ////pmanager->AddProcess(theUserCuts);
221
222 //
223 // set ordering for AlongStepDoIt
224 // pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
225 pmanager->SetProcessOrdering(anIonisation, idxAlongStep,1);
226
227 //
228 // set ordering for PostStepDoIt
229 // pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
230 pmanager->SetProcessOrdering(anIonisation, idxPostStep,1);
231 ////pmanager->SetProcessOrdering(theUserCuts, idxPostStep,2);
232 */
233 }
234 }
235}
236
237//------------------------------------------------------------------------
239{
240 // " G4VUserPhysicsList::SetCutsWithDefault" method sets
241 // the default cut value or all particle types
243 // if (verboseLevel>0)
244 // DumpCutValuesTable();
245}
@ RunMustBeAborted
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
@ idxPostStep
@ idxAlongStep
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4Electron * ElectronDefinition()
Definition G4Electron.cc:86
virtual void ConstructProcess()
virtual void ConstructParticle()
static G4Gamma * GammaDefinition()
Definition G4Gamma.cc:76
static G4MuonMinus * MuonMinusDefinition()
static G4MuonPlus * MuonPlusDefinition()
Definition G4MuonPlus.cc:93
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
static G4PionMinus * PionMinusDefinition()
static G4PionPlus * PionPlusDefinition()
Definition G4PionPlus.cc:88
static G4Positron * PositronDefinition()
Definition G4Positron.cc:85
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4int AddContinuousProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
void SetProcessOrderingToFirst(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
static G4Proton * ProtonDefinition()
Definition G4Proton.cc:85
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const