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