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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by pam-fi, Thu Jun 1 09:03:09 2006 UTC revision 1.30 by pam-fi, Wed Aug 22 07:03:44 2007 UTC
# Line 8  Line 8 
8  #include <TObject.h>  #include <TObject.h>
9  #include <TObjArray.h>  #include <TObjArray.h>
10  #include <TClonesArray.h>  #include <TClonesArray.h>
11  #include <TrkStruct.h>  #include <TRefArray.h>
12    #include <TRef.h>
13    
14    #include <TrkParams.h>
15    #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  
19  // upper and lower (mechanical) z-coordinate of the tracker  // (mechanical) z-coordinate of the tracker planes
20  #define ZTRKUP 22.29  #define ZTRK6 -22.22
21  #define ZTRKDW -22.22  #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    // (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    
39  /**  /**
40   * \brief Class to describe, by points, a particle trajectory in the apparatus.   * \brief Class to describe, by points, a particle trajectory in the apparatus.
# Line 40  class Trajectory : public TObject{ Line 59  class Trajectory : public TObject{
59      Trajectory();      Trajectory();
60      Trajectory(int n);      Trajectory(int n);
61      Trajectory(int n, float* pz);      Trajectory(int n, float* pz);
62        ~Trajectory(){Delete();};
63      void Dump();      void Dump();
64        void Delete();
65    
66        int DoTrack2(float* al);
67      float GetLength(){float l=0; for(int i=0; i<npoint;i++)l=l+tl[i]; return l;};      float GetLength(){float l=0; for(int i=0; i<npoint;i++)l=l+tl[i]; return l;};
68      float GetLength(int,int);      float GetLength(int,int);
69    
70      ClassDef(Trajectory,1);      ClassDef(Trajectory,2);
71    
72  };  };
73  /**  /**
# Line 54  class Trajectory : public TObject{ Line 76  class Trajectory : public TObject{
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 {
90    
91  private:  private:
92    
93        int   seqno;           ///<stored track sequential number
94        int   image;           ///<sequential number of track-image
95            
96  public:  public:
97    
98      float al[5];           ///<TRACK STATE VECTOR      float 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 flag for x-view (0 = view not included in the fit)
101      int   ygood[6];        ///<mask of included y planes      int   ygood[6];        ///<cluster flag 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
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];       ///<signal in MIP (scaled to 300 micrometer)      float dedx_x[6];       ///<dE/dx in MIP (<0 if saturated)
117      float dedx_y[6];       ///<signal in MIP (scaled to 300 micrometer)      float dedx_y[6];       ///<dE/dx in MIP (<0 if saturated)
     int   image;           ///<flag to tag track-images  
118    
119      TrkTrack();      TrkTrack();
120      TrkTrack(const TrkTrack&);      TrkTrack(const TrkTrack&);
121    
122        ~TrkTrack(){ Delete(); };
123            
124      void Dump();      void Dump();
125        void Clear();
126        void Clear(Option_t *option){Clear();};
127        void Delete();
128        void Copy(TrkTrack&);
129    //    void Set();
130    
131        Int_t  GetSeqNo(){return seqno;}        ///< Returns the track sequential number
132        Int_t  GetImageSeqNo(){return image;}   ///< Returns the track image sequential number
133      Bool_t HasImage(){return !(image==-1);} ///< Returns true if the track has an image      Bool_t HasImage(){return !(image==-1);} ///< Returns true if the track has an image
134      int DoTrack(Trajectory* t);                         ///< Evaluates the trajectory in the apparatus.      int DoTrack(Trajectory* t);                         ///< Evaluates the trajectory in the apparatus.
135      int DoTrack2(Trajectory* t);                        ///< Evaluates the trajectory in the apparatus.      int DoTrack2(Trajectory* t);                        ///< Evaluates the trajectory in the apparatus.
136      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.
137      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;};
138      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;};
139        Int_t GetNtot(){return GetNX()+GetNY();};
140      Float_t GetRigidity();      Float_t GetRigidity();
141      Float_t GetDeflection();      Float_t GetDeflection();
142        Bool_t IsSaturated(int,int);
143        Bool_t IsSaturated(int);
144        Bool_t IsSaturated();
145        Bool_t IsBad(int,int);
146      Float_t GetDEDX();      Float_t GetDEDX();
147        Float_t GetDEDX(int ip);
148        Float_t GetDEDX(int ip,int iv);
149        Int_t GetLeverArmX();
150        Int_t GetLeverArmY();
151        Float_t GetChi2X();
152        Float_t GetChi2Y();
153        Float_t GetLnLX();
154        Float_t GetLnLY();
155    
156        Float_t GetEffectiveAngle(int ip, int iv);
157        
158        void SetMeasure(double *xmeas, double *ymeas, double *zmeas);
159        void SetResolution(double *rx, double *ry);
160        void SetTail(double *tx, double *ty, double factor);
161        void SetStudentParam(int flag);
162        void SetGood(int *xg, int *yg);
163        void LoadField(TString s);
164        void Fit(double pfixed, int& fail, int iprint, int froml1);
165        void Fit(double pfixed, int& fail, int iprint){ Fit(pfixed,fail,iprint,0); };
166        void FitReset();
167        void SetTrackingMode(int trackmode);
168        void SetPrecisionFactor(double fact);
169        void SetStepMin(int istepmin);
170        Bool_t IsInsideCavity();
171    
172        Bool_t EvaluateClusterPositions();
173    
174        void FillMiniStruct(cMini2track&);
175        void SetFromMiniStruct(cMini2track*);
176        
177        Int_t GetClusterX_ID(int ip);
178        Int_t GetClusterY_ID(int ip);
179        Int_t GetLadder(int ip);
180        Int_t GetSensor(int ip);
181        Bool_t XGood(int ip){ return GetClusterX_ID(ip)!=-1; };
182        Bool_t YGood(int ip){ return GetClusterY_ID(ip)!=-1; };
183        void ResetXGood(int ip){ xgood[ip]=0; };
184        void ResetYGood(int ip){ ygood[ip]=0; };
185        void SetXGood(int ip, int clid, int is);
186        void SetYGood(int ip, int clid, int is);
187    
188        Bool_t BadClusterX(int ip){ return IsBad(ip,0); };
189        Bool_t BadClusterY(int ip){ return IsBad(ip,1); };
190    
191        Bool_t SaturatedClusterX(int ip){ return IsSaturated(ip,0); };
192        Bool_t SaturatedClusterY(int ip){ return IsSaturated(ip,1); };
193    
194      TrkTrack* GetTrkTrack(){return this;};      TrkTrack* GetTrkTrack(){return this;};
195    
196      ClassDef(TrkTrack,1);      friend class TrkLevel2;
197    
198        ClassDef(TrkTrack,3);
199    
200  };  };
201  /**  /**
# Line 109  public: Line 206  public:
206  class TrkSinglet : public TObject {  class TrkSinglet : public TObject {
207    
208  private:  private:
209            
210    
211  public:  public:
212            
213      int plane;       ///<plane      int plane;       ///<plane
214      float coord[2];  ///<coordinate (on sensor 1 and 2)      float coord[2];  ///<coordinate (on sensor 1 and 2)
215      float sgnl;      ///<cluster signal in MIP      float sgnl;      ///<cluster signal in MIP (<0 if saturated)
216    
217      TrkSinglet();      TrkSinglet();
218      TrkSinglet(const TrkSinglet&);      TrkSinglet(const TrkSinglet&);
219        ~TrkSinglet(){Delete();};
220    
221      void Dump();      void Dump();
222        void Clear();
223        void Clear(Option_t *option){Clear();};
224        void Delete(){Clear();};
225        Float_t GetSignal(){return fabs(sgnl);}
226        Bool_t IsSaturated(){return (sgnl<0); };
227            
228        friend class TrkLevel2;
229    
230      ClassDef(TrkSinglet,1);      ClassDef(TrkSinglet,3);
231    
232  };  };
233    
# Line 135  public: Line 241  public:
241   * 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.
242   * 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() ).
243   * Proper methods allow to sort tracks and select the physical ones ( GetTracks() ).   * Proper methods allow to sort tracks and select the physical ones ( GetTracks() ).
244     *
245     * The event status indicates the processing status of data from each DSP, according to the following
246     * notation:
247     *
248     *     xxxx xxxx xxxx xxxx xxxx xxxx
249     *     |||| |||| |||| |||| |||| ||||_ 0 missing packet
250     *     |||| |||| |||| |||| |||| |||__ 1 CRC error
251     *     |||| |||| |||| |||| |||| ||___ 2 on-line software alarm (latch-up, timeout ecc...)
252     *     |||| |||| |||| |||| |||| |____ 3 jump in the trigger counter
253     *     |||| |||| |||| |||| ||||______ 4 decode error
254     *     |||| |||| |||| |||| |||_______ 5 n.clusters > maximum number (level1 processing)
255     *     |||| |||| |||| |||| ||________ 6
256     *     |||| |||| |||| |||| |_________ 7
257     *     |||| |||| |||| ||||___________ 8 n.clusters > maximum value (level2 processing)
258     *     |||| |||| |||| |||____________ 9 n.couples per plane > maximum values (vector dimention)
259     *     |||| |||| |||| ||_____________ 10 n.doublets > maximum values
260     *     |||| |||| |||| |______________ 11 n.triplets > maximum values
261     *     |||| |||| ||||________________ 12 n.yz-clouds > maximum values
262     *     |||| |||| |||_________________ 13 n.xz-clouds > maximum values
263     *     |||| |||| ||__________________ 14 n.candidate-tracks > maximum values
264     *     |||| |||| |___________________ 15 n.couples per plane > maximum values (for Hough transform)
265     *     |||| ||||_____________________ 16
266     *        
267     *
268     * For all data processed before June 2007 the event status was coded according to
269     * a different rule:
270     *
271     * Status of level1 processing
272     *  0 -- OK  
273     *  1 -- missing packet
274     *  2 -- 1  CRC error
275     *  3 -- 2 on-line software alarm (latch-up flags asserted or n.transmitted-words = 0)
276     *  4 -- 3 jump in the trigger counter
277     * 10 -- 4 decode error
278     * 11 -- 5  n.clusters > maximum number (for level1 processing)
279     * Status of level2 processing
280     * 21 -- 0 n.clusters > maximum value (for level2 processing)
281     * 22 -- 1 n.couples per plane > maximum values (vector dimention)
282     * 23 -- 2 n.doublets > maximum values
283     * 24 -- 3 n.triplets > maximum values
284     * 25 -- 4 n.yz-clouds > maximum values
285     * 26 -- 5 n.xz-clouds > maximum values
286     * 27 -- 6 n.candidate-tracks > maximum values
287     * 28 -- 7 n.couples per plane > maximum values (for Hough transform)
288     *  
289     *
290   */   */
291  class TrkLevel2 : public TObject {  class TrkLevel2 : public TObject {
292    
293   private:   private:
294    
295   public:   public:
296    
297        Int_t         good[12];       ///< event status
298        UInt_t        VKmask[12];     ///< Viking-chip mask
299      Int_t good2;      UInt_t        VKflag[12];     ///< Viking-chip flag
     Int_t crc[12];  
300    
301      TClonesArray *Track;        ///< fitted tracks      TClonesArray *Track;        ///< fitted tracks
302      TClonesArray *SingletX;     ///< x singlets      TClonesArray *SingletX;     ///< x singlets
# Line 153  class TrkLevel2 : public TObject { Line 304  class TrkLevel2 : public TObject {
304    
305      TrkLevel2();      TrkLevel2();
306  //    TrkLevel2(cTrkLevel2 *);  //    TrkLevel2(cTrkLevel2 *);
307        ~TrkLevel2(){Delete();};
308      int ntrk(){return Track->GetEntries();}     ///< number of stored track          
309        void Clear();
310        void Clear(Option_t *option){Clear();};
311        void Delete();
312        void Set();
313        
314        int ntrk() {return Track->GetEntries();}    ///< number of stored track
315      int nclsx(){return SingletX->GetEntries();} ///< number of x singlets      int nclsx(){return SingletX->GetEntries();} ///< number of x singlets
316      int nclsy(){return SingletY->GetEntries();} ///< number of y singlets      int nclsy(){return SingletY->GetEntries();} ///< number of y singlets
317    
318      void Dump();      void Dump();
319      void FillCommonVar(cTrkLevel2 *);      void SetFromLevel2Struct(cTrkLevel2 *, TrkLevel1 *);
320      void Clear();      void SetFromLevel2Struct(cTrkLevel2 *s2){ SetFromLevel2Struct(s2, NULL);          };
321          void LoadField(TString);      void SetFromLevel2Struct(TrkLevel1 *l1) { SetFromLevel2Struct(&level2event_, l1); };    
322        void SetFromLevel2Struct()              { SetFromLevel2Struct(&level2event_);     };    
323      TrkTrack *GetStoredTrack(int i);      void GetLevel2Struct(cTrkLevel2 *) const;
324      TClonesArray *GetTracks();        void LoadField(TString);
325        float GetBX(float* v){return TrkParams::GetBX(v);};///< Bx (kGauss)
326      int GetNTracks(){return this->GetTracks()->GetEntries();}      float GetBY(float* v){return TrkParams::GetBY(v);};///< By (kGauss)
327        float GetBZ(float* v){return TrkParams::GetBZ(v);};///< Bz (kGauss)
328        Float_t GetZTrk(Int_t);
329        Float_t GetXTrkLeft(){return XTRKL;};
330        Float_t GetXTrkRight(){return XTRKR;};
331        Float_t GetYTrkLeft(){return YTRKL;};
332        Float_t GetYTrkRight(){return YTRKR;};
333        
334        Bool_t IsMaskedVK(int,int);
335        Bool_t GetVKMask(int,int);
336        Bool_t GetVKFlag(int,int);
337    
338        TrkSinglet   *GetSingletX(int);
339        TrkSinglet   *GetSingletY(int);
340        
341        TrkTrack     *GetStoredTrack(int i);
342        Int_t         GetSeqNo(Int_t i)  {return (((TrkTrack *)Track->At(i))->seqno);}; ///< Returns track sequential number
343    
344        TRefArray *GetTracks_NFitSorted();
345        TRefArray *GetTracks(){return this->GetTracks_NFitSorted();};
346        
347        Int_t     GetNTracks();
348      TrkTrack* GetTrack(int i);      TrkTrack* GetTrack(int i);
349      TrkTrack* GetTrackImage(int i);      TrkTrack* GetTrackImage(int i);
350        
351        TrkLevel2*    GetTrkLevel2(){return this;}
352        TClonesArray* GetTrackArray(){return Track;};///< returns pointer to the track array
353        
354        void   StatusDump(int view);
355        Bool_t StatusCheck(int view, int flagmask);
356    
357      TrkLevel2* GetTrkLevel2(){return this;}      ClassDef(TrkLevel2,3);
   
     ClassDef(TrkLevel2,1);  
358    
359  };  };
360    
   
   
   
361  #endif  #endif

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.30

  ViewVC Help
Powered by ViewVC 1.1.23