Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4SpecialCutsPhysics.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
14
16#include "TG4G3PhysicsManager.h"
17#include "TG4SpecialCuts.h"
18
19#include <G4Neutron.hh>
20#include <G4ParticleDefinition.hh>
21#include <G4ProcessManager.hh>
22#include <G4VProcess.hh>
23
24#include <TMCProcess.h>
25
26//_____________________________________________________________________________
29 fSpecialCutsForGamma(0),
30 fSpecialCutsForElectron(0),
31 fSpecialCutsForChargedHadron(0),
32 fSpecialCutsForNeutralHadron(0),
33 fSpecialCutsForNeutron(0),
34 fSpecialCutsForMuon(0)
35{
37}
38
39//_____________________________________________________________________________
41 G4int theVerboseLevel, const G4String& name)
42 : TG4VPhysicsConstructor(name, theVerboseLevel),
43 fSpecialCutsForGamma(0),
44 fSpecialCutsForElectron(0),
45 fSpecialCutsForChargedHadron(0),
46 fSpecialCutsForNeutralHadron(0),
47 fSpecialCutsForNeutron(0),
48 fSpecialCutsForMuon(0)
49{
51}
52
53//_____________________________________________________________________________
65
66//
67// protected methods
68//
69
70//_____________________________________________________________________________
75
76//_____________________________________________________________________________
78{
82
83 // create processes
90
92
93 auto aParticleIterator = GetParticleIterator();
94 aParticleIterator->reset();
95 while ((*aParticleIterator)()) {
96 G4ParticleDefinition* particle = aParticleIterator->value();
97
98 // skip particles which do not have process manager
99 if (!particle->GetProcessManager()) continue;
100
101 TG4G3ParticleWSP particleWSP = g3PhysicsManager->GetG3ParticleWSP(particle);
102 G4String name = g3PhysicsManager->GetG3ParticleWSPName(particleWSP);
103
104 // uncomment this to see all particles "WSP"
105 // G4cout << "Iterating particle: "
106 // << particle->GetParticleName() << " " << particleWSP << " "
107 // << name << G4endl;
108
109 if ((particleWSP != kNofParticlesWSP)) {
110 // special process is created in any case
111
112 G4ProcessManager* pManager = particle->GetProcessManager();
113 switch (particleWSP) {
114 case kGamma:
115 pManager->AddDiscreteProcess(fSpecialCutsForGamma);
116 break;
117 case kElectron:
118 pManager->AddDiscreteProcess(fSpecialCutsForElectron);
119 break;
120 case kChargedHadron:
121 pManager->AddDiscreteProcess(fSpecialCutsForChargedHadron);
122 break;
123 case kNeutralHadron: {
124 G4bool isNeutronWithKiller = false;
125 if (particle == G4Neutron::Definition()) {
126 G4ProcessVector* processes = pManager->GetProcessList();
127 for (size_t i = 0; i < processes->size(); ++i) {
128 if ((*processes)[i]->GetProcessName() == "nKiller") {
129 isNeutronWithKiller = true;
130 break;
131 }
132 }
133 }
134 if (isNeutronWithKiller) {
135 pManager->AddDiscreteProcess(fSpecialCutsForNeutron);
136 }
137 else {
138 pManager->AddDiscreteProcess(fSpecialCutsForNeutralHadron);
139 }
140 break;
141 }
142 case kMuon:
143 pManager->AddDiscreteProcess(fSpecialCutsForMuon);
144 break;
145 case kEplus:
146 case kAny:
147 case kNofParticlesWSP:
148 // nothing to be done
149 break;
150 }
151 }
152 }
153
154 if (VerboseLevel() > 0) G4cout << "### Special Cuts constructed. " << G4endl;
155}
Definition of the TG4G3PhysicsManager class.
Definition of the TG4SpecialCutsPhysics class.
Definition of the TG4SpecialCutsFor* classes.
Provides a Geant3 way control to Geant4 physics.
G4String GetG3ParticleWSPName(G4int particleWSP) const
static TG4G3PhysicsManager * Instance()
TG4G3ParticleWSP GetG3ParticleWSP(G4ParticleDefinition *particle) const
Special process that activates kinetic energy cuts for charged hadrons.
Special process that activates kinetic energy cuts for e-.
Special process that activates kinetic energy cuts for gamma.
Special process that activates kinetic energy cuts for muon.
Special process that activates kinetic energy cuts for neutral hadrons.
Special process that activates kinetic energy cuts for neutrons,.
TG4SpecialCutsForElectron * fSpecialCutsForElectron
the special cuts process for e-
virtual void ConstructProcess()
Construct physics processes.
TG4SpecialCutsForNeutralHadron * fSpecialCutsForNeutralHadron
the special cuts process for neutral hadron
TG4SpecialCutsPhysics(const G4String &name="SpecialCuts")
virtual void ConstructParticle()
Construct particles.
TG4SpecialCutsForChargedHadron * fSpecialCutsForChargedHadron
the special cuts process for charged hadron
TG4SpecialCutsForNeutron * fSpecialCutsForNeutron
the special cuts process for neutron
TG4SpecialCutsForMuon * fSpecialCutsForMuon
the special cuts process for muon
TG4SpecialCutsForGamma * fSpecialCutsForGamma
the special cuts process for gamma
Abstract base class for physics constructors with verbose.
virtual G4int VerboseLevel() const
TG4G3ParticleWSP
The particles types which a special process (cuts, controls) is applicable for.
@ kNofParticlesWSP
not a particle with a special control
@ kNeutralHadron
kHADR
@ kGamma
kPAIR, kCOMP, kPHOT, kPHIS
@ kElectron
kDRAY, kBREM, kMULS, kG3LOSS
@ kEplus
kDRAY, kBREM, kMULS, kG3LOSS, kANNI
@ kAny
kDCAY
@ kMuon
kDRAY, kBREM, kMULS, kG3LOSS, kMUNU
@ kChargedHadron
kDRAY, kMULS, kG3LOSS, kHADR,