]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4Limits.cxx
Change of argument list of methods GetPadCxy, GetPadIxy, SetHit and FirstPad
[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 "TG4CutVector.h"
8 #include "TG4FlagVector.h"
9
10 TG4Limits::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),
16     fIsFlag(false) 
17 {
18 //
19   fCutVector = new TG4CutVector();
20   fFlagVector = new TG4FlagVector();
21 }
22
23 TG4Limits::TG4Limits(const TG4Limits& right)
24   : G4UserLimits(right) 
25 {
26 //    
27   fCutVector = new TG4CutVector(*right.fCutVector);
28   fFlagVector = new TG4FlagVector(*right.fFlagVector);
29 }  
30
31 TG4Limits::~TG4Limits() {
32 //
33   delete fCutVector;
34   delete fFlagVector;
35 }
36
37 // operators
38
39 TG4Limits& 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;
48   *fFlagVector = *right.fFlagVector;
49
50   return *this;  
51 }    
52           
53 // private methods
54
55 G4double 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
69 void TG4Limits::SetG3Cut(TG3Cut g3Cut, G4double cutValue)
70 {
71 // Sets the cut value for the specified cut.
72 // ---
73
74   fCutVector->SetG3Cut(g3Cut, cutValue);
75   fIsCut = true;
76 }
77
78 void TG4Limits::SetG3Flag(TG3Flag g3Flag, G4double flagValue)
79 {
80 // Sets the process control value for the specified flag.
81 // ---
82
83   fFlagVector->SetG3Flag(g3Flag, flagValue);
84   if (flagValue - kUnset > 0.01) fIsFlag = true;
85 }
86
87 void TG4Limits::SetG3DefaultCuts()
88 {
89 // Sets the G3 default cut values for all cuts.
90 // ---
91
92   fCutVector->SetG3Defaults();
93   fIsCut = true;  
94 }
95
96 void TG4Limits::SetG3DefaultFlags()
97 {
98 // Sets the G3 default process control values for all flags.
99 // ---
100
101   fFlagVector->SetG3Defaults();
102   fIsFlag = true;
103 }
104
105 G4double 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
116 G4double 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
127 G4double 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
138 G4double 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
149 G4double 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
160 G4double TG4Limits::GetMinEkineForOther(const G4Track& track) const
161 {
162  // Returns 0.
163 // ---
164
165  return fMinEkine;
166 }
167
168 G4int TG4Limits::GetFlag(G4VProcess* process) const 
169 {
170 // Returns the flag value for the particle associated with
171 // the specified process.
172 // ---
173
174   if (fIsFlag)
175     return fFlagVector->GetFlag(process);
176   else 
177     return kUnset;
178 }