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
28// Note: G4VPhysicsConstructor("Geant4ePhysics") is deliberately not invoked here.
32
40
41
43{
44 /*
45 // Create ext-specific copies of useful particles, in case we are
46 // running the geant4e extrapolator. These particles will have a
47 // limited process list and can coexist with geant4 particles: they
48 // are distinguished by their name having the prefix "g4e_" and their
49 // "PDG code" always being the reserved value of 0 (which means that
50 // the user must use FindParticle(name) rather than FindParticle(#)
51 // to look up these special particles.
52 // Arguments for G4ParticleDefinition() are as follows:
53 // name mass width charge
54 // 2*spin parity C-conjugation
55 // 2*Isospin 2*Isospin3 G-parity
56 // type lepton number baryon number PDG encoding
57 // stable lifetime decay table
58 // shortlived subType anti_encoding
59 // Values copied verbatim from geant4, except our particles don't decay
60 // and the names/PDGcodes are unique.
61
62 static G4ParticleDefinition* g4eParticle = NULL;
63
64 if (g4eParticle == NULL) {
65 // Bohr Magneton for positron and positive muon
66 G4double muBpositron = 0.5 * CLHEP::eplus * CLHEP::hbar_Planck / (0.51099906 * CLHEP::MeV / CLHEP::c_squared);
67 G4double muBmuon = 0.5 * CLHEP::eplus * CLHEP::hbar_Planck / (0.1056584 * CLHEP::GeV / CLHEP::c_squared);
68 G4double muNucleon = CLHEP::eplus * CLHEP::hbar_Planck / 2. / (CLHEP::proton_mass_c2 / CLHEP::c_squared);
69 // Copied from G4Gamma.cc
70 g4eParticle = new G4ParticleDefinition(
71 "g4e_gamma", 0.0 * CLHEP::MeV, 0.0 * CLHEP::MeV, 0.0,
72 2, -1, -1,
73 0, 0, 0,
74 "gamma", 0, 0, g4ePDGcode,
75 true, 0.0, NULL,
76 false, "photon", g4ePDGcode
77 );
78 // Copied from G4Electron.cc
79 new G4ParticleDefinition(
80 "g4e_e-", 0.51099906 * CLHEP::MeV, 0.0 * CLHEP::MeV, -1.0 * CLHEP::eplus,
81 1, 0, 0,
82 0, 0, 0,
83 "lepton", 1, 0, g4ePDGcode,
84 true, -1.0, NULL,
85 false, "e", g4ePDGcode, -1.0011596521859 * muBpositron
86 );
87 // Copied from G4Positron.cc
88 new G4ParticleDefinition(
89 "g4e_e+", 0.51099906 * CLHEP::MeV, 0.0 * CLHEP::MeV, +1.0 * CLHEP::eplus,
90 1, 0, 0,
91 0, 0, 0,
92 "lepton", -1, 0, g4ePDGcode,
93 true, -1.0, NULL,
94 false, "e", g4ePDGcode, 1.0011596521859 * muBpositron
95 );
96 // Copied from G4MuonPlus.cc
97 new G4ParticleDefinition(
98 "g4e_mu+", 0.1056584 * CLHEP::GeV, 2.99591e-16 * CLHEP::MeV, +1.0 * CLHEP::eplus,
99 1, 0, 0,
100 0, 0, 0,
101 "lepton", -1, 0, g4ePDGcode,
102 true, -1.0, NULL,
103 false, "mu", g4ePDGcode, 1.0011659208 * muBmuon
104 );
105 // Copied from G4MuonMinus.cc
106 new G4ParticleDefinition(
107 "g4e_mu-", 0.1056584 * CLHEP::GeV, 2.99591e-16 * CLHEP::MeV, -1.0 * CLHEP::eplus,
108 1, 0, 0,
109 0, 0, 0,
110 "lepton", 1, 0, g4ePDGcode,
111 true, -1.0, NULL,
112 false, "mu", g4ePDGcode, -1.0011659208 * muBmuon
113 );
114 // Copied from G4PionPlus.cc
115 new G4ParticleDefinition(
116 "g4e_pi+", 0.1395700 * CLHEP::GeV, 2.5284e-14 * CLHEP::MeV, +1.0 * CLHEP::eplus,
117 0, -1, 0,
118 2, +2, -1,
119 "meson", 0, 0, g4ePDGcode,
120 true, -1.0, NULL,
121 false, "pi", g4ePDGcode
122 );
123 // Copied from G4PionMinus.cc
124 new G4ParticleDefinition(
125 "g4e_pi-", 0.1395700 * CLHEP::GeV, 2.5284e-14 * CLHEP::MeV, -1.0 * CLHEP::eplus,
126 0, -1, 0,
127 2, -2, -1,
128 "meson", 0, 0, g4ePDGcode,
129 true, -1.0, NULL,
130 false, "pi", g4ePDGcode
131 );
132 // Copied from G4KaonPlus.cc
133 new G4ParticleDefinition(
134 "g4e_kaon+", 0.493677 * CLHEP::GeV, 5.315e-14 * CLHEP::MeV, +1.0 * CLHEP::eplus,
135 0, -1, 0,
136 1, +1, 0,
137 "meson", 0, 0, g4ePDGcode,
138 true, -1.0, NULL,
139 false, "kaon", g4ePDGcode
140 );
141 // Copied from G4KaonMinus.cc
142 new G4ParticleDefinition(
143 "g4e_kaon-", 0.493677 * CLHEP::GeV, 5.315e-14 * CLHEP::MeV, -1.0 * CLHEP::eplus,
144 0, -1, 0,
145 1, -1, 0,
146 "meson", 0, 0, g4ePDGcode,
147 true, -1.0, NULL,
148 false, "kaon", g4ePDGcode
149 );
150 // Copied from G4Proton.cc except use G4ParticleDefinition instead of G4Ions
151 new G4ParticleDefinition(
152 "g4e_proton", 0.9382723 * CLHEP::GeV, 0.0 * CLHEP::MeV, +1.0 * CLHEP::eplus,
153 1, +1, 0,
154 1, +1, 0,
155 "baryon", 0, +1, g4ePDGcode,
156 true, -1.0, NULL,
157 false, "nucleon", g4ePDGcode, 2.792847351 * muNucleon
158 );
159 // Copied from G4AntiProton.cc except use G4ParticleDefinition instead of G4Ions
160 new G4ParticleDefinition(
161 "g4e_anti_proton", 0.9382723 * CLHEP::GeV, 0.0 * CLHEP::MeV, -1.0 * CLHEP::eplus,
162 1, +1, 0,
163 1, -1, 0,
164 "baryon", 0, -1, g4ePDGcode,
165 true, -1.0, NULL,
166 false, "nucleon", g4ePDGcode, -2.792847351 * muNucleon
167 );
168 // copied from G4Deuteron.hh except use G4ParticleDefinition instead of G4Ions
169 new G4ParticleDefinition(
170 "g4e_deuteron", 1.875613 * CLHEP::GeV, 0.0 * CLHEP::MeV, +1.0 * CLHEP::eplus,
171 2, +1, 0,
172 0, 0, 0,
173 "nucleus", 0, +2, g4ePDGcode,
174 true, -1.0, NULL,
175 false, "static", g4ePDGcode, 0.857438230 * muNucleon
176
177 );
178 // copied from G4AntiDeuteron.hh except use G4ParticleDefinition instead of G4Ions
179 new G4ParticleDefinition(
180 "g4e_anti_deuteron", 1.875613 * CLHEP::GeV, 0.0 * CLHEP::MeV, -1.0 * CLHEP::eplus,
181 2, +1, 0,
182 0, 0, 0,
183 "anti_nucleus", 0, -2, g4ePDGcode,
184 true, -1.0, NULL,
185 false, "static", g4ePDGcode, -0.857438230 * muNucleon
186 );
187
188 }
189 */
190}
191
192
194{
195 // Define the limited set of processes that will be suffered by the
196 // geant4e-specific particles
201 G4ParticleTable* myParticleTable = G4ParticleTable::GetParticleTable();
202 // theParticleIterator is a Geant4 macro since version 10.
203 G4ParticleTable::G4PTblDicIterator* myParticleIterator = myParticleTable->GetIterator();
204 myParticleIterator->reset();
205 while ((*myParticleIterator)()) {
206 G4ParticleDefinition* particle = myParticleIterator->value();
207 G4ProcessManager* pmanager = particle->GetProcessManager();
208 G4String particleName = particle->GetParticleName();
209 if (particleName.compare(0, 4, "g4e_") == 0) {
210 if (particleName == "g4e_gamma") {
211 pmanager->AddDiscreteProcess(new G4GammaConversion());
212 pmanager->AddDiscreteProcess(new G4ComptonScattering());
213 pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
214 } else {
215 pmanager->AddContinuousProcess(m_ELossProcess, 1);
216 pmanager->AddDiscreteProcess(m_StepLengthLimitProcess, 2);
217 pmanager->AddDiscreteProcess(m_MagFieldLimitProcess, 3);
218 }
219 }
220 }
221}
222
Define physics process to calculate energy loss without fluctuations.
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 ...
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.
Geant4ePhysics()
The Geant4ePhysics constructor.
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.