1 |
pam-fi |
1.1 |
/** |
2 |
|
|
* \file ExtTrack.cpp |
3 |
|
|
* \author Elena Vannuccini |
4 |
|
|
*/ |
5 |
|
|
#include <ExtTrack.h> |
6 |
|
|
#include <iostream> |
7 |
|
|
#include <math.h> |
8 |
|
|
using namespace std; |
9 |
|
|
|
10 |
pam-ts |
1.2 |
ExtTrack::ExtTrack(int dim){ |
11 |
|
|
|
12 |
|
|
//cout << " ExtTrack::ExtTrack("<<dim<<")"<<endl; |
13 |
|
|
xgood = NULL; |
14 |
|
|
ygood = NULL; |
15 |
|
|
multmaxx = NULL; |
16 |
|
|
multmaxy = NULL; |
17 |
|
|
xm = NULL; |
18 |
|
|
ym = NULL; |
19 |
|
|
zm = NULL; |
20 |
|
|
xma = NULL; |
21 |
|
|
yma = NULL; |
22 |
|
|
zma = NULL; |
23 |
|
|
xmb = NULL; |
24 |
|
|
ymb = NULL; |
25 |
|
|
zmb = NULL; |
26 |
|
|
resx = NULL; |
27 |
|
|
resy = NULL; |
28 |
|
|
xv = NULL; |
29 |
|
|
yv = NULL; |
30 |
|
|
zv = NULL; |
31 |
|
|
axv = NULL; |
32 |
|
|
ayv = NULL; |
33 |
|
|
dedx_x = NULL; |
34 |
|
|
dedx_y = NULL; |
35 |
|
|
|
36 |
|
|
// xGF = new float[TrkParams::nGF]; |
37 |
|
|
// yGF = new float[TrkParams::nGF]; |
38 |
|
|
// init vectors |
39 |
|
|
SetDimension(dim);//allocate vectors |
40 |
|
|
// init fit variables |
41 |
|
|
Reset(); |
42 |
|
|
// set fit parameters (default) |
43 |
|
|
SetZ0(23.5); |
44 |
|
|
SetMiniDefault(); |
45 |
|
|
}; |
46 |
|
|
//-------------------------------------- |
47 |
|
|
// |
48 |
|
|
// |
49 |
|
|
//-------------------------------------- |
50 |
|
|
ExtTrack::ExtTrack( const ExtTrack& t ){ |
51 |
|
|
//cout << " ExtTrack::ExtTrack( const ExtTrack& t ) "<<this<<endl; |
52 |
|
|
|
53 |
|
|
// -------------------- |
54 |
|
|
// initialize pointers |
55 |
|
|
// -------------------- |
56 |
|
|
|
57 |
|
|
xgood = NULL; |
58 |
|
|
ygood = NULL; |
59 |
|
|
multmaxx = NULL; |
60 |
|
|
multmaxy = NULL; |
61 |
|
|
xm = NULL; |
62 |
|
|
ym = NULL; |
63 |
|
|
zm = NULL; |
64 |
|
|
xma = NULL; |
65 |
|
|
yma = NULL; |
66 |
|
|
zma = NULL; |
67 |
|
|
xmb = NULL; |
68 |
|
|
ymb = NULL; |
69 |
|
|
zmb = NULL; |
70 |
|
|
resx = NULL; |
71 |
|
|
resy = NULL; |
72 |
|
|
xv = NULL; |
73 |
|
|
yv = NULL; |
74 |
|
|
zv = NULL; |
75 |
|
|
axv = NULL; |
76 |
|
|
ayv = NULL; |
77 |
|
|
dedx_x = NULL; |
78 |
|
|
dedx_y = NULL; |
79 |
|
|
|
80 |
|
|
// xGF = new float[TrkParams::nGF]; |
81 |
|
|
// yGF = new float[TrkParams::nGF]; |
82 |
|
|
|
83 |
|
|
SetDimension(t.nplanes);//allocate vectors |
84 |
|
|
|
85 |
|
|
// -------------------- |
86 |
|
|
// copy values |
87 |
|
|
// -------------------- |
88 |
|
|
zini = t.zini; |
89 |
|
|
chi2 = t.chi2; |
90 |
|
|
nstep = t.nstep; |
91 |
|
|
for(int it1=0;it1<5;it1++){ |
92 |
|
|
al[it1] = t.al[it1]; |
93 |
|
|
for(int it2=0;it2<5;it2++)coval[it1][it2] = t.coval[it1][it2]; |
94 |
|
|
}; |
95 |
|
|
|
96 |
|
|
|
97 |
|
|
for(int ip=0;ip<nplanes;ip++){ |
98 |
|
|
xgood[ip] = t.xgood[ip]; |
99 |
|
|
ygood[ip] = t.ygood[ip]; |
100 |
|
|
multmaxx[ip] = t.multmaxx[ip]; |
101 |
|
|
multmaxy[ip] = t.multmaxy[ip]; |
102 |
|
|
xm[ip] = t.xm[ip]; |
103 |
|
|
ym[ip] = t.ym[ip]; |
104 |
|
|
zm[ip] = t.zm[ip]; |
105 |
|
|
xma[ip] = t.xma[ip]; |
106 |
|
|
yma[ip] = t.yma[ip]; |
107 |
|
|
zma[ip] = t.zma[ip]; |
108 |
|
|
xmb[ip] = t.xmb[ip]; |
109 |
|
|
ymb[ip] = t.ymb[ip]; |
110 |
|
|
zmb[ip] = t.zmb[ip]; |
111 |
|
|
resx[ip] = t.resx[ip]; |
112 |
|
|
resy[ip] = t.resy[ip]; |
113 |
|
|
xv[ip] = t.xv[ip]; |
114 |
|
|
yv[ip] = t.yv[ip]; |
115 |
|
|
zv[ip] = t.zv[ip]; |
116 |
|
|
axv[ip] = t.axv[ip]; |
117 |
|
|
ayv[ip] = t.ayv[ip]; |
118 |
|
|
dedx_x[ip] = t.dedx_x[ip]; |
119 |
|
|
dedx_y[ip] = t.dedx_y[ip]; |
120 |
|
|
}; |
121 |
|
|
|
122 |
|
|
int ngf = TrkParams::nGF; |
123 |
|
|
for(int i=0; i<ngf; i++){ |
124 |
|
|
xGF[i] = t.xGF[i]; |
125 |
|
|
yGF[i] = t.yGF[i]; |
126 |
|
|
} |
127 |
|
|
|
128 |
|
|
}; |
129 |
pam-fi |
1.1 |
//-------------------------------------- |
130 |
|
|
// |
131 |
|
|
// |
132 |
|
|
//-------------------------------------- |
133 |
pam-ts |
1.2 |
void ExtTrack::Copy( ExtTrack& t ){ |
134 |
|
|
|
135 |
|
|
// cout << " ExtTrack::Copy( ExtTrack& t ) "<<endl; |
136 |
pam-fi |
1.1 |
|
137 |
pam-ts |
1.2 |
t.Reset();//reset variables |
138 |
pam-ts |
1.7 |
t.Clear("C");//deallocate vectors |
139 |
pam-ts |
1.2 |
t.SetDimension(nplanes);//allocate vectors |
140 |
|
|
|
141 |
|
|
t.zini = zini; |
142 |
|
|
t.chi2 = chi2; |
143 |
|
|
t.nstep = nstep; |
144 |
|
|
for(int it1=0;it1<5;it1++){ |
145 |
|
|
t.al[it1] = al[it1]; |
146 |
|
|
for(int it2=0;it2<5;it2++)t.coval[it1][it2] = coval[it1][it2]; |
147 |
|
|
}; |
148 |
pam-ts |
1.7 |
// cout << "ExtTrack::Copy()........nplanes "<<nplanes<<endl; |
149 |
pam-ts |
1.2 |
for(int ip=0;ip<nplanes;ip++){ |
150 |
|
|
t.xgood[ip] = xgood[ip]; |
151 |
|
|
t.ygood[ip] = ygood[ip]; |
152 |
|
|
t.multmaxx[ip] = multmaxx[ip]; |
153 |
|
|
t.multmaxy[ip] = multmaxy[ip]; |
154 |
|
|
t.xm[ip] = xm[ip]; |
155 |
|
|
t.ym[ip] = ym[ip]; |
156 |
|
|
t.zm[ip] = zm[ip]; |
157 |
|
|
t.xma[ip] = xma[ip]; |
158 |
|
|
t.yma[ip] = yma[ip]; |
159 |
|
|
t.zma[ip] = zma[ip]; |
160 |
|
|
t.xmb[ip] = xmb[ip]; |
161 |
|
|
t.ymb[ip] = ymb[ip]; |
162 |
|
|
t.zmb[ip] = zmb[ip]; |
163 |
|
|
t.resx[ip] = resx[ip]; |
164 |
|
|
t.resy[ip] = resy[ip]; |
165 |
|
|
t.xv[ip] = xv[ip]; |
166 |
|
|
t.yv[ip] = yv[ip]; |
167 |
|
|
t.zv[ip] = zv[ip]; |
168 |
|
|
t.axv[ip] = axv[ip]; |
169 |
|
|
t.ayv[ip] = ayv[ip]; |
170 |
|
|
t.dedx_x[ip] = dedx_x[ip]; |
171 |
|
|
t.dedx_y[ip] = dedx_y[ip]; |
172 |
|
|
}; |
173 |
|
|
int ngf = TrkParams::nGF; |
174 |
|
|
for(int i=0; i<ngf; i++){ |
175 |
|
|
t.xGF[i] = xGF[i]; |
176 |
|
|
t.yGF[i] = yGF[i]; |
177 |
|
|
} |
178 |
|
|
|
179 |
pam-fi |
1.1 |
}; |
180 |
|
|
//-------------------------------------- |
181 |
|
|
// |
182 |
|
|
// |
183 |
|
|
//-------------------------------------- |
184 |
pam-ts |
1.2 |
void ExtTrack::Set( TrkTrack& t , int index){ |
185 |
|
|
|
186 |
|
|
// cout << "Set("<< &t <<", "<<index<<")"<<endl; |
187 |
|
|
if(index < 0 ){ //NON FUNZIONA |
188 |
pam-ts |
1.7 |
cout << "Clear(\"C\") "<<endl; |
189 |
pam-ts |
1.2 |
Reset();//reset variables |
190 |
pam-ts |
1.7 |
Clear("C");//deallocate vectors |
191 |
pam-ts |
1.2 |
cout << "SetDimension("<<t.GetNhit()<<")"<<endl; |
192 |
|
|
SetDimension(t.GetNhit()); //allocate vectors |
193 |
pam-ts |
1.4 |
// }else{ |
194 |
|
|
// SetDimension(6+index); |
195 |
pam-ts |
1.2 |
} |
196 |
|
|
// default fit settings (the same as TrkTrack) |
197 |
|
|
SetMiniDefault(); |
198 |
|
|
SetZ0(23.5); |
199 |
|
|
// |
200 |
|
|
int ipp; |
201 |
|
|
if(index<0) ipp = 0; |
202 |
|
|
else ipp = index; |
203 |
|
|
// |
204 |
|
|
// cout << "Assign... nplanes = "<<nplanes<<endl; |
205 |
|
|
for(int ip=0;ip<6;ip++){ |
206 |
pam-fi |
1.1 |
|
207 |
pam-ts |
1.2 |
if(ipp>=nplanes){ |
208 |
|
|
cout << "void ExtTrack::Set( TrkTrack& , "<<index<<") -- ipp="<<ipp<<" exceed vector dimention "<<nplanes<<endl; |
209 |
|
|
continue; |
210 |
|
|
} |
211 |
pam-fi |
1.1 |
|
212 |
pam-ts |
1.2 |
if( t.XGood(ip) || t.YGood(ip) || !(index<0) ){ |
213 |
|
|
|
214 |
|
|
// cout << "ipp "<<ipp<<" ip "<<ip<<endl; |
215 |
|
|
|
216 |
|
|
|
217 |
|
|
xgood[ipp] = t.XGood(ip); //NB! |
218 |
|
|
ygood[ipp] = t.YGood(ip); //NB! |
219 |
|
|
multmaxx[ipp] = t.multmaxx[ip]; |
220 |
|
|
multmaxy[ipp] = t.multmaxy[ip]; |
221 |
|
|
xm[ipp] = t.xm[ip]; |
222 |
|
|
ym[ipp] = t.ym[ip]; |
223 |
|
|
zm[ipp] = t.zm[ip]; |
224 |
|
|
|
225 |
|
|
float dummy = -100.; |
226 |
|
|
xma[ipp] = dummy; |
227 |
|
|
yma[ipp] = dummy; |
228 |
|
|
zma[ipp] = zm[ipp]; |
229 |
|
|
xmb[ipp] = dummy; |
230 |
|
|
ymb[ipp] = dummy; |
231 |
|
|
zmb[ipp] = zm[ipp]; |
232 |
|
|
|
233 |
pam-ts |
1.7 |
if( t.XGood(ip) && t.YGood(ip) ){ //double hit |
234 |
pam-ts |
1.2 |
xma[ipp] = t.xm[ip]; |
235 |
|
|
yma[ipp] = t.ym[ip]; |
236 |
|
|
zma[ipp] = t.zm[ip]; |
237 |
|
|
xmb[ipp] = t.xm[ip]; |
238 |
|
|
ymb[ipp] = t.ym[ip]; |
239 |
|
|
zmb[ipp] = t.zm[ip]; |
240 |
|
|
} else if (t.XGood(ip) || t.YGood(ip) ){ //single hit |
241 |
|
|
TrkParams::Load(5); |
242 |
|
|
if( !TrkParams::IsLoaded(5) ){ |
243 |
|
|
cout << "void ExtTrack::FillMiniStruct(TrkTrack&) ---ERROR--- trk align.param. not loaded "<<endl; |
244 |
|
|
return; |
245 |
|
|
} |
246 |
|
|
double segment = 7.;// 2.;//cm //Elena 10th |
247 |
|
|
int is = (int)t.GetSensor(ip); if(ip==5)is=1-is; |
248 |
|
|
int ippp = 5-ip; |
249 |
|
|
int il = (int)t.GetLadder(ip); |
250 |
|
|
// NB: i parametri di allineamento hanno una notazione particolare!!! |
251 |
|
|
// sensor = 0 (hybrid side), 1 |
252 |
|
|
// ladder = 0-2 (increasing x) |
253 |
|
|
// plane = 0-5 (from bottom to top!!!) |
254 |
|
|
double omega = 0.; |
255 |
|
|
double beta = 0.; |
256 |
|
|
double gamma = 0.; |
257 |
|
|
if( |
258 |
|
|
(is < 0 || is > 1 || ip < 0 || ippp > 5 || il < 0 || il > 2) && |
259 |
|
|
true){ |
260 |
|
|
cout << " void ExtTrack::FillMiniStruct(TrkTrack&) --- WARNING ---trk sensor not defined, cannot read alignment parameters "<<endl; |
261 |
|
|
cout << " is ip il = "<<is<<" "<<ippp<<" "<<il<<endl; |
262 |
|
|
}else{ |
263 |
|
|
omega = alignparameters_.omega[is][il][ippp]; |
264 |
|
|
beta = alignparameters_.beta[is][il][ippp]; |
265 |
|
|
gamma = alignparameters_.gamma[is][il][ippp]; |
266 |
|
|
} |
267 |
|
|
if( t.XGood(ip) && !t.YGood(ip) ){ |
268 |
|
|
xma[ipp] = t.xm[ip] - omega * segment; |
269 |
|
|
yma[ipp] = t.ym[ip] + segment; |
270 |
|
|
zma[ipp] = t.zm[ip] + beta * segment;//not used yet |
271 |
|
|
xmb[ipp] = t.xm[ip] + omega * segment; |
272 |
|
|
ymb[ipp] = t.ym[ip] - segment; |
273 |
|
|
zmb[ipp] = t.zm[ip] - beta * segment;//not used yet |
274 |
|
|
}else if( !t.XGood(ip) && t.YGood(ip) ){ |
275 |
|
|
xma[ipp] = t.xm[ip] + segment; |
276 |
|
|
yma[ipp] = t.ym[ip] + omega * segment; |
277 |
|
|
zma[ipp] = t.zm[ip] - gamma * segment;//not used yet |
278 |
|
|
xmb[ipp] = t.xm[ip] - segment; |
279 |
|
|
ymb[ipp] = t.ym[ip] - omega * segment; |
280 |
|
|
zmb[ipp] = t.zm[ip] + gamma * segment;//not used yet |
281 |
|
|
} |
282 |
|
|
} |
283 |
|
|
|
284 |
|
|
// tailx[ipp] = t.tailx[ip]; |
285 |
|
|
// taily[ipp] = t.taily[ip]; |
286 |
|
|
resx[ipp] = t.resx[ip]; |
287 |
|
|
resy[ipp] = t.resy[ip]; |
288 |
|
|
xv[ipp] = t.xv[ip]; |
289 |
|
|
yv[ipp] = t.yv[ip]; |
290 |
|
|
zv[ipp] = t.zv[ip]; |
291 |
|
|
axv[ipp] = t.axv[ip]; |
292 |
|
|
ayv[ipp] = t.ayv[ip]; |
293 |
|
|
dedx_x[ipp] = t.dedx_x[ip]; |
294 |
|
|
dedx_y[ipp] = t.dedx_y[ip]; |
295 |
|
|
|
296 |
|
|
ipp++; |
297 |
|
|
|
298 |
|
|
} |
299 |
|
|
};//endl loop on planes |
300 |
|
|
|
301 |
|
|
chi2 = t.chi2; |
302 |
|
|
nstep = t.nstep; |
303 |
|
|
for(int it1=0;it1<5;it1++){ |
304 |
|
|
al[it1] = t.al[it1]; |
305 |
|
|
for(int it2=0;it2<5;it2++)coval[it1][it2] = t.coval[it1][it2]; |
306 |
|
|
}; |
307 |
|
|
|
308 |
pam-fi |
1.1 |
}; |
309 |
|
|
//-------------------------------------- |
310 |
|
|
// |
311 |
|
|
// |
312 |
|
|
//-------------------------------------- |
313 |
pam-ts |
1.2 |
void ExtTrack::SetMiniDefault(){ |
314 |
|
|
// cout << " ExtTrack::SetMiniDefault()"<<endl; |
315 |
|
|
exttrack_.trackmode = TrkParams::init__mini_trackmode; |
316 |
|
|
exttrack_.fact = TrkParams::init__mini_fact; |
317 |
|
|
exttrack_.istepmin = TrkParams::init__mini_istepmin; |
318 |
|
|
TrkParams::SetDeltaB(); |
319 |
|
|
TrkParams::SetDLT(); |
320 |
|
|
} |
321 |
pam-fi |
1.1 |
//-------------------------------------- |
322 |
|
|
// |
323 |
|
|
// |
324 |
|
|
//-------------------------------------- |
325 |
pam-ts |
1.2 |
void ExtTrack::SetDimension(int dim){ |
326 |
|
|
|
327 |
|
|
//cout << " ExtTrack::SetDimension("<<dim<<")"<<endl;; |
328 |
|
|
if(dim<=0){ |
329 |
|
|
nplanes = 0; |
330 |
|
|
if(dim<0)cout << "void ExtTrack::SetDimension("<<dim<<") --- invalid dimension "<<endl; |
331 |
|
|
return; |
332 |
|
|
} |
333 |
|
|
|
334 |
|
|
// Clear(); |
335 |
|
|
|
336 |
|
|
nplanes = dim; |
337 |
|
|
|
338 |
|
|
xgood = new int[nplanes]; |
339 |
|
|
ygood = new int[nplanes]; |
340 |
|
|
multmaxx = new int[nplanes]; |
341 |
|
|
multmaxy = new int[nplanes]; |
342 |
|
|
xm = new float[nplanes]; |
343 |
|
|
ym = new float[nplanes]; |
344 |
|
|
zm = new float[nplanes]; |
345 |
|
|
xma = new float[nplanes]; |
346 |
|
|
yma = new float[nplanes]; |
347 |
|
|
zma = new float[nplanes]; |
348 |
|
|
xmb = new float[nplanes]; |
349 |
|
|
ymb = new float[nplanes]; |
350 |
|
|
zmb = new float[nplanes]; |
351 |
|
|
resx = new float[nplanes]; |
352 |
|
|
resy = new float[nplanes]; |
353 |
|
|
xv = new float[nplanes]; |
354 |
|
|
yv = new float[nplanes]; |
355 |
|
|
zv = new float[nplanes]; |
356 |
|
|
axv = new float[nplanes]; |
357 |
|
|
ayv = new float[nplanes]; |
358 |
|
|
dedx_x = new float[nplanes]; |
359 |
|
|
dedx_y = new float[nplanes]; |
360 |
|
|
|
361 |
|
|
|
362 |
pam-fi |
1.1 |
} |
363 |
|
|
//-------------------------------------- |
364 |
|
|
// |
365 |
|
|
// |
366 |
|
|
//-------------------------------------- |
367 |
pam-ts |
1.2 |
bool ExtTrack::SetZ(int ip,float zmeas){ |
368 |
|
|
if(ip<0 || ip>=nplanes){ |
369 |
|
|
cout << " ExtTrack::SetZ("<<ip<<",...) ---> exceed vector dimension = "<<nplanes<<endl; |
370 |
|
|
return false; |
371 |
|
|
} |
372 |
|
|
zm[ip] = zmeas; |
373 |
|
|
zma[ip] = zmeas; |
374 |
|
|
zmb[ip] = zmeas; |
375 |
|
|
return true; |
376 |
|
|
|
377 |
|
|
}; |
378 |
|
|
|
379 |
|
|
bool ExtTrack::ResetXY(int ip){ |
380 |
|
|
|
381 |
|
|
// cout << " ExtTrack::ResetXY("<<ip<<") "<<endl; |
382 |
|
|
|
383 |
|
|
if(ip<0 || ip>=nplanes){ |
384 |
|
|
cout << " ExtTrack::ResetXY("<<ip<<",...) ---> exceed vector dimension = "<<nplanes<<endl; |
385 |
|
|
return false; |
386 |
|
|
} |
387 |
|
|
xm[ip] = -100.; |
388 |
|
|
ym[ip] = -100.; |
389 |
|
|
xma[ip] = -100.; |
390 |
|
|
yma[ip] = -100.; |
391 |
|
|
xmb[ip] = -100.; |
392 |
|
|
ymb[ip] = -100.; |
393 |
|
|
resx[ip] = 1000.; |
394 |
|
|
resy[ip] = 1000.; |
395 |
|
|
dedx_x[ip] = 0.; |
396 |
|
|
dedx_y[ip] = 0.; |
397 |
|
|
xgood[ip] = 0; |
398 |
|
|
ygood[ip] = 0; |
399 |
|
|
multmaxx[ip] = 0; |
400 |
|
|
multmaxy[ip] = 0; |
401 |
|
|
|
402 |
|
|
return true; |
403 |
pam-fi |
1.1 |
|
404 |
pam-ts |
1.2 |
}; |
405 |
pam-fi |
1.1 |
|
406 |
pam-ts |
1.2 |
bool ExtTrack::SetXY(int ip,float xmeas, float ymeas, float rx, float ry){ |
407 |
pam-fi |
1.1 |
|
408 |
pam-ts |
1.2 |
if(ip<0 || ip>=nplanes){ |
409 |
|
|
cout << " ExtTrack::SetXY("<<ip<<",...) ---> exceed vector dimension = "<<nplanes<<endl; |
410 |
|
|
return false; |
411 |
|
|
} |
412 |
|
|
|
413 |
|
|
xm[ip] = xmeas; |
414 |
|
|
ym[ip] = ymeas; |
415 |
|
|
xma[ip] = xmeas; |
416 |
|
|
yma[ip] = ymeas; |
417 |
|
|
xmb[ip] = xmeas; |
418 |
|
|
ymb[ip] = ymeas; |
419 |
|
|
resx[ip] = rx; |
420 |
|
|
resy[ip] = ry; |
421 |
|
|
// dedx_x[ip] = dedxx; |
422 |
|
|
// dedx_y[ip] = dedxy; |
423 |
|
|
xgood[ip] = 1; |
424 |
|
|
ygood[ip] = 1; |
425 |
|
|
|
426 |
|
|
return true; |
427 |
|
|
|
428 |
|
|
}; |
429 |
|
|
bool ExtTrack::SetX(int ip,float xa, float xb, float ya, float yb,float res ){ |
430 |
|
|
|
431 |
|
|
// cout << " ExtTrack::SetX("<<ip<<",...) -- nplanes"<<nplanes<<endl; |
432 |
|
|
|
433 |
|
|
if(ip<0 || ip>=nplanes){ |
434 |
|
|
cout << " ExtTrack::SetX("<<ip<<",...) ---> exceed vector dimension = "<<nplanes<<endl; |
435 |
|
|
return false; |
436 |
|
|
} |
437 |
|
|
xm[ip] = -100.; |
438 |
|
|
ym[ip] = -100.; |
439 |
|
|
xma[ip] = xa; |
440 |
|
|
yma[ip] = ya; |
441 |
|
|
xmb[ip] = xb; |
442 |
|
|
ymb[ip] = yb; |
443 |
|
|
resx[ip] = res; |
444 |
|
|
resy[ip] = 1000.; |
445 |
|
|
xgood[ip] = 1; |
446 |
|
|
ygood[ip] = 0; |
447 |
|
|
// dedx_x[ip] = dedx; |
448 |
|
|
// dedx_y[ip] = 0.; |
449 |
|
|
return true; |
450 |
|
|
}; |
451 |
|
|
bool ExtTrack::SetY(int ip,float xa, float xb, float ya, float yb,float res ){ |
452 |
|
|
|
453 |
|
|
// cout << " ExtTrack::SetY("<<ip<<",...) -- nplanes"<<nplanes<<endl; |
454 |
|
|
|
455 |
|
|
if(ip<0 || ip>=nplanes){ |
456 |
|
|
cout << " ExtTrack::SetX("<<ip<<",...) ---> exceed vector dimension = "<<nplanes<<endl; |
457 |
|
|
return false; |
458 |
|
|
} |
459 |
|
|
xm[ip] = -100.; |
460 |
|
|
ym[ip] = -100.; |
461 |
|
|
xma[ip] = xa; |
462 |
|
|
yma[ip] = ya; |
463 |
|
|
xmb[ip] = xb; |
464 |
|
|
ymb[ip] = yb; |
465 |
|
|
resx[ip] = 1000.; |
466 |
|
|
resy[ip] = res; |
467 |
|
|
xgood[ip] = 0; |
468 |
|
|
ygood[ip] = 1; |
469 |
|
|
// dedx_x[ip] = 0.; |
470 |
|
|
// dedx_y[ip] = dedx; |
471 |
|
|
return true; |
472 |
|
|
}; |
473 |
|
|
|
474 |
|
|
bool ExtTrack::SetXGood(int ip,int icl_piu_uno, int il, int is ){ |
475 |
|
|
|
476 |
|
|
// cout << " ExtTrack::SetXGood("<<ip<<",...) -- nplanes"<<nplanes<<endl; |
477 |
|
|
|
478 |
|
|
if(ip<0 || ip>=nplanes){ |
479 |
|
|
cout << " ExtTrack::SetXGood("<<ip<<",...) ---> exceed vector dimension = "<<nplanes<<endl; |
480 |
|
|
return false; |
481 |
|
|
} |
482 |
|
|
xgood[ip]=(il+1)*100000000+(is+1)*10000000+icl_piu_uno; |
483 |
|
|
return true; |
484 |
|
|
}; |
485 |
|
|
bool ExtTrack::SetYGood(int ip,int icl_piu_uno, int il, int is ){ |
486 |
|
|
if(ip<0 || ip>=nplanes){ |
487 |
|
|
cout << " ExtTrack::SetYGood("<<ip<<",...) -- nplanes"<<nplanes<<endl; |
488 |
|
|
cout << " ExtTrack::SetYGood("<<ip<<",...) ---> exceed vector dimension = "<<nplanes<<endl; |
489 |
|
|
return false; |
490 |
|
|
} |
491 |
|
|
ygood[ip]=(il+1)*100000000+(is+1)*10000000+icl_piu_uno; |
492 |
|
|
return true; |
493 |
pam-fi |
1.1 |
}; |
494 |
pam-ts |
1.2 |
|
495 |
pam-fi |
1.1 |
//-------------------------------------- |
496 |
|
|
// |
497 |
|
|
// |
498 |
|
|
//-------------------------------------- |
499 |
pam-ts |
1.7 |
/** |
500 |
|
|
* Clear the track. If option C is specied, deallocate the hit vectors. |
501 |
|
|
*/ |
502 |
pam-ts |
1.2 |
void ExtTrack::Clear(Option_t* option){ |
503 |
|
|
|
504 |
pam-ts |
1.7 |
Reset(); |
505 |
|
|
|
506 |
|
|
|
507 |
pam-ts |
1.2 |
// cout << " ExtTrack::Clear("<<option<<") "<<this<<endl; |
508 |
|
|
|
509 |
|
|
|
510 |
|
|
// cout << " xgood "<<xgood<<endl; |
511 |
|
|
|
512 |
|
|
// if(nplanes>0){ |
513 |
|
|
|
514 |
pam-ts |
1.7 |
if (option && option[0] == 'C') { |
515 |
|
|
|
516 |
|
|
|
517 |
|
|
if(xgood) delete [] xgood; |
518 |
|
|
if(ygood) delete [] ygood; |
519 |
|
|
if(multmaxx) delete [] multmaxx; |
520 |
|
|
if(multmaxy) delete [] multmaxy; |
521 |
|
|
if(xm) delete [] xm; |
522 |
|
|
if(ym) delete [] ym; |
523 |
|
|
if(zm) delete [] zm; |
524 |
|
|
if(xma) delete [] xma; |
525 |
|
|
if(yma) delete [] yma; |
526 |
|
|
if(zma) delete [] zma; |
527 |
|
|
if(xmb) delete [] xmb; |
528 |
|
|
if(ymb) delete [] ymb; |
529 |
|
|
if(zmb) delete [] zmb; |
530 |
|
|
if(resx) delete [] resx; |
531 |
|
|
if(resy) delete [] resy; |
532 |
|
|
if(xv) delete [] xv; |
533 |
|
|
if(yv) delete [] yv; |
534 |
|
|
if(zv) delete [] zv; |
535 |
|
|
if(axv) delete [] axv; |
536 |
|
|
if(ayv) delete [] ayv; |
537 |
|
|
if(dedx_x)delete [] dedx_x; |
538 |
|
|
if(dedx_y)delete [] dedx_y; |
539 |
|
|
//} |
540 |
|
|
|
541 |
|
|
xgood = NULL; |
542 |
|
|
ygood = NULL; |
543 |
|
|
multmaxx = NULL; |
544 |
|
|
multmaxy = NULL; |
545 |
|
|
xm = NULL; |
546 |
|
|
ym = NULL; |
547 |
|
|
zm = NULL; |
548 |
|
|
xma = NULL; |
549 |
|
|
yma = NULL; |
550 |
|
|
zma = NULL; |
551 |
|
|
xmb = NULL; |
552 |
|
|
ymb = NULL; |
553 |
|
|
zmb = NULL; |
554 |
|
|
resx = NULL; |
555 |
|
|
resy = NULL; |
556 |
|
|
xv = NULL; |
557 |
|
|
yv = NULL; |
558 |
|
|
zv = NULL; |
559 |
|
|
axv = NULL; |
560 |
|
|
ayv = NULL; |
561 |
|
|
dedx_x = NULL; |
562 |
|
|
dedx_y = NULL; |
563 |
|
|
|
564 |
|
|
nplanes = 0; |
565 |
pam-ts |
1.2 |
|
566 |
pam-ts |
1.7 |
} |
567 |
pam-ts |
1.2 |
|
568 |
pam-fi |
1.1 |
}; |
569 |
|
|
|
570 |
pam-ts |
1.2 |
void ExtTrack::Delete(){ |
571 |
pam-ts |
1.7 |
Clear("C"); |
572 |
pam-ts |
1.2 |
// delete [] xGF; |
573 |
|
|
// delete [] yGF; |
574 |
|
|
} |
575 |
|
|
|
576 |
|
|
//-------------------------------------- |
577 |
|
|
// |
578 |
|
|
// |
579 |
|
|
//-------------------------------------- |
580 |
pam-fi |
1.1 |
|
581 |
pam-ts |
1.2 |
// /** |
582 |
|
|
// * Set the position measurements |
583 |
|
|
// */ |
584 |
|
|
// void ExtTrack::SetMeasure(Double_t *xmeas, Double_t *ymeas, Double_t *zmeas){ |
585 |
|
|
// for(int i=0; i<nplanes; i++) xm[i]= (xmeas? *xmeas++ : 0.); |
586 |
|
|
// for(int i=0; i<nplanes; i++) ym[i]= (ymeas? *ymeas++ : 0.); |
587 |
|
|
// for(int i=0; i<nplanes; i++) zm[i]= (ymeas? *zmeas++ : 0.); |
588 |
|
|
// } |
589 |
|
|
// /** |
590 |
|
|
// * Set the TrkTrack position resolution |
591 |
|
|
// */ |
592 |
|
|
// void ExtTrack::SetResolution(Double_t *rx, Double_t *ry){ |
593 |
|
|
// for(int i=0; i<nplanes; i++) resx[i]= (rx? *rx++ : 0.); |
594 |
|
|
// for(int i=0; i<nplanes; i++) resy[i]= (ry? *ry++ : 0.); |
595 |
|
|
// } |
596 |
|
|
// /** |
597 |
|
|
// * Set the TrkTrack good measurement |
598 |
|
|
// */ |
599 |
|
|
// void ExtTrack::SetGood(int *xg, int *yg){ |
600 |
|
|
|
601 |
|
|
// for(int i=0; i<nplanes; i++) xgood[i]=(xg? *xg++ : 0 ); |
602 |
|
|
// for(int i=0; i<nplanes; i++) ygood[i]=(yg? *yg++ : 0 ); |
603 |
|
|
// } |
604 |
pam-fi |
1.1 |
|
605 |
|
|
//-------------------------------------- |
606 |
|
|
// |
607 |
|
|
// |
608 |
|
|
//-------------------------------------- |
609 |
|
|
void ExtTrack::Dump(){ |
610 |
|
|
cout << endl << "========== Track " ; |
611 |
pam-ts |
1.2 |
cout << endl << "zini : "<< zini; |
612 |
pam-fi |
1.1 |
cout << endl << "al : "; for(int i=0; i<5; i++)cout << al[i] << " "; |
613 |
|
|
cout << endl << "chi^2 : "<< chi2; |
614 |
|
|
cout << endl << "n.step : "<< nstep; |
615 |
|
|
cout << endl << "xgood : "; for(int i=0; i<nplanes; i++)cout << XGood(i) ; |
616 |
|
|
cout << endl << "ygood : "; for(int i=0; i<nplanes; i++)cout << YGood(i) ; |
617 |
|
|
cout << endl << "xm : "; for(int i=0; i<nplanes; i++)cout << xm[i] << " "; |
618 |
|
|
cout << endl << "ym : "; for(int i=0; i<nplanes; i++)cout << ym[i] << " "; |
619 |
|
|
cout << endl << "zm : "; for(int i=0; i<nplanes; i++)cout << zm[i] << " "; |
620 |
pam-ts |
1.2 |
cout << endl << "xma : "; for(int i=0; i<nplanes; i++)cout << xma[i] << " "; |
621 |
|
|
cout << endl << "yma : "; for(int i=0; i<nplanes; i++)cout << yma[i] << " "; |
622 |
|
|
cout << endl << "zma : "; for(int i=0; i<nplanes; i++)cout << zma[i] << " "; |
623 |
|
|
cout << endl << "xmb : "; for(int i=0; i<nplanes; i++)cout << xmb[i] << " "; |
624 |
|
|
cout << endl << "ymb : "; for(int i=0; i<nplanes; i++)cout << ymb[i] << " "; |
625 |
|
|
cout << endl << "zmb : "; for(int i=0; i<nplanes; i++)cout << zmb[i] << " "; |
626 |
pam-fi |
1.1 |
cout << endl << "xv : "; for(int i=0; i<nplanes; i++)cout << xv[i] << " "; |
627 |
|
|
cout << endl << "yv : "; for(int i=0; i<nplanes; i++)cout << yv[i] << " "; |
628 |
|
|
cout << endl << "zv : "; for(int i=0; i<nplanes; i++)cout << zv[i] << " "; |
629 |
|
|
cout << endl << "resx : "; for(int i=0; i<nplanes; i++)cout << resx[i] << " "; |
630 |
|
|
cout << endl << "resy : "; for(int i=0; i<nplanes; i++)cout << resy[i] << " "; |
631 |
|
|
cout << endl << "coval : "; for(int i=0; i<5; i++)cout << coval[0][i]<<" "; |
632 |
|
|
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[1][i]<<" "; |
633 |
|
|
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[2][i]<<" "; |
634 |
|
|
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[3][i]<<" "; |
635 |
|
|
cout << endl << " "; for(int i=0; i<5; i++)cout << coval[4][i]<<" "; |
636 |
pam-ts |
1.2 |
cout << endl << "MDR : "<< (coval[4][4]>0. ? 1./sqrt(coval[4][4]) : 0. ) ; |
637 |
pam-fi |
1.1 |
cout << endl << "dedx_x : "; for(int i=0; i<nplanes; i++)cout << dedx_x[i] << " "; |
638 |
|
|
cout << endl << "dedx_y : "; for(int i=0; i<nplanes; i++)cout << dedx_y[i] << " "; |
639 |
|
|
|
640 |
pam-ts |
1.2 |
cout << endl << "================="; |
641 |
pam-fi |
1.1 |
cout << endl; |
642 |
|
|
} |
643 |
|
|
/** |
644 |
|
|
* Reset the fit parameters |
645 |
|
|
*/ |
646 |
pam-ts |
1.2 |
void ExtTrack::ResetFit(){ |
647 |
|
|
|
648 |
|
|
// cout << " ExtTrack::ResetFit() "<<endl; |
649 |
pam-fi |
1.1 |
for(int i=0; i<5; i++) al[i]=-9999.; |
650 |
|
|
chi2=0.; |
651 |
|
|
nstep=0; |
652 |
pam-ts |
1.2 |
|
653 |
pam-fi |
1.1 |
for(int i=0; i<5; i++) { |
654 |
|
|
for(int j=0; j<5; j++) coval[i][j]=0.; |
655 |
|
|
} |
656 |
pam-ts |
1.2 |
|
657 |
|
|
for(int i=0; i<nplanes; i++){ |
658 |
|
|
xv[i] = 0.; |
659 |
|
|
yv[i] = 0.; |
660 |
|
|
zv[i] = 0.; |
661 |
|
|
axv[i] = 0.; |
662 |
|
|
ayv[i] = 0.; |
663 |
|
|
} |
664 |
|
|
|
665 |
|
|
int ngf = TrkParams::nGF; |
666 |
|
|
for(int i=0; i<ngf; i++){ |
667 |
|
|
xGF[i] = 0.; |
668 |
|
|
yGF[i] = 0.; |
669 |
|
|
} |
670 |
|
|
|
671 |
|
|
|
672 |
pam-fi |
1.1 |
} |
673 |
|
|
/** |
674 |
pam-ts |
1.2 |
* Reset x/y measured coordinates (NB it does not reset z coordinates) |
675 |
pam-fi |
1.1 |
*/ |
676 |
pam-ts |
1.2 |
void ExtTrack::ResetXY(){ |
677 |
pam-fi |
1.1 |
|
678 |
pam-ts |
1.2 |
for(int i=0; i<nplanes; i++)ResetXY(i); |
679 |
|
|
|
680 |
|
|
|
681 |
|
|
} |
682 |
|
|
/** |
683 |
|
|
* \brief Tracking method. It calls F77 mini routine. |
684 |
|
|
* |
685 |
|
|
* @see void TrkTrack::Fit(double, int&, int, int) |
686 |
|
|
*/ |
687 |
|
|
void ExtTrack::Fit(double pfixed, int& fail, int iprint){ |
688 |
pam-fi |
1.1 |
|
689 |
pam-ts |
1.2 |
TrkParams::Load(1); |
690 |
|
|
if( !TrkParams::IsLoaded(1) ){ |
691 |
|
|
cout << "void ExtTrack::Fit(double,int&,int,int) ---ERROR--- m.field not loaded "<<endl; |
692 |
|
|
return; |
693 |
|
|
} |
694 |
|
|
|
695 |
|
|
float al_ini[] = {0.,0.,0.,0.,0.}; |
696 |
|
|
|
697 |
|
|
fail = 0; |
698 |
|
|
|
699 |
|
|
FillMiniStruct(); //fill F77 common |
700 |
|
|
|
701 |
pam-fi |
1.1 |
|
702 |
pam-ts |
1.2 |
// if fit variables have been reset, evaluate the initial guess |
703 |
|
|
if(al[0]==-9999.&&al[1]==-9999.&&al[2]==-9999.&&al[3]==-9999.&&al[4]==-9999.){ |
704 |
|
|
if(iprint==2)cout << "calling guessext_()"<<endl; |
705 |
|
|
guessext_(); |
706 |
|
|
} |
707 |
|
|
// --------------------- free momentum |
708 |
|
|
if(pfixed==0.) { |
709 |
|
|
exttrack_.pfixed=0.; |
710 |
|
|
} |
711 |
|
|
// --------------------- fixed momentum |
712 |
|
|
if(pfixed!=0.) { |
713 |
|
|
al[4]=1./pfixed; |
714 |
|
|
exttrack_.pfixed=pfixed; |
715 |
|
|
} |
716 |
|
|
|
717 |
|
|
// store temporarily the initial guess |
718 |
|
|
for(int i=0; i<5; i++) al_ini[i]=exttrack_.al[i]; |
719 |
|
|
|
720 |
|
|
if(iprint==2){ |
721 |
|
|
cout<<endl<<" init. guess: "; |
722 |
|
|
for(int i=0; i<5; i++)cout << al_ini[i]<<" "; |
723 |
|
|
cout<<endl; |
724 |
|
|
} |
725 |
|
|
// ------------------------------------------ |
726 |
|
|
// call mini routine |
727 |
|
|
// ------------------------------------------ |
728 |
|
|
int istep=0; |
729 |
|
|
int ifail=0; |
730 |
|
|
if(iprint==2)cout << "calling miniext_("<<istep<<","<<ifail<<", "<<iprint<<")"<<endl; |
731 |
|
|
miniext_(&istep,&ifail, &iprint); |
732 |
|
|
if(ifail!=0) { |
733 |
|
|
if(iprint)cout << "ERROR: ifail= " << ifail << endl; |
734 |
|
|
fail = 1; |
735 |
|
|
} |
736 |
|
|
if(chi2!=chi2){ |
737 |
|
|
if(iprint)cout << "ERROR: chi2= " << chi2 << endl; |
738 |
|
|
ResetFit(); |
739 |
|
|
fail = 1; |
740 |
|
|
} |
741 |
|
|
// ------------------------------------------ |
742 |
|
|
|
743 |
|
|
SetFromMiniStruct(); //copy content of F77 common into the ExtTrack object |
744 |
|
|
|
745 |
|
|
if(fail){ |
746 |
|
|
if(iprint)cout << " >>>> fit failed "<<endl; |
747 |
|
|
for(int i=0; i<5; i++) al[i]=al_ini[i]; |
748 |
|
|
} |
749 |
|
|
}; |
750 |
pam-fi |
1.1 |
|
751 |
pam-ts |
1.2 |
/** |
752 |
|
|
* Method to fill minimization-routine common |
753 |
|
|
* NB (zini=23.5 is implicitelly set) |
754 |
|
|
*/ |
755 |
|
|
void ExtTrack::FillMiniStruct(cMiniExtTrack& track){ |
756 |
pam-fi |
1.1 |
|
757 |
pam-ts |
1.2 |
track.nplanes = nplanes; |
758 |
|
|
for(int i=0; i<nplanes; i++){ |
759 |
|
|
|
760 |
|
|
track.xgood[i] = (double) XGood(i); |
761 |
|
|
track.ygood[i] = (double) YGood(i); |
762 |
|
|
|
763 |
|
|
track.xm[i] = (double) xm[i]; |
764 |
|
|
track.ym[i] = (double) ym[i]; |
765 |
|
|
track.zm[i] = (double) zm[i]; |
766 |
|
|
|
767 |
|
|
|
768 |
|
|
track.xm_a[i] = (double) xma[i]; |
769 |
|
|
track.xm_b[i] = (double) xmb[i]; |
770 |
|
|
track.ym_a[i] = (double) yma[i]; |
771 |
|
|
track.ym_b[i] = (double) ymb[i]; |
772 |
|
|
track.zm_a[i] = (double) zma[i]; |
773 |
|
|
track.zm_b[i] = (double) zmb[i]; |
774 |
|
|
|
775 |
|
|
track.resx[i] = (double) resx[i]; |
776 |
|
|
track.resy[i] = (double) resy[i]; |
777 |
|
|
} |
778 |
|
|
|
779 |
|
|
for(int i=0; i<5; i++) track.al[i] = (double) al[i]; |
780 |
|
|
|
781 |
|
|
track.zini = (double) zini; |
782 |
|
|
|
783 |
pam-fi |
1.1 |
|
784 |
|
|
} |
785 |
|
|
/** |
786 |
|
|
* Method to set values from minimization-routine common |
787 |
|
|
*/ |
788 |
pam-ts |
1.2 |
void ExtTrack::SetFromMiniStruct(cMiniExtTrack *track){ |
789 |
pam-fi |
1.1 |
|
790 |
|
|
for(int i=0; i<5; i++) { |
791 |
pam-ts |
1.2 |
al[i] = (float) (track->al[i]); |
792 |
|
|
for(int j=0; j<5; j++) coval[i][j] = (float) (track->cov[i][j]); |
793 |
pam-fi |
1.1 |
} |
794 |
pam-ts |
1.2 |
chi2 = (float) (track->chi2); |
795 |
|
|
nstep = (float) (track->nstep); |
796 |
|
|
for(int i=0; i<nplanes; i++){ |
797 |
|
|
xv[i] = (float) (track->xv[i]); |
798 |
|
|
yv[i] = (float) (track->yv[i]); |
799 |
|
|
zv[i] = (float) (track->zv[i]); |
800 |
|
|
xm[i] = (float) (track->xm[i]); |
801 |
|
|
ym[i] = (float) (track->ym[i]); |
802 |
|
|
zm[i] = (float) (track->zm[i]); |
803 |
|
|
xma[i] = (float) (track->xm_a[i]); |
804 |
|
|
yma[i] = (float) (track->ym_a[i]); |
805 |
|
|
zma[i] = (float) (track->zm_a[i]); |
806 |
|
|
xmb[i] = (float) (track->xm_b[i]); |
807 |
|
|
ymb[i] = (float) (track->ym_b[i]); |
808 |
|
|
zmb[i] = (float) (track->zm_b[i]); |
809 |
|
|
axv[i] = (float) (track->axv[i]); |
810 |
|
|
ayv[i] = (float) (track->ayv[i]); |
811 |
pam-fi |
1.1 |
} |
812 |
pam-ts |
1.2 |
zini = (float) (track->zini); |
813 |
|
|
} |
814 |
|
|
/** |
815 |
|
|
* Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track. |
816 |
|
|
* If no cluster is associated, ID=-1. |
817 |
|
|
* |
818 |
|
|
*/ |
819 |
|
|
int ExtTrack::GetClusterX_ID(int ip){ |
820 |
pam-ts |
1.7 |
if(ip<0 || ip>=nplanes)return -1; |
821 |
pam-ts |
1.2 |
return ((int)fabs(xgood[ip]))%10000000-1; |
822 |
|
|
}; |
823 |
|
|
/** |
824 |
|
|
* Method to retrieve ID (0-xxx) of y-cluster (if any) associated to this track. |
825 |
|
|
* |
826 |
|
|
*/ |
827 |
|
|
int ExtTrack::GetClusterY_ID(int ip){ |
828 |
pam-ts |
1.7 |
if(ip<0 || ip>=nplanes)return -1; |
829 |
pam-ts |
1.2 |
return ((int)fabs(ygood[ip]))%10000000-1; |
830 |
|
|
}; |
831 |
|
|
|
832 |
|
|
/** |
833 |
mocchiut |
1.3 |
* Method to retrieve the dE/dx measured on a tracker view. |
834 |
|
|
* @param ip plane (0-5) |
835 |
|
|
* @param iv view (0=x 1=y) |
836 |
|
|
*/ |
837 |
|
|
Float_t ExtTrack::GetDEDX(int ip, int iv){ |
838 |
pam-ts |
1.7 |
if(iv==0 && ip>=0 && ip<nplanes)return fabs(dedx_x[ip]); |
839 |
|
|
else if(iv==1 && ip>=0 && ip<nplanes)return fabs(dedx_y[ip]); |
840 |
mocchiut |
1.3 |
else { |
841 |
|
|
cout << "TrkTrack::GetDEDX(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl; |
842 |
|
|
return 0.; |
843 |
|
|
} |
844 |
|
|
} |
845 |
|
|
/** |
846 |
|
|
* Method to evaluate the dE/dx measured on a tracker plane. |
847 |
|
|
* The two measurements on x- and y-view are averaged. |
848 |
|
|
* @param ip plane (0-5) |
849 |
|
|
*/ |
850 |
|
|
Float_t ExtTrack::GetDEDX(int ip){ |
851 |
|
|
if( (Int_t)XGood(ip)+(Int_t)YGood(ip) == 0 ) return 0; |
852 |
|
|
return (GetDEDX(ip,0)+GetDEDX(ip,1))/((Int_t)XGood(ip)+(Int_t)YGood(ip)); |
853 |
|
|
}; |
854 |
|
|
|
855 |
|
|
/** |
856 |
|
|
* Method to evaluate the dE/dx averaged over all planes. |
857 |
|
|
*/ |
858 |
|
|
Float_t ExtTrack::GetDEDX(){ |
859 |
|
|
Float_t dedx=0; |
860 |
pam-ts |
1.7 |
for(Int_t ip=0; ip<nplanes; ip++)dedx+=GetDEDX(ip,0)*XGood(ip)+GetDEDX(ip,1)*YGood(ip); |
861 |
mocchiut |
1.3 |
dedx = dedx/(GetNX()+GetNY()); |
862 |
|
|
return dedx; |
863 |
|
|
}; |
864 |
|
|
|
865 |
|
|
/** |
866 |
pam-ts |
1.2 |
* Method to retrieve the ladder, if assigned |
867 |
|
|
*/ |
868 |
|
|
int ExtTrack::GetLadder(int ip){ |
869 |
|
|
if(XGood(ip))return (int)fabs(xgood[ip]/100000000)-1; |
870 |
|
|
if(YGood(ip))return (int)fabs(ygood[ip]/100000000)-1; |
871 |
|
|
return -1; |
872 |
|
|
}; |
873 |
|
|
/** |
874 |
|
|
* Method to retrieve the sensor, if assigned |
875 |
|
|
*/ |
876 |
|
|
int ExtTrack::GetSensor(int ip){ |
877 |
|
|
if(XGood(ip))return (int)((int)fabs(xgood[ip]/10000000)%10)-1; |
878 |
|
|
if(YGood(ip))return (int)((int)fabs(ygood[ip]/10000000)%10)-1; |
879 |
|
|
return -1; |
880 |
|
|
}; |
881 |
|
|
/** |
882 |
|
|
* |
883 |
|
|
*/ |
884 |
|
|
Int_t ExtTrack::GetClusterX_Multiplicity(int ip){ |
885 |
|
|
if(ip<0 || ip>=nplanes){ |
886 |
|
|
cout << " ExtTrack::GetClusterX_Multiplicity("<<ip<<",...) ---> exceed vector dimension = "<<nplanes<<endl; |
887 |
|
|
return -1; |
888 |
|
|
} |
889 |
|
|
return (Int_t)(multmaxx[ip]/10000); |
890 |
|
|
} |
891 |
|
|
/** |
892 |
|
|
* |
893 |
|
|
*/ |
894 |
|
|
|
895 |
|
|
Int_t ExtTrack::GetClusterY_Multiplicity(int ip){ |
896 |
|
|
if(ip<0 || ip>=nplanes){ |
897 |
|
|
cout << " ExtTrack::GetClusterY_Multiplicity("<<ip<<",...) ---> exceed vector dimension = "<<nplanes<<endl; |
898 |
|
|
return -1; |
899 |
|
|
} |
900 |
|
|
return (Int_t)(multmaxy[ip]/10000); |
901 |
|
|
} |
902 |
|
|
/** |
903 |
|
|
* |
904 |
|
|
*/ |
905 |
|
|
|
906 |
|
|
Int_t ExtTrack::GetClusterX_MaxStrip(int ip){ |
907 |
|
|
if(ip<0 || ip>=nplanes){ |
908 |
|
|
cout << " ExtTrack::GetClusterX_MaxStrip("<<ip<<",...) ---> exceed vector dimension = "<<nplanes<<endl; |
909 |
|
|
return -1; |
910 |
|
|
} |
911 |
|
|
return (Int_t)(multmaxx[ip]%10000); |
912 |
pam-fi |
1.1 |
} |
913 |
pam-ts |
1.2 |
/** |
914 |
|
|
* |
915 |
|
|
*/ |
916 |
pam-fi |
1.1 |
|
917 |
pam-ts |
1.2 |
Int_t ExtTrack::GetClusterY_MaxStrip(int ip){ |
918 |
|
|
if(ip<0 || ip>=nplanes){ |
919 |
|
|
cout << " ExtTrack::GetClusterY_MaxStrip("<<ip<<",...) ---> exceed vector dimension = "<<nplanes<<endl; |
920 |
|
|
return -1; |
921 |
|
|
} |
922 |
|
|
return (Int_t)(multmaxy[ip]%10000); |
923 |
|
|
} |
924 |
|
|
Float_t ExtTrack::GetRigidity(){ |
925 |
|
|
Float_t rig=0; |
926 |
|
|
if(chi2>0)rig=1./al[4]; |
927 |
|
|
if(rig<0) rig=-rig; |
928 |
|
|
return rig; |
929 |
|
|
}; |
930 |
mocchiut |
1.3 |
// |
931 |
|
|
Float_t ExtTrack::GetDeflection(){ |
932 |
|
|
Float_t def=0; |
933 |
|
|
if(chi2>0)def=al[4]; |
934 |
|
|
return def; |
935 |
|
|
}; |
936 |
mocchiut |
1.5 |
|
937 |
|
|
|
938 |
|
|
// |
939 |
|
|
// all that follows: EM porting from TrkLevel2 |
940 |
|
|
// |
941 |
|
|
Bool_t ExtTrack::IsInsideAcceptance(float toll){ |
942 |
|
|
int ngf = TrkParams::nGF; |
943 |
|
|
for(int i=0; i<ngf; i++){ |
944 |
|
|
// |
945 |
|
|
// cout << endl << TrkParams::GF_element[i]; |
946 |
|
|
if( |
947 |
|
|
TrkParams::GF_element[i].CompareTo("S11") && |
948 |
|
|
TrkParams::GF_element[i].CompareTo("S12") && |
949 |
|
|
TrkParams::GF_element[i].CompareTo("S21") && |
950 |
|
|
TrkParams::GF_element[i].CompareTo("S22") && |
951 |
|
|
TrkParams::GF_element[i].CompareTo("T1") && |
952 |
|
|
TrkParams::GF_element[i].CompareTo("CUF") && |
953 |
|
|
TrkParams::GF_element[i].CompareTo("T2") && |
954 |
|
|
TrkParams::GF_element[i].CompareTo("T3") && |
955 |
|
|
TrkParams::GF_element[i].CompareTo("T4") && |
956 |
|
|
TrkParams::GF_element[i].CompareTo("T5") && |
957 |
|
|
TrkParams::GF_element[i].CompareTo("CLF") && |
958 |
|
|
TrkParams::GF_element[i].CompareTo("T6") && |
959 |
|
|
TrkParams::GF_element[i].CompareTo("S31") && |
960 |
|
|
TrkParams::GF_element[i].CompareTo("S32") && |
961 |
|
|
true)continue; |
962 |
|
|
// apply condition only within the cavity |
963 |
|
|
// cout << " -- "<<xGF[i]<<" "<<yGF[i]; |
964 |
|
|
if( |
965 |
|
|
xGF[i] <= TrkParams::xGF_min[i] + toll || |
966 |
|
|
xGF[i] >= TrkParams::xGF_max[i] - toll || |
967 |
|
|
yGF[i] <= TrkParams::yGF_min[i] + toll || |
968 |
|
|
yGF[i] >= TrkParams::yGF_max[i] - toll || |
969 |
|
|
false){ |
970 |
|
|
|
971 |
|
|
return false; |
972 |
|
|
} |
973 |
|
|
} |
974 |
|
|
return true; |
975 |
|
|
} |
976 |
|
|
|
977 |
|
|
/** |
978 |
|
|
* Returns the reduced chi-square of track x-projection |
979 |
|
|
*/ |
980 |
|
|
Float_t ExtTrack::GetChi2X(){ |
981 |
|
|
float chiq=0; |
982 |
|
|
for(int ip=0; ip<nplanes; ip++)if(XGood(ip))chiq+= pow((xv[ip]-xm[ip])/resx[ip],2.); |
983 |
|
|
if(GetNX()>3)chiq=chiq/(GetNX()-3); |
984 |
|
|
else chiq=0; |
985 |
mocchiut |
1.6 |
// if(chiq==0)cout << " Float_t ExtTrack::GetChi2X() -- WARNING -- value not defined "<<chiq<<endl; |
986 |
mocchiut |
1.5 |
return chiq; |
987 |
|
|
} |
988 |
|
|
/** |
989 |
|
|
* Returns the reduced chi-square of track y-projection |
990 |
|
|
*/ |
991 |
|
|
Float_t ExtTrack::GetChi2Y(){ |
992 |
|
|
float chiq=0; |
993 |
|
|
for(int ip=0; ip<nplanes; ip++)if(YGood(ip))chiq+= pow((yv[ip]-ym[ip])/resy[ip],2.); |
994 |
|
|
if(GetNY()>2)chiq=chiq/(GetNY()-2); |
995 |
|
|
else chiq=0; |
996 |
mocchiut |
1.6 |
// if(chiq==0)cout << " Float_t ExtTrack::GetChi2Y() -- WARNING -- value not defined "<<chiq<<endl; |
997 |
mocchiut |
1.5 |
return chiq; |
998 |
|
|
} |
999 |
|
|
|
1000 |
pam-ts |
1.7 |
/** |
1001 |
|
|
* Returns the track "lever-arm" on the x view, defined as the distance (in planes) between |
1002 |
|
|
* the upper and lower x measurements (the maximum value of lever-arm is 6). |
1003 |
|
|
*/ |
1004 |
|
|
Int_t ExtTrack::GetLeverArmX(){ |
1005 |
|
|
int first_plane = -1; |
1006 |
|
|
int last_plane = -1; |
1007 |
|
|
for(Int_t ip=0; ip<nplanes; ip++){ |
1008 |
|
|
if( XGood(ip) && first_plane == -1 )first_plane = ip; |
1009 |
|
|
if( XGood(ip) && first_plane != -1 )last_plane = ip; |
1010 |
|
|
} |
1011 |
|
|
if( first_plane == -1 || last_plane == -1){ |
1012 |
|
|
cout<< "Int_t ExtTrack::GetLeverArmX() -- XGood(ip) always false ??? "<<endl; |
1013 |
|
|
return 0; |
1014 |
|
|
} |
1015 |
|
|
return (last_plane-first_plane+1); |
1016 |
|
|
} |
1017 |
|
|
/** |
1018 |
|
|
* Returns the track "lever-arm" on the y view, defined as the distance (in planes) between |
1019 |
|
|
* the upper and lower y measurements (the maximum value of lever-arm is 6). |
1020 |
|
|
*/ |
1021 |
|
|
Int_t ExtTrack::GetLeverArmY(){ |
1022 |
|
|
int first_plane = -1; |
1023 |
|
|
int last_plane = -1; |
1024 |
|
|
for(Int_t ip=0; ip<nplanes; ip++){ |
1025 |
|
|
if( YGood(ip) && first_plane == -1 )first_plane = ip; |
1026 |
|
|
if( YGood(ip) && first_plane != -1 )last_plane = ip; |
1027 |
|
|
} |
1028 |
|
|
if( first_plane == -1 || last_plane == -1){ |
1029 |
|
|
cout<< "Int_t ExtTrack::GetLeverArmY() -- YGood(ip) always false ??? "<<endl; |
1030 |
|
|
return 0; |
1031 |
|
|
} |
1032 |
|
|
return (last_plane-first_plane+1); |
1033 |
|
|
} |
1034 |
|
|
/** |
1035 |
|
|
* Returns the track "lever-arm" on the x+y view, defined as the distance (in planes) between |
1036 |
|
|
* the upper and lower x,y (couple) measurements (the maximum value of lever-arm is 6). |
1037 |
|
|
*/ |
1038 |
|
|
Int_t ExtTrack::GetLeverArmXY(){ |
1039 |
|
|
int first_plane = -1; |
1040 |
|
|
int last_plane = -1; |
1041 |
|
|
for(Int_t ip=0; ip<nplanes; ip++){ |
1042 |
|
|
if( XGood(ip) && YGood(ip) && first_plane == -1 )first_plane = ip; |
1043 |
|
|
if( XGood(ip) && YGood(ip) && first_plane != -1 )last_plane = ip; |
1044 |
|
|
} |
1045 |
|
|
if( first_plane == -1 || last_plane == -1){ |
1046 |
|
|
// cout<< "Int_t ExtTrack::GetLeverArmXY() -- XGood(ip)*YGood(ip) always false ??? "<<endl; |
1047 |
|
|
return 0; |
1048 |
|
|
} |
1049 |
|
|
return (last_plane-first_plane+1); |
1050 |
|
|
} |
1051 |
|
|
|
1052 |
|
|
|
1053 |
|
|
|
1054 |
pam-fi |
1.1 |
ClassImp(ExtTrack); |