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