1 |
mocchiut |
1.1 |
/** |
2 |
|
|
* \file TrkLevel2.h |
3 |
|
|
* \author Elena Vannuccini |
4 |
|
|
*/ |
5 |
|
|
#ifndef trklevel2_h |
6 |
|
|
#define trklevel2_h |
7 |
|
|
|
8 |
|
|
#include <TObject.h> |
9 |
|
|
#include <TObjArray.h> |
10 |
|
|
#include <TClonesArray.h> |
11 |
pam-fi |
1.7 |
#include <TRefArray.h> |
12 |
pam-fi |
1.8 |
#include <TRef.h> |
13 |
pam-fi |
1.3 |
|
14 |
pam-fi |
1.18 |
#include <TrkParams.h> |
15 |
pam-fi |
1.8 |
#include <TrkLevel1.h> |
16 |
mocchiut |
1.1 |
|
17 |
pam-fi |
1.2 |
// z-coordinate of track state-vector reference-plane |
18 |
|
|
#define ZINI 23.5 |
19 |
pam-fi |
1.5 |
// (mechanical) z-coordinate of the tracker planes |
20 |
|
|
#define ZTRK6 -22.23 |
21 |
|
|
#define ZTRK5 -13.32 |
22 |
|
|
#define ZTRK4 -4.42 |
23 |
|
|
#define ZTRK3 4.48 |
24 |
|
|
#define ZTRK2 13.38 |
25 |
|
|
#define ZTRK1 22.28 |
26 |
|
|
// (mechanical) x/y-coordinates of magnet cavity |
27 |
|
|
#define XTRKL -8.1 |
28 |
|
|
#define XTRKR 8.1 |
29 |
|
|
#define YTRKL -6.6 |
30 |
|
|
#define YTRKR 6.6 |
31 |
pam-fi |
1.2 |
|
32 |
mocchiut |
1.1 |
/** |
33 |
|
|
* \brief Class to describe, by points, a particle trajectory in the apparatus. |
34 |
|
|
* |
35 |
|
|
* The idea is to create it by integrating the equations of motion, given the |
36 |
|
|
* track state vector and the z coordinates where to evaluate track position. |
37 |
|
|
*/ |
38 |
|
|
// ================================================================== |
39 |
|
|
class Trajectory : public TObject{ |
40 |
|
|
private: |
41 |
|
|
|
42 |
|
|
public: |
43 |
|
|
|
44 |
|
|
int npoint; ///< number of evaluated points along the trajectory |
45 |
|
|
float* x; ///< x coordinates |
46 |
|
|
float* y; ///< y coordinates |
47 |
|
|
float* z; ///< z coordinates |
48 |
pam-fi |
1.2 |
float* thx; ///< x projected angle |
49 |
|
|
float* thy; ///< y projected angle |
50 |
|
|
float* tl; ///< track length |
51 |
mocchiut |
1.1 |
|
52 |
pam-fi |
1.2 |
Trajectory(); |
53 |
mocchiut |
1.1 |
Trajectory(int n); |
54 |
|
|
Trajectory(int n, float* pz); |
55 |
pam-fi |
1.15 |
~Trajectory(){Delete();}; |
56 |
mocchiut |
1.1 |
void Dump(); |
57 |
pam-fi |
1.15 |
void Delete(); |
58 |
mocchiut |
1.1 |
|
59 |
pam-fi |
1.13 |
int DoTrack2(float* al); |
60 |
pam-fi |
1.2 |
float GetLength(){float l=0; for(int i=0; i<npoint;i++)l=l+tl[i]; return l;}; |
61 |
|
|
float GetLength(int,int); |
62 |
|
|
|
63 |
pam-fi |
1.9 |
ClassDef(Trajectory,2); |
64 |
mocchiut |
1.1 |
|
65 |
|
|
}; |
66 |
|
|
/** |
67 |
|
|
* \brief Class to describe fitted tracks. |
68 |
|
|
* |
69 |
|
|
* A track is defined by the measured coordinates associated to it, the |
70 |
|
|
* track status vector, plus other quantities. |
71 |
|
|
* A track may have an "image", due to the ambiguity in the y view. |
72 |
pam-fi |
1.24 |
* |
73 |
|
|
* Cluster flags: xgood[6], ygood[6] |
74 |
|
|
* |
75 |
|
|
* xgood/ygood = +/- 0lsccccccc |
76 |
|
|
* | |||------- ID (1-7483647) of the included cluster |
77 |
|
|
* | ||-------- sensor number (1,2 - increasing y) |
78 |
|
|
* | |--------- ladder number (1,2,3 - increasing x) |
79 |
|
|
* |------------- does-not/does include bad strips |
80 |
mocchiut |
1.1 |
*/ |
81 |
|
|
// ================================================================== |
82 |
|
|
class TrkTrack : public TObject { |
83 |
|
|
|
84 |
|
|
private: |
85 |
|
|
|
86 |
pam-fi |
1.3 |
int seqno; ///<stored track sequential number |
87 |
|
|
int image; ///<sequential number of track-image |
88 |
pam-fi |
1.8 |
|
89 |
mocchiut |
1.1 |
public: |
90 |
|
|
|
91 |
pam-fi |
1.22 |
float al[5]; ///<TRACK STATE VECTOR |
92 |
mocchiut |
1.1 |
float coval[5][5]; ///<covariance matrix |
93 |
pam-fi |
1.24 |
int xgood[6]; ///<cluster flag for x-view (0 = view not included in the fit) |
94 |
|
|
int ygood[6]; ///<cluster flag for y-view (0 = view not included in the fit) |
95 |
mocchiut |
1.1 |
float xm[6]; ///<measured x coordinates |
96 |
|
|
float ym[6]; ///<measured y coordinates |
97 |
|
|
float zm[6]; ///<measured z coordinates |
98 |
|
|
float resx[6]; ///<spatial resolution on X view |
99 |
|
|
float resy[6]; ///<spatial resolution on y view |
100 |
pam-fi |
1.24 |
float tailx[6]; ///<spatial resolution tail on X view |
101 |
|
|
float taily[6]; ///<spatial resolution tail on y view |
102 |
mocchiut |
1.1 |
float chi2; ///<chi2 |
103 |
pam-fi |
1.12 |
int nstep; ///<n. step |
104 |
|
|
float xv[6]; ///<calculated x coordinates |
105 |
mocchiut |
1.1 |
float yv[6]; ///<calculated y coordinates |
106 |
|
|
float zv[6]; ///<calculated z coordinates |
107 |
|
|
float axv[6]; ///<calculated angles (deg) on x view |
108 |
|
|
float ayv[6]; ///<calculated angles (deg) on y view |
109 |
pam-fi |
1.24 |
float dedx_x[6]; ///<dE/dx in MIP (<0 if saturated) |
110 |
|
|
float dedx_y[6]; ///<dE/dx in MIP (<0 if saturated) |
111 |
pam-fi |
1.3 |
|
112 |
mocchiut |
1.1 |
TrkTrack(); |
113 |
|
|
TrkTrack(const TrkTrack&); |
114 |
|
|
|
115 |
pam-fi |
1.15 |
~TrkTrack(){ Delete(); }; |
116 |
pam-fi |
1.10 |
|
117 |
mocchiut |
1.1 |
void Dump(); |
118 |
pam-fi |
1.12 |
void Clear(); |
119 |
pam-fi |
1.15 |
void Clear(Option_t *option){Clear();}; |
120 |
pam-fi |
1.12 |
void Delete(); |
121 |
pam-fi |
1.15 |
void Copy(TrkTrack&); |
122 |
pam-fi |
1.16 |
// void Set(); |
123 |
|
|
|
124 |
pam-fi |
1.3 |
Int_t GetSeqNo(){return seqno;} ///< Returns the track sequential number |
125 |
|
|
Int_t GetImageSeqNo(){return image;} ///< Returns the track image sequential number |
126 |
mocchiut |
1.1 |
Bool_t HasImage(){return !(image==-1);} ///< Returns true if the track has an image |
127 |
pam-fi |
1.2 |
int DoTrack(Trajectory* t); ///< Evaluates the trajectory in the apparatus. |
128 |
|
|
int DoTrack2(Trajectory* t); ///< Evaluates the trajectory in the apparatus. |
129 |
|
|
float BdL(){return 0;}; ///< Evaluates the integral of B*dL along the track. |
130 |
pam-fi |
1.24 |
Int_t GetNX(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=(Int_t)XGood(i); return n;}; |
131 |
|
|
Int_t GetNY(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=(Int_t)YGood(i); return n;}; |
132 |
pam-fi |
1.3 |
Int_t GetNtot(){return GetNX()+GetNY();}; |
133 |
mocchiut |
1.1 |
Float_t GetRigidity(); |
134 |
|
|
Float_t GetDeflection(); |
135 |
pam-fi |
1.24 |
Bool_t IsSaturated(int,int); |
136 |
|
|
Bool_t IsSaturated(int); |
137 |
|
|
Bool_t IsSaturated(); |
138 |
|
|
Bool_t IsBad(int,int); |
139 |
mocchiut |
1.1 |
Float_t GetDEDX(); |
140 |
pam-fi |
1.24 |
Float_t GetDEDX(int); |
141 |
|
|
Float_t GetDEDX(int,int); |
142 |
|
|
Int_t GetLeverArmX(); |
143 |
|
|
Int_t GetLeverArmY(); |
144 |
pam-fi |
1.12 |
|
145 |
|
|
void SetMeasure(double *xmeas, double *ymeas, double *zmeas); |
146 |
|
|
void SetResolution(double *rx, double *ry); |
147 |
|
|
void SetGood(int *xg, int *yg); |
148 |
|
|
void LoadField(TString s); |
149 |
pam-fi |
1.25 |
void Fit(double pfixed, int& fail, int iprint, int froml1); |
150 |
|
|
void Fit(double pfixed, int& fail, int iprint){ Fit(pfixed,fail,iprint,0); }; |
151 |
pam-fi |
1.12 |
void FitReset(); |
152 |
pam-fi |
1.19 |
void SetTrackingMode(int trackmode); |
153 |
pam-fi |
1.21 |
void SetPrecisionFactor(double fact); |
154 |
|
|
void SetStepMin(int istepmin); |
155 |
pam-fi |
1.14 |
|
156 |
pam-fi |
1.25 |
void EvaluateClusterPositions(); |
157 |
|
|
|
158 |
pam-fi |
1.14 |
void FillMiniStruct(cMini2track&); |
159 |
|
|
void SetFromMiniStruct(cMini2track*); |
160 |
pam-fi |
1.12 |
|
161 |
pam-fi |
1.24 |
Int_t GetClusterX_ID(int ip); |
162 |
|
|
Int_t GetClusterY_ID(int ip); |
163 |
|
|
Int_t GetLadder(int ip); |
164 |
|
|
Int_t GetSensor(int ip); |
165 |
|
|
Bool_t XGood(int ip){ return GetClusterX_ID(ip)!=-1; }; |
166 |
|
|
Bool_t YGood(int ip){ return GetClusterY_ID(ip)!=-1; }; |
167 |
pam-fi |
1.25 |
void ResetXGood(int ip){ xgood[ip]=0; }; |
168 |
|
|
void ResetYGood(int ip){ ygood[ip]=0; }; |
169 |
|
|
void SetXGood(int ip, int clid, int is); |
170 |
|
|
void SetYGood(int ip, int clid, int is); |
171 |
pam-fi |
1.24 |
|
172 |
|
|
Bool_t BadClusterX(int ip){ return IsBad(ip,0); }; |
173 |
|
|
Bool_t BadClusterY(int ip){ return IsBad(ip,1); }; |
174 |
|
|
|
175 |
|
|
Bool_t SaturatedClusterX(int ip){ return IsSaturated(ip,0); }; |
176 |
|
|
Bool_t SaturatedClusterY(int ip){ return IsSaturated(ip,1); }; |
177 |
pam-fi |
1.20 |
|
178 |
mocchiut |
1.1 |
TrkTrack* GetTrkTrack(){return this;}; |
179 |
|
|
|
180 |
pam-fi |
1.3 |
friend class TrkLevel2; |
181 |
|
|
|
182 |
pam-fi |
1.24 |
ClassDef(TrkTrack,3); |
183 |
mocchiut |
1.1 |
|
184 |
|
|
}; |
185 |
|
|
/** |
186 |
|
|
* \brief Class to describe single clusters ("singlets"). |
187 |
|
|
* |
188 |
|
|
* Single clusters are clusters not associated to any track. |
189 |
|
|
*/ |
190 |
|
|
class TrkSinglet : public TObject { |
191 |
|
|
|
192 |
|
|
private: |
193 |
pam-fi |
1.8 |
|
194 |
mocchiut |
1.1 |
|
195 |
|
|
public: |
196 |
pam-fi |
1.8 |
|
197 |
mocchiut |
1.1 |
int plane; ///<plane |
198 |
|
|
float coord[2]; ///<coordinate (on sensor 1 and 2) |
199 |
pam-fi |
1.24 |
float sgnl; ///<cluster signal in MIP (<0 if saturated) |
200 |
mocchiut |
1.1 |
|
201 |
|
|
TrkSinglet(); |
202 |
|
|
TrkSinglet(const TrkSinglet&); |
203 |
pam-fi |
1.15 |
~TrkSinglet(){Delete();}; |
204 |
mocchiut |
1.1 |
|
205 |
|
|
void Dump(); |
206 |
pam-fi |
1.15 |
void Clear(); |
207 |
|
|
void Clear(Option_t *option){Clear();}; |
208 |
|
|
void Delete(){Clear();}; |
209 |
pam-fi |
1.24 |
Float_t GetSignal(){return fabs(sgnl);} |
210 |
|
|
Bool_t IsSaturated(){return (sgnl<0); }; |
211 |
pam-fi |
1.8 |
|
212 |
pam-fi |
1.3 |
friend class TrkLevel2; |
213 |
|
|
|
214 |
pam-fi |
1.24 |
ClassDef(TrkSinglet,3); |
215 |
mocchiut |
1.1 |
|
216 |
|
|
}; |
217 |
|
|
|
218 |
|
|
/** |
219 |
|
|
* \brief Class to describe tracker LEVEL2 data. |
220 |
|
|
* |
221 |
|
|
* A tracker events is defined by some general variables, plus the collection of all the fitted tracks and all |
222 |
|
|
* single clusters on X and Y views. |
223 |
|
|
* Tracks and single clusters ("singlets") are described by the classes TrkTrack and TrkSinglet respectivelly. |
224 |
|
|
* |
225 |
|
|
* Each track may have an "image", due to the ambiguity on the Y view, which is stored also. |
226 |
|
|
* Thus, the number of stored tracks ( ntrk() ) differs from the number of "physical" tracks ( GetNTracks() ). |
227 |
|
|
* Proper methods allow to sort tracks and select the physical ones ( GetTracks() ). |
228 |
|
|
*/ |
229 |
|
|
class TrkLevel2 : public TObject { |
230 |
|
|
|
231 |
|
|
private: |
232 |
pam-fi |
1.15 |
|
233 |
mocchiut |
1.1 |
public: |
234 |
|
|
|
235 |
pam-fi |
1.15 |
Int_t good[12]; ///< event status |
236 |
pam-fi |
1.24 |
UInt_t VKmask[12]; ///< Viking-chip mask |
237 |
|
|
UInt_t VKflag[12]; ///< Viking-chip flag |
238 |
mocchiut |
1.1 |
|
239 |
|
|
TClonesArray *Track; ///< fitted tracks |
240 |
|
|
TClonesArray *SingletX; ///< x singlets |
241 |
|
|
TClonesArray *SingletY; ///< y singlets |
242 |
|
|
|
243 |
|
|
TrkLevel2(); |
244 |
|
|
// TrkLevel2(cTrkLevel2 *); |
245 |
pam-fi |
1.11 |
~TrkLevel2(){Delete();}; |
246 |
pam-fi |
1.10 |
|
247 |
pam-fi |
1.11 |
void Clear(); |
248 |
pam-fi |
1.15 |
void Clear(Option_t *option){Clear();}; |
249 |
pam-fi |
1.11 |
void Delete(); |
250 |
pam-fi |
1.16 |
void Set(); |
251 |
pam-fi |
1.11 |
|
252 |
|
|
int ntrk() {return Track->GetEntries();} ///< number of stored track |
253 |
mocchiut |
1.1 |
int nclsx(){return SingletX->GetEntries();} ///< number of x singlets |
254 |
|
|
int nclsy(){return SingletY->GetEntries();} ///< number of y singlets |
255 |
|
|
|
256 |
|
|
void Dump(); |
257 |
pam-fi |
1.11 |
void SetFromLevel2Struct(cTrkLevel2 *, TrkLevel1 *); |
258 |
pam-fi |
1.18 |
void SetFromLevel2Struct(cTrkLevel2 *s2){ SetFromLevel2Struct(s2, NULL); }; |
259 |
|
|
void SetFromLevel2Struct(TrkLevel1 *l1) { SetFromLevel2Struct(&level2event_, l1); }; |
260 |
|
|
void SetFromLevel2Struct() { SetFromLevel2Struct(&level2event_); }; |
261 |
pam-fi |
1.11 |
void GetLevel2Struct(cTrkLevel2 *) const; |
262 |
pam-fi |
1.3 |
void LoadField(TString); |
263 |
pam-fi |
1.25 |
float GetBX(float* v){return TrkParams::GetBX(v);};///< Bx (kGauss) |
264 |
|
|
float GetBY(float* v){return TrkParams::GetBY(v);};///< By (kGauss) |
265 |
|
|
float GetBZ(float* v){return TrkParams::GetBZ(v);};///< Bz (kGauss) |
266 |
pam-fi |
1.6 |
Float_t GetZTrk(Int_t); |
267 |
|
|
Float_t GetXTrkLeft(){return XTRKL;}; |
268 |
|
|
Float_t GetXTrkRight(){return XTRKR;}; |
269 |
|
|
Float_t GetYTrkLeft(){return YTRKL;}; |
270 |
|
|
Float_t GetYTrkRight(){return YTRKR;}; |
271 |
|
|
|
272 |
pam-fi |
1.24 |
Bool_t IsMaskedVK(int,int); |
273 |
|
|
Bool_t GetVKMask(int,int); |
274 |
|
|
Bool_t GetVKFlag(int,int); |
275 |
|
|
|
276 |
pam-fi |
1.6 |
TrkSinglet *GetSingletX(int); |
277 |
|
|
TrkSinglet *GetSingletY(int); |
278 |
|
|
|
279 |
|
|
TrkTrack *GetStoredTrack(int i); |
280 |
pam-fi |
1.3 |
Int_t GetSeqNo(Int_t i) {return (((TrkTrack *)Track->At(i))->seqno);}; ///< Returns track sequential number |
281 |
pam-fi |
1.24 |
|
282 |
pam-fi |
1.11 |
TRefArray *GetTracks_NFitSorted(); |
283 |
|
|
TRefArray *GetTracks(){return this->GetTracks_NFitSorted();}; |
284 |
|
|
|
285 |
|
|
Int_t GetNTracks(); |
286 |
|
|
TrkTrack* GetTrack(int i); |
287 |
mocchiut |
1.1 |
TrkTrack* GetTrackImage(int i); |
288 |
pam-fi |
1.11 |
|
289 |
pam-fi |
1.3 |
TrkLevel2* GetTrkLevel2(){return this;} |
290 |
|
|
TClonesArray* GetTrackArray(){return Track;};///< returns pointer to the track array |
291 |
|
|
|
292 |
pam-fi |
1.24 |
ClassDef(TrkLevel2,3); |
293 |
mocchiut |
1.1 |
|
294 |
|
|
}; |
295 |
|
|
|
296 |
|
|
#endif |