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 |
pam-fi |
1.27 |
#define ZTRK6 -22.22 |
21 |
|
|
#define ZTRK5 -13.31 |
22 |
|
|
#define ZTRK4 -4.41 |
23 |
|
|
#define ZTRK3 4.49 |
24 |
|
|
#define ZTRK2 13.39 |
25 |
|
|
#define ZTRK1 22.29 |
26 |
|
|
// magnet cavity dimensions |
27 |
|
|
#define ZMAGNHIGH 21.83 |
28 |
|
|
#define ZMAGNLOW -21.83 |
29 |
|
|
#define XMAGNHIGH 8.07 |
30 |
|
|
#define XMAGNLOW -8.07 |
31 |
|
|
#define YMAGNHIGH 6.57 |
32 |
|
|
#define YMAGNLOW -6.57 |
33 |
pam-fi |
1.5 |
// (mechanical) x/y-coordinates of magnet cavity |
34 |
|
|
#define XTRKL -8.1 |
35 |
|
|
#define XTRKR 8.1 |
36 |
|
|
#define YTRKL -6.6 |
37 |
|
|
#define YTRKR 6.6 |
38 |
pam-fi |
1.2 |
|
39 |
mocchiut |
1.1 |
/** |
40 |
|
|
* \brief Class to describe, by points, a particle trajectory in the apparatus. |
41 |
|
|
* |
42 |
|
|
* The idea is to create it by integrating the equations of motion, given the |
43 |
|
|
* track state vector and the z coordinates where to evaluate track position. |
44 |
|
|
*/ |
45 |
|
|
// ================================================================== |
46 |
|
|
class Trajectory : public TObject{ |
47 |
|
|
private: |
48 |
|
|
|
49 |
|
|
public: |
50 |
|
|
|
51 |
|
|
int npoint; ///< number of evaluated points along the trajectory |
52 |
|
|
float* x; ///< x coordinates |
53 |
|
|
float* y; ///< y coordinates |
54 |
|
|
float* z; ///< z coordinates |
55 |
pam-fi |
1.2 |
float* thx; ///< x projected angle |
56 |
|
|
float* thy; ///< y projected angle |
57 |
|
|
float* tl; ///< track length |
58 |
mocchiut |
1.1 |
|
59 |
pam-fi |
1.2 |
Trajectory(); |
60 |
mocchiut |
1.1 |
Trajectory(int n); |
61 |
|
|
Trajectory(int n, float* pz); |
62 |
pam-fi |
1.15 |
~Trajectory(){Delete();}; |
63 |
mocchiut |
1.1 |
void Dump(); |
64 |
pam-fi |
1.15 |
void Delete(); |
65 |
mocchiut |
1.1 |
|
66 |
pam-fi |
1.13 |
int DoTrack2(float* al); |
67 |
pam-fi |
1.2 |
float GetLength(){float l=0; for(int i=0; i<npoint;i++)l=l+tl[i]; return l;}; |
68 |
|
|
float GetLength(int,int); |
69 |
|
|
|
70 |
pam-fi |
1.9 |
ClassDef(Trajectory,2); |
71 |
mocchiut |
1.1 |
|
72 |
|
|
}; |
73 |
|
|
/** |
74 |
|
|
* \brief Class to describe fitted tracks. |
75 |
|
|
* |
76 |
|
|
* A track is defined by the measured coordinates associated to it, the |
77 |
|
|
* track status vector, plus other quantities. |
78 |
|
|
* A track may have an "image", due to the ambiguity in the y view. |
79 |
pam-fi |
1.24 |
* |
80 |
|
|
* Cluster flags: xgood[6], ygood[6] |
81 |
|
|
* |
82 |
|
|
* xgood/ygood = +/- 0lsccccccc |
83 |
|
|
* | |||------- ID (1-7483647) of the included cluster |
84 |
|
|
* | ||-------- sensor number (1,2 - increasing y) |
85 |
|
|
* | |--------- ladder number (1,2,3 - increasing x) |
86 |
|
|
* |------------- does-not/does include bad strips |
87 |
mocchiut |
1.1 |
*/ |
88 |
|
|
// ================================================================== |
89 |
|
|
class TrkTrack : public TObject { |
90 |
|
|
|
91 |
|
|
private: |
92 |
|
|
|
93 |
pam-fi |
1.3 |
int seqno; ///<stored track sequential number |
94 |
|
|
int image; ///<sequential number of track-image |
95 |
pam-fi |
1.8 |
|
96 |
mocchiut |
1.1 |
public: |
97 |
|
|
|
98 |
pam-fi |
1.22 |
float al[5]; ///<TRACK STATE VECTOR |
99 |
mocchiut |
1.1 |
float coval[5][5]; ///<covariance matrix |
100 |
pam-fi |
1.24 |
int xgood[6]; ///<cluster flag for x-view (0 = view not included in the fit) |
101 |
|
|
int ygood[6]; ///<cluster flag for y-view (0 = view not included in the fit) |
102 |
mocchiut |
1.1 |
float xm[6]; ///<measured x coordinates |
103 |
|
|
float ym[6]; ///<measured y coordinates |
104 |
|
|
float zm[6]; ///<measured z coordinates |
105 |
|
|
float resx[6]; ///<spatial resolution on X view |
106 |
|
|
float resy[6]; ///<spatial resolution on y view |
107 |
pam-fi |
1.24 |
float tailx[6]; ///<spatial resolution tail on X view |
108 |
|
|
float taily[6]; ///<spatial resolution tail on y view |
109 |
mocchiut |
1.1 |
float chi2; ///<chi2 |
110 |
pam-fi |
1.12 |
int nstep; ///<n. step |
111 |
|
|
float xv[6]; ///<calculated x coordinates |
112 |
mocchiut |
1.1 |
float yv[6]; ///<calculated y coordinates |
113 |
|
|
float zv[6]; ///<calculated z coordinates |
114 |
|
|
float axv[6]; ///<calculated angles (deg) on x view |
115 |
|
|
float ayv[6]; ///<calculated angles (deg) on y view |
116 |
pam-fi |
1.24 |
float dedx_x[6]; ///<dE/dx in MIP (<0 if saturated) |
117 |
|
|
float dedx_y[6]; ///<dE/dx in MIP (<0 if saturated) |
118 |
pam-fi |
1.3 |
|
119 |
mocchiut |
1.1 |
TrkTrack(); |
120 |
|
|
TrkTrack(const TrkTrack&); |
121 |
|
|
|
122 |
pam-fi |
1.15 |
~TrkTrack(){ Delete(); }; |
123 |
pam-fi |
1.10 |
|
124 |
mocchiut |
1.1 |
void Dump(); |
125 |
pam-fi |
1.12 |
void Clear(); |
126 |
pam-fi |
1.15 |
void Clear(Option_t *option){Clear();}; |
127 |
pam-fi |
1.12 |
void Delete(); |
128 |
pam-fi |
1.15 |
void Copy(TrkTrack&); |
129 |
pam-fi |
1.16 |
// void Set(); |
130 |
|
|
|
131 |
pam-fi |
1.3 |
Int_t GetSeqNo(){return seqno;} ///< Returns the track sequential number |
132 |
|
|
Int_t GetImageSeqNo(){return image;} ///< Returns the track image sequential number |
133 |
mocchiut |
1.1 |
Bool_t HasImage(){return !(image==-1);} ///< Returns true if the track has an image |
134 |
pam-fi |
1.2 |
int DoTrack(Trajectory* t); ///< Evaluates the trajectory in the apparatus. |
135 |
|
|
int DoTrack2(Trajectory* t); ///< Evaluates the trajectory in the apparatus. |
136 |
|
|
float BdL(){return 0;}; ///< Evaluates the integral of B*dL along the track. |
137 |
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;}; |
138 |
|
|
Int_t GetNY(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=(Int_t)YGood(i); return n;}; |
139 |
pam-fi |
1.3 |
Int_t GetNtot(){return GetNX()+GetNY();}; |
140 |
mocchiut |
1.1 |
Float_t GetRigidity(); |
141 |
|
|
Float_t GetDeflection(); |
142 |
pam-fi |
1.24 |
Bool_t IsSaturated(int,int); |
143 |
|
|
Bool_t IsSaturated(int); |
144 |
|
|
Bool_t IsSaturated(); |
145 |
|
|
Bool_t IsBad(int,int); |
146 |
mocchiut |
1.1 |
Float_t GetDEDX(); |
147 |
pam-fi |
1.28 |
Float_t GetDEDX(int ip); |
148 |
|
|
Float_t GetDEDX(int ip,int iv); |
149 |
pam-fi |
1.24 |
Int_t GetLeverArmX(); |
150 |
|
|
Int_t GetLeverArmY(); |
151 |
pam-fi |
1.29 |
Float_t GetChi2X(); |
152 |
|
|
Float_t GetChi2Y(); |
153 |
|
|
Float_t GetLnLX(); |
154 |
|
|
Float_t GetLnLY(); |
155 |
pam-fi |
1.12 |
|
156 |
|
|
void SetMeasure(double *xmeas, double *ymeas, double *zmeas); |
157 |
|
|
void SetResolution(double *rx, double *ry); |
158 |
pam-fi |
1.26 |
void SetTail(double *tx, double *ty, double factor); |
159 |
|
|
void SetStudentParam(int flag); |
160 |
pam-fi |
1.12 |
void SetGood(int *xg, int *yg); |
161 |
|
|
void LoadField(TString s); |
162 |
pam-fi |
1.25 |
void Fit(double pfixed, int& fail, int iprint, int froml1); |
163 |
|
|
void Fit(double pfixed, int& fail, int iprint){ Fit(pfixed,fail,iprint,0); }; |
164 |
pam-fi |
1.12 |
void FitReset(); |
165 |
pam-fi |
1.19 |
void SetTrackingMode(int trackmode); |
166 |
pam-fi |
1.21 |
void SetPrecisionFactor(double fact); |
167 |
|
|
void SetStepMin(int istepmin); |
168 |
pam-fi |
1.27 |
Bool_t IsInsideCavity(); |
169 |
pam-fi |
1.14 |
|
170 |
pam-fi |
1.28 |
Bool_t EvaluateClusterPositions(); |
171 |
pam-fi |
1.25 |
|
172 |
pam-fi |
1.14 |
void FillMiniStruct(cMini2track&); |
173 |
|
|
void SetFromMiniStruct(cMini2track*); |
174 |
pam-fi |
1.12 |
|
175 |
pam-fi |
1.24 |
Int_t GetClusterX_ID(int ip); |
176 |
|
|
Int_t GetClusterY_ID(int ip); |
177 |
|
|
Int_t GetLadder(int ip); |
178 |
|
|
Int_t GetSensor(int ip); |
179 |
|
|
Bool_t XGood(int ip){ return GetClusterX_ID(ip)!=-1; }; |
180 |
|
|
Bool_t YGood(int ip){ return GetClusterY_ID(ip)!=-1; }; |
181 |
pam-fi |
1.25 |
void ResetXGood(int ip){ xgood[ip]=0; }; |
182 |
|
|
void ResetYGood(int ip){ ygood[ip]=0; }; |
183 |
|
|
void SetXGood(int ip, int clid, int is); |
184 |
|
|
void SetYGood(int ip, int clid, int is); |
185 |
pam-fi |
1.24 |
|
186 |
|
|
Bool_t BadClusterX(int ip){ return IsBad(ip,0); }; |
187 |
|
|
Bool_t BadClusterY(int ip){ return IsBad(ip,1); }; |
188 |
|
|
|
189 |
|
|
Bool_t SaturatedClusterX(int ip){ return IsSaturated(ip,0); }; |
190 |
|
|
Bool_t SaturatedClusterY(int ip){ return IsSaturated(ip,1); }; |
191 |
pam-fi |
1.20 |
|
192 |
mocchiut |
1.1 |
TrkTrack* GetTrkTrack(){return this;}; |
193 |
|
|
|
194 |
pam-fi |
1.3 |
friend class TrkLevel2; |
195 |
|
|
|
196 |
pam-fi |
1.24 |
ClassDef(TrkTrack,3); |
197 |
mocchiut |
1.1 |
|
198 |
|
|
}; |
199 |
|
|
/** |
200 |
|
|
* \brief Class to describe single clusters ("singlets"). |
201 |
|
|
* |
202 |
|
|
* Single clusters are clusters not associated to any track. |
203 |
|
|
*/ |
204 |
|
|
class TrkSinglet : public TObject { |
205 |
|
|
|
206 |
|
|
private: |
207 |
pam-fi |
1.8 |
|
208 |
mocchiut |
1.1 |
|
209 |
|
|
public: |
210 |
pam-fi |
1.8 |
|
211 |
mocchiut |
1.1 |
int plane; ///<plane |
212 |
|
|
float coord[2]; ///<coordinate (on sensor 1 and 2) |
213 |
pam-fi |
1.24 |
float sgnl; ///<cluster signal in MIP (<0 if saturated) |
214 |
mocchiut |
1.1 |
|
215 |
|
|
TrkSinglet(); |
216 |
|
|
TrkSinglet(const TrkSinglet&); |
217 |
pam-fi |
1.15 |
~TrkSinglet(){Delete();}; |
218 |
mocchiut |
1.1 |
|
219 |
|
|
void Dump(); |
220 |
pam-fi |
1.15 |
void Clear(); |
221 |
|
|
void Clear(Option_t *option){Clear();}; |
222 |
|
|
void Delete(){Clear();}; |
223 |
pam-fi |
1.24 |
Float_t GetSignal(){return fabs(sgnl);} |
224 |
|
|
Bool_t IsSaturated(){return (sgnl<0); }; |
225 |
pam-fi |
1.8 |
|
226 |
pam-fi |
1.3 |
friend class TrkLevel2; |
227 |
|
|
|
228 |
pam-fi |
1.24 |
ClassDef(TrkSinglet,3); |
229 |
mocchiut |
1.1 |
|
230 |
|
|
}; |
231 |
|
|
|
232 |
|
|
/** |
233 |
|
|
* \brief Class to describe tracker LEVEL2 data. |
234 |
|
|
* |
235 |
|
|
* A tracker events is defined by some general variables, plus the collection of all the fitted tracks and all |
236 |
|
|
* single clusters on X and Y views. |
237 |
|
|
* Tracks and single clusters ("singlets") are described by the classes TrkTrack and TrkSinglet respectivelly. |
238 |
|
|
* |
239 |
|
|
* Each track may have an "image", due to the ambiguity on the Y view, which is stored also. |
240 |
|
|
* Thus, the number of stored tracks ( ntrk() ) differs from the number of "physical" tracks ( GetNTracks() ). |
241 |
|
|
* Proper methods allow to sort tracks and select the physical ones ( GetTracks() ). |
242 |
pam-fi |
1.28 |
* |
243 |
|
|
* The event status indicates the processing status of data from each DSP, according to the following |
244 |
|
|
* notation: |
245 |
|
|
* |
246 |
|
|
* xxxx xxxx xxxx xxxx xxxx xxxx |
247 |
|
|
* |||| |||| |||| |||| |||| ||||_ 0 missing packet |
248 |
|
|
* |||| |||| |||| |||| |||| |||__ 1 CRC error |
249 |
|
|
* |||| |||| |||| |||| |||| ||___ 2 on-line software alarm (latch-up, timeout ecc...) |
250 |
|
|
* |||| |||| |||| |||| |||| |____ 3 jump in the trigger counter |
251 |
|
|
* |||| |||| |||| |||| ||||______ 4 decode error |
252 |
|
|
* |||| |||| |||| |||| |||_______ 5 n.clusters > maximum number (level1 processing) |
253 |
|
|
* |||| |||| |||| |||| ||________ 6 |
254 |
|
|
* |||| |||| |||| |||| |_________ 7 |
255 |
|
|
* |||| |||| |||| ||||___________ 8 n.clusters > maximum value (level2 processing) |
256 |
|
|
* |||| |||| |||| |||____________ 9 n.couples per plane > maximum values (vector dimention) |
257 |
|
|
* |||| |||| |||| ||_____________ 10 n.doublets > maximum values |
258 |
|
|
* |||| |||| |||| |______________ 11 n.triplets > maximum values |
259 |
|
|
* |||| |||| ||||________________ 12 n.yz-clouds > maximum values |
260 |
|
|
* |||| |||| |||_________________ 13 n.xz-clouds > maximum values |
261 |
|
|
* |||| |||| ||__________________ 14 n.candidate-tracks > maximum values |
262 |
|
|
* |||| |||| |___________________ 15 n.couples per plane > maximum values (for Hough transform) |
263 |
|
|
* |||| ||||_____________________ 16 |
264 |
|
|
* |
265 |
|
|
* |
266 |
|
|
* For all data processed before June 2007 the event status was coded according to |
267 |
|
|
* a different rule: |
268 |
|
|
* |
269 |
|
|
* Status of level1 processing |
270 |
|
|
* 0 -- OK |
271 |
|
|
* 1 -- missing packet |
272 |
|
|
* 2 -- 1 CRC error |
273 |
|
|
* 3 -- 2 on-line software alarm (latch-up flags asserted or n.transmitted-words = 0) |
274 |
|
|
* 4 -- 3 jump in the trigger counter |
275 |
|
|
* 10 -- 4 decode error |
276 |
|
|
* 11 -- 5 n.clusters > maximum number (for level1 processing) |
277 |
|
|
* Status of level2 processing |
278 |
|
|
* 21 -- 0 n.clusters > maximum value (for level2 processing) |
279 |
|
|
* 22 -- 1 n.couples per plane > maximum values (vector dimention) |
280 |
|
|
* 23 -- 2 n.doublets > maximum values |
281 |
|
|
* 24 -- 3 n.triplets > maximum values |
282 |
|
|
* 25 -- 4 n.yz-clouds > maximum values |
283 |
|
|
* 26 -- 5 n.xz-clouds > maximum values |
284 |
|
|
* 27 -- 6 n.candidate-tracks > maximum values |
285 |
|
|
* 28 -- 7 n.couples per plane > maximum values (for Hough transform) |
286 |
|
|
* |
287 |
|
|
* |
288 |
mocchiut |
1.1 |
*/ |
289 |
|
|
class TrkLevel2 : public TObject { |
290 |
|
|
|
291 |
|
|
private: |
292 |
pam-fi |
1.15 |
|
293 |
mocchiut |
1.1 |
public: |
294 |
|
|
|
295 |
pam-fi |
1.15 |
Int_t good[12]; ///< event status |
296 |
pam-fi |
1.24 |
UInt_t VKmask[12]; ///< Viking-chip mask |
297 |
|
|
UInt_t VKflag[12]; ///< Viking-chip flag |
298 |
mocchiut |
1.1 |
|
299 |
|
|
TClonesArray *Track; ///< fitted tracks |
300 |
|
|
TClonesArray *SingletX; ///< x singlets |
301 |
|
|
TClonesArray *SingletY; ///< y singlets |
302 |
|
|
|
303 |
|
|
TrkLevel2(); |
304 |
|
|
// TrkLevel2(cTrkLevel2 *); |
305 |
pam-fi |
1.11 |
~TrkLevel2(){Delete();}; |
306 |
pam-fi |
1.10 |
|
307 |
pam-fi |
1.11 |
void Clear(); |
308 |
pam-fi |
1.15 |
void Clear(Option_t *option){Clear();}; |
309 |
pam-fi |
1.11 |
void Delete(); |
310 |
pam-fi |
1.16 |
void Set(); |
311 |
pam-fi |
1.11 |
|
312 |
|
|
int ntrk() {return Track->GetEntries();} ///< number of stored track |
313 |
mocchiut |
1.1 |
int nclsx(){return SingletX->GetEntries();} ///< number of x singlets |
314 |
|
|
int nclsy(){return SingletY->GetEntries();} ///< number of y singlets |
315 |
|
|
|
316 |
|
|
void Dump(); |
317 |
pam-fi |
1.11 |
void SetFromLevel2Struct(cTrkLevel2 *, TrkLevel1 *); |
318 |
pam-fi |
1.18 |
void SetFromLevel2Struct(cTrkLevel2 *s2){ SetFromLevel2Struct(s2, NULL); }; |
319 |
|
|
void SetFromLevel2Struct(TrkLevel1 *l1) { SetFromLevel2Struct(&level2event_, l1); }; |
320 |
|
|
void SetFromLevel2Struct() { SetFromLevel2Struct(&level2event_); }; |
321 |
pam-fi |
1.11 |
void GetLevel2Struct(cTrkLevel2 *) const; |
322 |
pam-fi |
1.3 |
void LoadField(TString); |
323 |
pam-fi |
1.25 |
float GetBX(float* v){return TrkParams::GetBX(v);};///< Bx (kGauss) |
324 |
|
|
float GetBY(float* v){return TrkParams::GetBY(v);};///< By (kGauss) |
325 |
|
|
float GetBZ(float* v){return TrkParams::GetBZ(v);};///< Bz (kGauss) |
326 |
pam-fi |
1.6 |
Float_t GetZTrk(Int_t); |
327 |
|
|
Float_t GetXTrkLeft(){return XTRKL;}; |
328 |
|
|
Float_t GetXTrkRight(){return XTRKR;}; |
329 |
|
|
Float_t GetYTrkLeft(){return YTRKL;}; |
330 |
|
|
Float_t GetYTrkRight(){return YTRKR;}; |
331 |
|
|
|
332 |
pam-fi |
1.24 |
Bool_t IsMaskedVK(int,int); |
333 |
|
|
Bool_t GetVKMask(int,int); |
334 |
|
|
Bool_t GetVKFlag(int,int); |
335 |
|
|
|
336 |
pam-fi |
1.6 |
TrkSinglet *GetSingletX(int); |
337 |
|
|
TrkSinglet *GetSingletY(int); |
338 |
|
|
|
339 |
|
|
TrkTrack *GetStoredTrack(int i); |
340 |
pam-fi |
1.3 |
Int_t GetSeqNo(Int_t i) {return (((TrkTrack *)Track->At(i))->seqno);}; ///< Returns track sequential number |
341 |
pam-fi |
1.24 |
|
342 |
pam-fi |
1.11 |
TRefArray *GetTracks_NFitSorted(); |
343 |
|
|
TRefArray *GetTracks(){return this->GetTracks_NFitSorted();}; |
344 |
|
|
|
345 |
|
|
Int_t GetNTracks(); |
346 |
|
|
TrkTrack* GetTrack(int i); |
347 |
mocchiut |
1.1 |
TrkTrack* GetTrackImage(int i); |
348 |
pam-fi |
1.11 |
|
349 |
pam-fi |
1.3 |
TrkLevel2* GetTrkLevel2(){return this;} |
350 |
|
|
TClonesArray* GetTrackArray(){return Track;};///< returns pointer to the track array |
351 |
|
|
|
352 |
pam-fi |
1.28 |
void StatusDump(int view); |
353 |
|
|
Bool_t StatusCheck(int view, int flagmask); |
354 |
|
|
|
355 |
pam-fi |
1.24 |
ClassDef(TrkLevel2,3); |
356 |
mocchiut |
1.1 |
|
357 |
|
|
}; |
358 |
|
|
|
359 |
|
|
#endif |