Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4EmBuilder.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// Geant4 class G4EmBuilder
28//
29// Author V.Ivanchenko 22.05.2020
30//
31
32#include "G4EmBuilder.hh"
33
34#include "G4SystemOfUnits.hh"
36#include "G4PhysListUtil.hh"
37#include "G4EmParameters.hh"
39
44#include "G4WentzelVIModel.hh"
45
46#include "G4ProcessManager.hh"
49
54
55#include "G4MuIonisation.hh"
56#include "G4MuBremsstrahlung.hh"
57#include "G4MuPairProduction.hh"
58#include "G4hBremsstrahlung.hh"
59#include "G4hPairProduction.hh"
60
61#include "G4hIonisation.hh"
62#include "G4ionIonisation.hh"
63#include "G4NuclearStopping.hh"
64
67
68#include "G4ParticleTable.hh"
69#include "G4Gamma.hh"
70#include "G4Electron.hh"
71#include "G4Positron.hh"
72
73#include "G4ChargedGeantino.hh"
74#include "G4Geantino.hh"
75#include "G4NeutrinoMu.hh"
76#include "G4AntiNeutrinoMu.hh"
77#include "G4NeutrinoE.hh"
78#include "G4AntiNeutrinoE.hh"
79
80#include "G4MuonPlus.hh"
81#include "G4MuonMinus.hh"
82#include "G4PionPlus.hh"
83#include "G4PionMinus.hh"
84#include "G4PionZero.hh"
85#include "G4KaonPlus.hh"
86#include "G4KaonMinus.hh"
87#include "G4Proton.hh"
88#include "G4AntiProton.hh"
89#include "G4Lambda.hh"
90#include "G4AntiLambda.hh"
91
92#include "G4Deuteron.hh"
93#include "G4Triton.hh"
94#include "G4He3.hh"
95#include "G4Alpha.hh"
96#include "G4GenericIon.hh"
97
99#include "G4HadParticles.hh"
101#include "G4LossTableManager.hh"
103
105 const std::vector<G4int>& partList)
106{
109
110 for( auto & pdg : partList ) {
111 auto part = table->FindParticle( pdg );
112 if ( part == nullptr || part->GetPDGCharge() == 0.0 ) { continue; }
113 ph->RegisterProcess(hmsc, part);
114 ph->RegisterProcess(new G4hIonisation(), part);
115 }
116}
117
119 G4NuclearStopping* nucStopping)
120{
122
124 ph->RegisterProcess(hmsc, part);
125 ph->RegisterProcess(new G4hIonisation(), part);
126
127 part = G4Triton::Triton();
128 ph->RegisterProcess(hmsc, part);
129 ph->RegisterProcess(new G4hIonisation(), part);
130
131 part = G4Alpha::Alpha();
132 ph->RegisterProcess(new G4hMultipleScattering(), part);
133 ph->RegisterProcess(new G4ionIonisation(), part);
134 if( nucStopping != nullptr ) {
135 ph->RegisterProcess(nucStopping, part);
136 }
137
138 part = G4He3::He3();
139 ph->RegisterProcess(new G4hMultipleScattering(), part);
140 ph->RegisterProcess(new G4ionIonisation(), part);
141 if( nucStopping != nullptr ) {
142 ph->RegisterProcess(nucStopping, part);
143 }
144}
145
147{
149
151 ph->RegisterProcess(new G4hIonisation(), part);
152 ph->RegisterProcess(new G4CoulombScattering(false), part);
153
154 part = G4Triton::Triton();
155 ph->RegisterProcess(new G4hIonisation(), part);
156 ph->RegisterProcess(new G4CoulombScattering(false), part);
157
158 part = G4Alpha::Alpha();
159 ph->RegisterProcess(new G4ionIonisation(), part);
160 ph->RegisterProcess(new G4CoulombScattering(false), part);
161
162 part = G4He3::He3();
163 ph->RegisterProcess(new G4ionIonisation(), part);
164 ph->RegisterProcess(new G4CoulombScattering(false), part);
165}
166
169 G4bool isHEP, G4bool isProton,
170 G4bool isWVI)
171{
173
175 if(isWVI) { msc->SetEmModel(new G4WentzelVIModel()); }
176 G4CoulombScattering* ss = ( isWVI ) ? new G4CoulombScattering() : nullptr;
177
178 ph->RegisterProcess(msc, part1);
179 ph->RegisterProcess(new G4hIonisation(), part1);
180
181 G4hBremsstrahlung* brem = ( isHEP ) ? new G4hBremsstrahlung() : nullptr;
182 G4hPairProduction* pair = ( isHEP ) ? new G4hPairProduction() : nullptr;
183
184 if( isHEP ) {
185 ph->RegisterProcess(brem, part1);
186 ph->RegisterProcess(pair, part1);
187 }
188 if( isWVI ) { ph->RegisterProcess(ss, part1); }
189
190 if( isProton ) {
191 msc = new G4hMultipleScattering();
192 if(isWVI) {
193 msc->SetEmModel(new G4WentzelVIModel());
194 ss = new G4CoulombScattering();
195 }
196 }
197 ph->RegisterProcess(msc, part2);
198 ph->RegisterProcess(new G4hIonisation(), part2);
199 if( isHEP ) {
200 ph->RegisterProcess(brem, part2);
201 ph->RegisterProcess(pair, part2);
202 }
203 if( isWVI ) { ph->RegisterProcess(ss, part2); }
204}
205
208 G4bool isHEP)
209{
211
212 ph->RegisterProcess(new G4hIonisation(), part1);
213
214 G4hBremsstrahlung* brem = ( isHEP ) ? new G4hBremsstrahlung() : nullptr;
215 G4hPairProduction* pair = ( isHEP ) ? new G4hPairProduction() : nullptr;
216
217 if( isHEP ) {
218 ph->RegisterProcess(brem, part1);
219 ph->RegisterProcess(pair, part1);
220 }
221 auto ss = new G4CoulombScattering(false);
222 ph->RegisterProcess(ss, part1);
223
224 ph->RegisterProcess(new G4hIonisation(), part2);
225 if( isHEP ) {
226 ph->RegisterProcess(brem, part2);
227 ph->RegisterProcess(pair, part2);
228 }
229 ph->RegisterProcess(new G4CoulombScattering(false), part2);
230}
231
233 G4NuclearStopping* nucStopping,
234 G4bool isWVI)
235{
239 G4bool isHEP = ( param->MaxKinEnergy() > hpar->EnergyThresholdForHeavyHadrons() );
240
241 // muon multiple and single scattering
243 if(isWVI) { mumsc->SetEmModel(new G4WentzelVIModel()); }
244 G4CoulombScattering* muss = ( isWVI ) ? new G4CoulombScattering() : nullptr;
245
246 // Add standard EM Processes
247 // mu+-
249 ph->RegisterProcess(mumsc, part);
250 ph->RegisterProcess(new G4MuIonisation(), part);
251
252 // muon bremsstrahlung and pair production
253 G4MuBremsstrahlung* mub = ( isHEP ) ? new G4MuBremsstrahlung() : nullptr;
254 G4MuPairProduction* mup = ( isHEP ) ? new G4MuPairProduction() : nullptr;
255
256 if( isHEP ) {
257 ph->RegisterProcess(mub, part);
258 ph->RegisterProcess(mup, part);
259 }
260 if( isWVI ) { ph->RegisterProcess(muss, part); }
261
262 part = G4MuonMinus::MuonMinus();
263 ph->RegisterProcess(mumsc, part);
264 ph->RegisterProcess(new G4MuIonisation(), part);
265 if( isHEP ) {
266 ph->RegisterProcess(mub, part);
267 ph->RegisterProcess(mup, part);
268 }
269 if( isWVI ) { ph->RegisterProcess(muss, part); }
270
271 // pi+-
273
274 // K+-
276
277 // p, pbar
279 if( nucStopping != nullptr ) {
280 ph->RegisterProcess(nucStopping, G4Proton::Proton());
281 }
282
283 // ions
284 ConstructIonEmPhysics(hmsc, nucStopping);
285
286 // hyperons and anti particles
287 if( isHEP ) {
289
290 // b- and c- charged particles
291 if( hpar->EnableBCParticles() ) {
293 }
294 // light hyper-nuclei
295 if( hpar->EnableHyperNuclei() ) {
297 }
298 }
299}
300
302{
306 G4bool isHEP = ( param->MaxKinEnergy() > hpar->EnergyThresholdForHeavyHadrons() );
307
308 // muon multiple and single scattering
309 G4CoulombScattering* muss = new G4CoulombScattering(false);
310
311 // Add standard EM Processes
312 // mu+-
314 ph->RegisterProcess(new G4MuIonisation(), part);
315
316 // muon bremsstrahlung and pair production
317 G4MuBremsstrahlung* mub = ( isHEP ) ? new G4MuBremsstrahlung() : nullptr;
318 G4MuPairProduction* mup = ( isHEP ) ? new G4MuPairProduction() : nullptr;
319
320 if( isHEP ) {
321 ph->RegisterProcess(mub, part);
322 ph->RegisterProcess(mup, part);
323 }
324 ph->RegisterProcess(muss, part);
325
326 part = G4MuonMinus::MuonMinus();
327 ph->RegisterProcess(new G4MuIonisation(), part);
328 if( isHEP ) {
329 ph->RegisterProcess(mub, part);
330 ph->RegisterProcess(mup, part);
331 }
332 ph->RegisterProcess(muss, part);
333
334 // pi+-
336
337 // K+-
339
340 // p, pbar
342 // ions
344
345 // hyperons and anti particles
346 if( isHEP ) {
348
349 // b- and c- charged particles
350 if( hpar->EnableBCParticles() ) {
352 }
353 // light hyper-nuclei
354 if( hpar->EnableHyperNuclei() ) {
356 }
357 }
358}
359
398
400{
403 if(nullptr == ad) {
404 ad = new G4UAtomicDeexcitation();
405 man->SetAtomDeexcitation(ad);
406 }
407}
408
410 G4ParticleDefinition* particle)
411{
414 G4ProcessManager* procManager = particle->GetProcessManager();
415 auto plist = procManager->GetProcessList();
416 G4int ptype = (0 < plist->size()) ? (*plist)[0]->GetProcessSubType() : 0;
418 // Remove default G4Transportation and replace with G4TransportationWithMsc.
419 procManager->RemoveProcess(0);
420 G4TransportationWithMsc* transportWithMsc = new G4TransportationWithMsc(
423 transportWithMsc->SetMultipleSteps(true);
424 }
425 transportWithMsc->AddMscModel(msc1);
426 if(msc2 != nullptr) {
427 transportWithMsc->AddMscModel(msc2);
428 }
429 procManager->AddProcess(transportWithMsc, -1, 0, 0);
430 } else {
431 // Register as a separate process.
433 msc->SetEmModel(msc1);
434 if(msc2 != nullptr) {
435 msc->SetEmModel(msc2);
436 }
438 ph->RegisterProcess(msc, particle);
439 }
440}
441
443{
445 G4ProcessManager* procManager = particle->GetProcessManager();
446 auto plist = procManager->GetProcessList();
447 G4int ptype = (0 < plist->size()) ? (*plist)[0]->GetProcessSubType() : 0;
449 // Remove default G4Transportation and replace with G4TransportationWithMsc.
450 procManager->RemoveProcess(0);
451 G4TransportationWithMsc* transportWithMsc =
454 transportWithMsc->SetMultipleSteps(true);
455 }
456 transportWithMsc->AddSSModel(ss);
457 procManager->AddProcess(transportWithMsc, -1, 0, 0);
458 }
459 else {
460 // Register as a separate process.
461 G4CoulombScattering* ssProc = new G4CoulombScattering(false);
462 ssProc->SetEmModel(ss);
464 ph->RegisterProcess(ssProc, particle);
465 }
466}
G4TransportationWithMscType
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
static G4Alpha * Alpha()
Definition G4Alpha.cc:83
static G4AntiLambda * AntiLambda()
static G4AntiNeutrinoE * AntiNeutrinoE()
static G4AntiNeutrinoMu * AntiNeutrinoMu()
static G4AntiNeutron * AntiNeutron()
static G4AntiProton * AntiProton()
static G4ChargedGeantino * ChargedGeantinoDefinition()
static G4Deuteron * Deuteron()
Definition G4Deuteron.cc:90
static G4Electron * Electron()
Definition G4Electron.cc:91
static void ConstructCharged(G4hMultipleScattering *hmsc, G4NuclearStopping *nucStopping, G4bool isWVI=true)
static void ConstructChargedSS(G4hMultipleScattering *hmsc)
static void ConstructMinimalEmSet()
static void ConstructElectronSSProcess(G4VEmModel *ss, G4ParticleDefinition *particle)
static void ConstructLightHadrons(G4ParticleDefinition *part1, G4ParticleDefinition *part2, G4bool isHEP, G4bool isProton, G4bool isWVI)
static void ConstructIonEmPhysics(G4hMultipleScattering *hmsc, G4NuclearStopping *nucStopping)
static void ConstructElectronMscProcess(G4VMscModel *msc1, G4VMscModel *msc2, G4ParticleDefinition *particle)
static void ConstructIonEmPhysicsSS()
static void PrepareEMPhysics()
static void ConstructLightHadronsSS(G4ParticleDefinition *part1, G4ParticleDefinition *part2, G4bool isHEP)
static void ConstructBasicEmPhysics(G4hMultipleScattering *hmsc, const std::vector< G4int > &listHadrons)
static G4EmParameters * Instance()
G4TransportationWithMscType TransportationWithMsc() const
G4double MaxKinEnergy() const
static G4Gamma * Gamma()
Definition G4Gamma.cc:81
static G4Geantino * GeantinoDefinition()
Definition G4Geantino.cc:76
static G4GenericIon * GenericIon()
static const std::vector< G4int > & GetBCChargedHadrons()
static const std::vector< G4int > & GetHeavyChargedParticles()
static const std::vector< G4int > & GetChargedHyperNuclei()
static G4HadronicParameters * Instance()
G4double EnergyThresholdForHeavyHadrons() const
static G4He3 * He3()
Definition G4He3.cc:90
static G4KaonMinus * KaonMinus()
static G4KaonPlus * KaonPlus()
static G4Lambda * Lambda()
Definition G4Lambda.cc:105
void SetAtomDeexcitation(G4VAtomDeexcitation *)
static G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
static G4MuonMinus * MuonMinus()
static G4MuonPlus * MuonPlus()
Definition G4MuonPlus.cc:98
static G4NeutrinoE * NeutrinoE()
static G4NeutrinoMu * NeutrinoMu()
static G4Neutron * Neutron()
Definition G4Neutron.cc:101
G4ProcessManager * GetProcessManager() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
static void InitialiseParameters()
G4bool RegisterProcess(G4VProcess *process, G4ParticleDefinition *particle)
static G4PhysicsListHelper * GetPhysicsListHelper()
static G4PionMinus * PionMinus()
static G4PionPlus * PionPlus()
Definition G4PionPlus.cc:93
static G4PionZero * PionZero()
static G4Positron * Positron()
Definition G4Positron.cc:90
G4ProcessVector * GetProcessList() const
G4VProcess * RemoveProcess(G4VProcess *aProcess)
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
static G4Proton * Proton()
Definition G4Proton.cc:90
void AddMscModel(G4VMscModel *mscModel, G4int order=0, const G4Region *region=nullptr)
void AddSSModel(G4VEmModel *model, G4int order=0, const G4Region *region=nullptr)
static G4Triton * Triton()
Definition G4Triton.cc:90
void SetEmModel(G4VEmModel *, G4int index=0)
void SetEmModel(G4VMscModel *, G4int idx=0)