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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.23 by pam-fi, Tue Jan 16 10:03:48 2007 UTC revision 1.32 by pam-fi, Fri Apr 27 10:39:57 2007 UTC
# Line 12  using namespace std; Line 12  using namespace std;
12  extern "C" {      extern "C" {    
13      void dotrack_(int*, double*, double*, double*, double*, int*);      void dotrack_(int*, double*, double*, double*, double*, int*);
14      void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*);      void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*);
15  //    int  readb_(const char*);       void mini2_(int*,int*,int*);
16      int  readb_();       void guess_();
17      void mini2_(int*,int*,int*);       void gufld_(float*, float*);
     void guess_();  
18  }  }
19    
20  //--------------------------------------  //--------------------------------------
21  //  //
22  //  //
# Line 39  TrkTrack::TrkTrack(){ Line 39  TrkTrack::TrkTrack(){
39          zm[ip]     = 0;          zm[ip]     = 0;
40          resx[ip]   = 0;          resx[ip]   = 0;
41          resy[ip]   = 0;          resy[ip]   = 0;
42            tailx[ip]   = 0;
43            taily[ip]   = 0;
44          xv[ip]     = 0;          xv[ip]     = 0;
45          yv[ip]     = 0;          yv[ip]     = 0;
46          zv[ip]     = 0;          zv[ip]     = 0;
# Line 47  TrkTrack::TrkTrack(){ Line 49  TrkTrack::TrkTrack(){
49          dedx_x[ip] = 0;          dedx_x[ip] = 0;
50          dedx_y[ip] = 0;          dedx_y[ip] = 0;
51      };      };
52      clx = 0;  //    clx = 0;
53      cly = 0;  //    cly = 0;
54  //    clx = new TRefArray(6,0);  //    clx = new TRefArray(6,0); //forse causa memory leak???
55  //    cly = new TRefArray(6,0);  //    cly = new TRefArray(6,0); //forse causa memory leak???
56    //    clx = TRefArray(6,0);
57    //    cly = TRefArray(6,0);
58    
59  };  };
60  //--------------------------------------  //--------------------------------------
61  //  //
# Line 73  TrkTrack::TrkTrack(const TrkTrack& t){ Line 78  TrkTrack::TrkTrack(const TrkTrack& t){
78          zm[ip]     = t.zm[ip];          zm[ip]     = t.zm[ip];
79          resx[ip]   = t.resx[ip];          resx[ip]   = t.resx[ip];
80          resy[ip]   = t.resy[ip];          resy[ip]   = t.resy[ip];
81            tailx[ip]  = t.tailx[ip];
82            taily[ip]  = t.taily[ip];
83          xv[ip]     = t.xv[ip];          xv[ip]     = t.xv[ip];
84          yv[ip]     = t.yv[ip];          yv[ip]     = t.yv[ip];
85          zv[ip]     = t.zv[ip];          zv[ip]     = t.zv[ip];
# Line 81  TrkTrack::TrkTrack(const TrkTrack& t){ Line 88  TrkTrack::TrkTrack(const TrkTrack& t){
88          dedx_x[ip] = t.dedx_x[ip];          dedx_x[ip] = t.dedx_x[ip];
89          dedx_y[ip] = t.dedx_y[ip];          dedx_y[ip] = t.dedx_y[ip];
90      };      };
91      clx = 0;  //    clx = 0;
92      cly = 0;  //    cly = 0;
93      if(t.clx)clx = new TRefArray(*(t.clx));  //    if(t.clx)clx = new TRefArray(*(t.clx));
94      if(t.cly)cly = new TRefArray(*(t.cly));  //    if(t.cly)cly = new TRefArray(*(t.cly));
95            //    clx = TRefArray(t.clx);
96    //    cly = TRefArray(t.cly);
97    
98  };  };
99  //--------------------------------------  //--------------------------------------
100  //  //
# Line 109  void TrkTrack::Copy(TrkTrack& t){ Line 118  void TrkTrack::Copy(TrkTrack& t){
118          t.zm[ip]     = zm[ip];          t.zm[ip]     = zm[ip];
119          t.resx[ip]   = resx[ip];          t.resx[ip]   = resx[ip];
120          t.resy[ip]   = resy[ip];          t.resy[ip]   = resy[ip];
121            t.tailx[ip]  = tailx[ip];
122            t.taily[ip]  = taily[ip];
123          t.xv[ip]     = xv[ip];          t.xv[ip]     = xv[ip];
124          t.yv[ip]     = yv[ip];          t.yv[ip]     = yv[ip];
125          t.zv[ip]     = zv[ip];          t.zv[ip]     = zv[ip];
# Line 118  void TrkTrack::Copy(TrkTrack& t){ Line 129  void TrkTrack::Copy(TrkTrack& t){
129          t.dedx_y[ip] = dedx_y[ip];          t.dedx_y[ip] = dedx_y[ip];
130                            
131      };      };
132    
133    //    t.clx = TRefArray(clx);
134    //    t.cly = TRefArray(cly);
135            
136  };  };
137  //--------------------------------------  //--------------------------------------
# Line 143  int TrkTrack::DoTrack(Trajectory* t){ Line 157  int TrkTrack::DoTrack(Trajectory* t){
157      for (int i=0; i<5; i++)         dal[i]  = (double)al[i];      for (int i=0; i<5; i++)         dal[i]  = (double)al[i];
158      for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i];      for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i];
159    
160        TrkParams::Load(1);
161        if( !TrkParams::IsLoaded(1) ){
162            cout << "int TrkTrack::DoTrack(Trajectory* t) --- ERROR --- m.field not loaded"<<endl;
163            return 0;
164        }
165      dotrack_(&(t->npoint),dzin,dxout,dyout,dal,&ifail);      dotrack_(&(t->npoint),dzin,dxout,dyout,dal,&ifail);
166            
167      for (int i=0; i<t->npoint; i++){      for (int i=0; i<t->npoint; i++){
# Line 182  int TrkTrack::DoTrack2(Trajectory* t){ Line 201  int TrkTrack::DoTrack2(Trajectory* t){
201      for (int i=0; i<5; i++)         dal[i]  = (double)al[i];      for (int i=0; i<5; i++)         dal[i]  = (double)al[i];
202      for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i];      for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i];
203    
204        TrkParams::Load(1);
205        if( !TrkParams::IsLoaded(1) ){
206            cout << "int TrkTrack::DoTrack2(Trajectory* t) --- ERROR --- m.field not loaded"<<endl;
207            return 0;
208        }
209      dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);      dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);
210            
211      for (int i=0; i<t->npoint; i++){      for (int i=0; i<t->npoint; i++){
# Line 221  Float_t TrkTrack::GetDeflection(){ Line 245  Float_t TrkTrack::GetDeflection(){
245          return def;          return def;
246  };  };
247  //  //
248  Float_t TrkTrack::GetDEDX(){  /**
249          Float_t dedx=0;   * Method to retrieve the dE/dx measured on a tracker view.
250          for(Int_t i=0; i<6; i++)dedx+=dedx_x[i]*xgood[i]+dedx_y[i]*ygood[i];   * @param ip plane (0-5)
251          dedx = dedx/(this->GetNX()+this->GetNY());   * @param iv view (0=x 1=y)
252          return dedx;   */
253    Float_t TrkTrack::GetDEDX(int ip, int iv){
254        if(iv==0 && ip>=0 && ip<6)return fabs(dedx_x[ip]);
255        else if(iv==1 && ip>=0 && ip<6)return fabs(dedx_y[ip]);
256        else {
257            cout << "TrkTrack::GetDEDX(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
258            return 0.;
259        }
260    }
261    /**
262     * Method to evaluate the dE/dx measured on a tracker plane.
263     * The two measurements on x- and y-view are averaged.
264     * @param ip plane (0-5)
265     */
266    Float_t TrkTrack::GetDEDX(int ip){
267        if( (Int_t)XGood(ip)+(Int_t)YGood(ip) == 0 ) return 0;
268        return (GetDEDX(ip,0)+GetDEDX(ip,1))/((Int_t)XGood(ip)+(Int_t)YGood(ip));
269  };  };
270    
271    /**
272     * Method to evaluate the dE/dx averaged over all planes.
273     */
274    Float_t TrkTrack::GetDEDX(){
275        Float_t dedx=0;
276        for(Int_t ip=0; ip<6; ip++)dedx+=GetDEDX(ip,0)*XGood(ip)+GetDEDX(ip,1)*YGood(ip);
277        dedx = dedx/(GetNX()+GetNY());
278        return dedx;
279    };
280    /**
281     * Returns 1 if the cluster on a tracker view includes bad strips.
282     * @param ip plane (0-5)
283     * @param iv view (0=x 1=y)
284     */
285    Bool_t TrkTrack::IsBad(int ip,int iv){
286        if(iv==0 && ip>=0 && ip<6)return (xgood[ip]<0) ;
287        else if(iv==1 && ip>=0 && ip<6)return (ygood[ip]<0) ;
288        else {
289            cout << "TrkTrack::IsBad(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
290            return 0.;
291        }
292    };
293    /**
294     * Returns 1 if the signal on a tracker view is saturated.
295     * @param ip plane (0-5)
296     * @param iv view (0=x 1=y)
297     */
298    Bool_t TrkTrack::IsSaturated(int ip,int iv){
299        if(iv==0 && ip>=0 && ip<6)return (dedx_x[ip]<0) ;
300        else if(iv==1 && ip>=0 && ip<6)return (dedx_y[ip]<0) ;
301        else {
302            cout << "TrkTrack::IsSaturated(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
303            return 0.;
304        }
305    };
306    /**
307     * Returns 1 if either the x or the y signal on a tracker plane is saturated.
308     * @param ip plane (0-5)
309     */
310    Bool_t TrkTrack::IsSaturated(int ip){
311        return (IsSaturated(ip,0)||IsSaturated(ip,1));
312    };
313    /**
314     * Returns 1 if there is at least a saturated signal along the track.
315     */
316    Bool_t TrkTrack::IsSaturated(){
317        for(int ip=0; ip<6; ip++)for(int iv=0; iv<2; iv++)if(IsSaturated(ip,iv))return true;
318        return false;
319    }
320    /**
321     * Returns the track "lever-arm" on the x view, defined as the distance (in planes) between
322     * the upper and lower x measurements (the maximum value of lever-arm is 6).
323     */
324    Int_t TrkTrack::GetLeverArmX(){
325        int first_plane = -1;
326        int last_plane  = -1;
327        for(Int_t ip=0; ip<6; ip++){
328            if( XGood(ip) && first_plane == -1 )first_plane = ip;
329            if( XGood(ip) && first_plane != -1 )last_plane = ip;
330        }
331        if( first_plane == -1 || last_plane == -1){
332            cout<< "Int_t TrkTrack::GetLeverArmX() -- XGood(ip) always false ??? "<<endl;
333            return 0;
334        }
335        return (last_plane-first_plane+1);
336    }
337    /**
338     * Returns the track "lever-arm" on the y view, defined as the distance (in planes) between
339     * the upper and lower y measurements (the maximum value of lever-arm is 6).
340     */
341    Int_t TrkTrack::GetLeverArmY(){
342        int first_plane = -1;
343        int last_plane  = -1;
344        for(Int_t ip=0; ip<6; ip++){
345            if( YGood(ip) && first_plane == -1 )first_plane = ip;
346            if( YGood(ip) && first_plane != -1 )last_plane = ip;
347        }
348        if( first_plane == -1 || last_plane == -1){
349            cout<< "Int_t TrkTrack::GetLeverArmY() -- YGood(ip) always false ??? "<<endl;
350            return 0;
351        }
352        return (last_plane-first_plane+1);
353    }
354  //--------------------------------------  //--------------------------------------
355  //  //
356  //  //
# Line 239  void TrkTrack::Dump(){ Line 362  void TrkTrack::Dump(){
362      cout << endl << "al       : "; for(int i=0; i<5; i++)cout << al[i] << " ";      cout << endl << "al       : "; for(int i=0; i<5; i++)cout << al[i] << " ";
363      cout << endl << "chi^2    : "<< chi2;      cout << endl << "chi^2    : "<< chi2;
364      cout << endl << "n.step   : "<< nstep;      cout << endl << "n.step   : "<< nstep;
365      cout << endl << "xgood    : "; for(int i=0; i<6; i++)cout << xgood[i] ;      cout << endl << "xgood    : "; for(int i=0; i<6; i++)cout << XGood(i) ;
366      cout << endl << "ygood    : "; for(int i=0; i<6; i++)cout << ygood[i] ;      cout << endl << "ygood    : "; for(int i=0; i<6; i++)cout << YGood(i) ;
367      cout << endl << "xm       : "; for(int i=0; i<6; i++)cout << xm[i] << " ";      cout << endl << "xm       : "; for(int i=0; i<6; i++)cout << xm[i] << " ";
368      cout << endl << "ym       : "; for(int i=0; i<6; i++)cout << ym[i] << " ";      cout << endl << "ym       : "; for(int i=0; i<6; i++)cout << ym[i] << " ";
369      cout << endl << "zm       : "; for(int i=0; i<6; i++)cout << zm[i] << " ";      cout << endl << "zm       : "; for(int i=0; i<6; i++)cout << zm[i] << " ";
# Line 277  void TrkTrack::SetResolution(double *rx, Line 400  void TrkTrack::SetResolution(double *rx,
400   * Set the TrkTrack good measurement   * Set the TrkTrack good measurement
401   */   */
402  void TrkTrack::SetGood(int *xg, int *yg){  void TrkTrack::SetGood(int *xg, int *yg){
403        // NB! si perdera` l'informazione sul numero del cluster
404      for(int i=0; i<6; i++) xgood[i]=*xg++;      for(int i=0; i<6; i++) xgood[i]=*xg++;
405      for(int i=0; i<6; i++) ygood[i]=*yg++;      for(int i=0; i<6; i++) ygood[i]=*yg++;
406  }  }
# Line 286  void TrkTrack::SetGood(int *xg, int *yg) Line 410  void TrkTrack::SetGood(int *xg, int *yg)
410   */   */
411  void TrkTrack::LoadField(TString path){  void TrkTrack::LoadField(TString path){
412            
413      strcpy(path_.path,path.Data());  //     strcpy(path_.path,path.Data());
414      path_.pathlen = path.Length();  //     path_.pathlen = path.Length();
415      path_.error   = 0;  //     path_.error   = 0;
416      readb_();  //     readb_();
417    
418        TrkParams::Set(path,1);
419        TrkParams::Load(1);
420    
421  };  };
422    
423    
424  /**  /**
425   * Method to fill minimization-routine common   * Method to fill minimization-routine common
426   */   */
# Line 300  void TrkTrack::FillMiniStruct(cMini2trac Line 428  void TrkTrack::FillMiniStruct(cMini2trac
428    
429      for(int i=0; i<6; i++){      for(int i=0; i<6; i++){
430    
431          track.xgood[i]=xgood[i];  //      track.xgood[i]=xgood[i];
432          track.ygood[i]=ygood[i];  //      track.ygood[i]=ygood[i];
433            track.xgood[i]=XGood(i);
434            track.ygood[i]=YGood(i);
435                    
436          track.xm[i]=xm[i];          track.xm[i]=xm[i];
437          track.ym[i]=ym[i];          track.ym[i]=ym[i];
# Line 314  void TrkTrack::FillMiniStruct(cMini2trac Line 444  void TrkTrack::FillMiniStruct(cMini2trac
444          track.xm_b[i]=xm[i];          track.xm_b[i]=xm[i];
445          track.ym_a[i]=ym[i];          track.ym_a[i]=ym[i];
446          track.ym_b[i]=ym[i];          track.ym_b[i]=ym[i];
447          if(       xgood[i] && !ygood[i] ){          if(       XGood(i) && !YGood(i) ){
448              track.ym_a[i] = track.ym_a[i]+segment;              track.ym_a[i] = track.ym_a[i]+segment;
449              track.ym_b[i] = track.ym_b[i]-segment;              track.ym_b[i] = track.ym_b[i]-segment;
450          }else if( !xgood[i] && ygood[i]){          }else if( !XGood(i) && YGood(i)){
451              track.xm_a[i] = track.xm_a[i]+segment;              track.xm_a[i] = track.xm_a[i]+segment;
452              track.xm_b[i] = track.xm_b[i]-segment;              track.xm_b[i] = track.xm_b[i]-segment;
453          }          }
# Line 353  void TrkTrack::SetFromMiniStruct(cMini2t Line 483  void TrkTrack::SetFromMiniStruct(cMini2t
483          axv[i] = track->axv[i];          axv[i] = track->axv[i];
484          ayv[i] = track->ayv[i];          ayv[i] = track->ayv[i];
485      }      }
   
