4 // See the class description in the header file.
6 #include "TG4G3CutVector.h"
7 #include "TG4G3Defaults.h"
10 #include <G4ParticleDefinition.hh>
11 #include <G4VProcess.hh>
13 //_____________________________________________________________________________
14 TG4G3CutVector::TG4G3CutVector()
16 // initialize fCutVector
17 fCutVector = new TG4doubleVector();
18 for (G4int i=0; i<kNoG3Cuts; i++) fCutVector->insert(0.);
21 //_____________________________________________________________________________
22 TG4G3CutVector::TG4G3CutVector(const TG4G3CutVector& right)
25 fCutVector = new TG4doubleVector();
31 //_____________________________________________________________________________
32 TG4G3CutVector::~TG4G3CutVector() {
39 //_____________________________________________________________________________
40 TG4G3CutVector& TG4G3CutVector::operator=(const TG4G3CutVector& right)
42 // check assignement to self
43 if (this == &right) return *this;
45 // initialize fCutVector
47 for (G4int i=0; i<kNoG3Cuts; i++) {
48 fCutVector->insert((*right.fCutVector)[i]);
54 //_____________________________________________________________________________
55 G4double TG4G3CutVector::operator[](G4int index) const
58 if (index < kNoG3Cuts)
59 return (*fCutVector)[index];
61 TG4Globals::Exception(
62 "TG4G3CutVector::operator[]: index out of the vector scope");
69 //_____________________________________________________________________________
70 void TG4G3CutVector::SetG3Cut(TG4G3Cut cut, G4double cutValue)
72 // Sets the cutValue for the specified cut.
76 (*fCutVector)[cut] = cutValue;
79 TG4Globals::Exception(
80 "TG4G3CutVector::SetG3Cut: Inconsistent cut.");
84 //_____________________________________________________________________________
85 void TG4G3CutVector::SetG3Defaults()
87 // Sets G3 default values for all cuts.
90 for (G4int i=0; i<kNoG3Cuts; i++) {
91 (*fCutVector)[i] = TG4G3Defaults::CutValue(i);
95 //_____________________________________________________________________________
96 G4double TG4G3CutVector::GetMinEkine(const G4Track& track) const
98 // Returns the cut value for the particle associated with
102 G4ParticleDefinition* particle = track.GetDefinition();
103 G4String particleName = particle->GetParticleName();
105 if (particleName == "gamma") {
106 return GetMinEkineForGamma(track);
108 else if (particleName == "e-") {
109 return GetMinEkineForElectron(track);
111 else if ((particle->GetParticleType() == "baryon") ||
112 (particle->GetParticleType() == "meson") ||
113 (particle->GetParticleType() == "nucleus")) {
114 if (particle->GetPDGCharge() == 0)
115 return GetMinEkineForHadron(track);
117 return GetMinEkineForNeutralHadron(track);
119 else if ((particleName == "mu-") || (particleName == "mu+")) {
120 return GetMinEkineForMuon(track);
123 G4String text = "TG4G3CutVector::GetMinEkine: \n";
124 text = text + " The kinetic energy cut for " + particleName;
125 text = text + " is not defined.";
126 TG4Globals::Warning(text);
131 //_____________________________________________________________________________
132 G4double TG4G3CutVector::GetMinEkineForGamma(const G4Track& track) const
134 // Returns the cut value for gamma.
135 // (Cut is not applied for "opticalphoton"
136 // as it is treated in G4 as a particle different
137 // from "gamma" in G4.)
140 G4cout << "TG4G3CutVector::GetMinEkineForGamma start" << G4endl;
141 const G4VProcess* kpCreatorProcess = track.GetCreatorProcess();
142 G4String processName = "";
143 if (kpCreatorProcess) processName = kpCreatorProcess->GetProcessName();
145 if ((processName == "eBrem") || (processName == "IeBrem")) {
146 return (*fCutVector)[kBCUTE];
148 else if ((processName == "MuBrems") || (processName == "IMuBrems") ||
149 (processName == "//hBrems")|| (processName == "//IhBrems")) {
150 // hadron Brehmstrahlung is not defined in G4
151 return (*fCutVector)[kBCUTM];
154 return (*fCutVector)[kCUTGAM];
158 //_____________________________________________________________________________
159 G4double TG4G3CutVector::GetMinEkineForElectron(const G4Track& track) const
161 // Returns the cut value for e-.
162 // Should these cuts be applied to e+ too ??
165 const G4VProcess* kpCreatorProcess = track.GetCreatorProcess();
166 G4String processName = "";
167 if (kpCreatorProcess) processName = kpCreatorProcess->GetProcessName();
169 if ((processName == "eIoni") || (processName == "IeIoni")) {
170 // !! Geant4 treats delta rays + continuous energy loss
171 // within one process
172 return (*fCutVector)[kDCUTE];
174 else if ((processName == "MuIoni") || (processName == "IMuIoni")) {
175 // !! Geant4 treats delta rays + continuous energy loss
176 // within one process
177 return (*fCutVector)[kDCUTM];
180 return (*fCutVector)[kCUTELE];
184 //_____________________________________________________________________________
185 G4double TG4G3CutVector::GetMinEkineForHadron(const G4Track& track) const
187 // Returns the cut value for charged hadron.
190 return (*fCutVector)[kCUTHAD];
193 //_____________________________________________________________________________
194 G4double TG4G3CutVector::GetMinEkineForNeutralHadron(const G4Track& track) const
196 // Returns the cut value for neutral hadron.
199 return (*fCutVector)[kCUTNEU];
202 //_____________________________________________________________________________
203 G4double TG4G3CutVector::GetMinEkineForMuon(const G4Track& track) const
205 // Returns the cut value for neutral muon.
208 return (*fCutVector)[kCUTMUO];
211 //_____________________________________________________________________________
212 G4double TG4G3CutVector::GetMinEkineForOther(const G4Track& track) const