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