Belle II Software development
Geant4ePhysics.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <simulation/physicslist/Geant4ePhysics.h>
10
11#include <G4ParticleTable.hh>
12#include <G4ParticleDefinition.hh>
13#include <G4ProcessManager.hh>
14#include <G4ComptonScattering.hh>
15#include <G4GammaConversion.hh>
16#include <G4PhotoElectricEffect.hh>
17#include <simulation/kernel/ExtStepLengthLimitProcess.h>
18#include <simulation/kernel/ExtMagFieldLimitProcess.h>
19#include <simulation/kernel/ExtEnergyLoss.h>
20#include <simulation/kernel/ExtMessenger.h>
21
22#define g4ePDGcode 0
23
24using namespace std;
25using namespace Belle2;
26using namespace Simulation;
27
28Geant4ePhysics::Geant4ePhysics() :
29// G4VPhysicsConstructor("Geant4ePhysics"),
30 m_StepLengthLimitProcess(NULL), m_MagFieldLimitProcess(NULL),
31 m_ELossProcess(NULL), m_Messenger(NULL)
32{
33 if (false) {
36 }
37}
38
40{
44 if (m_Messenger) delete m_Messenger;
45}
46
47
49{
50 /*
51 // Create ext-specific copies of useful particles, in case we are
52 // running the geant4e extrapolator. These particles will have a
53 // limited process list and can coexist with geant4 particles: they
54 // are distinguished by their name having the prefix "g4e_" and their
55 // "PDG code" always being the reserved value of 0 (which means that
56 // the user must use FindParticle(name) rather than FindParticle(#)
57 // to look up these special particles.
58 // Arguments for G4ParticleDefinition() are as follows:
59 // name mass width charge
60 // 2*spin parity C-conjugation
61 // 2*Isospin 2*Isospin3 G-parity
62 // type lepton number baryon number PDG encoding
63 // stable lifetime decay table
64 // shortlived subType anti_encoding
65 // Values copied verbatim from geant4, except our particles don't decay
66 // and the names/PDGcodes are unique.
67
68 static G4ParticleDefinition* g4eParticle = NULL;
69
70 if (g4eParticle == NULL) {
71 // Bohr Magneton for positron and positive muon
72 G4double muBpositron = 0.5 * CLHEP::eplus * CLHEP::hbar_Planck / (0.51099906 * CLHEP::MeV / CLHEP::c_squared);
73 G4double muBmuon = 0.5 * CLHEP::eplus * CLHEP::hbar_Planck / (0.1056584 * CLHEP::GeV / CLHEP::c_squared);
74 G4double muNucleon = CLHEP::eplus * CLHEP::hbar_Planck / 2. / (CLHEP::proton_mass_c2 / CLHEP::c_squared);
75 // Copied from G4Gamma.cc
76 g4eParticle = new G4ParticleDefinition(
77 "g4e_gamma", 0.0 * CLHEP::MeV, 0.0 * CLHEP::MeV, 0.0,
78 2, -1, -1,
79 0, 0, 0,
80 "gamma", 0, 0, g4ePDGcode,
81 true, 0.0, NULL,
82 false, "photon", g4ePDGcode
83 );
84 // Copied from G4Electron.cc
85 new G4ParticleDefinition(
86 "g4e_e-", 0.51099906 * CLHEP::MeV, 0.0 * CLHEP::MeV, -1.0 * CLHEP::eplus,
87 1, 0, 0,
88 0, 0, 0,
89 "lepton", 1, 0, g4ePDGcode,
90 true, -1.0, NULL,
91 false, "e", g4ePDGcode, -1.0011596521859 * muBpositron
92 );
93 // Copied from G4Positron.cc
94 new G4ParticleDefinition(
95 "g4e_e+", 0.51099906 * CLHEP::MeV, 0.0 * CLHEP::MeV, +1.0 * CLHEP::eplus,
96 1, 0, 0,
97 0, 0, 0,
98 "lepton", -1, 0, g4ePDGcode,
99 true, -1.0, NULL,
100 false, "e", g4ePDGcode, 1.0011596521859 * muBpositron
101 );
102 // Copied from G4MuonPlus.cc
103 new G4ParticleDefinition(
104 "g4e_mu+", 0.1056584 * CLHEP::GeV, 2.99591e-16 * CLHEP::MeV, +1.0 * CLHEP::eplus,
105 1, 0, 0,
106 0, 0, 0,
107 "lepton", -1, 0, g4ePDGcode,
108 true, -1.0, NULL,
109 false, "mu", g4ePDGcode, 1.0011659208 * muBmuon
110 );
111 // Copied from G4MuonMinus.cc
112 new G4ParticleDefinition(
113 "g4e_mu-", 0.1056584 * CLHEP::GeV, 2.99591e-16 * CLHEP::MeV, -1.0 * CLHEP::eplus,
114 1, 0, 0,
115 0, 0, 0,
116 "lepton", 1, 0, g4ePDGcode,
117 true, -1.0, NULL,
118 false, "mu", g4ePDGcode, -1.0011659208 * muBmuon
119 );
120 // Copied from G4PionPlus.cc
121 new G4ParticleDefinition(
122 "g4e_pi+", 0.1395700 * CLHEP::GeV, 2.5284e-14 * CLHEP::MeV, +1.0 * CLHEP::eplus,
123 0, -1, 0,
124 2, +2, -1,
125 "meson", 0, 0, g4ePDGcode,
126 true, -1.0, NULL,
127 false, "pi", g4ePDGcode
128 );
129 // Copied from G4PionMinus.cc
130 new G4ParticleDefinition(
131 "g4e_pi-", 0.1395700 * CLHEP::GeV, 2.5284e-14 * CLHEP::MeV, -1.0 * CLHEP::eplus,
132 0, -1, 0,
133 2, -2, -1,
134 "meson", 0, 0, g4ePDGcode,
135 true, -1.0, NULL,
136 false, "pi", g4ePDGcode
137 );
138 // Copied from G4KaonPlus.cc
139 new G4ParticleDefinition(
140 "g4e_kaon+", 0.493677 * CLHEP::GeV, 5.315e-14 * CLHEP::MeV, +1.0 * CLHEP::eplus,
141 0, -1, 0,
142 1, +1, 0,
143 "meson", 0, 0, g4ePDGcode,
144 true, -1.0, NULL,
145 false, "kaon", g4ePDGcode
146 );
147 // Copied from G4KaonMinus.cc
148 new G4ParticleDefinition(
149 "g4e_kaon-", 0.493677 * CLHEP::GeV, 5.315e-14 * CLHEP::MeV, -1.0 * CLHEP::eplus,
150 0, -1, 0,
151 1, -1, 0,
152 "meson", 0, 0, g4ePDGcode,
153 true, -1.0, NULL,
154 false, "kaon", g4ePDGcode
155 );
156 // Copied from G4Proton.cc except use G4ParticleDefinition instead of G4Ions
157 new G4ParticleDefinition(
158 "g4e_proton", 0.9382723 * CLHEP::GeV, 0.0 * CLHEP::MeV, +1.0 * CLHEP::eplus,
159 1, +1, 0,
160 1, +1, 0,
161 "baryon", 0, +1, g4ePDGcode,
162 true, -1.0, NULL,
163 false, "nucleon", g4ePDGcode, 2.792847351 * muNucleon
164 );
165 // Copied from G4AntiProton.cc except use G4ParticleDefinition instead of G4Ions
166 new G4ParticleDefinition(
167 "g4e_anti_proton", 0.9382723 * CLHEP::GeV, 0.0 * CLHEP::MeV, -1.0 * CLHEP::eplus,
168 1, +1, 0,
169 1, -1, 0,
170 "baryon", 0, -1, g4ePDGcode,
171 true, -1.0, NULL,
172 false, "nucleon", g4ePDGcode, -2.792847351 * muNucleon
173 );
174 // copied from G4Deuteron.hh except use G4ParticleDefinition instead of G4Ions
175 new G4ParticleDefinition(
176 "g4e_deuteron", 1.875613 * CLHEP::GeV, 0.0 * CLHEP::MeV, +1.0 * CLHEP::eplus,
177 2, +1, 0,
178 0, 0, 0,
179 "nucleus", 0, +2, g4ePDGcode,
180 true, -1.0, NULL,
181 false, "static", g4ePDGcode, 0.857438230 * muNucleon
182
183 );
184 // copied from G4AntiDeuteron.hh except use G4ParticleDefinition instead of G4Ions
185 new G4ParticleDefinition(
186 "g4e_anti_deuteron", 1.875613 * CLHEP::GeV, 0.0 * CLHEP::MeV, -1.0 * CLHEP::eplus,
187 2, +1, 0,
188 0, 0, 0,
189 "anti_nucleus", 0, -2, g4ePDGcode,
190 true, -1.0, NULL,
191 false, "static", g4ePDGcode, -0.857438230 * muNucleon
192 );
193
194 }
195 */
196}
197
198
200{
201 // Define the limited set of processes that will be suffered by the
202 // geant4e-specific particles
207 G4ParticleTable* myParticleTable = G4ParticleTable::GetParticleTable();
208 // theParticleIterator is a Geant4 macro since version 10.
209 G4ParticleTable::G4PTblDicIterator* myParticleIterator = myParticleTable->GetIterator();
210 myParticleIterator->reset();
211 while ((*myParticleIterator)()) {
212 G4ParticleDefinition* particle = myParticleIterator->value();
213 G4ProcessManager* pmanager = particle->GetProcessManager();
214 G4String particleName = particle->GetParticleName();
215 if (particleName.compare(0, 4, "g4e_") == 0) {
216 if (particleName == "g4e_gamma") {
217 pmanager->AddDiscreteProcess(new G4GammaConversion());
218 pmanager->AddDiscreteProcess(new G4ComptonScattering());
219 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
220 } else {
221 pmanager->AddContinuousProcess(m_ELossProcess, 1);
222 pmanager->AddDiscreteProcess(m_StepLengthLimitProcess, 2);
223 pmanager->AddDiscreteProcess(m_MagFieldLimitProcess, 3);
224 }
225 }
226 }
227}
228
Define physics process to calculate energy loss without fluctuations.
Definition: ExtEnergyLoss.h:32
Defines the physics process that avoids hit invocation in sensitive volumes.
Define the mechanism by which the user can communicate with the geant4e extrapolator using geant4 UI ...
Definition: ExtMessenger.h:36
Defines the physics process that avoids hit invocation in sensitive volumes.
ExtStepLengthLimitProcess * m_StepLengthLimitProcess
Process that limits the geant4e step length.
ExtMagFieldLimitProcess * m_MagFieldLimitProcess
Process that limits the geant4e step length in magnetic field.
virtual void ConstructParticle() override
ConstructParticle() defines the geant4e-specific particles.
ExtMessenger * m_Messenger
Pointer to the ExtMessenger that is used to control geant4e.
virtual ~Geant4ePhysics()
The Geant4ePhysics destructor.
virtual void ConstructProcess() override
ConstructProcess() defines the geant4e-specific processes.
ExtEnergyLoss * m_ELossProcess
Process that limits the geant4e step length due to energy loss.
Abstract base class for different kinds of events.
STL namespace.