11 |
#include <TRefArray.h> |
#include <TRefArray.h> |
12 |
#include <TRef.h> |
#include <TRef.h> |
13 |
|
|
|
//#include <TrkStruct.h> |
|
14 |
#include <TrkParams.h> |
#include <TrkParams.h> |
15 |
#include <TrkLevel1.h> |
#include <TrkLevel1.h> |
16 |
|
|
17 |
// z-coordinate of track state-vector reference-plane |
// z-coordinate of track state-vector reference-plane |
18 |
#define ZINI 23.5 |
#define ZINI 23.5 |
|
// upper and lower (mechanical) z-coordinate of the tracker |
|
|
//#define ZTRKUP 22.29 |
|
|
//#define ZTRKDW -22.22 |
|
19 |
// (mechanical) z-coordinate of the tracker planes |
// (mechanical) z-coordinate of the tracker planes |
20 |
#define ZTRK6 -22.23 |
#define ZTRK6 -22.22 |
21 |
#define ZTRK5 -13.32 |
#define ZTRK5 -13.31 |
22 |
#define ZTRK4 -4.42 |
#define ZTRK4 -4.41 |
23 |
#define ZTRK3 4.48 |
#define ZTRK3 4.49 |
24 |
#define ZTRK2 13.38 |
#define ZTRK2 13.39 |
25 |
#define ZTRK1 22.28 |
#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 |
// (mechanical) x/y-coordinates of magnet cavity |
// (mechanical) x/y-coordinates of magnet cavity |
34 |
#define XTRKL -8.1 |
#define XTRKL -8.1 |
35 |
#define XTRKR 8.1 |
#define XTRKR 8.1 |
76 |
* A track is defined by the measured coordinates associated to it, the |
* A track is defined by the measured coordinates associated to it, the |
77 |
* track status vector, plus other quantities. |
* track status vector, plus other quantities. |
78 |
* A track may have an "image", due to the ambiguity in the y view. |
* A track may have an "image", due to the ambiguity in the y view. |
79 |
|
* |
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 |
*/ |
*/ |
88 |
// ================================================================== |
// ================================================================== |
89 |
class TrkTrack : public TObject { |
class TrkTrack : public TObject { |
92 |
|
|
93 |
int seqno; ///<stored track sequential number |
int seqno; ///<stored track sequential number |
94 |
int image; ///<sequential number of track-image |
int image; ///<sequential number of track-image |
|
|
|
95 |
|
|
96 |
public: |
public: |
97 |
|
|
98 |
TRefArray *clx; |
float al[5]; ///<TRACK STATE VECTOR |
|
TRefArray *cly; |
|
|
|
|
|
/* float al[5]; ///<TRACK STATE VECTOR */ |
|
|
double al[5]; ///<TRACK STATE VECTOR |
|
99 |
float coval[5][5]; ///<covariance matrix |
float coval[5][5]; ///<covariance matrix |
100 |
int xgood[6]; ///<mask of included x planes |
int xgood[6]; ///<cluster id for x-view (0 = view not included in the fit) |
101 |
int ygood[6]; ///<mask of included y planes |
int ygood[6]; ///<cluster id for y-view (0 = view not included in the fit) |
102 |
float xm[6]; ///<measured x coordinates |
float xm[6]; ///<measured x coordinates |
103 |
float ym[6]; ///<measured y coordinates |
float ym[6]; ///<measured y coordinates |
104 |
float zm[6]; ///<measured z coordinates |
float zm[6]; ///<measured z coordinates |
105 |
float resx[6]; ///<spatial resolution on X view |
float resx[6]; ///<spatial resolution on X view |
106 |
float resy[6]; ///<spatial resolution on y view |
float resy[6]; ///<spatial resolution on y view |
107 |
|
float tailx[6]; ///<spatial resolution tail on X view |
108 |
|
float taily[6]; ///<spatial resolution tail on y view |
109 |
float chi2; ///<chi2 |
float chi2; ///<chi2 |
110 |
int nstep; ///<n. step |
int nstep; ///<n.step |
111 |
float xv[6]; ///<calculated x coordinates |
float xv[6]; ///<calculated x coordinates |
112 |
float yv[6]; ///<calculated y coordinates |
float yv[6]; ///<calculated y coordinates |
113 |
float zv[6]; ///<calculated z coordinates |
float zv[6]; ///<calculated z coordinates |
114 |
float axv[6]; ///<calculated angles (deg) on x view |
float axv[6]; ///<calculated angles (deg) on x view |
115 |
float ayv[6]; ///<calculated angles (deg) on y view |
float ayv[6]; ///<calculated angles (deg) on y view |
116 |
float dedx_x[6]; ///<dE/dx in MIP |
float dedx_x[6]; ///<dE/dx in MIP (<0 if saturated) |
117 |
float dedx_y[6]; ///<dE/dx in MIP |
float dedx_y[6]; ///<dE/dx in MIP (<0 if saturated) |
118 |
|
int multmaxx[6]; ///<cluster multiplicity and strip of maximum on x view |
119 |
|
int multmaxy[6]; ///<cluster multiplicity and strip of maximum on y view |
120 |
|
float seedx[6]; ///< seed of the cluster x |
121 |
|
float seedy[6]; ///< seed of the cluster y |
122 |
|
float xpu[6]; ///< x coordinate in pitch units |
123 |
|
float ypu[6]; ///< y coordinate in pitch units |
124 |
|
|
125 |
TrkTrack(); |
TrkTrack(); |
126 |
TrkTrack(const TrkTrack&); |
TrkTrack(const TrkTrack&); |
140 |
int DoTrack(Trajectory* t); ///< Evaluates the trajectory in the apparatus. |
int DoTrack(Trajectory* t); ///< Evaluates the trajectory in the apparatus. |
141 |
int DoTrack2(Trajectory* t); ///< Evaluates the trajectory in the apparatus. |
int DoTrack2(Trajectory* t); ///< Evaluates the trajectory in the apparatus. |
142 |
float BdL(){return 0;}; ///< Evaluates the integral of B*dL along the track. |
float BdL(){return 0;}; ///< Evaluates the integral of B*dL along the track. |
143 |
Int_t GetNX(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=xgood[i]; return n;}; |
Int_t GetNX(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=(Int_t)XGood(i); return n;}; |
144 |
Int_t GetNY(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=ygood[i]; return n;}; |
Int_t GetNY(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=(Int_t)YGood(i); return n;}; |
145 |
Int_t GetNtot(){return GetNX()+GetNY();}; |
Int_t GetNtot(){return GetNX()+GetNY();}; |
146 |
Float_t GetRigidity(); |
Float_t GetRigidity(); |
147 |
Float_t GetDeflection(); |
Float_t GetDeflection(); |
148 |
|
Bool_t IsSaturated(int,int); |
149 |
|
Bool_t IsSaturated(int); |
150 |
|
Bool_t IsSaturated(); |
151 |
|
Bool_t IsBad(int,int); |
152 |
Float_t GetDEDX(); |
Float_t GetDEDX(); |
153 |
Float_t GetDEDX(Int_t ip){if( !(xgood[ip]+ygood[ip]) ) return 0; return (dedx_x[ip]+dedx_y[ip])/(xgood[ip]+ygood[ip]);}; |
Float_t GetDEDX(int ip); |
154 |
// sono un'imbecille... assegno xm e ym anche quando si tratta di un singolo |
Float_t GetDEDX(int ip,int iv); |
155 |
// non posso quindi usare xm e ym per dire se una vista e` inclusa nel fit o no |
Int_t GetLeverArmX(); |
156 |
/* Bool_t XGood(int ip){ return xm[ip] != -100.;}; |
Int_t GetLeverArmY(); |
157 |
Bool_t YGood(int ip){ return ym[ip] != -100.;};*/ |
Float_t GetChi2X(); |
158 |
Bool_t XGood(int ip){ return xgood[ip]> 0;}; |
Float_t GetChi2Y(); |
159 |
Bool_t YGood(int ip){ return ygood[ip]> 0;}; |
Float_t GetLnLX(); |
160 |
|
Float_t GetLnLY(); |
161 |
|
|
162 |
|
Float_t GetEffectiveAngle(int ip, int iv); |
163 |
|
|
164 |
void SetMeasure(double *xmeas, double *ymeas, double *zmeas); |
void SetMeasure(double *xmeas, double *ymeas, double *zmeas); |
165 |
void SetResolution(double *rx, double *ry); |
void SetResolution(double *rx, double *ry); |
166 |
|
void SetTail(double *tx, double *ty, double factor); |
167 |
|
void SetStudentParam(int flag); |
168 |
void SetGood(int *xg, int *yg); |
void SetGood(int *xg, int *yg); |
169 |
void LoadField(TString s); |
void LoadField(TString s); |
170 |
void Fit(double pfixed, int& fail, int iprint); |
void Fit(double pfixed, int& fail, int iprint, int froml1); |
171 |
|
void Fit(double pfixed, int& fail, int iprint){ Fit(pfixed,fail,iprint,0); }; |
172 |
void FitReset(); |
void FitReset(); |
173 |
void SetTrackingMode(int trackmode); |
void SetTrackingMode(int trackmode); |
174 |
void SetPrecisionFactor(double fact); |
void SetPrecisionFactor(double fact); |
175 |
void SetStepMin(int istepmin); |
void SetStepMin(int istepmin); |
176 |
|
Bool_t IsInsideCavity(); |
177 |
|
|
178 |
|
Bool_t EvaluateClusterPositions(); |
179 |
|
|
180 |
void FillMiniStruct(cMini2track&); |
void FillMiniStruct(cMini2track&); |
181 |
void SetFromMiniStruct(cMini2track*); |
void SetFromMiniStruct(cMini2track*); |
182 |
|
|
183 |
TrkCluster *GetClusterX(int ip); |
Int_t GetClusterX_ID(int ip); |
184 |
TrkCluster *GetClusterY(int ip); |
Int_t GetClusterY_ID(int ip); |
185 |
|
Int_t GetLadder(int ip); |
186 |
Int_t GetClusterX_ID(int ip){return xgood[ip];}; |
Int_t GetSensor(int ip); |
187 |
Int_t GetClusterY_ID(int ip){return ygood[ip];}; |
Bool_t XGood(int ip){ return GetClusterX_ID(ip)!=-1; }; |
188 |
|
Bool_t YGood(int ip){ return GetClusterY_ID(ip)!=-1; }; |
189 |
|
void ResetXGood(int ip){ xgood[ip]=0; }; |
190 |
|
void ResetYGood(int ip){ ygood[ip]=0; }; |
191 |
|
void SetXGood(int ip, int clid, int is); |
192 |
|
void SetYGood(int ip, int clid, int is); |
193 |
|
|
194 |
|
Bool_t BadClusterX(int ip){ return IsBad(ip,0); }; |
195 |
|
Bool_t BadClusterY(int ip){ return IsBad(ip,1); }; |
196 |
|
|
197 |
|
Bool_t SaturatedClusterX(int ip){ return IsSaturated(ip,0); }; |
198 |
|
Bool_t SaturatedClusterY(int ip){ return IsSaturated(ip,1); }; |
199 |
|
|
200 |
|
Int_t GetClusterX_Multiplicity(int ip){ return (Int_t)(multmaxx[ip]/10000); }; |
201 |
|
Int_t GetClusterY_Multiplicity(int ip){ return (Int_t)(multmaxy[ip]/10000); }; |
202 |
|
Int_t GetClusterX_MaxStrip(int ip){ return (Int_t)(multmaxx[ip]%10000); }; |
203 |
|
Int_t GetClusterY_MaxStrip(int ip){ return (Int_t)(multmaxy[ip]%10000); }; |
204 |
|
Float_t GetClusterX_Seed(int ip){ return seedx[ip]; }; |
205 |
|
Float_t GetClusterY_Seed(int ip){ return seedy[ip]; }; |
206 |
|
/* Float_t GetClusterX_CoordinatePU(int ip); */ |
207 |
|
/* Float_t GetClusterY_CoordinatePU(int ip); */ |
208 |
|
|
209 |
|
|
210 |
TrkTrack* GetTrkTrack(){return this;}; |
TrkTrack* GetTrkTrack(){return this;}; |
211 |
|
|
212 |
friend class TrkLevel2; |
friend class TrkLevel2; |
213 |
|
|
214 |
ClassDef(TrkTrack,2); |
ClassDef(TrkTrack,4); |
215 |
|
|
216 |
}; |
}; |
217 |
/** |
/** |
226 |
|
|
227 |
public: |
public: |
228 |
|
|
|
TRef cls; |
|
|
|
|
229 |
int plane; ///<plane |
int plane; ///<plane |
230 |
float coord[2]; ///<coordinate (on sensor 1 and 2) |
float coord[2]; ///<coordinate (on sensor 1 and 2) |
231 |
float sgnl; ///<cluster signal in MIP |
float sgnl; ///<cluster signal in MIP (<0 if saturated) |
232 |
|
|
233 |
TrkSinglet(); |
TrkSinglet(); |
234 |
TrkSinglet(const TrkSinglet&); |
TrkSinglet(const TrkSinglet&); |
238 |
void Clear(); |
void Clear(); |
239 |
void Clear(Option_t *option){Clear();}; |
void Clear(Option_t *option){Clear();}; |
240 |
void Delete(){Clear();}; |
void Delete(){Clear();}; |
241 |
|
Float_t GetSignal(){return fabs(sgnl);} |
242 |
|
Bool_t IsSaturated(){return (sgnl<0); }; |
243 |
|
|
|
TrkCluster *GetCluster(){TrkCluster *pt = (TrkCluster*)cls.GetObject(); return pt;}; |
|
|
|
|
244 |
friend class TrkLevel2; |
friend class TrkLevel2; |
245 |
|
|
246 |
ClassDef(TrkSinglet,2); |
ClassDef(TrkSinglet,3); |
247 |
|
|
248 |
}; |
}; |
249 |
|
|
257 |
* Each track may have an "image", due to the ambiguity on the Y view, which is stored also. |
* Each track may have an "image", due to the ambiguity on the Y view, which is stored also. |
258 |
* Thus, the number of stored tracks ( ntrk() ) differs from the number of "physical" tracks ( GetNTracks() ). |
* Thus, the number of stored tracks ( ntrk() ) differs from the number of "physical" tracks ( GetNTracks() ). |
259 |
* Proper methods allow to sort tracks and select the physical ones ( GetTracks() ). |
* Proper methods allow to sort tracks and select the physical ones ( GetTracks() ). |
260 |
|
* |
261 |
|
* The event status indicates the processing status of data from each DSP, according to the following |
262 |
|
* notation: |
263 |
|
* |
264 |
|
* xxxx xxxx xxxx xxxx xxxx xxxx |
265 |
|
* |||| |||| |||| |||| |||| ||||_ 0 missing packet |
266 |
|
* |||| |||| |||| |||| |||| |||__ 1 CRC error |
267 |
|
* |||| |||| |||| |||| |||| ||___ 2 on-line software alarm (latch-up, timeout ecc...) |
268 |
|
* |||| |||| |||| |||| |||| |____ 3 jump in the trigger counter |
269 |
|
* |||| |||| |||| |||| ||||______ 4 decode error |
270 |
|
* |||| |||| |||| |||| |||_______ 5 n.clusters > maximum number (level1 processing) |
271 |
|
* |||| |||| |||| |||| ||________ 6 |
272 |
|
* |||| |||| |||| |||| |_________ 7 |
273 |
|
* |||| |||| |||| ||||___________ 8 n.clusters > maximum value (level2 processing) |
274 |
|
* |||| |||| |||| |||____________ 9 n.couples per plane > maximum values (vector dimention) |
275 |
|
* |||| |||| |||| ||_____________ 10 n.doublets > maximum values |
276 |
|
* |||| |||| |||| |______________ 11 n.triplets > maximum values |
277 |
|
* |||| |||| ||||________________ 12 n.yz-clouds > maximum values |
278 |
|
* |||| |||| |||_________________ 13 n.xz-clouds > maximum values |
279 |
|
* |||| |||| ||__________________ 14 n.candidate-tracks > maximum values |
280 |
|
* |||| |||| |___________________ 15 n.couples per plane > maximum values (for Hough transform) |
281 |
|
* |||| ||||_____________________ 16 |
282 |
|
* |
283 |
|
* |
284 |
|
* For all data processed before June 2007 the event status was coded according to |
285 |
|
* a different rule: |
286 |
|
* |
287 |
|
* Status of level1 processing |
288 |
|
* 0 -- OK |
289 |
|
* 1 -- missing packet |
290 |
|
* 2 -- 1 CRC error |
291 |
|
* 3 -- 2 on-line software alarm (latch-up flags asserted or n.transmitted-words = 0) |
292 |
|
* 4 -- 3 jump in the trigger counter |
293 |
|
* 10 -- 4 decode error |
294 |
|
* 11 -- 5 n.clusters > maximum number (for level1 processing) |
295 |
|
* Status of level2 processing |
296 |
|
* 21 -- 0 n.clusters > maximum value (for level2 processing) |
297 |
|
* 22 -- 1 n.couples per plane > maximum values (vector dimention) |
298 |
|
* 23 -- 2 n.doublets > maximum values |
299 |
|
* 24 -- 3 n.triplets > maximum values |
300 |
|
* 25 -- 4 n.yz-clouds > maximum values |
301 |
|
* 26 -- 5 n.xz-clouds > maximum values |
302 |
|
* 27 -- 6 n.candidate-tracks > maximum values |
303 |
|
* 28 -- 7 n.couples per plane > maximum values (for Hough transform) |
304 |
|
* |
305 |
|
* |
306 |
*/ |
*/ |
307 |
class TrkLevel2 : public TObject { |
class TrkLevel2 : public TObject { |
308 |
|
|
311 |
public: |
public: |
312 |
|
|
313 |
Int_t good[12]; ///< event status |
Int_t good[12]; ///< event status |
314 |
|
UInt_t VKmask[12]; ///< Viking-chip mask |
315 |
|
UInt_t VKflag[12]; ///< Viking-chip flag |
316 |
|
|
317 |
TClonesArray *Track; ///< fitted tracks |
TClonesArray *Track; ///< fitted tracks |
318 |
TClonesArray *SingletX; ///< x singlets |
TClonesArray *SingletX; ///< x singlets |
338 |
void SetFromLevel2Struct() { SetFromLevel2Struct(&level2event_); }; |
void SetFromLevel2Struct() { SetFromLevel2Struct(&level2event_); }; |
339 |
void GetLevel2Struct(cTrkLevel2 *) const; |
void GetLevel2Struct(cTrkLevel2 *) const; |
340 |
void LoadField(TString); |
void LoadField(TString); |
341 |
float GetBX(float*); |
float GetBX(float* v){return TrkParams::GetBX(v);};///< Bx (kGauss) |
342 |
float GetBY(float*); |
float GetBY(float* v){return TrkParams::GetBY(v);};///< By (kGauss) |
343 |
float GetBZ(float*); |
float GetBZ(float* v){return TrkParams::GetBZ(v);};///< Bz (kGauss) |
344 |
Float_t GetZTrk(Int_t); |
Float_t GetZTrk(Int_t); |
345 |
Float_t GetXTrkLeft(){return XTRKL;}; |
Float_t GetXTrkLeft(){return XTRKL;}; |
346 |
Float_t GetXTrkRight(){return XTRKR;}; |
Float_t GetXTrkRight(){return XTRKR;}; |
347 |
Float_t GetYTrkLeft(){return YTRKL;}; |
Float_t GetYTrkLeft(){return YTRKL;}; |
348 |
Float_t GetYTrkRight(){return YTRKR;}; |
Float_t GetYTrkRight(){return YTRKR;}; |
349 |
|
|
350 |
|
Bool_t IsMaskedVK(int,int); |
351 |
|
Bool_t GetVKMask(int,int); |
352 |
|
Bool_t GetVKFlag(int,int); |
353 |
|
|
354 |
TrkSinglet *GetSingletX(int); |
TrkSinglet *GetSingletX(int); |
355 |
TrkSinglet *GetSingletY(int); |
TrkSinglet *GetSingletY(int); |
356 |
|
|
357 |
TrkTrack *GetStoredTrack(int i); |
TrkTrack *GetStoredTrack(int i); |
358 |
Int_t GetSeqNo(Int_t i) {return (((TrkTrack *)Track->At(i))->seqno);}; ///< Returns track sequential number |
Int_t GetSeqNo(Int_t i) {return (((TrkTrack *)Track->At(i))->seqno);}; ///< Returns track sequential number |
359 |
// TClonesArray *GetTracks_Chi2Sorted(); |
|
|
// TClonesArray *GetTracks_NFitSorted(); |
|
|
// TClonesArray *GetTracks(); |
|
360 |
TRefArray *GetTracks_NFitSorted(); |
TRefArray *GetTracks_NFitSorted(); |
361 |
TRefArray *GetTracks(){return this->GetTracks_NFitSorted();}; |
TRefArray *GetTracks(){return this->GetTracks_NFitSorted();}; |
362 |
|
|
|
// int GetNTracks(){return this->GetTracks()->GetEntries();} |
|
363 |
Int_t GetNTracks(); |
Int_t GetNTracks(); |
364 |
TrkTrack* GetTrack(int i); |
TrkTrack* GetTrack(int i); |
365 |
TrkTrack* GetTrackImage(int i); |
TrkTrack* GetTrackImage(int i); |
367 |
TrkLevel2* GetTrkLevel2(){return this;} |
TrkLevel2* GetTrkLevel2(){return this;} |
368 |
TClonesArray* GetTrackArray(){return Track;};///< returns pointer to the track array |
TClonesArray* GetTrackArray(){return Track;};///< returns pointer to the track array |
369 |
|
|
370 |
ClassDef(TrkLevel2,2); |
void StatusDump(int view); |
371 |
|
Bool_t StatusCheck(int view, int flagmask); |
372 |
|
|
373 |
|
ClassDef(TrkLevel2,3); |
374 |
|
|
375 |
}; |
}; |
376 |
|
|