/[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.12 - (hide annotations) (download)
Thu Oct 26 16:22:36 2006 UTC (18 years, 1 month ago) by pam-fi
Branch: MAIN
Changes since 1.11: +23 -16 lines
File MIME type: text/plain
fitting 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 mocchiut 1.1 #include <TrkStruct.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     // upper and lower (mechanical) z-coordinate of the tracker
20 pam-fi 1.5 //#define ZTRKUP 22.29
21     //#define ZTRKDW -22.22
22     // (mechanical) z-coordinate of the tracker planes
23     #define ZTRK6 -22.23
24     #define ZTRK5 -13.32
25     #define ZTRK4 -4.42
26     #define ZTRK3 4.48
27     #define ZTRK2 13.38
28     #define ZTRK1 22.28
29     // (mechanical) x/y-coordinates of magnet cavity
30     #define XTRKL -8.1
31     #define XTRKR 8.1
32     #define YTRKL -6.6
33     #define YTRKR 6.6
34 pam-fi 1.2
35 mocchiut 1.1 /**
36     * \brief Class to describe, by points, a particle trajectory in the apparatus.
37     *
38     * The idea is to create it by integrating the equations of motion, given the
39     * track state vector and the z coordinates where to evaluate track position.
40     */
41     // ==================================================================
42     class Trajectory : public TObject{
43     private:
44    
45     public:
46    
47     int npoint; ///< number of evaluated points along the trajectory
48     float* x; ///< x coordinates
49     float* y; ///< y coordinates
50     float* z; ///< z coordinates
51 pam-fi 1.2 float* thx; ///< x projected angle
52     float* thy; ///< y projected angle
53     float* tl; ///< track length
54 mocchiut 1.1
55 pam-fi 1.2 Trajectory();
56 mocchiut 1.1 Trajectory(int n);
57     Trajectory(int n, float* pz);
58     void Dump();
59    
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     */
73     // ==================================================================
74     class TrkTrack : public TObject {
75    
76     private:
77    
78 pam-fi 1.3 int seqno; ///<stored track sequential number
79     int image; ///<sequential number of track-image
80    
81 pam-fi 1.8
82 mocchiut 1.1 public:
83    
84 pam-fi 1.8 // TRef clx[6];
85     // TRef cly[6];
86 pam-fi 1.12 TRefArray *clx;
87     TRefArray *cly;
88 pam-fi 1.3
89 mocchiut 1.1 float al[5]; ///<TRACK STATE VECTOR
90     float coval[5][5]; ///<covariance matrix
91     int xgood[6]; ///<mask of included x planes
92     int ygood[6]; ///<mask of included y planes
93     float xm[6]; ///<measured x coordinates
94     float ym[6]; ///<measured y coordinates
95     float zm[6]; ///<measured z coordinates
96     float resx[6]; ///<spatial resolution on X view
97     float resy[6]; ///<spatial resolution on y view
98     float chi2; ///<chi2
99 pam-fi 1.12 int nstep; ///<n. step
100     float xv[6]; ///<calculated x coordinates
101 mocchiut 1.1 float yv[6]; ///<calculated y coordinates
102     float zv[6]; ///<calculated z coordinates
103     float axv[6]; ///<calculated angles (deg) on x view
104     float ayv[6]; ///<calculated angles (deg) on y view
105     float dedx_x[6]; ///<signal in MIP (scaled to 300 micrometer)
106     float dedx_y[6]; ///<signal in MIP (scaled to 300 micrometer)
107 pam-fi 1.3
108 mocchiut 1.1
109     TrkTrack();
110     TrkTrack(const TrkTrack&);
111    
112 pam-fi 1.12 ~TrkTrack(){Delete();};
113 pam-fi 1.10
114 mocchiut 1.1 void Dump();
115 pam-fi 1.12 void Clear();
116     void Delete();
117 pam-fi 1.9
118 pam-fi 1.3 Int_t GetSeqNo(){return seqno;} ///< Returns the track sequential number
119     Int_t GetImageSeqNo(){return image;} ///< Returns the track image sequential number
120 mocchiut 1.1 Bool_t HasImage(){return !(image==-1);} ///< Returns true if the track has an image
121 pam-fi 1.2 int DoTrack(Trajectory* t); ///< Evaluates the trajectory in the apparatus.
122     int DoTrack2(Trajectory* t); ///< Evaluates the trajectory in the apparatus.
123     float BdL(){return 0;}; ///< Evaluates the integral of B*dL along the track.
124 mocchiut 1.1 Int_t GetNX(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=xgood[i]; return n;};
125     Int_t GetNY(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=ygood[i]; return n;};
126 pam-fi 1.3 Int_t GetNtot(){return GetNX()+GetNY();};
127 mocchiut 1.1 Float_t GetRigidity();
128     Float_t GetDeflection();
129     Float_t GetDEDX();
130 pam-fi 1.12 Float_t GetDEDX(Int_t ip){if( !(xgood[ip]+ygood[ip]) ) return 0; return (dedx_x[ip]+dedx_y[ip])/(xgood[ip]+ygood[ip]);};
131     // sono un'imbecille... assegno xm e ym anche quando si tratta di un singolo
132     // non posso quindi usare xm e ym per dire se una vista e` inclusa nel fit o no
133 pam-fi 1.9 /* Bool_t XGood(int ip){ return xm[ip] != -100.;};
134     Bool_t YGood(int ip){ return ym[ip] != -100.;};*/
135 pam-fi 1.12 Bool_t XGood(int ip){ return xgood[ip]==1;};
136     Bool_t YGood(int ip){ return ygood[ip]==1;};
137    
138     void SetMeasure(double *xmeas, double *ymeas, double *zmeas);
139     void SetResolution(double *rx, double *ry);
140     void SetGood(int *xg, int *yg);
141     void LoadField(TString s);
142     void Fit(double pfixed, int& fail, int iprint);
143     void FitReset();
144    
145     TrkCluster *GetClusterX(int ip){TrkCluster *pt = (TrkCluster*)(clx->At(ip)); return pt;};
146     TrkCluster *GetClusterY(int ip){TrkCluster *pt = (TrkCluster*)(cly->At(ip)); return pt;};
147    
148 mocchiut 1.1 TrkTrack* GetTrkTrack(){return this;};
149    
150 pam-fi 1.3 friend class TrkLevel2;
151    
152 pam-fi 1.9 ClassDef(TrkTrack,2);
153 mocchiut 1.1
154     };
155     /**
156     * \brief Class to describe single clusters ("singlets").
157     *
158     * Single clusters are clusters not associated to any track.
159     */
160     class TrkSinglet : public TObject {
161    
162     private:
163 pam-fi 1.8
164 mocchiut 1.1
165     public:
166 pam-fi 1.8
167     TRef cls;
168 mocchiut 1.1
169     int plane; ///<plane
170     float coord[2]; ///<coordinate (on sensor 1 and 2)
171     float sgnl; ///<cluster signal in MIP
172    
173     TrkSinglet();
174     TrkSinglet(const TrkSinglet&);
175    
176     void Dump();
177 pam-fi 1.8
178 pam-fi 1.11 TrkCluster *GetCluster(){TrkCluster *pt = (TrkCluster*)cls.GetObject(); return pt;};
179 mocchiut 1.1
180 pam-fi 1.3 friend class TrkLevel2;
181    
182 pam-fi 1.9 ClassDef(TrkSinglet,2);
183 mocchiut 1.1
184     };
185    
186     /**
187     * \brief Class to describe tracker LEVEL2 data.
188     *
189     * A tracker events is defined by some general variables, plus the collection of all the fitted tracks and all
190     * single clusters on X and Y views.
191     * Tracks and single clusters ("singlets") are described by the classes TrkTrack and TrkSinglet respectivelly.
192     *
193     * Each track may have an "image", due to the ambiguity on the Y view, which is stored also.
194     * Thus, the number of stored tracks ( ntrk() ) differs from the number of "physical" tracks ( GetNTracks() ).
195     * Proper methods allow to sort tracks and select the physical ones ( GetTracks() ).
196     */
197     class TrkLevel2 : public TObject {
198    
199     private:
200 pam-fi 1.5
201     // TRefArray *PhysicalTrack; ///< physical tracks (no image) -
202    
203 mocchiut 1.1 public:
204    
205 pam-fi 1.9 Int_t good[12]; ///< event status
206     // Int_t good2;
207     // Int_t crc[12];
208 mocchiut 1.1
209     TClonesArray *Track; ///< fitted tracks
210     TClonesArray *SingletX; ///< x singlets
211     TClonesArray *SingletY; ///< y singlets
212    
213     TrkLevel2();
214     // TrkLevel2(cTrkLevel2 *);
215 pam-fi 1.11 ~TrkLevel2(){Delete();};
216 pam-fi 1.10
217 pam-fi 1.11 void Clear();
218     void Delete();
219    
220     int ntrk() {return Track->GetEntries();} ///< number of stored track
221 mocchiut 1.1 int nclsx(){return SingletX->GetEntries();} ///< number of x singlets
222     int nclsy(){return SingletY->GetEntries();} ///< number of y singlets
223    
224     void Dump();
225 pam-fi 1.6 void SetFromLevel2Struct(cTrkLevel2 *);
226 pam-fi 1.11 void SetFromLevel2Struct(cTrkLevel2 *, TrkLevel1 *);
227     void GetLevel2Struct(cTrkLevel2 *) const;
228 pam-fi 1.3 void LoadField(TString);
229 pam-fi 1.6 Float_t GetZTrk(Int_t);
230     Float_t GetXTrkLeft(){return XTRKL;};
231     Float_t GetXTrkRight(){return XTRKR;};
232     Float_t GetYTrkLeft(){return YTRKL;};
233     Float_t GetYTrkRight(){return YTRKR;};
234    
235     TrkSinglet *GetSingletX(int);
236     TrkSinglet *GetSingletY(int);
237    
238     TrkTrack *GetStoredTrack(int i);
239 pam-fi 1.3 Int_t GetSeqNo(Int_t i) {return (((TrkTrack *)Track->At(i))->seqno);}; ///< Returns track sequential number
240 pam-fi 1.5 // TClonesArray *GetTracks_Chi2Sorted();
241 pam-fi 1.7 // TClonesArray *GetTracks_NFitSorted();
242     // TClonesArray *GetTracks();
243 pam-fi 1.11 TRefArray *GetTracks_NFitSorted();
244     TRefArray *GetTracks(){return this->GetTracks_NFitSorted();};
245    
246 pam-fi 1.4 // int GetNTracks(){return this->GetTracks()->GetEntries();}
247 pam-fi 1.11 Int_t GetNTracks();
248     TrkTrack* GetTrack(int i);
249 mocchiut 1.1 TrkTrack* GetTrackImage(int i);
250 pam-fi 1.11
251 pam-fi 1.3 TrkLevel2* GetTrkLevel2(){return this;}
252     TClonesArray* GetTrackArray(){return Track;};///< returns pointer to the track array
253    
254 pam-fi 1.9 ClassDef(TrkLevel2,2);
255 mocchiut 1.1
256     };
257    
258     #endif

  ViewVC Help
Powered by ViewVC 1.1.23