]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4Limits.cxx
changed ordering of includes from Root to avoid compilation error
[u/mrichter/AliRoot.git] / TGeant4 / TG4Limits.cxx
1 // $Id$
2 // Category: global
3 //
4 // See the class description in the header file.
5
6 #include "TG4Limits.h"
7 #include "TG4G3CutVector.h"
8 #include "TG4G3ControlVector.h"
9
10 #include <globals.hh>
11
12 const G4double TG4Limits::fgkDefaultMaxStep = 10*cm;
13
14 TG4Limits::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),
20     fIsControl(false) 
21 {
22 //
23   fMaxStep = fgkDefaultMaxStep;
24   fCutVector = new TG4G3CutVector();
25   fControlVector = new TG4G3ControlVector();
26 }
27
28 TG4Limits::TG4Limits(const TG4Limits& right)
29   : G4UserLimits(right) 
30 {
31 //    
32   // allocation
33   fCutVector = new TG4G3CutVector();
34   fControlVector = new TG4G3ControlVector();
35
36   // copy stuff
37   *this = right;
38 }  
39
40 TG4Limits::~TG4Limits() {
41 //
42   delete fCutVector;
43   delete fControlVector;
44 }
45
46 // operators
47
48 TG4Limits& 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;
57   *fControlVector = *right.fControlVector;
58
59   return *this;  
60 }    
61           
62 // private methods
63
64 G4double 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
78 void TG4Limits::SetG3Cut(TG4G3Cut cut, G4double cutValue)
79 {
80 // Sets the cut value for the specified cut.
81 // ---
82
83   fCutVector->SetG3Cut(cut, cutValue);
84   fIsCut = true;
85 }
86
87 void TG4Limits::SetG3Control(TG4G3Control control, G4double flagValue)
88 {
89 // Sets the process control value for the specified flag.
90 // ---
91
92   fControlVector->SetG3Control(control, flagValue);
93   if (flagValue - kUnset > 0.01) fIsControl = true;
94 }
95
96 void TG4Limits::SetG3DefaultCuts()
97 {
98 // Sets the G3 default cut values for all cuts.
99 // ---
100
101   fCutVector->SetG3Defaults();
102   fIsCut = true;  
103 }
104
105 void TG4Limits::SetG3DefaultControls()
106 {
107 // Sets the G3 default process control values for all flags.
108 // ---
109
110   fControlVector->SetG3Defaults();
111   fIsControl = true;
112 }
113
114 G4double 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
125 G4double 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
136 G4double 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
147 G4double 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
158 G4double 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
169 G4double TG4Limits::GetMinEkineForOther(const G4Track& track) const
170 {
171  // Returns 0.
172 // ---
173
174  return fMinEkine;
175 }
176
177 G4int TG4Limits::GetControl(G4VProcess* process) const 
178 {
179 // Returns the flag value for the particle associated with
180 // the specified process.
181 // ---
182
183   if (fIsControl)
184     return fControlVector->GetControl(process);
185   else 
186     return kUnset;
187 }