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