/[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.15 - (hide annotations) (download)
Thu Jan 11 10:20:57 2007 UTC (17 years, 10 months ago) by pam-fi
Branch: MAIN
Changes since 1.14: +13 -11 lines
File MIME type: text/plain
memory-leak bugs + other bugs fixed

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 pam-fi 1.15 ~Trajectory(){Delete();};
59 mocchiut 1.1 void Dump();
60 pam-fi 1.15 void Delete();
61 mocchiut 1.1
62 pam-fi 1.13 int DoTrack2(float* al);
63 pam-fi 1.2 float GetLength(){float l=0; for(int i=0; i<npoint;i++)l=l+tl[i]; return l;};
64     float GetLength(int,int);
65    
66 pam-fi 1.9 ClassDef(Trajectory,2);
67 mocchiut 1.1
68     };
69     /**
70     * \brief Class to describe fitted tracks.
71     *
72     * A track is defined by the measured coordinates associated to it, the
73     * track status vector, plus other quantities.
74     * A track may have an "image", due to the ambiguity in the y view.
75     */
76     // ==================================================================
77     class TrkTrack : public TObject {
78    
79     private:
80    
81 pam-fi 1.3 int seqno; ///<stored track sequential number
82     int image; ///<sequential number of track-image
83    
84 pam-fi 1.8
85 mocchiut 1.1 public:
86    
87 pam-fi 1.12 TRefArray *clx;
88     TRefArray *cly;
89 pam-fi 1.3
90 mocchiut 1.1 float al[5]; ///<TRACK STATE VECTOR
91     float coval[5][5]; ///<covariance matrix
92     int xgood[6]; ///<mask of included x planes
93     int ygood[6]; ///<mask of included y planes
94     float xm[6]; ///<measured x coordinates
95     float ym[6]; ///<measured y coordinates
96     float zm[6]; ///<measured z coordinates
97     float resx[6]; ///<spatial resolution on X view
98     float resy[6]; ///<spatial resolution on y view
99     float chi2; ///<chi2
100 pam-fi 1.12 int nstep; ///<n. step
101     float xv[6]; ///<calculated x coordinates
102 mocchiut 1.1 float yv[6]; ///<calculated y coordinates
103     float zv[6]; ///<calculated z coordinates
104     float axv[6]; ///<calculated angles (deg) on x view
105     float ayv[6]; ///<calculated angles (deg) on y view
106     float dedx_x[6]; ///<signal in MIP (scaled to 300 micrometer)
107     float dedx_y[6]; ///<signal in MIP (scaled to 300 micrometer)
108 pam-fi 1.3
109 mocchiut 1.1 TrkTrack();
110     TrkTrack(const TrkTrack&);
111    
112 pam-fi 1.15 ~TrkTrack(){ Delete(); };
113 pam-fi 1.10
114 mocchiut 1.1 void Dump();
115 pam-fi 1.12 void Clear();
116 pam-fi 1.15 void Clear(Option_t *option){Clear();};
117 pam-fi 1.12 void Delete();
118 pam-fi 1.15 void Copy(TrkTrack&);
119 pam-fi 1.9
120 pam-fi 1.3 Int_t GetSeqNo(){return seqno;} ///< Returns the track sequential number
121     Int_t GetImageSeqNo(){return image;} ///< Returns the track image sequential number
122 mocchiut 1.1 Bool_t HasImage(){return !(image==-1);} ///< Returns true if the track has an image
123 pam-fi 1.2 int DoTrack(Trajectory* t); ///< Evaluates the trajectory in the apparatus.
124     int DoTrack2(Trajectory* t); ///< Evaluates the trajectory in the apparatus.
125     float BdL(){return 0;}; ///< Evaluates the integral of B*dL along the track.
126 mocchiut 1.1 Int_t GetNX(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=xgood[i]; return n;};
127     Int_t GetNY(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=ygood[i]; return n;};
128 pam-fi 1.3 Int_t GetNtot(){return GetNX()+GetNY();};
129 mocchiut 1.1 Float_t GetRigidity();
130     Float_t GetDeflection();
131     Float_t GetDEDX();
132 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]);};
133     // sono un'imbecille... assegno xm e ym anche quando si tratta di un singolo
134     // non posso quindi usare xm e ym per dire se una vista e` inclusa nel fit o no
135 pam-fi 1.9 /* Bool_t XGood(int ip){ return xm[ip] != -100.;};
136     Bool_t YGood(int ip){ return ym[ip] != -100.;};*/
137 pam-fi 1.12 Bool_t XGood(int ip){ return xgood[ip]==1;};
138     Bool_t YGood(int ip){ return ygood[ip]==1;};
139    
140     void SetMeasure(double *xmeas, double *ymeas, double *zmeas);
141     void SetResolution(double *rx, double *ry);
142     void SetGood(int *xg, int *yg);
143     void LoadField(TString s);
144     void Fit(double pfixed, int& fail, int iprint);
145     void FitReset();
146 pam-fi 1.14
147     void FillMiniStruct(cMini2track&);
148     void SetFromMiniStruct(cMini2track*);
149 pam-fi 1.12
150     TrkCluster *GetClusterX(int ip){TrkCluster *pt = (TrkCluster*)(clx->At(ip)); return pt;};
151     TrkCluster *GetClusterY(int ip){TrkCluster *pt = (TrkCluster*)(cly->At(ip)); return pt;};
152    
153 mocchiut 1.1 TrkTrack* GetTrkTrack(){return this;};
154    
155 pam-fi 1.3 friend class TrkLevel2;
156    
157 pam-fi 1.9 ClassDef(TrkTrack,2);
158 mocchiut 1.1
159     };
160     /**
161     * \brief Class to describe single clusters ("singlets").
162     *
163     * Single clusters are clusters not associated to any track.
164     */
165     class TrkSinglet : public TObject {
166    
167     private:
168 pam-fi 1.8
169 mocchiut 1.1
170     public:
171 pam-fi 1.8
172 pam-fi 1.15 TRef cls;
173 mocchiut 1.1
174     int plane; ///<plane
175     float coord[2]; ///<coordinate (on sensor 1 and 2)
176     float sgnl; ///<cluster signal in MIP
177    
178     TrkSinglet();
179     TrkSinglet(const TrkSinglet&);
180 pam-fi 1.15 ~TrkSinglet(){Delete();};
181 mocchiut 1.1
182     void Dump();
183 pam-fi 1.15 void Clear();
184     void Clear(Option_t *option){Clear();};
185     void Delete(){Clear();};
186 pam-fi 1.8
187 pam-fi 1.11 TrkCluster *GetCluster(){TrkCluster *pt = (TrkCluster*)cls.GetObject(); return pt;};
188 mocchiut 1.1
189 pam-fi 1.3 friend class TrkLevel2;
190    
191 pam-fi 1.9 ClassDef(TrkSinglet,2);
192 mocchiut 1.1
193     };
194    
195     /**
196     * \brief Class to describe tracker LEVEL2 data.
197     *
198     * A tracker events is defined by some general variables, plus the collection of all the fitted tracks and all
199     * single clusters on X and Y views.
200     * Tracks and single clusters ("singlets") are described by the classes TrkTrack and TrkSinglet respectivelly.
201     *
202     * Each track may have an "image", due to the ambiguity on the Y view, which is stored also.
203     * Thus, the number of stored tracks ( ntrk() ) differs from the number of "physical" tracks ( GetNTracks() ).
204     * Proper methods allow to sort tracks and select the physical ones ( GetTracks() ).
205     */
206     class TrkLevel2 : public TObject {
207    
208     private:
209 pam-fi 1.15
210 mocchiut 1.1 public:
211    
212 pam-fi 1.15 Int_t good[12]; ///< event status
213 mocchiut 1.1
214     TClonesArray *Track; ///< fitted tracks
215     TClonesArray *SingletX; ///< x singlets
216     TClonesArray *SingletY; ///< y singlets
217    
218     TrkLevel2();
219     // TrkLevel2(cTrkLevel2 *);
220 pam-fi 1.11 ~TrkLevel2(){Delete();};
221 pam-fi 1.10
222 pam-fi 1.11 void Clear();
223 pam-fi 1.15 void Clear(Option_t *option){Clear();};
224 pam-fi 1.11 void Delete();
225    
226     int ntrk() {return Track->GetEntries();} ///< number of stored track
227 mocchiut 1.1 int nclsx(){return SingletX->GetEntries();} ///< number of x singlets
228     int nclsy(){return SingletY->GetEntries();} ///< number of y singlets
229    
230     void Dump();
231 pam-fi 1.6 void SetFromLevel2Struct(cTrkLevel2 *);
232 pam-fi 1.11 void SetFromLevel2Struct(cTrkLevel2 *, TrkLevel1 *);
233     void GetLevel2Struct(cTrkLevel2 *) const;
234 pam-fi 1.3 void LoadField(TString);
235 pam-fi 1.6 Float_t GetZTrk(Int_t);
236     Float_t GetXTrkLeft(){return XTRKL;};
237     Float_t GetXTrkRight(){return XTRKR;};
238     Float_t GetYTrkLeft(){return YTRKL;};
239     Float_t GetYTrkRight(){return YTRKR;};
240    
241     TrkSinglet *GetSingletX(int);
242     TrkSinglet *GetSingletY(int);
243    
244     TrkTrack *GetStoredTrack(int i);
245 pam-fi 1.3 Int_t GetSeqNo(Int_t i) {return (((TrkTrack *)Track->At(i))->seqno);}; ///< Returns track sequential number
246 pam-fi 1.5 // TClonesArray *GetTracks_Chi2Sorted();
247 pam-fi 1.7 // TClonesArray *GetTracks_NFitSorted();
248     // TClonesArray *GetTracks();
249 pam-fi 1.11 TRefArray *GetTracks_NFitSorted();
250     TRefArray *GetTracks(){return this->GetTracks_NFitSorted();};
251    
252 pam-fi 1.4 // int GetNTracks(){return this->GetTracks()->GetEntries();}
253 pam-fi 1.11 Int_t GetNTracks();
254     TrkTrack* GetTrack(int i);
255 mocchiut 1.1 TrkTrack* GetTrackImage(int i);
256 pam-fi 1.11
257 pam-fi 1.3 TrkLevel2* GetTrkLevel2(){return this;}
258     TClonesArray* GetTrackArray(){return Track;};///< returns pointer to the track array
259    
260 pam-fi 1.9 ClassDef(TrkLevel2,2);
261 mocchiut 1.1
262     };
263    
264     #endif

  ViewVC Help
Powered by ViewVC 1.1.23