486            
487  }  }
488  /**  /**
# Line 385  void TrkTrack::Fit(double pfixed, int& f Line 514  void TrkTrack::Fit(double pfixed, int& f
514    
515      //  ------------------------------------------      //  ------------------------------------------
516      //  call mini routine      //  call mini routine
517        TrkParams::Load(1);
518        if( !TrkParams::IsLoaded(1) ){
519            cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl;
520            return;
521        }
522      int istep=0;      int istep=0;
523      int ifail=0;      int ifail=0;
524      mini2_(&istep,&ifail, &iprint);      mini2_(&istep,&ifail, &iprint);
# Line 431  void TrkTrack::FitReset(){ Line 565  void TrkTrack::FitReset(){
565          for(int j=0; j<5; j++) coval[i][j]=0.;          for(int j=0; j<5; j++) coval[i][j]=0.;
566      }      }
567  }  }
568    /*
569     * Set the tracking mode
570     */
571    void TrkTrack::SetTrackingMode(int trackmode){
572        extern cMini2track track_;
573        track_.trackmode = trackmode;
574    }
575    /*
576     * Set the factor scale for tracking precision
577     */
578    void TrkTrack::SetPrecisionFactor(double fact){
579        extern cMini2track track_;
580        track_.fact = fact;
581    }
582    /*
583     * Set the factor scale for tracking precision
584     */
585    void TrkTrack::SetStepMin(int istepmin){
586        extern cMini2track track_;
587        track_.istepmin = istepmin;
588    }
589    
590    
591    /*
592     * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track.
593     * If no cluster is associated, ID=-1.
594     * @param ip Tracker plane (0-5)
595     */
596    Int_t TrkTrack::GetClusterX_ID(int ip){
597        return ((Int_t)fabs(xgood[ip]))%10000000-1;
598    };
599    /*
600     * Method to retrieve ID (0-xxx) of y-cluster (if any) associated to this track.
601     * If no cluster is associated, ID=-1.
602     * @param ip Tracker plane (0-5)
603     */
604    Int_t TrkTrack::GetClusterY_ID(int ip){
605        return ((Int_t)fabs(ygood[ip]))%10000000-1;
606    };
607    /*
608     * Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane.
609     * If no ladder is traversed (dead area) the metod retuns -1.
610     * @param ip Tracker plane (0-5)
611     */
612    Int_t TrkTrack::GetLadder(int ip){
613        if(XGood(ip))return (Int_t)fabs(xgood[ip]/100000000)-1;
614        if(YGood(ip))return (Int_t)fabs(ygood[ip]/100000000)-1;
615        return -1;
616    };
617    /*
618     * Method to retrieve the sensor (0-1, increasing y) traversed by the track on this plane.
619     * If no sensor is traversed (dead area) the metod retuns -1.
620     * @param ip Tracker plane (0-5)
621     */
622    Int_t TrkTrack::GetSensor(int ip){
623        if(XGood(ip))return (Int_t)((Int_t)fabs(xgood[ip]/10000000)%10)-1;
624        if(YGood(ip))return (Int_t)((Int_t)fabs(ygood[ip]/10000000)%10)-1;
625        return -1;
626    };
627    
628    
629  //--------------------------------------  //--------------------------------------
630  //  //
# Line 454  void TrkTrack::Clear(){ Line 648  void TrkTrack::Clear(){
648          zm[ip]     = 0;          zm[ip]     = 0;
649          resx[ip]   = 0;          resx[ip]   = 0;
650          resy[ip]   = 0;          resy[ip]   = 0;
651            tailx[ip]  = 0;
652            taily[ip]  = 0;
653          xv[ip]     = 0;          xv[ip]     = 0;
654          yv[ip]     = 0;          yv[ip]     = 0;
655          zv[ip]     = 0;          zv[ip]     = 0;
# Line 463  void TrkTrack::Clear(){ Line 659  void TrkTrack::Clear(){
659          dedx_y[ip] = 0;          dedx_y[ip] = 0;
660    
661      };      };
662      if(clx)clx->Clear();  //     if(clx)clx->Clear();
663      if(cly)cly->Clear();  //     if(cly)cly->Clear();
664    //    clx.Clear();
665    //    cly.Clear();
666  };  };
667  //--------------------------------------  //--------------------------------------
668  //  //
# Line 472  void TrkTrack::Clear(){ Line 670  void TrkTrack::Clear(){
670  //--------------------------------------  //--------------------------------------
671  void TrkTrack::Delete(){  void TrkTrack::Delete(){
672  //    cout << "TrkTrack::Delete()"<<endl;  //    cout << "TrkTrack::Delete()"<<endl;
673  //    Clear();      Clear();
674      if(clx)delete clx;  //    if(clx)delete clx;
675      if(cly)delete cly;  //    if(cly)delete cly;
676  };  };
677  //--------------------------------------  //--------------------------------------
678  //  //
# Line 504  TrkSinglet::TrkSinglet(const TrkSinglet& Line 702  TrkSinglet::TrkSinglet(const TrkSinglet&
702      coord[1] = s.coord[1];      coord[1] = s.coord[1];
703      sgnl     = s.sgnl;      sgnl     = s.sgnl;
704  //      cls      = 0;//<<<<pointer  //      cls      = 0;//<<<<pointer
705      cls      = TRef(s.cls);  //    cls      = TRef(s.cls);
706  };  };
707  //--------------------------------------  //--------------------------------------
708  //  //
# Line 535  void TrkSinglet::Clear(){ Line 733  void TrkSinglet::Clear(){
733  //  //
734  //--------------------------------------  //--------------------------------------
735  TrkLevel2::TrkLevel2(){  TrkLevel2::TrkLevel2(){
736      cout <<"TrkLevel2::TrkLevel2()"<<endl;    //    cout <<"TrkLevel2::TrkLevel2()"<<endl;
737      for(Int_t i=0; i<12 ; i++){      for(Int_t i=0; i<12 ; i++){
738                  good[i] = -1;          good[i] = -1;
739          };          VKmask[i] = 0;
740  // okkio!! memory-leak          VKflag[i] = 0;  
741  //     Track    = new TClonesArray("TrkTrack");      };
 //     SingletX = new TClonesArray("TrkSinglet");  
 //     SingletY = new TClonesArray("TrkSinglet");  
742      Track    = 0;      Track    = 0;
743      SingletX = 0;      SingletX = 0;
744      SingletY = 0;      SingletY = 0;
# Line 569  void TrkLevel2::Dump(){ Line 765  void TrkLevel2::Dump(){
765      cout << endl << "ntrk()   : " << this->ntrk() ;      cout << endl << "ntrk()   : " << this->ntrk() ;
766      cout << endl << "nclsx()  : " << this->nclsx();      cout << endl << "nclsx()  : " << this->nclsx();
767      cout << endl << "nclsy()  : " << this->nclsy();      cout << endl << "nclsy()  : " << this->nclsy();
 //     TClonesArray &t  = *Track;  
 //     TClonesArray &sx = *SingletX;  
 //     TClonesArray &sy = *SingletY;  
 //     for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();  
 //     for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();  
 //     for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();  
768      if(Track){      if(Track){
769          TClonesArray &t  = *Track;          TClonesArray &t  = *Track;
770          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();
# Line 593  void TrkLevel2::Dump(){ Line 783  void TrkLevel2::Dump(){
783  //  //
784  //--------------------------------------  //--------------------------------------
785  /**  /**
786   * Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common).   * The method returns false if the viking-chip was masked  
787     * either apriori ,on the basis of the mask read from the DB,
788     * or run-by-run, on the basis of the calibration parameters)
789     * @param iv Tracker view (0-11)
790     * @param ivk Viking-chip number (0-23)
791     */
792    Bool_t TrkLevel2::GetVKMask(int iv, int ivk){
793        Int_t whichbit = (Int_t)pow(2,ivk);
794        return (whichbit&VKmask[iv])!=0;    
795    }
796    /**
797     * The method returns false if the viking-chip was masked  
798     * for this event due to common-noise computation failure.
799     * @param iv Tracker view (0-11)
800     * @param ivk Viking-chip number (0-23)
801     */
802    Bool_t TrkLevel2::GetVKFlag(int iv, int ivk){
803        Int_t whichbit = (Int_t)pow(2,ivk);
804        return (whichbit&VKflag[iv])!=0;    
805    }
806    /**
807     * The method returns true if the viking-chip was masked, either
808     * forced (see TrkLevel2::GetVKMask(int,int)) or
809     * for this event only (TrkLevel2::GetVKFlag(int,int)).
810     * @param iv Tracker view (0-11)
811     * @param ivk Viking-chip number (0-23)
812   */   */
813  void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){
814        return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );
815    };
816    
817          //  temporary objects:  //--------------------------------------
818    //
819    //
820    //--------------------------------------
821    /**
822     * Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common).
823     * Ref to Level1 data (clusters) is also set. If l1==NULL no references are set.
824     * (NB It make sense to set references only if events are stored in a tree that contains also the Level1 branch)
825     */
826    void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){
827    
828    //    cout << "void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1)"<<endl;
829        Clear();
830    
831    //  temporary objects:
832      TrkSinglet* t_singlet = new TrkSinglet();      TrkSinglet* t_singlet = new TrkSinglet();
833      TrkTrack*   t_track   = new TrkTrack();      TrkTrack*   t_track   = new TrkTrack();
834    
835          //  **** general variables ****  //  -----------------
836  //    good2 = l2->good2;  //  general variables
837    //  -----------------
838      for(Int_t i=0; i<12 ; i++){      for(Int_t i=0; i<12 ; i++){
839  //              crc[i] = l2->crc[i];          good[i] = l2->good[i];
840                  good[i] = l2->good[i];          VKmask[i]=0;
841            VKflag[i]=0;
842            for(Int_t ii=0; ii<24 ; ii++){
843                Int_t setbit = (Int_t)pow(2,ii);
844                if( l2->vkflag[ii][i]!=-1 )VKmask[i]=VKmask[i]|setbit;
845                if( l2->vkflag[ii][i]!=0  )VKflag[i]=VKflag[i]|setbit;
846          };          };
847          //  *** TRACKS ***      };
848    //  --------------
849    //  *** TRACKS ***
850    //  --------------
851      if(!Track) Track = new TClonesArray("TrkTrack");      if(!Track) Track = new TClonesArray("TrkTrack");
852      TClonesArray &t = *Track;      TClonesArray &t = *Track;
853    
854      for(int i=0; i<l2->ntrk; i++){      for(int i=0; i<l2->ntrk; i++){
855          t_track->seqno = i;// NBNBNBNB deve sempre essere = i          t_track->seqno = i;// NBNBNBNB deve sempre essere = i
856          t_track->image = l2->image[i]-1;          t_track->image = l2->image[i]-1;
         //      cout << "track "<<i<<t_track->seqno << t_track->image<<endl;  
857          t_track->chi2  = l2->chi2_nt[i];          t_track->chi2  = l2->chi2_nt[i];
858          t_track->nstep = l2->nstep_nt[i];          t_track->nstep = l2->nstep_nt[i];
859          for(int it1=0;it1<5;it1++){          for(int it1=0;it1<5;it1++){
# Line 622  void TrkLevel2::SetFromLevel2Struct(cTrk Line 862  void TrkLevel2::SetFromLevel2Struct(cTrk
862                  t_track->coval[it1][it2] = l2->coval[i][it2][it1];                  t_track->coval[it1][it2] = l2->coval[i][it2][it1];
863          };          };
864          for(int ip=0;ip<6;ip++){          for(int ip=0;ip<6;ip++){
865              t_track->xgood[ip]  = l2->xgood_nt[i][ip];              // ---------------------------------
866              t_track->ygood[ip]  = l2->ygood_nt[i][ip];              // new implementation of xgood/ygood
867                // ---------------------------------
868                t_track->xgood[ip]  = l2->cltrx[i][ip]; //cluster ID
869                t_track->ygood[ip]  = l2->cltry[i][ip]; //cluster ID
870                t_track->xgood[ip] += 10000000*l2->ls[i][ip]; // ladder+sensor
871                t_track->ygood[ip] += 10000000*l2->ls[i][ip]; // ladder+sensor
872                if(l2->xbad[i][ip]>0)t_track->xgood[ip]=-t_track->xgood[ip];
873                if(l2->ybad[i][ip]>0)t_track->ygood[ip]=-t_track->ygood[ip];
874    //          if(l2->xbad[i][ip]>0 || l2->ybad[i][ip]>0){
875    //          if(l2->dedx_x[i][ip]<0 || l2->dedx_y[i][ip]<0){
876    //              cout << ip << " - "<< l2->cltrx[i][ip] << " "<<l2->cltry[i][ip]<<" "<<l2->ls[i][ip]<<endl;
877    //              cout << ip << " - "<<t_track->xgood[ip]<<" "<<t_track->ygood[ip]<<endl;
878    //              cout << ip << " - "<<t_track->GetClusterX_ID(ip)<<" "<<t_track->GetClusterY_ID(ip)<<" "<<t_track->GetLadder(ip)<<" "<<t_track->GetSensor(ip)<<endl;
879    //              cout << ip << " - "<<t_track->BadClusterX(ip)<<" "<<t_track->BadClusterY(ip)<<endl;
880    //              cout << ip << " - "<<t_track->SaturatedClusterX(ip)<<" "<<t_track->SaturatedClusterY(ip)<<endl;
881    //          }
882              t_track->xm[ip]     = l2->xm_nt[i][ip];              t_track->xm[ip]     = l2->xm_nt[i][ip];
883              t_track->ym[ip]     = l2->ym_nt[i][ip];              t_track->ym[ip]     = l2->ym_nt[i][ip];
884              t_track->zm[ip]     = l2->zm_nt[i][ip];              t_track->zm[ip]     = l2->zm_nt[i][ip];
885              t_track->resx[ip]   = l2->resx_nt[i][ip];              t_track->resx[ip]   = l2->resx_nt[i][ip];
886              t_track->resy[ip]   = l2->resy_nt[i][ip];              t_track->resy[ip]   = l2->resy_nt[i][ip];
887                t_track->tailx[ip]  = l2->tailx[i][ip];
888                t_track->taily[ip]  = l2->taily[i][ip];
889              t_track->xv[ip]     = l2->xv_nt[i][ip];              t_track->xv[ip]     = l2->xv_nt[i][ip];
890              t_track->yv[ip]     = l2->yv_nt[i][ip];              t_track->yv[ip]     = l2->yv_nt[i][ip];
891              t_track->zv[ip]     = l2->zv_nt[i][ip];              t_track->zv[ip]     = l2->zv_nt[i][ip];
# Line 636  void TrkLevel2::SetFromLevel2Struct(cTrk Line 893  void TrkLevel2::SetFromLevel2Struct(cTrk
893              t_track->ayv[ip]    = l2->ayv_nt[i][ip];              t_track->ayv[ip]    = l2->ayv_nt[i][ip];
894              t_track->dedx_x[ip] = l2->dedx_x[i][ip];              t_track->dedx_x[ip] = l2->dedx_x[i][ip];
895              t_track->dedx_y[ip] = l2->dedx_y[i][ip];              t_track->dedx_y[ip] = l2->dedx_y[i][ip];
896  //                      t_track->clx[ip] = 0;              //-----------------------------------------------------
897  //                      t_track->cly[ip] = 0;              //-----------------------------------------------------
898                //-----------------------------------------------------
899                //-----------------------------------------------------
900          };          };
901    //      if(t_track->IsSaturated())t_track->Dump();
902          new(t[i]) TrkTrack(*t_track);          new(t[i]) TrkTrack(*t_track);
903          t_track->Clear();          t_track->Clear();
904      };      };
905    
906    //  ----------------
907  //  *** SINGLETS ***  //  *** SINGLETS ***
908    //  ----------------
909      if(!SingletX)SingletX = new TClonesArray("TrkSinglet");      if(!SingletX)SingletX = new TClonesArray("TrkSinglet");
910      TClonesArray &sx = *SingletX;      TClonesArray &sx = *SingletX;
911      for(int i=0; i<l2->nclsx; i++){      for(int i=0; i<l2->nclsx; i++){
# Line 650  void TrkLevel2::SetFromLevel2Struct(cTrk Line 913  void TrkLevel2::SetFromLevel2Struct(cTrk
913          t_singlet->coord[0] = l2->xs[i][0];          t_singlet->coord[0] = l2->xs[i][0];
914          t_singlet->coord[1] = l2->xs[i][1];          t_singlet->coord[1] = l2->xs[i][1];
915          t_singlet->sgnl     = l2->signlxs[i];          t_singlet->sgnl     = l2->signlxs[i];
916  //              t_singlet->cls      = 0;          //-----------------------------------------------------
917    //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);
918            //-----------------------------------------------------
919          new(sx[i]) TrkSinglet(*t_singlet);          new(sx[i]) TrkSinglet(*t_singlet);
920          t_singlet->Clear();          t_singlet->Clear();
921      }      }
# Line 661  void TrkLevel2::SetFromLevel2Struct(cTrk Line 926  void TrkLevel2::SetFromLevel2Struct(cTrk
926          t_singlet->coord[0] = l2->ys[i][0];          t_singlet->coord[0] = l2->ys[i][0];
927          t_singlet->coord[1] = l2->ys[i][1];          t_singlet->coord[1] = l2->ys[i][1];
928          t_singlet->sgnl     = l2->signlys[i];          t_singlet->sgnl     = l2->signlys[i];
929  //              t_singlet->cls      = 0;          //-----------------------------------------------------
930    //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);
931            //-----------------------------------------------------
932          new(sy[i]) TrkSinglet(*t_singlet);          new(sy[i]) TrkSinglet(*t_singlet);
933          t_singlet->Clear();          t_singlet->Clear();
934      };      };
# Line 669  void TrkLevel2::SetFromLevel2Struct(cTrk Line 936  void TrkLevel2::SetFromLevel2Struct(cTrk
936      delete t_track;      delete t_track;
937      delete t_singlet;      delete t_singlet;
938  }  }
 //--------------------------------------  
 //  
 //  
 //--------------------------------------  
 /**  
  * Fills a TrkLevel2 object with values from a struct cTrkLevel2 (to get data from F77 common).  
  * Ref to Level1 data (clusters) is also set.  
  */  
 void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1){  
   
 //  temporary objects:  
         TrkSinglet* t_singlet = new TrkSinglet();  
         TrkTrack*   t_track   = new TrkTrack();  
 // general variables  
 //      good2 = l2->good2;  
         for(Int_t i=0; i<12 ; i++){  
 //              crc[i] = l2->crc[i];  
                 good[i] = l2->good[i];  
         };  
 // *** TRACKS ***  
         if(!Track) Track = new TClonesArray("TrkTrack");  
         TClonesArray &t = *Track;  
         if(!t_track->clx)t_track->clx = new TRefArray(6,0);  
         if(!t_track->cly)t_track->cly = new TRefArray(6,0);  
         for(int i=0; i<l2->ntrk; i++){  
                 t_track->seqno = i;// NBNBNBNB deve sempre essere = i  
                 t_track->image = l2->image[i]-1;  
 //              cout << "track "<<i<<t_track->seqno << t_track->image<<endl;  
                 t_track->chi2  = l2->chi2_nt[i];  
                 t_track->nstep = l2->nstep_nt[i];  
                 for(int it1=0;it1<5;it1++){  
                         t_track->al[it1] = l2->al_nt[i][it1];  
                         for(int it2=0;it2<5;it2++)  
                                 t_track->coval[it1][it2] = l2->coval[i][it2][it1];  
                 };  
                 for(int ip=0;ip<6;ip++){  
                         t_track->xgood[ip]  = l2->xgood_nt[i][ip];  
                         t_track->ygood[ip]  = l2->ygood_nt[i][ip];  
                         t_track->xm[ip]     = l2->xm_nt[i][ip];  
                         t_track->ym[ip]     = l2->ym_nt[i][ip];  
                         t_track->zm[ip]     = l2->zm_nt[i][ip];  
                         t_track->resx[ip]   = l2->resx_nt[i][ip];  
                         t_track->resy[ip]   = l2->resy_nt[i][ip];  
                         t_track->xv[ip]     = l2->xv_nt[i][ip];  
                         t_track->yv[ip]     = l2->yv_nt[i][ip];  
                         t_track->zv[ip]     = l2->zv_nt[i][ip];  
                         t_track->axv[ip]    = l2->axv_nt[i][ip];  
                         t_track->ayv[ip]    = l2->ayv_nt[i][ip];  
                         t_track->dedx_x[ip] = l2->dedx_x[i][ip];  
                         t_track->dedx_y[ip] = l2->dedx_y[i][ip];  
 //                      cout << "traccia "<<i<<"  --  "<< ip << " "<< l2->cltrx[i][ip] <<" "<< l2->cltry[i][ip] <<" "<< t_track->xgood[ip] << t_track->ygood[ip]<<endl;  
                         //-----------------------------------------------------  
                         //-----------------------------------------------------  
                         if(t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip);  
                         if(t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip);  
 //                      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;  
 //                      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;  
                         //-----------------------------------------------------  
                         //-----------------------------------------------------  
                 };  
                 new(t[i]) TrkTrack(*t_track);  
                 t_track->Clear();  
         };  
 // *** SINGLETS ***  
         if(!SingletX)SingletX = new TClonesArray("TrkSinglet");  
         TClonesArray &sx = *SingletX;  
         for(int i=0; i<l2->nclsx; i++){  
                 t_singlet->plane    = l2->planex[i];  
                 t_singlet->coord[0] = l2->xs[i][0];  
                 t_singlet->coord[1] = l2->xs[i][1];  
                 t_singlet->sgnl     = l2->signlxs[i];  
                 //-----------------------------------------------------  
 //              cout << "singolo x "<<i<<"  --  "<<  l2->clsx[i] <<endl;  
                 t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);  
 //              cout<<" i "<<i<<" l2->clsx[i] "<<l2->clsx[i]<< " l1->GetCluster(l2->clsx[i]-1) "<<l1->GetCluster(l2->clsx[i]-1)<<endl;            
                 //-----------------------------------------------------  
                 new(sx[i]) TrkSinglet(*t_singlet);  
                 t_singlet->Clear();  
         }  
         if(!SingletY)SingletY = new TClonesArray("TrkSinglet");  
         TClonesArray &sy = *SingletY;  
         for(int i=0; i<l2->nclsy; i++){  
                 t_singlet->plane    = l2->planey[i];  
                 t_singlet->coord[0] = l2->ys[i][0];  
                 t_singlet->coord[1] = l2->ys[i][1];  
                 t_singlet->sgnl     = l2->signlys[i];  
                 //-----------------------------------------------------  
 //              cout << "singolo y "<<i<<"  --  "<<  l2->clsy[i] <<endl;  
                 t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);  
 //              cout<<" i "<<i<<" l2->clsy[i] "<<l2->clsy[i]<< " l1->GetCluster(l2->clsy[i]-1) "<<l1->GetCluster(l2->clsy[i]-1)<<endl;            
                 //-----------------------------------------------------  
                 new(sy[i]) TrkSinglet(*t_singlet);  
                 t_singlet->Clear();  
         };  
           
         delete t_track;  
         delete t_singlet;  
 }  
