Geant4 10.7.0
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//------------------------------------------------------------------------
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;
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());
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();
202 ////G4VProcess* theUserCuts = new G4UserSpecialCuts();
203
204 //
205 // add processes
206 pmanager->AddProcess(anIonisation);
207 // pmanager->AddProcess(aMultipleScattering);
208 ////pmanager->AddProcess(theUserCuts);
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);
219 ////pmanager->SetProcessOrdering(theUserCuts, idxPostStep,2);
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
@ RunMustBeAborted
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
@ idxPostStep
@ idxAlongStep
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4Electron * ElectronDefinition()
Definition: G4Electron.cc:88
virtual void ConstructProcess()
virtual void ConstructEM()
virtual void ConstructParticle()
static G4Gamma * GammaDefinition()
Definition: G4Gamma.cc:80
static G4MuonMinus * MuonMinusDefinition()
Definition: G4MuonMinus.cc:94
static G4MuonPlus * MuonPlusDefinition()
Definition: G4MuonPlus.cc:93
G4ProcessManager * GetProcessManager() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
static G4PionMinus * PionMinusDefinition()
Definition: G4PionMinus.cc:92
static G4PionPlus * PionPlusDefinition()
Definition: G4PionPlus.cc:92
static G4Positron * PositronDefinition()
Definition: G4Positron.cc:88
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:87
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const