/[PAMELA software]/DarthVader/TrackerLevel2/src/TrkLevel2.cpp
ViewVC logotype

Contents of /DarthVader/TrackerLevel2/src/TrkLevel2.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21 - (show annotations) (download)
Thu Jan 11 10:20:58 2007 UTC (17 years, 10 months ago) by pam-fi
Branch: MAIN
Changes since 1.20: +344 -250 lines
memory-leak bugs + other bugs fixed

1 /**
2 * \file TrkLevel2.cpp
3 * \author Elena Vannuccini
4 */
5 #include <TrkLevel2.h>
6 #include <iostream>
7 #include <math.h>
8 using namespace std;
9 //......................................
10 // F77 routines
11 //......................................
12 extern "C" {
13 void dotrack_(int*, double*, double*, double*, double*, int*);
14 void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*);
15 // int readb_(const char*);
16 int readb_();
17 void mini2_(int*,int*,int*);
18 void guess_();
19 }
20 //--------------------------------------
21 //
22 //
23 //--------------------------------------
24 TrkTrack::TrkTrack(){
25 // cout << "TrkTrack::TrkTrack()" << endl;
26 seqno = -1;
27 image = -1;
28 chi2 = 0;
29 nstep = 0;
30 for(int it1=0;it1<5;it1++){
31 al[it1] = 0;
32 for(int it2=0;it2<5;it2++)coval[it1][it2] = 0;
33 };
34 for(int ip=0;ip<6;ip++){
35 xgood[ip] = 0;
36 ygood[ip] = 0;
37 xm[ip] = 0;
38 ym[ip] = 0;
39 zm[ip] = 0;
40 resx[ip] = 0;
41 resy[ip] = 0;
42 xv[ip] = 0;
43 yv[ip] = 0;
44 zv[ip] = 0;
45 axv[ip] = 0;
46 ayv[ip] = 0;
47 dedx_x[ip] = 0;
48 dedx_y[ip] = 0;
49 };
50 clx = 0;
51 cly = 0;
52 };
53 //--------------------------------------
54 //
55 //
56 //--------------------------------------
57 TrkTrack::TrkTrack(const TrkTrack& t){
58 seqno = t.seqno;
59 image = t.image;
60 chi2 = t.chi2;
61 nstep = t.nstep;
62 for(int it1=0;it1<5;it1++){
63 al[it1] = t.al[it1];
64 for(int it2=0;it2<5;it2++)coval[it1][it2] = t.coval[it1][it2];
65 };
66 for(int ip=0;ip<6;ip++){
67 xgood[ip] = t.xgood[ip];
68 ygood[ip] = t.ygood[ip];
69 xm[ip] = t.xm[ip];
70 ym[ip] = t.ym[ip];
71 zm[ip] = t.zm[ip];
72 resx[ip] = t.resx[ip];
73 resy[ip] = t.resy[ip];
74 xv[ip] = t.xv[ip];
75 yv[ip] = t.yv[ip];
76 zv[ip] = t.zv[ip];
77 axv[ip] = t.axv[ip];
78 ayv[ip] = t.ayv[ip];
79 dedx_x[ip] = t.dedx_x[ip];
80 dedx_y[ip] = t.dedx_y[ip];
81 };
82 clx = new TRefArray(*(t.clx));
83 cly = new TRefArray(*(t.cly));
84
85 };
86 //--------------------------------------
87 //
88 //
89 //--------------------------------------
90 void TrkTrack::Copy(TrkTrack& t){
91
92 t.seqno = seqno;
93 t.image = image;
94 t.chi2 = chi2;
95 t.nstep = nstep;
96 for(int it1=0;it1<5;it1++){
97 t.al[it1] = al[it1];
98 for(int it2=0;it2<5;it2++)t.coval[it1][it2] = coval[it1][it2];
99 };
100 for(int ip=0;ip<6;ip++){
101 t.xgood[ip] = xgood[ip];
102 t.ygood[ip] = ygood[ip];
103 t.xm[ip] = xm[ip];
104 t.ym[ip] = ym[ip];
105 t.zm[ip] = zm[ip];
106 t.resx[ip] = resx[ip];
107 t.resy[ip] = resy[ip];
108 t.xv[ip] = xv[ip];
109 t.yv[ip] = yv[ip];
110 t.zv[ip] = zv[ip];
111 t.axv[ip] = axv[ip];
112 t.ayv[ip] = ayv[ip];
113 t.dedx_x[ip] = dedx_x[ip];
114 t.dedx_y[ip] = dedx_y[ip];
115
116 };
117
118 };
119 //--------------------------------------
120 //
121 //
122 //--------------------------------------
123 /**
124 * Evaluates the trajectory in the apparatus associated to the track.
125 * It integrates the equations of motion in the magnetic field. The magnetic field should be previously loaded ( by calling TrkLevel2::LoadField() ), otherwise an error message is returned.
126 * @param t pointer to an object of the class Trajectory,
127 * which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ).
128 * @return error flag.
129 */
130 int TrkTrack::DoTrack(Trajectory* t){
131
132 double *dxout = new double[t->npoint];
133 double *dyout = new double[t->npoint];
134 double *dzin = new double[t->npoint];
135 double dal[5];
136
137 int ifail = 0;
138
139 for (int i=0; i<5; i++) dal[i] = (double)al[i];
140 for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i];
141
142 dotrack_(&(t->npoint),dzin,dxout,dyout,dal,&ifail);
143
144 for (int i=0; i<t->npoint; i++){
145 t->x[i] = (float)*dxout++;
146 t->y[i] = (float)*dyout++;
147 }
148
149 // delete [] dxout;
150 // delete [] dyout;
151 // delete [] dzin;
152
153 return ifail;
154 };
155 //--------------------------------------
156 //
157 //
158 //--------------------------------------
159 /**
160 * Evaluates the trajectory in the apparatus associated to the track.
161 * It integrates the equations of motion in the magnetic field. The magnetic field should be previously loaded ( by calling TrkLevel2::LoadField() ), otherwise an error message is returned.
162 * @param t pointer to an object of the class Trajectory,
163 * which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ).
164 * @return error flag.
165 */
166 int TrkTrack::DoTrack2(Trajectory* t){
167
168 double *dxout = new double[t->npoint];
169 double *dyout = new double[t->npoint];
170 double *dthxout = new double[t->npoint];
171 double *dthyout = new double[t->npoint];
172 double *dtlout = new double[t->npoint];
173 double *dzin = new double[t->npoint];
174 double dal[5];
175
176 int ifail = 0;
177
178 for (int i=0; i<5; i++) dal[i] = (double)al[i];
179 for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i];
180
181 dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);
182
183 for (int i=0; i<t->npoint; i++){
184 t->x[i] = (float)*dxout++;
185 t->y[i] = (float)*dyout++;
186 t->thx[i] = (float)*dthxout++;
187 t->thy[i] = (float)*dthyout++;
188 t->tl[i] = (float)*dtlout++;
189 }
190
191 // delete [] dxout;
192 // delete [] dyout;
193 // delete [] dzin;
194
195 return ifail;
196 };
197 //--------------------------------------
198 //
199 //
200 //--------------------------------------
201 //float TrkTrack::BdL(){
202 //};
203 //--------------------------------------
204 //
205 //
206 //--------------------------------------
207 Float_t TrkTrack::GetRigidity(){
208 Float_t rig=0;
209 if(chi2>0)rig=1./al[4];
210 if(rig<0) rig=-rig;
211 return rig;
212 };
213 //
214 Float_t TrkTrack::GetDeflection(){
215 Float_t def=0;
216 if(chi2>0)def=al[4];
217 return def;
218 };
219 //
220 Float_t TrkTrack::GetDEDX(){
221 Float_t dedx=0;
222 for(Int_t i=0; i<6; i++)dedx+=dedx_x[i]*xgood[i]+dedx_y[i]*ygood[i];
223 dedx = dedx/(this->GetNX()+this->GetNY());
224 return dedx;
225 };
226
227 //--------------------------------------
228 //
229 //
230 //--------------------------------------
231 void TrkTrack::Dump(){
232 cout << endl << "========== Track " ;
233 cout << endl << "seq. n. : "<< seqno;
234 cout << endl << "image n. : "<< image;
235 cout << endl << "al : "; for(int i=0; i<5; i++)cout << al[i] << " ";
236 cout << endl << "chi^2 : "<< chi2;
237 cout << endl << "n.step : "<< nstep;
238 cout << endl << "xgood : "; for(int i=0; i<6; i++)cout << xgood[i] ;
239 cout << endl << "ygood : "; for(int i=0; i<6; i++)cout << ygood[i] ;
240 cout << endl << "xm : "; for(int i=0; i<6; i++)cout << xm[i] << " ";
241 cout << endl << "ym : "; for(int i=0; i<6; i++)cout << ym[i] << " ";
242 cout << endl << "zm : "; for(int i=0; i<6; i++)cout << zm[i] << " ";
243 cout << endl << "xv : "; for(int i=0; i<6; i++)cout << xv[i] << " ";
244 cout << endl << "yv : "; for(int i=0; i<6; i++)cout << yv[i] << " ";
245 cout << endl << "zv : "; for(int i=0; i<6; i++)cout << zv[i] << " ";
246 cout << endl << "resx : "; for(int i=0; i<6; i++)cout << resx[i] << " ";
247 cout << endl << "resy : "; for(int i=0; i<6; i++)cout << resy[i] << " ";
248 cout << endl << "coval : "; for(int i=0; i<5; i++)cout << coval[0][i]<<" ";
249 cout << endl << " "; for(int i=0; i<5; i++)cout << coval[1][i]<<" ";
250 cout << endl << " "; for(int i=0; i<5; i++)cout << coval[2][i]<<" ";
251 cout << endl << " "; for(int i=0; i<5; i++)cout << coval[3][i]<<" ";
252 cout << endl << " "; for(int i=0; i<5; i++)cout << coval[4][i]<<" ";
253 cout << endl << "dedx_x : "; for(int i=0; i<6; i++)cout << dedx_x[i] << " ";
254 cout << endl << "dedx_y : "; for(int i=0; i<6; i++)cout << dedx_y[i] << " ";
255 cout << endl;
256 }
257 /**
258 * Set the TrkTrack position measurements
259 */
260 void TrkTrack::SetMeasure(double *xmeas, double *ymeas, double *zmeas){
261 for(int i=0; i<6; i++) xm[i]=*xmeas++;
262 for(int i=0; i<6; i++) ym[i]=*ymeas++;
263 for(int i=0; i<6; i++) zm[i]=*zmeas++;
264 }
265 /**
266 * Set the TrkTrack position resolution
267 */
268 void TrkTrack::SetResolution(double *rx, double *ry){
269 for(int i=0; i<6; i++) resx[i]=*rx++;
270 for(int i=0; i<6; i++) resy[i]=*ry++;
271 }
272 /**
273 * Set the TrkTrack good measurement
274 */
275 void TrkTrack::SetGood(int *xg, int *yg){
276 for(int i=0; i<6; i++) xgood[i]=*xg++;
277 for(int i=0; i<6; i++) ygood[i]=*yg++;
278 }
279
280 /**
281 * Load the magnetic field
282 */
283 void TrkTrack::LoadField(TString path){
284
285 strcpy(path_.path,path.Data());
286 path_.pathlen = path.Length();
287 path_.error = 0;
288 readb_();
289
290 };
291
292 /**
293 * Method to fill minimization-routine common
294 */
295 void TrkTrack::FillMiniStruct(cMini2track& track){
296
297 for(int i=0; i<6; i++){
298
299 track.xgood[i]=xgood[i];
300 track.ygood[i]=ygood[i];
301
302 track.xm[i]=xm[i];
303 track.ym[i]=ym[i];
304 track.zm[i]=zm[i];
305
306 // --- temporaneo ----------------------------
307 // andrebbe inserita la dimensione del sensore
308 float segment = 100.;
309 track.xm_a[i]=xm[i];
310 track.xm_b[i]=xm[i];
311 track.ym_a[i]=ym[i];
312 track.ym_b[i]=ym[i];
313 if( xgood[i] && !ygood[i] ){
314 track.ym_a[i] = track.ym_a[i]+segment;
315 track.ym_b[i] = track.ym_b[i]-segment;
316 }else if( !xgood[i] && ygood[i]){
317 track.xm_a[i] = track.xm_a[i]+segment;
318 track.xm_b[i] = track.xm_b[i]-segment;
319 }
320 // --- temporaneo ----------------------------
321
322 track.resx[i]=resx[i];
323 track.resy[i]=resy[i];
324 }
325
326 for(int i=0; i<5; i++) track.al[i]=al[i];
327 track.zini = 23.5;
328 // ZINI = 23.5 !!! it should be the same parameter in all codes
329
330 }
331 /**
332 * Method to set values from minimization-routine common
333 */
334 void TrkTrack::SetFromMiniStruct(cMini2track *track){
335
336 for(int i=0; i<5; i++) {
337 al[i]=track->al[i];
338 for(int j=0; j<5; j++) coval[i][j]=track->cov[i][j];
339 }
340 chi2 = track->chi2;
341 nstep = track->nstep;
342 for(int i=0; i<6; i++){
343 xv[i] = track->xv[i];
344 yv[i] = track->yv[i];
345 zv[i] = track->zv[i];
346 xm[i] = track->xm[i];
347 ym[i] = track->ym[i];
348 zm[i] = track->zm[i];
349 axv[i] = track->axv[i];
350 ayv[i] = track->ayv[i];
351 }
352
353
354 }
355 /**
356 * Tracking method. It calls F77 mini routine.
357 */
358 void TrkTrack::Fit(double pfixed, int& fail, int iprint){
359
360 float al_ini[] = {0.,0.,0.,0.,0.};
361
362 extern cMini2track track_;
363 fail = 0;
364 FillMiniStruct(track_);
365
366 // if fit variables have been reset, evaluate the initial guess
367 if(al[0]==-9999.&&al[1]==-9999.&&al[2]==-9999.&&al[3]==-9999.&&al[4]==-9999.)guess_();
368
369 // --------------------- free momentum
370 if(pfixed==0.) {
371 track_.pfixed=0.;
372 }
373 // --------------------- fixed momentum
374 if(pfixed!=0.) {
375 al[4]=1./pfixed;
376 track_.pfixed=pfixed;
377 }
378
379 // store temporarily the initial guess
380 for(int i=0; i<5; i++) al_ini[i]=track_.al[i];
381
382 // ------------------------------------------
383 // call mini routine
384 int istep=0;
385 int ifail=0;
386 mini2_(&istep,&ifail, &iprint);
387 if(ifail!=0) {
388 if(iprint)cout << "ERROR: ifail= " << ifail << endl;
389 fail = 1;
390 }
391 // ------------------------------------------
392
393 SetFromMiniStruct(&track_);
394 // cout << endl << "eta ===> " << track_.al[4] << endl;
395
396 // for(int i=0; i<5; i++) al[i]=track_.al[i];
397 // chi2=track_.chi2;
398 // nstep=track_.nstep;
399 // for(int i=0; i<6; i++) xv[i]=track_.xv[i];
400 // for(int i=0; i<6; i++) yv[i]=track_.yv[i];
401 // for(int i=0; i<6; i++) zv[i]=track_.zv[i];
402 // for(int i=0; i<6; i++) axv[i]=track_.axv[i];
403 // for(int i=0; i<6; i++) ayv[i]=track_.ayv[i];
404 // for(int i=0; i<5; i++) {
405 // for(int j=0; j<5; j++) coval[i][j]=track_.cov[i][j];
406 // }
407
408 if(fail){
409 if(iprint)cout << " >>>> fit failed >>>> drawing initial par"<<endl;
410 for(int i=0; i<5; i++) al[i]=al_ini[i];
411 }
412
413 };
414 /*
415 * Reset the fit parameters
416 */
417 void TrkTrack::FitReset(){
418 for(int i=0; i<5; i++) al[i]=-9999.;
419 chi2=0.;
420 nstep=0;
421 for(int i=0; i<6; i++) xv[i]=0.;
422 for(int i=0; i<6; i++) yv[i]=0.;
423 for(int i=0; i<6; i++) zv[i]=0.;
424 for(int i=0; i<6; i++) axv[i]=0.;
425 for(int i=0; i<6; i++) ayv[i]=0.;
426 for(int i=0; i<5; i++) {
427 for(int j=0; j<5; j++) coval[i][j]=0.;
428 }
429 }
430
431 //--------------------------------------
432 //
433 //
434 //--------------------------------------
435 void TrkTrack::Clear(){
436 // cout << "TrkTrack::Clear()"<<endl;
437 seqno = -1;
438 image = -1;
439 chi2 = 0;
440 nstep = 0;
441 for(int it1=0;it1<5;it1++){
442 al[it1] = 0;
443 for(int it2=0;it2<5;it2++)coval[it1][it2] = 0;
444 };
445 for(int ip=0;ip<6;ip++){
446 xgood[ip] = 0;
447 ygood[ip] = 0;
448 xm[ip] = 0;
449 ym[ip] = 0;
450 zm[ip] = 0;
451 resx[ip] = 0;
452 resy[ip] = 0;
453 xv[ip] = 0;
454 yv[ip] = 0;
455 zv[ip] = 0;
456 axv[ip] = 0;
457 ayv[ip] = 0;
458 dedx_x[ip] = 0;
459 dedx_y[ip] = 0;
460
461 };
462 if(clx)clx->Clear();
463 if(cly)cly->Clear();
464 };
465 //--------------------------------------
466 //
467 //
468 //--------------------------------------
469 void TrkTrack::Delete(){
470 // cout << "TrkTrack::Delete()"<<endl;
471 // Clear();
472 if(clx)delete clx;
473 if(cly)delete cly;
474 };
475 //--------------------------------------
476 //
477 //
478 //--------------------------------------
479
480 //--------------------------------------
481 //
482 //
483 //--------------------------------------
484 TrkSinglet::TrkSinglet(){
485 // cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl;
486 plane = 0;
487 coord[0] = 0;
488 coord[1] = 0;
489 sgnl = 0;
490 // cls = 0;
491 };
492 //--------------------------------------
493 //
494 //
495 //--------------------------------------
496 TrkSinglet::TrkSinglet(const TrkSinglet& s){
497 // cout << "TrkSinglet::TrkSinglet(const TrkSinglet& s) " << GetUniqueID()<<endl;
498 plane = s.plane;
499 coord[0] = s.coord[0];
500 coord[1] = s.coord[1];
501 sgnl = s.sgnl;
502 // cls = 0;//<<<<pointer
503 cls = TRef(s.cls);
504 };
505 //--------------------------------------
506 //
507 //
508 //--------------------------------------
509 void TrkSinglet::Dump(){
510 int i=0;
511 cout << endl << "========== Singlet " ;
512 cout << endl << "plane : " << plane;
513 cout << endl << "coord[2] : "; while( i<2 && cout << coord[i] << " ") i++;
514 cout << endl << "sgnl : " << sgnl;
515 }
516 //--------------------------------------
517 //
518 //
519 //--------------------------------------
520 void TrkSinglet::Clear(){
521 // cout << "TrkSinglet::Clear() " << GetUniqueID()<<endl;
522 // cls=0;
523 plane=-1;
524 coord[0]=-999;
525 coord[1]=-999;
526 sgnl=0;
527
528 }
529 //--------------------------------------
530 //
531 //
532 //--------------------------------------
533 TrkLevel2::TrkLevel2(){
534 // cout <<"TrkLevel2::TrkLevel2()"<<endl;
535 for(Int_t i=0; i<12 ; i++){
536 good[i] = -1;
537 };
538 // Track = new TClonesArray("TrkTrack");
539 // SingletX = new TClonesArray("TrkSinglet");
540 // SingletY = new TClonesArray("TrkSinglet");
541 Track = 0;
542 SingletX = 0;
543 SingletY = 0;
544
545 }
546 //--------------------------------------
547 //
548 //
549 //--------------------------------------
550 void TrkLevel2::Dump(){
551
552 //
553 cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
554 cout << endl << "good : "; for(int i=0; i<12; i++) cout << good[i]<<" ";
555 cout << endl << "ntrk() : " << this->ntrk() ;
556 cout << endl << "nclsx() : " << this->nclsx();
557 cout << endl << "nclsy() : " << this->nclsy();
558 // TClonesArray &t = *Track;
559 // TClonesArray &sx = *SingletX;
560 // TClonesArray &sy = *SingletY;
561 // for(int i=0; i<ntrk(); i++) ((TrkTrack *)t[i])->Dump();
562 // for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();
563 // for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();
564 if(Track){
565 TClonesArray &t = *Track;
566 for(int i=0; i<ntrk(); i++) ((TrkTrack *)t[i])->Dump();
567 }
568 if(SingletX){
569 TClonesArray &sx = *SingletX;
570 for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();
571 }
572 if(SingletY){
573 TClonesArray &sy = *SingletY;
574 for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();
575 }
576 }
577 //--------------------------------------
578 //
579 //
580 //--------------------------------------
581 /**
582 * Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common).
583 */
584 void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){
585
586 // temporary objects:
587 TrkSinglet* t_singlet = new TrkSinglet();
588 TrkTrack* t_track = new TrkTrack();
589
590 // **** general variables ****
591 // good2 = l2->good2;
592 for(Int_t i=0; i<12 ; i++){
593 // crc[i] = l2->crc[i];
594 good[i] = l2->good[i];
595 };
596 // *** TRACKS ***
597 if(!Track) Track = new TClonesArray("TrkTrack");
598 TClonesArray &t = *Track;
599 for(int i=0; i<l2->ntrk; i++){
600 t_track->seqno = i;// NBNBNBNB deve sempre essere = i
601 t_track->image = l2->image[i]-1;
602 // cout << "track "<<i<<t_track->seqno << t_track->image<<endl;
603 t_track->chi2 = l2->chi2_nt[i];
604 t_track->nstep = l2->nstep_nt[i];
605 for(int it1=0;it1<5;it1++){
606 t_track->al[it1] = l2->al_nt[i][it1];
607 for(int it2=0;it2<5;it2++)
608 t_track->coval[it1][it2] = l2->coval[i][it2][it1];
609 };
610 for(int ip=0;ip<6;ip++){
611 t_track->xgood[ip] = l2->xgood_nt[i][ip];
612 t_track->ygood[ip] = l2->ygood_nt[i][ip];
613 t_track->xm[ip] = l2->xm_nt[i][ip];
614 t_track->ym[ip] = l2->ym_nt[i][ip];
615 t_track->zm[ip] = l2->zm_nt[i][ip];
616 t_track->resx[ip] = l2->resx_nt[i][ip];
617 t_track->resy[ip] = l2->resy_nt[i][ip];
618 t_track->xv[ip] = l2->xv_nt[i][ip];
619 t_track->yv[ip] = l2->yv_nt[i][ip];
620 t_track->zv[ip] = l2->zv_nt[i][ip];
621 t_track->axv[ip] = l2->axv_nt[i][ip];
622 t_track->ayv[ip] = l2->ayv_nt[i][ip];
623 t_track->dedx_x[ip] = l2->dedx_x[i][ip];
624 t_track->dedx_y[ip] = l2->dedx_y[i][ip];
625 // t_track->clx[ip] = 0;
626 // t_track->cly[ip] = 0;
627 };
628 new(t[i]) TrkTrack(*t_track);
629 t_track->Clear();
630 };
631 // *** SINGLETS ***
632 if(!SingletX)SingletX = new TClonesArray("TrkSinglet");
633 TClonesArray &sx = *SingletX;
634 for(int i=0; i<l2->nclsx; i++){
635 t_singlet->plane = l2->planex[i];
636 t_singlet->coord[0] = l2->xs[i][0];
637 t_singlet->coord[1] = l2->xs[i][1];
638 t_singlet->sgnl = l2->signlxs[i];
639 // t_singlet->cls = 0;
640 new(sx[i]) TrkSinglet(*t_singlet);
641 t_singlet->Clear();
642 }
643 if(!SingletY)SingletY = new TClonesArray("TrkSinglet");
644 TClonesArray &sy = *SingletY;
645 for(int i=0; i<l2->nclsy; i++){
646 t_singlet->plane = l2->planey[i];
647 t_singlet->coord[0] = l2->ys[i][0];
648 t_singlet->coord[1] = l2->ys[i][1];
649 t_singlet->sgnl = l2->signlys[i];
650 // t_singlet->cls = 0;
651 new(sy[i]) TrkSinglet(*t_singlet);
652 t_singlet->Clear();
653 };
654
655 delete t_track;
656 delete t_singlet;
657 }
658 //--------------------------------------
659 //
660 //
661 //--------------------------------------
662 /**
663 * Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common).
664 * Ref to Level1 data (clusters) is also set.
665 */
666 void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){
667
668 // temporary objects:
669 TrkSinglet* t_singlet = new TrkSinglet();
670 TrkTrack* t_track = new TrkTrack();
671 // general variables
672 // good2 = l2->good2;
673 for(Int_t i=0; i<12 ; i++){
674 // crc[i] = l2->crc[i];
675 good[i] = l2->good[i];
676 };
677 // *** TRACKS ***
678 if(!Track) Track = new TClonesArray("TrkTrack");
679 TClonesArray &t = *Track;
680 if(!t_track->clx)t_track->clx = new TRefArray(6,0);
681 if(!t_track->cly)t_track->cly = new TRefArray(6,0);
682 for(int i=0; i<l2->ntrk; i++){
683 t_track->seqno = i;// NBNBNBNB deve sempre essere = i
684 t_track->image = l2->image[i]-1;
685 // cout << "track "<<i<<t_track->seqno << t_track->image<<endl;
686 t_track->chi2 = l2->chi2_nt[i];
687 t_track->nstep = l2->nstep_nt[i];
688 for(int it1=0;it1<5;it1++){
689 t_track->al[it1] = l2->al_nt[i][it1];
690 for(int it2=0;it2<5;it2++)
691 t_track->coval[it1][it2] = l2->coval[i][it2][it1];
692 };
693 for(int ip=0;ip<6;ip++){
694 t_track->xgood[ip] = l2->xgood_nt[i][ip];
695 t_track->ygood[ip] = l2->ygood_nt[i][ip];
696 t_track->xm[ip] = l2->xm_nt[i][ip];
697 t_track->ym[ip] = l2->ym_nt[i][ip];
698 t_track->zm[ip] = l2->zm_nt[i][ip];
699 t_track->resx[ip] = l2->resx_nt[i][ip];
700 t_track->resy[ip] = l2->resy_nt[i][ip];
701 t_track->xv[ip] = l2->xv_nt[i][ip];
702 t_track->yv[ip] = l2->yv_nt[i][ip];
703 t_track->zv[ip] = l2->zv_nt[i][ip];
704 t_track->axv[ip] = l2->axv_nt[i][ip];
705 t_track->ayv[ip] = l2->ayv_nt[i][ip];
706 t_track->dedx_x[ip] = l2->dedx_x[i][ip];
707 t_track->dedx_y[ip] = l2->dedx_y[i][ip];
708 // cout << "traccia "<<i<<" -- "<< ip << " "<< l2->cltrx[i][ip] <<" "<< l2->cltry[i][ip] <<" "<< t_track->xgood[ip] << t_track->ygood[ip]<<endl;
709 //-----------------------------------------------------
710 //-----------------------------------------------------
711 if(t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip);
712 if(t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip);
713 // if(t_track->ygood[ip])cout<<" i "<<i<<" ip "<<ip<<" l2->cltry[i][ip] "<<l2->cltry[i][ip]<< " l1->GetCluster(l2->cltry[i][ip]-1) "<<l1->GetCluster(l2->cltry[i][ip]-1)<<endl;
714 // if(t_track->xgood[ip])cout<<" i "<<i<<" ip "<<ip<<" l2->cltrx[i][ip] "<<l2->cltrx[i][ip]<< " l1->GetCluster(l2->cltrx[i][ip]-1) "<<l1->GetCluster(l2->cltrx[i][ip]-1)<<endl;
715 //-----------------------------------------------------
716 //-----------------------------------------------------
717 };
718 new(t[i]) TrkTrack(*t_track);
719 t_track->Clear();
720 };
721 // *** SINGLETS ***
722 if(!SingletX)SingletX = new TClonesArray("TrkSinglet");
723 TClonesArray &sx = *SingletX;
724 for(int i=0; i<l2->nclsx; i++){
725 t_singlet->plane = l2->planex[i];
726 t_singlet->coord[0] = l2->xs[i][0];
727 t_singlet->coord[1] = l2->xs[i][1];
728 t_singlet->sgnl = l2->signlxs[i];
729 //-----------------------------------------------------
730 // cout << "singolo x "<<i<<" -- "<< l2->clsx[i] <<endl;
731 t_singlet->cls = l1->GetCluster(l2->clsx[i]-1);
732 // cout<<" i "<<i<<" l2->clsx[i] "<<l2->clsx[i]<< " l1->GetCluster(l2->clsx[i]-1) "<<l1->GetCluster(l2->clsx[i]-1)<<endl;
733 //-----------------------------------------------------
734 new(sx[i]) TrkSinglet(*t_singlet);
735 t_singlet->Clear();
736 }
737 if(!SingletY)SingletY = new TClonesArray("TrkSinglet");
738 TClonesArray &sy = *SingletY;
739 for(int i=0; i<l2->nclsy; i++){
740 t_singlet->plane = l2->planey[i];
741 t_singlet->coord[0] = l2->ys[i][0];
742 t_singlet->coord[1] = l2->ys[i][1];
743 t_singlet->sgnl = l2->signlys[i];
744 //-----------------------------------------------------
745 // cout << "singolo y "<<i<<" -- "<< l2->clsy[i] <<endl;
746 t_singlet->cls = l1->GetCluster(l2->clsy[i]-1);
747 // cout<<" i "<<i<<" l2->clsy[i] "<<l2->clsy[i]<< " l1->GetCluster(l2->clsy[i]-1) "<<l1->GetCluster(l2->clsy[i]-1)<<endl;
748 //-----------------------------------------------------
749 new(sy[i]) TrkSinglet(*t_singlet);
750 t_singlet->Clear();
751 };
752
753 delete t_track;
754 delete t_singlet;
755 }
756 /**
757 * Fills a struct cTrkLevel2 with values from a TrkLevel2 object (to put data into a F77 common).
758 */
759
760 void TrkLevel2::GetLevel2Struct(cTrkLevel2 *l2) const {
761
762 // general variables
763 // l2->good2 = good2 ;
764 for(Int_t i=0; i<12 ; i++){
765 // l2->crc[i] = crc[i];
766 l2->good[i] = good[i];
767 };
768 // *** TRACKS ***
769
770 if(Track){
771 l2->ntrk = Track->GetEntries();
772 for(Int_t i=0;i<l2->ntrk;i++){
773 l2->image[i] = 1 + ((TrkTrack *)Track->At(i))->image;
774 l2->chi2_nt[i] = ((TrkTrack *)Track->At(i))->chi2;
775 l2->nstep_nt[i] = ((TrkTrack *)Track->At(i))->nstep;
776 for(int it1=0;it1<5;it1++){
777 l2->al_nt[i][it1] = ((TrkTrack *)Track->At(i))->al[it1];
778 for(int it2=0;it2<5;it2++)
779 l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2];
780 };
781 for(int ip=0;ip<6;ip++){
782 l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->xgood[ip];
783 l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->ygood[ip];
784 l2->xm_nt[i][ip] = ((TrkTrack *)Track->At(i))->xm[ip];
785 l2->ym_nt[i][ip] = ((TrkTrack *)Track->At(i))->ym[ip];
786 l2->zm_nt[i][ip] = ((TrkTrack *)Track->At(i))->zm[ip];
787 l2->resx_nt[i][ip] = ((TrkTrack *)Track->At(i))->resx[ip];
788 l2->resy_nt[i][ip] = ((TrkTrack *)Track->At(i))->resy[ip];
789 l2->xv_nt[i][ip] = ((TrkTrack *)Track->At(i))->xv[ip];
790 l2->yv_nt[i][ip] = ((TrkTrack *)Track->At(i))->yv[ip];
791 l2->zv_nt[i][ip] = ((TrkTrack *)Track->At(i))->zv[ip];
792 l2->axv_nt[i][ip] = ((TrkTrack *)Track->At(i))->axv[ip];
793 l2->ayv_nt[i][ip] = ((TrkTrack *)Track->At(i))->ayv[ip];
794 l2->dedx_x[i][ip] = ((TrkTrack *)Track->At(i))->dedx_x[ip];
795 l2->dedx_y[i][ip] = ((TrkTrack *)Track->At(i))->dedx_y[ip];
796 };
797 }
798 }
799 // *** SINGLETS ***
800 if(SingletX){
801 l2->nclsx = SingletX->GetEntries();
802 for(Int_t i=0;i<l2->nclsx;i++){
803 l2->planex[i] = ((TrkSinglet *)SingletX->At(i))->plane;
804 l2->xs[i][0] = ((TrkSinglet *)SingletX->At(i))->coord[0];
805 l2->xs[i][1] = ((TrkSinglet *)SingletX->At(i))->coord[1];
806 l2->signlxs[i] = ((TrkSinglet *)SingletX->At(i))->sgnl;
807 }
808 }
809
810 if(SingletY){
811 l2->nclsy = SingletY->GetEntries();
812 for(Int_t i=0;i<l2->nclsy;i++){
813 l2->planey[i] = ((TrkSinglet *)SingletY->At(i))->plane;
814 l2->ys[i][0] = ((TrkSinglet *)SingletY->At(i))->coord[0];
815 l2->ys[i][1] = ((TrkSinglet *)SingletY->At(i))->coord[1];
816 l2->signlys[i] = ((TrkSinglet *)SingletY->At(i))->sgnl;
817 }
818 }
819 }
820 //--------------------------------------
821 //
822 //
823 //--------------------------------------
824 void TrkLevel2::Clear(){
825 for(Int_t i=0; i<12 ; i++){
826 good[i] = -1;
827 };
828 // if(Track)Track->Clear("C");
829 // if(SingletX)SingletX->Clear("C");
830 // if(SingletY)SingletY->Clear("C");
831 if(Track)Track->Delete();
832 if(SingletX)SingletX->Delete();
833 if(SingletY)SingletY->Delete();
834 }
835 // //--------------------------------------
836 // //
837 // //
838 // //--------------------------------------
839 void TrkLevel2::Delete(){
840
841 // cout << "void TrkLevel2::Delete()"<<endl;
842 Clear();
843 if(Track)delete Track;
844 if(SingletX)delete SingletX;
845 if(SingletY)delete SingletY;
846
847 }
848 //--------------------------------------
849 //
850 //
851 //--------------------------------------
852 /**
853 * Sort physical tracks and stores them in a TObjectArray, ordering by increasing chi**2 value (in case of track image, it selects the one with lower chi**2). The total number of physical tracks is given by GetNTracks() and the it-th physical track can be retrieved by means of the method GetTrack(int it).
854 * This method is overridden by PamLevel2::GetTracks(), where calorimeter and TOF information is used.
855 */
856 TRefArray *TrkLevel2::GetTracks_NFitSorted(){
857
858 if(!Track)return 0;
859
860 TRefArray *sorted = new TRefArray();
861
862 TClonesArray &t = *Track;
863 // TClonesArray &ts = *PhysicalTrack;
864 int N = ntrk();
865 vector<int> m(N); for(int i=0; i<N; i++)m[i]=1;
866 // int m[50]; for(int i=0; i<N; i++)m[i]=1;
867
868 int indo=0;
869 int indi=0;
870 while(N != 0){
871 int nfit =0;
872 float chi2ref = numeric_limits<float>::max();
873
874 // first loop to search maximum num. of fit points
875 for(int i=0; i < ntrk(); i++){
876 if( ((TrkTrack *)t[i])->GetNtot() >= nfit && m[i]==1){
877 nfit = ((TrkTrack *)t[i])->GetNtot();
878 }
879 }
880 //second loop to search minimum chi2 among selected
881 for(int i=0; i<this->ntrk(); i++){
882 Float_t chi2 = ((TrkTrack *)t[i])->chi2;
883 if(chi2 < 0) chi2 = chi2*1000;
884 if( chi2 < chi2ref
885 && ((TrkTrack *)t[i])->GetNtot() == nfit
886 && m[i]==1){
887 chi2ref = ((TrkTrack *)t[i])->chi2;
888 indi = i;
889 };
890 };
891 if( ((TrkTrack *)t[indi])->HasImage() ){
892 m[((TrkTrack *)t[indi])->image] = 0;
893 N--;
894
895 // cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl;
896 };
897 sorted->Add( (TrkTrack*)t[indi] );
898
899 m[indi] = 0;
900 // cout << "SORTED "<< indo << " "<< indi << " "<< N << endl;
901 N--;
902 indo++;
903 }
904 m.clear();
905 // cout << "GetTracks_NFitSorted(it): Done"<< endl;
906
907 return sorted;
908 // return PhysicalTrack;
909 }
910 //--------------------------------------
911 //
912 //
913 //--------------------------------------
914 /**
915 * Retrieves the is-th stored track.
916 * @param it Track number, ranging from 0 to ntrk().
917 * Fitted tracks ( images included ) are stored in a TObjectArray ( TrkLevel2::Track ) in the same order they are returned by the F77 fitting routine.
918 */
919 TrkTrack *TrkLevel2::GetStoredTrack(int is){
920
921 if(is >= this->ntrk()){
922 cout << "** TrkLevel2 ** Track "<< is << "doen not exits! " << endl;
923 cout << " Stored tracks ntrk() = "<< this->ntrk() << endl;
924 return 0;
925 }
926 if(!Track){
927 cout << "TrkTrack *TrkLevel2::GetStoredTrack(int is) >> (TClonesArray*) Track ==0 "<<endl;
928 };
929 TClonesArray &t = *(Track);
930 TrkTrack *track = (TrkTrack*)t[is];
931 return track;
932 }
933 //--------------------------------------
934 //
935 //
936 //--------------------------------------
937 /**
938 * Retrieves the is-th stored X singlet.
939 * @param it Singlet number, ranging from 0 to nclsx().
940 */
941 TrkSinglet *TrkLevel2::GetSingletX(int is){
942
943 if(is >= this->nclsx()){
944 cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;
945 cout << " Stored x-singlets nclsx() = "<< this->nclsx() << endl;
946 return 0;
947 }
948 if(!SingletX)return 0;
949 TClonesArray &t = *(SingletX);
950 TrkSinglet *singlet = (TrkSinglet*)t[is];
951 return singlet;
952 }
953 //--------------------------------------
954 //
955 //
956 //--------------------------------------
957 /**
958 * Retrieves the is-th stored Y singlet.
959 * @param it Singlet number, ranging from 0 to nclsx().
960 */
961 TrkSinglet *TrkLevel2::GetSingletY(int is){
962
963 if(is >= this->nclsy()){
964 cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;
965 cout << " Stored y-singlets nclsy() = "<< this->nclsx() << endl;
966 return 0;
967 }
968 if(!SingletY)return 0;
969 TClonesArray &t = *(SingletY);
970 TrkSinglet *singlet = (TrkSinglet*)t[is];
971 return singlet;
972 }
973 //--------------------------------------
974 //
975 //
976 //--------------------------------------
977 /**
978 * Retrieves the it-th "physical" track, sorted by the method GetNTracks().
979 * @param it Track number, ranging from 0 to GetNTracks().
980 */
981
982 TrkTrack *TrkLevel2::GetTrack(int it){
983
984 if(it >= this->GetNTracks()){
985 cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;
986 cout << " Physical tracks GetNTracks() = "<< this->ntrk() << endl;
987 return 0;
988 }
989
990 TRefArray *sorted = GetTracks(); //TEMPORANEO
991 if(!sorted)return 0;
992 TrkTrack *track = (TrkTrack*)sorted->At(it);
993 sorted->Clear();
994 delete sorted;
995 return track;
996 }
997 /**
998 * Give the number of "physical" tracks, sorted by the method GetTracks().
999 */
1000 Int_t TrkLevel2::GetNTracks(){
1001
1002 Float_t ntot=0;
1003 if(!Track)return 0;
1004 TClonesArray &t = *Track;
1005 for(int i=0; i<ntrk(); i++) {
1006 if( ((TrkTrack *)t[i])->GetImageSeqNo() == -1 ) ntot+=1.;
1007 else ntot+=0.5;
1008 }
1009 return (Int_t)ntot;
1010
1011 };
1012 //--------------------------------------
1013 //
1014 //
1015 //--------------------------------------
1016 /**
1017 * Retrieves (if present) the image of the it-th "physical" track, sorted by the method GetNTracks().
1018 * @param it Track number, ranging from 0 to GetNTracks().
1019 */
1020 TrkTrack *TrkLevel2::GetTrackImage(int it){
1021
1022 if(it >= this->GetNTracks()){
1023 cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;
1024 cout << " Physical tracks GetNTracks() = "<< this->ntrk() << endl;
1025 return 0;
1026 }
1027
1028 TRefArray* sorted = GetTracks(); //TEMPORANEO
1029 if(!sorted)return 0;
1030 TrkTrack *track = (TrkTrack*)sorted->At(it);
1031
1032 if(!track->HasImage()){
1033 cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl;
1034 return 0;
1035 }
1036 if(!Track)return 0;
1037 TrkTrack *image = (TrkTrack*)(*Track)[track->image];
1038
1039 sorted->Delete();
1040 delete sorted;
1041
1042 return image;
1043
1044 }
1045 //--------------------------------------
1046 //
1047 //
1048 //--------------------------------------
1049 /**
1050 * Loads the magnetic field.
1051 * @param s Path of the magnetic-field files.
1052 */
1053 void TrkLevel2::LoadField(TString path){
1054 //
1055 strcpy(path_.path,path.Data());
1056 path_.pathlen = path.Length();
1057 path_.error = 0;
1058 readb_();
1059 //
1060 };
1061 //--------------------------------------
1062 //
1063 //
1064 //--------------------------------------
1065 /**
1066 * Get tracker-plane (mechanical) z-coordinate
1067 * @param plane_id plane index (1=TOP,2,3,4,5,6=BOTTOM)
1068 */
1069 Float_t TrkLevel2::GetZTrk(Int_t plane_id){
1070 switch(plane_id){
1071 case 1: return ZTRK1;
1072 case 2: return ZTRK2;
1073 case 3: return ZTRK3;
1074 case 4: return ZTRK4;
1075 case 5: return ZTRK5;
1076 case 6: return ZTRK6;
1077 default: return 0.;
1078 };
1079 };
1080 //--------------------------------------
1081 //
1082 //
1083 //--------------------------------------
1084 /**
1085 * Trajectory default constructor.
1086 * (By default is created with z-coordinates inside the tracking volume)
1087 */
1088 Trajectory::Trajectory(){
1089 npoint = 10;
1090 x = new float[npoint];
1091 y = new float[npoint];
1092 z = new float[npoint];
1093 thx = new float[npoint];
1094 thy = new float[npoint];
1095 tl = new float[npoint];
1096 float dz = ((ZTRK1)-(ZTRK6))/(npoint-1);
1097 for(int i=0; i<npoint; i++){
1098 x[i] = 0;
1099 y[i] = 0;
1100 z[i] = (ZTRK1) - i*dz;
1101 thx[i] = 0;
1102 thy[i] = 0;
1103 tl[i] = 0;
1104 }
1105 }
1106 //--------------------------------------
1107 //
1108 //
1109 //--------------------------------------
1110 /**
1111 * Trajectory constructor.
1112 * (By default is created with z-coordinates inside the tracking volume)
1113 * \param n Number of points
1114 */
1115 Trajectory::Trajectory(int n){
1116 if(n<=0){
1117 cout << "NB! Trajectory must have at least 1 point >>> created with 10 points" << endl;
1118 n=10;
1119 }
1120 npoint = n;
1121 x = new float[npoint];
1122 y = new float[npoint];
1123 z = new float[npoint];
1124 thx = new float[npoint];
1125 thy = new float[npoint];
1126 tl = new float[npoint];
1127 float dz = ((ZTRK1)-(ZTRK6))/(npoint-1);
1128 for(int i=0; i<npoint; i++){
1129 x[i] = 0;
1130 y[i] = 0;
1131 z[i] = (ZTRK1) - i*dz;
1132 thx[i] = 0;
1133 thy[i] = 0;
1134 tl[i] = 0;
1135 }
1136 }
1137 //--------------------------------------
1138 //
1139 //
1140 //--------------------------------------
1141 /**
1142 * Trajectory constructor.
1143 * \param n Number of points
1144 * \param pz Pointer to float array, defining z coordinates
1145 */
1146 Trajectory::Trajectory(int n, float* zin){
1147 npoint = 10;
1148 if(n>0)npoint = n;
1149 x = new float[npoint];
1150 y = new float[npoint];
1151 z = new float[npoint];
1152 thx = new float[npoint];
1153 thy = new float[npoint];
1154 tl = new float[npoint];
1155 int i=0;
1156 do{
1157 x[i] = 0;
1158 y[i] = 0;
1159 z[i] = zin[i];
1160 thx[i] = 0;
1161 thy[i] = 0;
1162 tl[i] = 0;
1163 i++;
1164 }while(zin[i-1] > zin[i] && i < npoint);
1165 npoint=i;
1166 if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl;
1167 }
1168 void Trajectory::Delete(){
1169
1170 if(x) delete [] x;
1171 if(y) delete [] y;
1172 if(z) delete [] z;
1173 if(thx) delete [] thx;
1174 if(thy) delete [] thy;
1175 if(tl) delete [] tl;
1176
1177 }
1178 //--------------------------------------
1179 //
1180 //
1181 //--------------------------------------
1182 /**
1183 * Dump the trajectory coordinates.
1184 */
1185 void Trajectory::Dump(){
1186 cout <<endl<< "Trajectory ========== "<<endl;
1187 for (int i=0; i<npoint; i++){
1188 cout << i <<" >> " << x[i] <<" "<< y[i] <<" "<< z[i] ;
1189 cout <<" -- " << thx[i] <<" "<< thy[i] ;
1190 cout <<" -- " << tl[i] << endl;
1191 };
1192 }
1193 //--------------------------------------
1194 //
1195 //
1196 //--------------------------------------
1197 /**
1198 * Get trajectory length between two points
1199 * @param ifirst first point (default 0)
1200 * @param ilast last point (default npoint)
1201 */
1202 float Trajectory::GetLength(int ifirst, int ilast){
1203 if( ifirst<0 ) ifirst = 0;
1204 if( ilast>=npoint) ilast = npoint-1;
1205 float l=0;
1206 for(int i=ifirst;i<=ilast;i++){
1207 l=l+tl[i];
1208 };
1209 if(z[ilast] > ZINI)l=l-tl[ilast];
1210 if(z[ifirst] < ZINI) l=l-tl[ifirst];
1211
1212 return l;
1213
1214 }
1215
1216 /**
1217 * Evaluates the trajectory in the apparatus associated to the track.
1218 * It integrates the equations of motion in the magnetic field. The magnetic field should be previously loaded ( by calling TrkLevel2::LoadField() ), otherwise an error message is returned.
1219 * @param t pointer to an object of the class Trajectory,
1220 * which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ).
1221 * @return error flag.
1222 */
1223 int Trajectory::DoTrack2(float* al){
1224
1225 double *dxout = new double[npoint];
1226 double *dyout = new double[npoint];
1227 double *dthxout = new double[npoint];
1228 double *dthyout = new double[npoint];
1229 double *dtlout = new double[npoint];
1230 double *dzin = new double[npoint];
1231 double dal[5];
1232
1233 int ifail = 0;
1234
1235 for (int i=0; i<5; i++) dal[i] = (double)al[i];
1236 for (int i=0; i<npoint; i++) dzin[i] = (double)z[i];
1237
1238 dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);
1239
1240 for (int i=0; i<npoint; i++){
1241 x[i] = (float)*dxout++;
1242 y[i] = (float)*dyout++;
1243 thx[i] = (float)*dthxout++;
1244 thy[i] = (float)*dthyout++;
1245 tl[i] = (float)*dtlout++;
1246 }
1247
1248 return ifail;
1249 };
1250
1251 ClassImp(TrkLevel2);
1252 ClassImp(TrkSinglet);
1253 ClassImp(TrkTrack);
1254 ClassImp(Trajectory);

  ViewVC Help
Powered by ViewVC 1.1.23