]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TGeant4/TG4Limits.cxx
Access function to local momenta renamed.
[u/mrichter/AliRoot.git] / TGeant4 / TG4Limits.cxx
CommitLineData
2817d3e2 1// $Id$
2// Category: global
3//
4// See the class description in the header file.
5
6#include "TG4Limits.h"
6eb43d7c 7#include "TG4G3CutVector.h"
8#include "TG4G3ControlVector.h"
2817d3e2 9
10TG4Limits::TG4Limits()
11 : G4UserLimits(),
12 // default values of G4UserLimits data members are set:
13 // fMaxStep (DBL_MAX), fMaxTrack(DBL_MAX),fMaxTime(DBL_MAX),
14 // fMinEkine(0.), fMinRange(0.)
15 fIsCut(false),
6eb43d7c 16 fIsControl(false)
2817d3e2 17{
18//
6eb43d7c 19 fCutVector = new TG4G3CutVector();
20 fControlVector = new TG4G3ControlVector();
2817d3e2 21}
22
23TG4Limits::TG4Limits(const TG4Limits& right)
24 : G4UserLimits(right)
25{
26//
6eb43d7c 27 fCutVector = new TG4G3CutVector(*right.fCutVector);
28 fControlVector = new TG4G3ControlVector(*right.fControlVector);
2817d3e2 29}
30
31TG4Limits::~TG4Limits() {
32//
33 delete fCutVector;
6eb43d7c 34 delete fControlVector;
2817d3e2 35}
36
37// operators
38
39TG4Limits& TG4Limits::operator=(const TG4Limits& right)
40{
41 // check assignement to self
42 if (this == &right) return *this;
43
44 // base class assignement
45 G4UserLimits::operator=(right);
46
47 *fCutVector = *right.fCutVector;
6eb43d7c 48 *fControlVector = *right.fControlVector;
2817d3e2 49
50 return *this;
51}
52
53// private methods
54
55G4double TG4Limits::GetUserMinEkine(const G4Track& track)
56{
57// Returns the kinetic energy cut for the particle
58// associated with the specified track.
59// ---
60
61 if (fIsCut)
62 return fCutVector->GetMinEkine(track);
63 else
64 return fMinEkine;
65}
66
67// public methods
68
6eb43d7c 69void TG4Limits::SetG3Cut(TG4G3Cut cut, G4double cutValue)
2817d3e2 70{
71// Sets the cut value for the specified cut.
72// ---
73
6eb43d7c 74 fCutVector->SetG3Cut(cut, cutValue);
2817d3e2 75 fIsCut = true;
76}
77
6eb43d7c 78void TG4Limits::SetG3Control(TG4G3Control control, G4double flagValue)
2817d3e2 79{
80// Sets the process control value for the specified flag.
81// ---
82
6eb43d7c 83 fControlVector->SetG3Control(control, flagValue);
84 if (flagValue - kUnset > 0.01) fIsControl = true;
2817d3e2 85}
86
87void TG4Limits::SetG3DefaultCuts()
88{
89// Sets the G3 default cut values for all cuts.
90// ---
91
92 fCutVector->SetG3Defaults();
93 fIsCut = true;
94}
95
6eb43d7c 96void TG4Limits::SetG3DefaultControls()
2817d3e2 97{
98// Sets the G3 default process control values for all flags.
99// ---
100
6eb43d7c 101 fControlVector->SetG3Defaults();
102 fIsControl = true;
2817d3e2 103}
104
105G4double TG4Limits::GetMinEkineForGamma(const G4Track& track) const
106{
107// Returns the cut value for gamma.
108// ---
109
110 if (fIsCut)
111 return fCutVector->GetMinEkine(track);
112 else
113 return fMinEkine;
114}
115
116G4double TG4Limits::GetMinEkineForElectron(const G4Track& track) const
117{
118// Returns the cut value for e-.
119// ---
120
121 if (fIsCut)
122 return fCutVector->GetMinEkineForElectron(track);
123 else
124 return fMinEkine;
125}
126
127G4double TG4Limits::GetMinEkineForHadron(const G4Track& track) const
128{
129// Returns the cut value for charged hadron.
130// ---
131
132 if (fIsCut)
133 return fCutVector->GetMinEkineForHadron(track);
134 else
135 return fMinEkine;
136}
137
138G4double TG4Limits::GetMinEkineForNeutralHadron(const G4Track& track) const
139{
140// Returns the cut value for neutral hadron.
141// ---
142
143 if (fIsCut)
144 return fCutVector->GetMinEkineForNeutralHadron(track);
145 else
146 return fMinEkine;
147}
148
149G4double TG4Limits::GetMinEkineForMuon(const G4Track& track) const
150{
151// Returns the cut value for neutral muon.
152// ---
153
154 if (fIsCut)
155 return fCutVector->GetMinEkineForMuon(track);
156 else
157 return fMinEkine;
158}
159
160G4double TG4Limits::GetMinEkineForOther(const G4Track& track) const
161{
162 // Returns 0.
163// ---
164
165 return fMinEkine;
166}
167
6eb43d7c 168G4int TG4Limits::GetControl(G4VProcess* process) const
2817d3e2 169{
170// Returns the flag value for the particle associated with
171// the specified process.
172// ---
173
6eb43d7c 174 if (fIsControl)
175 return fControlVector->GetControl(process);
2817d3e2 176 else
177 return kUnset;
178}