/[PAMELA software]/DarthVader/TrackerLevel2/inc/TrkLevel2.h
ViewVC logotype

Annotation of /DarthVader/TrackerLevel2/inc/TrkLevel2.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.34 - (hide annotations) (download)
Tue Jan 22 08:55:06 2008 UTC (16 years, 10 months ago) by pam-fi
Branch: MAIN
Changes since 1.33: +32 -8 lines
File MIME type: text/plain
ome new methods

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 pam-fi 1.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.32 public:
94    
95 pam-fi 1.3 int seqno; ///<stored track sequential number
96     int image; ///<sequential number of track-image
97 pam-fi 1.8
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.31 int xgood[6]; ///<cluster id for x-view (0 = view not included in the fit)
101     int ygood[6]; ///<cluster id 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.31 int nstep; ///<n.step
111 pam-fi 1.12 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.31 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 pam-fi 1.3
125 mocchiut 1.1 TrkTrack();
126     TrkTrack(const TrkTrack&);
127    
128 pam-fi 1.15 ~TrkTrack(){ Delete(); };
129 pam-fi 1.10
130 mocchiut 1.1 void Dump();
131 pam-fi 1.12 void Clear();
132 pam-fi 1.15 void Clear(Option_t *option){Clear();};
133 pam-fi 1.12 void Delete();
134 pam-fi 1.15 void Copy(TrkTrack&);
135 pam-fi 1.16 // void Set();
136    
137 pam-fi 1.3 Int_t GetSeqNo(){return seqno;} ///< Returns the track sequential number
138     Int_t GetImageSeqNo(){return image;} ///< Returns the track image sequential number
139 mocchiut 1.1 Bool_t HasImage(){return !(image==-1);} ///< Returns true if the track has an image
140 pam-fi 1.2 int DoTrack(Trajectory* t); ///< Evaluates the trajectory in the apparatus.
141     int DoTrack2(Trajectory* t); ///< Evaluates the trajectory in the apparatus.
142     float BdL(){return 0;}; ///< Evaluates the integral of B*dL along the track.
143 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;};
144     Int_t GetNY(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=(Int_t)YGood(i); return n;};
145 pam-fi 1.3 Int_t GetNtot(){return GetNX()+GetNY();};
146 mocchiut 1.1 Float_t GetRigidity();
147     Float_t GetDeflection();
148 pam-fi 1.24 Bool_t IsSaturated(int,int);
149     Bool_t IsSaturated(int);
150     Bool_t IsSaturated();
151     Bool_t IsBad(int,int);
152 mocchiut 1.1 Float_t GetDEDX();
153 pam-fi 1.28 Float_t GetDEDX(int ip);
154     Float_t GetDEDX(int ip,int iv);
155 pam-fi 1.24 Int_t GetLeverArmX();
156     Int_t GetLeverArmY();
157 pam-fi 1.29 Float_t GetChi2X();
158     Float_t GetChi2Y();
159     Float_t GetLnLX();
160     Float_t GetLnLY();
161 pam-fi 1.12
162 pam-fi 1.30 Float_t GetEffectiveAngle(int ip, int iv);
163    
164 pam-fi 1.12 void SetMeasure(double *xmeas, double *ymeas, double *zmeas);
165     void SetResolution(double *rx, double *ry);
166 pam-fi 1.26 void SetTail(double *tx, double *ty, double factor);
167     void SetStudentParam(int flag);
168 pam-fi 1.12 void SetGood(int *xg, int *yg);
169     void LoadField(TString s);
170 pam-fi 1.25 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 pam-fi 1.12 void FitReset();
173 pam-fi 1.19 void SetTrackingMode(int trackmode);
174 pam-fi 1.21 void SetPrecisionFactor(double fact);
175     void SetStepMin(int istepmin);
176 pam-fi 1.33 void SetDeltaB(int id, double db);
177    
178 pam-fi 1.27 Bool_t IsInsideCavity();
179 pam-fi 1.14
180 pam-fi 1.28 Bool_t EvaluateClusterPositions();
181 pam-fi 1.25
182 pam-fi 1.14 void FillMiniStruct(cMini2track&);
183     void SetFromMiniStruct(cMini2track*);
184 pam-fi 1.12
185 pam-fi 1.24 Int_t GetClusterX_ID(int ip);
186     Int_t GetClusterY_ID(int ip);
187     Int_t GetLadder(int ip);
188     Int_t GetSensor(int ip);
189     Bool_t XGood(int ip){ return GetClusterX_ID(ip)!=-1; };
190     Bool_t YGood(int ip){ return GetClusterY_ID(ip)!=-1; };
191 pam-fi 1.25 void ResetXGood(int ip){ xgood[ip]=0; };
192     void ResetYGood(int ip){ ygood[ip]=0; };
193     void SetXGood(int ip, int clid, int is);
194     void SetYGood(int ip, int clid, int is);
195 pam-fi 1.24
196     Bool_t BadClusterX(int ip){ return IsBad(ip,0); };
197     Bool_t BadClusterY(int ip){ return IsBad(ip,1); };
198    
199     Bool_t SaturatedClusterX(int ip){ return IsSaturated(ip,0); };
200     Bool_t SaturatedClusterY(int ip){ return IsSaturated(ip,1); };
201 pam-fi 1.20
202 pam-fi 1.31 Int_t GetClusterX_Multiplicity(int ip){ return (Int_t)(multmaxx[ip]/10000); };
203     Int_t GetClusterY_Multiplicity(int ip){ return (Int_t)(multmaxy[ip]/10000); };
204     Int_t GetClusterX_MaxStrip(int ip){ return (Int_t)(multmaxx[ip]%10000); };
205     Int_t GetClusterY_MaxStrip(int ip){ return (Int_t)(multmaxy[ip]%10000); };
206     Float_t GetClusterX_Seed(int ip){ return seedx[ip]; };
207     Float_t GetClusterY_Seed(int ip){ return seedy[ip]; };
208     /* Float_t GetClusterX_CoordinatePU(int ip); */
209     /* Float_t GetClusterY_CoordinatePU(int ip); */
210    
211 pam-fi 1.34 Float_t GetYav();
212     Float_t GetXav();
213     Float_t GetZav();
214    
215     Int_t GetNColumns();
216    
217     Float_t GetDEDX_max(int ip, int iv);
218     Float_t GetDEDX_max(int iv){ return GetDEDX_max(-1,iv); };
219     Float_t GetDEDX_max(){ return GetDEDX_max(-1,-1); };
220     Float_t GetDEDX_min(int ip, int iv);
221     Float_t GetDEDX_min(int iv){ return GetDEDX_min(-1,iv); };
222     Float_t GetDEDX_min(){ return GetDEDX_min(-1,-1); };
223    
224     Float_t GetResidual_max(int ip, int iv);
225     Float_t GetResidual_max(int iv){ return GetResidual_max(-1,iv); };
226     Float_t GetResidual_max(){ return GetResidual_max(-1,-1); };
227    
228     Int_t GetClusterX_Multiplicity_max();
229     Int_t GetClusterX_Multiplicity_min();
230     Int_t GetClusterY_Multiplicity_max();
231     Int_t GetClusterY_Multiplicity_min();
232    
233     Float_t GetClusterX_Seed_min();
234     Float_t GetClusterY_Seed_min();
235 pam-fi 1.31
236 mocchiut 1.1 TrkTrack* GetTrkTrack(){return this;};
237    
238 pam-fi 1.3 friend class TrkLevel2;
239    
240 pam-fi 1.31 ClassDef(TrkTrack,4);
241 mocchiut 1.1
242     };
243     /**
244     * \brief Class to describe single clusters ("singlets").
245     *
246     * Single clusters are clusters not associated to any track.
247     */
248     class TrkSinglet : public TObject {
249    
250     private:
251 pam-fi 1.8
252 mocchiut 1.1
253     public:
254 pam-fi 1.8
255 mocchiut 1.1 int plane; ///<plane
256     float coord[2]; ///<coordinate (on sensor 1 and 2)
257 pam-fi 1.24 float sgnl; ///<cluster signal in MIP (<0 if saturated)
258 mocchiut 1.1
259     TrkSinglet();
260     TrkSinglet(const TrkSinglet&);
261 pam-fi 1.15 ~TrkSinglet(){Delete();};
262 mocchiut 1.1
263     void Dump();
264 pam-fi 1.15 void Clear();
265     void Clear(Option_t *option){Clear();};
266     void Delete(){Clear();};
267 pam-fi 1.24 Float_t GetSignal(){return fabs(sgnl);}
268     Bool_t IsSaturated(){return (sgnl<0); };
269 pam-fi 1.8
270 pam-fi 1.3 friend class TrkLevel2;
271    
272 pam-fi 1.24 ClassDef(TrkSinglet,3);
273 mocchiut 1.1
274     };
275    
276     /**
277     * \brief Class to describe tracker LEVEL2 data.
278     *
279     * A tracker events is defined by some general variables, plus the collection of all the fitted tracks and all
280     * single clusters on X and Y views.
281     * Tracks and single clusters ("singlets") are described by the classes TrkTrack and TrkSinglet respectivelly.
282     *
283     * Each track may have an "image", due to the ambiguity on the Y view, which is stored also.
284     * Thus, the number of stored tracks ( ntrk() ) differs from the number of "physical" tracks ( GetNTracks() ).
285     * Proper methods allow to sort tracks and select the physical ones ( GetTracks() ).
286 pam-fi 1.28 *
287     * The event status indicates the processing status of data from each DSP, according to the following
288     * notation:
289     *
290     * xxxx xxxx xxxx xxxx xxxx xxxx
291     * |||| |||| |||| |||| |||| ||||_ 0 missing packet
292     * |||| |||| |||| |||| |||| |||__ 1 CRC error
293     * |||| |||| |||| |||| |||| ||___ 2 on-line software alarm (latch-up, timeout ecc...)
294     * |||| |||| |||| |||| |||| |____ 3 jump in the trigger counter
295     * |||| |||| |||| |||| ||||______ 4 decode error
296     * |||| |||| |||| |||| |||_______ 5 n.clusters > maximum number (level1 processing)
297     * |||| |||| |||| |||| ||________ 6
298     * |||| |||| |||| |||| |_________ 7
299     * |||| |||| |||| ||||___________ 8 n.clusters > maximum value (level2 processing)
300     * |||| |||| |||| |||____________ 9 n.couples per plane > maximum values (vector dimention)
301     * |||| |||| |||| ||_____________ 10 n.doublets > maximum values
302     * |||| |||| |||| |______________ 11 n.triplets > maximum values
303     * |||| |||| ||||________________ 12 n.yz-clouds > maximum values
304     * |||| |||| |||_________________ 13 n.xz-clouds > maximum values
305     * |||| |||| ||__________________ 14 n.candidate-tracks > maximum values
306     * |||| |||| |___________________ 15 n.couples per plane > maximum values (for Hough transform)
307     * |||| ||||_____________________ 16
308     *
309     *
310     * For all data processed before June 2007 the event status was coded according to
311     * a different rule:
312     *
313     * Status of level1 processing
314     * 0 -- OK
315     * 1 -- missing packet
316     * 2 -- 1 CRC error
317     * 3 -- 2 on-line software alarm (latch-up flags asserted or n.transmitted-words = 0)
318     * 4 -- 3 jump in the trigger counter
319     * 10 -- 4 decode error
320     * 11 -- 5 n.clusters > maximum number (for level1 processing)
321     * Status of level2 processing
322     * 21 -- 0 n.clusters > maximum value (for level2 processing)
323     * 22 -- 1 n.couples per plane > maximum values (vector dimention)
324     * 23 -- 2 n.doublets > maximum values
325     * 24 -- 3 n.triplets > maximum values
326     * 25 -- 4 n.yz-clouds > maximum values
327     * 26 -- 5 n.xz-clouds > maximum values
328     * 27 -- 6 n.candidate-tracks > maximum values
329     * 28 -- 7 n.couples per plane > maximum values (for Hough transform)
330     *
331     *
332 mocchiut 1.1 */
333     class TrkLevel2 : public TObject {
334    
335     private:
336 pam-fi 1.15
337 mocchiut 1.1 public:
338    
339 pam-fi 1.15 Int_t good[12]; ///< event status
340 pam-fi 1.24 UInt_t VKmask[12]; ///< Viking-chip mask
341     UInt_t VKflag[12]; ///< Viking-chip flag
342 mocchiut 1.1
343     TClonesArray *Track; ///< fitted tracks
344     TClonesArray *SingletX; ///< x singlets
345     TClonesArray *SingletY; ///< y singlets
346    
347     TrkLevel2();
348     // TrkLevel2(cTrkLevel2 *);
349 pam-fi 1.11 ~TrkLevel2(){Delete();};
350 pam-fi 1.10
351 pam-fi 1.11 void Clear();
352 pam-fi 1.15 void Clear(Option_t *option){Clear();};
353 pam-fi 1.11 void Delete();
354 pam-fi 1.16 void Set();
355 pam-fi 1.11
356     int ntrk() {return Track->GetEntries();} ///< number of stored track
357 mocchiut 1.1 int nclsx(){return SingletX->GetEntries();} ///< number of x singlets
358     int nclsy(){return SingletY->GetEntries();} ///< number of y singlets
359    
360     void Dump();
361 pam-fi 1.11 void SetFromLevel2Struct(cTrkLevel2 *, TrkLevel1 *);
362 pam-fi 1.18 void SetFromLevel2Struct(cTrkLevel2 *s2){ SetFromLevel2Struct(s2, NULL); };
363     void SetFromLevel2Struct(TrkLevel1 *l1) { SetFromLevel2Struct(&level2event_, l1); };
364     void SetFromLevel2Struct() { SetFromLevel2Struct(&level2event_); };
365 pam-fi 1.11 void GetLevel2Struct(cTrkLevel2 *) const;
366 pam-fi 1.3 void LoadField(TString);
367 pam-fi 1.25 float GetBX(float* v){return TrkParams::GetBX(v);};///< Bx (kGauss)
368     float GetBY(float* v){return TrkParams::GetBY(v);};///< By (kGauss)
369     float GetBZ(float* v){return TrkParams::GetBZ(v);};///< Bz (kGauss)
370 pam-fi 1.6 Float_t GetZTrk(Int_t);
371 pam-fi 1.34 Float_t GetXTrkLeft(){return XMAGNLOW;};
372     Float_t GetXTrkRight(){return XMAGNHIGH;};
373     Float_t GetYTrkLeft(){return YMAGNLOW;};
374     Float_t GetYTrkRight(){return YMAGNHIGH;};
375 pam-fi 1.6
376 pam-fi 1.24 Bool_t IsMaskedVK(int,int);
377     Bool_t GetVKMask(int,int);
378     Bool_t GetVKFlag(int,int);
379    
380 pam-fi 1.6 TrkSinglet *GetSingletX(int);
381     TrkSinglet *GetSingletY(int);
382    
383     TrkTrack *GetStoredTrack(int i);
384 pam-fi 1.3 Int_t GetSeqNo(Int_t i) {return (((TrkTrack *)Track->At(i))->seqno);}; ///< Returns track sequential number
385 pam-fi 1.24
386 pam-fi 1.11 TRefArray *GetTracks_NFitSorted();
387     TRefArray *GetTracks(){return this->GetTracks_NFitSorted();};
388    
389     Int_t GetNTracks();
390     TrkTrack* GetTrack(int i);
391 mocchiut 1.1 TrkTrack* GetTrackImage(int i);
392 pam-fi 1.11
393 pam-fi 1.3 TrkLevel2* GetTrkLevel2(){return this;}
394     TClonesArray* GetTrackArray(){return Track;};///< returns pointer to the track array
395    
396 pam-fi 1.28 void StatusDump(int view);
397     Bool_t StatusCheck(int view, int flagmask);
398    
399 pam-fi 1.24 ClassDef(TrkLevel2,3);
400 mocchiut 1.1
401     };
402    
403     #endif

  ViewVC Help
Powered by ViewVC 1.1.23