939  /**  /**
940   * Fills a struct cTrkLevel2 with values from a TrkLevel2 object (to put data into a F77 common).   * Fills a struct cTrkLevel2 with values from a TrkLevel2 object (to put data into a F77 common).
941   */   */
# Line 793  void TrkLevel2::GetLevel2Struct(cTrkLeve Line 962  void TrkLevel2::GetLevel2Struct(cTrkLeve
962                      l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2];                      l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2];
963              };              };
964              for(int ip=0;ip<6;ip++){              for(int ip=0;ip<6;ip++){
965                  l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->xgood[ip];                  l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->XGood(ip);
966                  l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->ygood[ip];                  l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->YGood(ip);
967                  l2->xm_nt[i][ip]    = ((TrkTrack *)Track->At(i))->xm[ip];                  l2->xm_nt[i][ip]    = ((TrkTrack *)Track->At(i))->xm[ip];
968                  l2->ym_nt[i][ip]    = ((TrkTrack *)Track->At(i))->ym[ip];                  l2->ym_nt[i][ip]    = ((TrkTrack *)Track->At(i))->ym[ip];
969                  l2->zm_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zm[ip];                  l2->zm_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zm[ip];
970                  l2->resx_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resx[ip];                  l2->resx_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resx[ip];
971                  l2->resy_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resy[ip];                  l2->resy_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resy[ip];
972                    l2->tailx[i][ip]  = ((TrkTrack *)Track->At(i))->tailx[ip];
973                    l2->taily[i][ip]  = ((TrkTrack *)Track->At(i))->taily[ip];
974                  l2->xv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->xv[ip];                  l2->xv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->xv[ip];
975                  l2->yv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->yv[ip];                  l2->yv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->yv[ip];
976                  l2->zv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zv[ip];                  l2->zv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zv[ip];
# Line 838  void TrkLevel2::GetLevel2Struct(cTrkLeve Line 1009  void TrkLevel2::GetLevel2Struct(cTrkLeve
1009  void TrkLevel2::Clear(){  void TrkLevel2::Clear(){
1010      for(Int_t i=0; i<12 ; i++){      for(Int_t i=0; i<12 ; i++){
1011          good[i] = -1;          good[i] = -1;
1012            VKflag[i] = 0;
1013            VKmask[i] = 0;
1014      };      };
1015  //    if(Track)Track->Clear("C");  //    if(Track)Track->Clear("C");
1016  //    if(SingletX)SingletX->Clear("C");  //    if(SingletX)SingletX->Clear("C");
# Line 881  TRefArray *TrkLevel2::GetTracks_NFitSort Line 1054  TRefArray *TrkLevel2::GetTracks_NFitSort
1054                    
1055      int indo=0;      int indo=0;
1056      int indi=0;      int indi=0;
1057      while(N != 0){      while(N > 0){
1058    //    while(N != 0){
1059          int nfit =0;          int nfit =0;
1060          float chi2ref = numeric_limits<float>::max();          float chi2ref = numeric_limits<float>::max();
1061                                    
# Line 892  TRefArray *TrkLevel2::GetTracks_NFitSort Line 1066  TRefArray *TrkLevel2::GetTracks_NFitSort
1066              }              }
1067          }          }
1068          //second loop to search minimum chi2 among selected          //second loop to search minimum chi2 among selected
1069          for(int i=0; i<this->ntrk(); i++){          for(int i=0; i<ntrk(); i++){
1070              Float_t chi2 = ((TrkTrack *)t[i])->chi2;              Float_t chi2 = ((TrkTrack *)t[i])->chi2;
1071              if(chi2 < 0) chi2 = chi2*1000;              if(chi2 < 0) chi2 = -chi2*1000;
1072              if(    chi2 < chi2ref              if(    chi2 < chi2ref
1073                     && ((TrkTrack *)t[i])->GetNtot() == nfit                     && ((TrkTrack *)t[i])->GetNtot() == nfit
1074                     && m[i]==1){                     && m[i]==1){
# Line 906  TRefArray *TrkLevel2::GetTracks_NFitSort Line 1080  TRefArray *TrkLevel2::GetTracks_NFitSort
1080              m[((TrkTrack *)t[indi])->image] = 0;              m[((TrkTrack *)t[indi])->image] = 0;
1081              N--;              N--;
1082                    
1083              //      cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl;  //          cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl;
1084          };          };
1085          sorted->Add( (TrkTrack*)t[indi] );                sorted->Add( (TrkTrack*)t[indi] );      
1086                                    
1087          m[indi] = 0;          m[indi] = 0;
1088  //              cout << "SORTED "<< indo << " "<< indi << " "<< N << endl;  //      cout << "SORTED "<< indo << " "<< indi << " "<< N << " "<<((TrkTrack *)t[indi])->image<<" "<<chi2ref<<endl;
1089          N--;              N--;    
1090          indo++;          indo++;
1091      }      }
1092      m.clear();      m.clear();
1093  //      cout << "GetTracks_NFitSorted(it): Done"<< endl;  //    cout << "GetTracks_NFitSorted(it): Done"<< endl;
1094    
1095      return sorted;      return sorted;
1096  //    return PhysicalTrack;  //    return PhysicalTrack;
# Line 1066  TrkTrack *TrkLevel2::GetTrackImage(int i Line 1240  TrkTrack *TrkLevel2::GetTrackImage(int i
1240   */   */
1241  void TrkLevel2::LoadField(TString path){  void TrkLevel2::LoadField(TString path){
1242  //  //
1243      strcpy(path_.path,path.Data());  //     strcpy(path_.path,path.Data());
1244      path_.pathlen = path.Length();  //     path_.pathlen = path.Length();
1245      path_.error   = 0;  //     path_.error   = 0;
1246      readb_();  //     readb_();
1247    
1248        TrkParams::Set(path,1);
1249        TrkParams::Load(1);
1250    
1251  //  //
1252  };  };
1253    /**
1254     * Get BY (kGauss)
1255     * @param v (x,y,z) coordinates in cm
1256     */
1257    float TrkLevel2::GetBX(float* v){
1258        float b[3];
1259        gufld_(v,b);
1260        return b[0]/10.;
1261    }
1262    /**
1263     * Get BY (kGauss)
1264     * @param v (x,y,z) coordinates in cm
1265     */
1266    float TrkLevel2::GetBY(float* v){
1267        float b[3];
1268        gufld_(v,b);
1269        return b[1]/10.;
1270    }
1271    /**
1272     * Get BY (kGauss)
1273     * @param v (x,y,z) coordinates in cm
1274     */
1275    float TrkLevel2::GetBZ(float* v){
1276        float b[3];
1277        gufld_(v,b);
1278        return b[2]/10.;
1279    }
1280  //--------------------------------------  //--------------------------------------
1281  //  //
1282  //  //
# Line 1249  int Trajectory::DoTrack2(float* al){ Line 1454  int Trajectory::DoTrack2(float* al){
1454      for (int i=0; i<5; i++)      dal[i]  = (double)al[i];      for (int i=0; i<5; i++)      dal[i]  = (double)al[i];
1455      for (int i=0; i<npoint; i++) dzin[i] = (double)z[i];      for (int i=0; i<npoint; i++) dzin[i] = (double)z[i];
1456    
1457        TrkParams::Load(1);
1458        if( !TrkParams::IsLoaded(1) ){
1459            cout << "int Trajectory::DoTrack2(float* al) --- ERROR --- m.field not loaded"<<endl;
1460            return 0;
1461        }
1462      dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);      dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);
1463            
1464      for (int i=0; i<npoint; i++){      for (int i=0; i<npoint; i++){

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.32

  ViewVC Help
Powered by ViewVC 1.1.23