/[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.29 by pam-fi, Thu Mar 15 12:17:10 2007 UTC revision 1.33 by pam-fi, Mon May 14 11:03:05 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*);
 //    int  readb_(const char*);  
 //    int  readb_();  
15       void mini2_(int*,int*,int*);       void mini2_(int*,int*,int*);
16       void guess_();       void guess_();
      void gufld_(float*, float*);  
17  }  }
18    
19  //--------------------------------------  //--------------------------------------
# Line 41  TrkTrack::TrkTrack(){ Line 38  TrkTrack::TrkTrack(){
38          zm[ip]     = 0;          zm[ip]     = 0;
39          resx[ip]   = 0;          resx[ip]   = 0;
40          resy[ip]   = 0;          resy[ip]   = 0;
41            tailx[ip]   = 0;
42            taily[ip]   = 0;
43          xv[ip]     = 0;          xv[ip]     = 0;
44          yv[ip]     = 0;          yv[ip]     = 0;
45          zv[ip]     = 0;          zv[ip]     = 0;
# Line 49  TrkTrack::TrkTrack(){ Line 48  TrkTrack::TrkTrack(){
48          dedx_x[ip] = 0;          dedx_x[ip] = 0;
49          dedx_y[ip] = 0;          dedx_y[ip] = 0;
50      };      };
51      clx = 0;  //    clx = 0;
52      cly = 0;  //    cly = 0;
53  //    clx = new TRefArray(6,0); //forse causa memory leak???  //    clx = new TRefArray(6,0); //forse causa memory leak???
54  //    cly = new TRefArray(6,0); //forse causa memory leak???  //    cly = new TRefArray(6,0); //forse causa memory leak???
55    //    clx = TRefArray(6,0);
56    //    cly = TRefArray(6,0);
57    
58        TrkParams::SetTrackingMode();
59        TrkParams::SetPrecisionFactor();
60        TrkParams::SetStepMin();
61        TrkParams::SetPFA();
62    
63  };  };
64  //--------------------------------------  //--------------------------------------
65  //  //
# Line 75  TrkTrack::TrkTrack(const TrkTrack& t){ Line 82  TrkTrack::TrkTrack(const TrkTrack& t){
82          zm[ip]     = t.zm[ip];          zm[ip]     = t.zm[ip];
83          resx[ip]   = t.resx[ip];          resx[ip]   = t.resx[ip];
84          resy[ip]   = t.resy[ip];          resy[ip]   = t.resy[ip];
85            tailx[ip]  = t.tailx[ip];
86            taily[ip]  = t.taily[ip];
87          xv[ip]     = t.xv[ip];          xv[ip]     = t.xv[ip];
88          yv[ip]     = t.yv[ip];          yv[ip]     = t.yv[ip];
89          zv[ip]     = t.zv[ip];          zv[ip]     = t.zv[ip];
# Line 83  TrkTrack::TrkTrack(const TrkTrack& t){ Line 92  TrkTrack::TrkTrack(const TrkTrack& t){
92          dedx_x[ip] = t.dedx_x[ip];          dedx_x[ip] = t.dedx_x[ip];
93          dedx_y[ip] = t.dedx_y[ip];          dedx_y[ip] = t.dedx_y[ip];
94      };      };
95      clx = 0;  //    clx = 0;
96      cly = 0;  //    cly = 0;
97      if(t.clx)clx = new TRefArray(*(t.clx));  //    if(t.clx)clx = new TRefArray(*(t.clx));
98      if(t.cly)cly = new TRefArray(*(t.cly));  //    if(t.cly)cly = new TRefArray(*(t.cly));
99            //    clx = TRefArray(t.clx);
100    //    cly = TRefArray(t.cly);
101    
102        TrkParams::SetTrackingMode();
103        TrkParams::SetPrecisionFactor();
104        TrkParams::SetStepMin();  
105        TrkParams::SetPFA();
106    
107  };  };
108  //--------------------------------------  //--------------------------------------
109  //  //
# Line 111  void TrkTrack::Copy(TrkTrack& t){ Line 127  void TrkTrack::Copy(TrkTrack& t){
127          t.zm[ip]     = zm[ip];          t.zm[ip]     = zm[ip];
128          t.resx[ip]   = resx[ip];          t.resx[ip]   = resx[ip];
129          t.resy[ip]   = resy[ip];          t.resy[ip]   = resy[ip];
130            t.tailx[ip]  = tailx[ip];
131            t.taily[ip]  = taily[ip];
132          t.xv[ip]     = xv[ip];          t.xv[ip]     = xv[ip];
133          t.yv[ip]     = yv[ip];          t.yv[ip]     = yv[ip];
134          t.zv[ip]     = zv[ip];          t.zv[ip]     = zv[ip];
# Line 120  void TrkTrack::Copy(TrkTrack& t){ Line 138  void TrkTrack::Copy(TrkTrack& t){
138          t.dedx_y[ip] = dedx_y[ip];          t.dedx_y[ip] = dedx_y[ip];
139                            
140      };      };
141    
142    //    t.clx = TRefArray(clx);
143    //    t.cly = TRefArray(cly);
144            
145  };  };
146  //--------------------------------------  //--------------------------------------
# Line 233  Float_t TrkTrack::GetDeflection(){ Line 254  Float_t TrkTrack::GetDeflection(){
254          return def;          return def;
255  };  };
256  //  //
257  Float_t TrkTrack::GetDEDX(){  /**
258          Float_t dedx=0;   * Method to retrieve the dE/dx measured on a tracker view.
259          for(Int_t i=0; i<6; i++)dedx+=dedx_x[i]*xgood[i]+dedx_y[i]*ygood[i];   * @param ip plane (0-5)
260          dedx = dedx/(this->GetNX()+this->GetNY());   * @param iv view (0=x 1=y)
261          return dedx;   */
262    Float_t TrkTrack::GetDEDX(int ip, int iv){
263        if(iv==0 && ip>=0 && ip<6)return fabs(dedx_x[ip]);
264        else if(iv==1 && ip>=0 && ip<6)return fabs(dedx_y[ip]);
265        else {
266            cout << "TrkTrack::GetDEDX(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
267            return 0.;
268        }
269    }
270    /**
271     * Method to evaluate the dE/dx measured on a tracker plane.
272     * The two measurements on x- and y-view are averaged.
273     * @param ip plane (0-5)
274     */
275    Float_t TrkTrack::GetDEDX(int ip){
276        if( (Int_t)XGood(ip)+(Int_t)YGood(ip) == 0 ) return 0;
277        return (GetDEDX(ip,0)+GetDEDX(ip,1))/((Int_t)XGood(ip)+(Int_t)YGood(ip));
278  };  };
279    
280    /**
281     * Method to evaluate the dE/dx averaged over all planes.
282     */
283    Float_t TrkTrack::GetDEDX(){
284        Float_t dedx=0;
285        for(Int_t ip=0; ip<6; ip++)dedx+=GetDEDX(ip,0)*XGood(ip)+GetDEDX(ip,1)*YGood(ip);
286        dedx = dedx/(GetNX()+GetNY());
287        return dedx;
288    };
289    /**
290     * Returns 1 if the cluster on a tracker view includes bad strips.
291     * @param ip plane (0-5)
292     * @param iv view (0=x 1=y)
293     */
294    Bool_t TrkTrack::IsBad(int ip,int iv){
295        if(iv==0 && ip>=0 && ip<6)return (xgood[ip]<0) ;
296        else if(iv==1 && ip>=0 && ip<6)return (ygood[ip]<0) ;
297        else {
298            cout << "TrkTrack::IsBad(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
299            return 0.;
300        }
301    };
302    /**
303     * Returns 1 if the signal on a tracker view is saturated.
304     * @param ip plane (0-5)
305     * @param iv view (0=x 1=y)
306     */
307    Bool_t TrkTrack::IsSaturated(int ip,int iv){
308        if(iv==0 && ip>=0 && ip<6)return (dedx_x[ip]<0) ;
309        else if(iv==1 && ip>=0 && ip<6)return (dedx_y[ip]<0) ;
310        else {
311            cout << "TrkTrack::IsSaturated(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
312            return 0.;
313        }
314    };
315    /**
316     * Returns 1 if either the x or the y signal on a tracker plane is saturated.
317     * @param ip plane (0-5)
318     */
319    Bool_t TrkTrack::IsSaturated(int ip){
320        return (IsSaturated(ip,0)||IsSaturated(ip,1));
321    };
322    /**
323     * Returns 1 if there is at least a saturated signal along the track.
324     */
325    Bool_t TrkTrack::IsSaturated(){
326        for(int ip=0; ip<6; ip++)for(int iv=0; iv<2; iv++)if(IsSaturated(ip,iv))return true;
327        return false;
328    }
329    /**
330     * Returns the track "lever-arm" on the x view, defined as the distance (in planes) between
331     * the upper and lower x measurements (the maximum value of lever-arm is 6).
332     */
333    Int_t TrkTrack::GetLeverArmX(){
334        int first_plane = -1;
335        int last_plane  = -1;
336        for(Int_t ip=0; ip<6; ip++){
337            if( XGood(ip) && first_plane == -1 )first_plane = ip;
338            if( XGood(ip) && first_plane != -1 )last_plane = ip;
339        }
340        if( first_plane == -1 || last_plane == -1){
341            cout<< "Int_t TrkTrack::GetLeverArmX() -- XGood(ip) always false ??? "<<endl;
342            return 0;
343        }
344        return (last_plane-first_plane+1);
345    }
346    /**
347     * Returns the track "lever-arm" on the y view, defined as the distance (in planes) between
348     * the upper and lower y measurements (the maximum value of lever-arm is 6).
349     */
350    Int_t TrkTrack::GetLeverArmY(){
351        int first_plane = -1;
352        int last_plane  = -1;
353        for(Int_t ip=0; ip<6; ip++){
354            if( YGood(ip) && first_plane == -1 )first_plane = ip;
355            if( YGood(ip) && first_plane != -1 )last_plane = ip;
356        }
357        if( first_plane == -1 || last_plane == -1){
358            cout<< "Int_t TrkTrack::GetLeverArmY() -- YGood(ip) always false ??? "<<endl;
359            return 0;
360        }
361        return (last_plane-first_plane+1);
362    }
363  //--------------------------------------  //--------------------------------------
364  //  //
365  //  //
# Line 251  void TrkTrack::Dump(){ Line 371  void TrkTrack::Dump(){
371      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] << " ";
372      cout << endl << "chi^2    : "<< chi2;      cout << endl << "chi^2    : "<< chi2;
373      cout << endl << "n.step   : "<< nstep;      cout << endl << "n.step   : "<< nstep;
374      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) ;
375      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) ;
376      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] << " ";
377      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] << " ";
378      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 286  void TrkTrack::SetResolution(double *rx, Line 406  void TrkTrack::SetResolution(double *rx,
406      for(int i=0; i<6; i++) resy[i]=*ry++;      for(int i=0; i<6; i++) resy[i]=*ry++;
407  }  }
408  /**  /**
409   * Set the TrkTrack good measurement   * Set the TrkTrack good measurement.
410   */   */
411  void TrkTrack::SetGood(int *xg, int *yg){  void TrkTrack::SetGood(int *xg, int *yg){
412    
413      for(int i=0; i<6; i++) xgood[i]=*xg++;      for(int i=0; i<6; i++) xgood[i]=*xg++;
414      for(int i=0; i<6; i++) ygood[i]=*yg++;      for(int i=0; i<6; i++) ygood[i]=*yg++;
415  }  }
# Line 303  void TrkTrack::LoadField(TString path){ Line 424  void TrkTrack::LoadField(TString path){
424  //     path_.error   = 0;  //     path_.error   = 0;
425  //     readb_();  //     readb_();
426    
427        TrkParams::SetTrackingMode();
428        TrkParams::SetPrecisionFactor();
429        TrkParams::SetStepMin();
430    
431      TrkParams::Set(path,1);      TrkParams::Set(path,1);
432      TrkParams::Load(1);      TrkParams::Load(1);
433    
# Line 316  void TrkTrack::FillMiniStruct(cMini2trac Line 441  void TrkTrack::FillMiniStruct(cMini2trac
441    
442      for(int i=0; i<6; i++){      for(int i=0; i<6; i++){
443    
444          track.xgood[i]=xgood[i];  //      cout << i<<" - "<<xgood[i]<<" "<<XGood(i)<<endl;
445          track.ygood[i]=ygood[i];  //      cout << i<<" - "<<ygood[i]<<" "<<YGood(i)<<endl;
446            track.xgood[i]=XGood(i);
447            track.ygood[i]=YGood(i);
448                    
449          track.xm[i]=xm[i];          track.xm[i]=xm[i];
450          track.ym[i]=ym[i];          track.ym[i]=ym[i];
# Line 330  void TrkTrack::FillMiniStruct(cMini2trac Line 457  void TrkTrack::FillMiniStruct(cMini2trac
457          track.xm_b[i]=xm[i];          track.xm_b[i]=xm[i];
458          track.ym_a[i]=ym[i];          track.ym_a[i]=ym[i];
459          track.ym_b[i]=ym[i];          track.ym_b[i]=ym[i];
460          if(       xgood[i] && !ygood[i] ){          if(       XGood(i) && !YGood(i) ){
461              track.ym_a[i] = track.ym_a[i]+segment;              track.ym_a[i] = track.ym_a[i]+segment;
462              track.ym_b[i] = track.ym_b[i]-segment;              track.ym_b[i] = track.ym_b[i]-segment;
463          }else if( !xgood[i] && ygood[i]){          }else if( !XGood(i) && YGood(i)){
464              track.xm_a[i] = track.xm_a[i]+segment;              track.xm_a[i] = track.xm_a[i]+segment;
465              track.xm_b[i] = track.xm_b[i]-segment;              track.xm_b[i] = track.xm_b[i]-segment;
466          }          }
# Line 372  void TrkTrack::SetFromMiniStruct(cMini2t Line 499  void TrkTrack::SetFromMiniStruct(cMini2t
499            
500  }  }
501  /**  /**
502   * Tracking method. It calls F77 mini routine.   * \brief Method to re-evaluate coordinates of clusters associated with a track.
503     *
504     * The method can be applied only after recovering level1 information
505     * (either by reprocessing single events from level0 or from  
506     * the TrkLevel1 branch, if present); it calls F77 subroutines that
507     * read the level1 common and fill the minimization-routine common.
508     * Some clusters can be excluded or added by means of the methods:
509     *
510     * TrkTrack::ResetXGood(int ip)
511     * TrkTrack::ResetYGood(int ip)
512     * TrkTrack::SetXGood(int ip, int cid, int is)
513     * TrkTrack::SetYGood(int ip, int cid, int is)
514     *
515     * NB! The method TrkTrack::SetGood(int *xg, int *yg) set the plane-mask (0-1)
516     * for the minimization-routine common. It deletes the cluster information
517     * (at least for the moment...) thus cannot be applied before
518     * TrkTrack::EvaluateClusterPositions().  
519     *
520     * Different p.f.a. can be applied by calling (once) the method:
521     *
522     * TrkParams::SetPFA(0); //Set ETA p.f.a.
523     *
524     * @see TrkParams::SetPFA(int)
525     */
526    void TrkTrack::EvaluateClusterPositions(){
527        
528    //     cout << "void TrkTrack::GetClusterPositions() "<<endl;
529    
530        TrkParams::Load( );
531        if( !TrkParams::IsLoaded() )return;
532        
533        for(int ip=0; ip<6; ip++){
534    //      cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;;
535            int icx = GetClusterX_ID(ip)+1;
536            int icy = GetClusterY_ID(ip)+1;
537            int sensor = GetSensor(ip)+1;//<< convenzione "Paolo"
538            if(ip==5 && sensor!=0)sensor=3-sensor;//<< convenzione "Elena"
539            int ladder = GetLadder(ip)+1;
540            float ax = axv[ip];
541            float ay = ayv[ip];
542            float v[3];
543            v[0]=xv[ip];
544            v[1]=yv[ip];
545            v[2]=zv[ip];
546            float bfx = 10*TrkParams::GetBX(v);//Tesla
547            float bfy = 10*TrkParams::GetBY(v);//Tesla
548            int ipp=ip+1;
549            xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy);
550        }
551    }
552    /**
553     * \brief Tracking method. It calls F77 mini routine.
554     *
555     * @param pfixed Particle momentum. If pfixed=0 the momentum
556     * is left as a free parameter, otherwise it is fixed to the input value.
557     * @param fail Output flag (!=0 if the fit failed).
558     * @param iprint Flag to set debug mode ( 0 = no output; 1 = verbose; 2 = debug).
559     * @param froml1 Flag to re-evaluate positions (see TrkTrack::GetClusterPositions()).
560     *
561     * The option to re-evaluate positions can be used only after recovering
562     * level1 information, eg. by reprocessing the single event.
563     *
564     * Example:
565     *
566     * if( !event->GetTrkLevel0() )return false;
567     * event->GetTrkLevel0()->ProcessEvent(); // re-processing level0->level1
568     * int fail=0;
569     * event->GetTrkLevel2()->GetTrack(0)->Fit(0.,fail,0,1);
570     *
571     * @see EvaluateClusterPositions()
572     *
573     * The fitting procedure can be varied by changing the tracking mode,
574     * the fit-precision factor and the minimum number of step.
575     * @see SetTrackingMode(int)
576     * @see SetPrecisionFactor(double)
577     * @see SetStepMin(int)
578   */   */
579  void TrkTrack::Fit(double pfixed, int& fail, int iprint){  void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){
580    
581      float al_ini[] = {0.,0.,0.,0.,0.};      float al_ini[] = {0.,0.,0.,0.,0.};
582    
583        TrkParams::Load( );
584        if( !TrkParams::IsLoaded() )return;
585    
586      extern cMini2track track_;      extern cMini2track track_;
587      fail = 0;      fail = 0;
588      FillMiniStruct(track_);      FillMiniStruct(track_);
589        
590        if(froml1!=0)EvaluateClusterPositions();
591        
592      // if fit variables have been reset, evaluate the initial guess      // if fit variables have been reset, evaluate the initial guess
593      if(al[0]==-9999.&&al[1]==-9999.&&al[2]==-9999.&&al[3]==-9999.&&al[4]==-9999.)guess_();      if(al[0]==-9999.&&al[1]==-9999.&&al[2]==-9999.&&al[3]==-9999.&&al[4]==-9999.)guess_();
594    
# Line 400  void TrkTrack::Fit(double pfixed, int& f Line 607  void TrkTrack::Fit(double pfixed, int& f
607    
608      //  ------------------------------------------      //  ------------------------------------------
609      //  call mini routine      //  call mini routine
610      TrkParams::Load(1);  //     TrkParams::Load(1);
611      if( !TrkParams::IsLoaded(1) ){  //     if( !TrkParams::IsLoaded(1) ){
612          cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl;  //      cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl;
613          return;  //      return;
614      }  //     }
615      int istep=0;      int istep=0;
616      int ifail=0;      int ifail=0;
617      mini2_(&istep,&ifail, &iprint);      mini2_(&istep,&ifail, &iprint);
# Line 415  void TrkTrack::Fit(double pfixed, int& f Line 622  void TrkTrack::Fit(double pfixed, int& f
622      //  ------------------------------------------      //  ------------------------------------------
623            
624      SetFromMiniStruct(&track_);      SetFromMiniStruct(&track_);
 //    cout << endl << "eta ===> " << track_.al[4] << endl;  
   
 //     for(int i=0; i<5; i++) al[i]=track_.al[i];  
 //     chi2=track_.chi2;  
 //     nstep=track_.nstep;  
 //     for(int i=0; i<6; i++) xv[i]=track_.xv[i];  
 //     for(int i=0; i<6; i++) yv[i]=track_.yv[i];  
 //     for(int i=0; i<6; i++) zv[i]=track_.zv[i];  
 //     for(int i=0; i<6; i++) axv[i]=track_.axv[i];  
 //     for(int i=0; i<6; i++) ayv[i]=track_.ayv[i];  
 //     for(int i=0; i<5; i++) {  
 //      for(int j=0; j<5; j++) coval[i][j]=track_.cov[i][j];  
 //     }  
625    
626      if(fail){      if(fail){
627          if(iprint)cout << " >>>> fit failed >>>> drawing initial par"<<endl;          if(iprint)cout << " >>>> fit failed "<<endl;
628          for(int i=0; i<5; i++) al[i]=al_ini[i];          for(int i=0; i<5; i++) al[i]=al_ini[i];
629      }      }
630    
631  };  };
632  /*  /**
633   * Reset the fit parameters   * Reset the fit parameters
634   */   */
635  void TrkTrack::FitReset(){  void TrkTrack::FitReset(){
636      for(int i=0; i<5; i++) al[i]=-9999.;      for(int i=0; i<5; i++) al[i]=-9999.;
637      chi2=0.;      chi2=0.;
638      nstep=0;      nstep=0;
639      for(int i=0; i<6; i++) xv[i]=0.;  //     for(int i=0; i<6; i++) xv[i]=0.;
640      for(int i=0; i<6; i++) yv[i]=0.;  //     for(int i=0; i<6; i++) yv[i]=0.;
641      for(int i=0; i<6; i++) zv[i]=0.;  //     for(int i=0; i<6; i++) zv[i]=0.;
642      for(int i=0; i<6; i++) axv[i]=0.;  //     for(int i=0; i<6; i++) axv[i]=0.;
643      for(int i=0; i<6; i++) ayv[i]=0.;  //     for(int i=0; i<6; i++) ayv[i]=0.;
644      for(int i=0; i<5; i++) {      for(int i=0; i<5; i++) {
645          for(int j=0; j<5; j++) coval[i][j]=0.;          for(int j=0; j<5; j++) coval[i][j]=0.;
646      }      }
647  }  }
648    /**
649     * Set the tracking mode
650     */
651  void TrkTrack::SetTrackingMode(int trackmode){  void TrkTrack::SetTrackingMode(int trackmode){
652      extern cMini2track track_;      extern cMini2track track_;
653      track_.trackmode = trackmode;      track_.trackmode = trackmode;
654  }  }
655    /**
656     * Set the factor scale for tracking precision
657     */
658    void TrkTrack::SetPrecisionFactor(double fact){
659        extern cMini2track track_;
660        track_.fact = fact;
661    }
662    /**
663     * Set the factor scale for tracking precision
664     */
665    void TrkTrack::SetStepMin(int istepmin){
666        extern cMini2track track_;
667        track_.istepmin = istepmin;
668    }
669    
670    
671  /*  /**
672   * Method to retrieve the X-view clusters associated to the track.   * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track.
673     * If no cluster is associated, ID=-1.
674     * @param ip Tracker plane (0-5)
675     */
676    Int_t TrkTrack::GetClusterX_ID(int ip){
677        return ((Int_t)fabs(xgood[ip]))%10000000-1;
678    };
679    /**
680     * Method to retrieve ID (0-xxx) of y-cluster (if any) associated to this track.
681     * If no cluster is associated, ID=-1.
682     * @param ip Tracker plane (0-5)
683     */
684    Int_t TrkTrack::GetClusterY_ID(int ip){
685        return ((Int_t)fabs(ygood[ip]))%10000000-1;
686    };
687    /**
688     * Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane.
689     * If no ladder is traversed (dead area) the metod retuns -1.
690   * @param ip Tracker plane (0-5)   * @param ip Tracker plane (0-5)
691   */   */
692  TrkCluster *TrkTrack::GetClusterX(int ip){  Int_t TrkTrack::GetLadder(int ip){
693      cout << " TrkCluster *TrkTrack::GetClusterX(int ip) -- momentaneamente fuori servizio --"<< endl;      if(XGood(ip))return (Int_t)fabs(xgood[ip]/100000000)-1;
694      if(!clx)return NULL;      if(YGood(ip))return (Int_t)fabs(ygood[ip]/100000000)-1;
695      TrkCluster *pt = (TrkCluster*)(clx->At(ip));      return -1;
     return pt;  
696  };  };
697  /*  /**
698   * Method to retrieve the Y-view clusters associated to the track.   * Method to retrieve the sensor (0-1, increasing y) traversed by the track on this plane.
699     * If no sensor is traversed (dead area) the metod retuns -1.
700   * @param ip Tracker plane (0-5)   * @param ip Tracker plane (0-5)
701   */   */
702  TrkCluster *TrkTrack::GetClusterY(int ip){  Int_t TrkTrack::GetSensor(int ip){
703      cout << " TrkCluster *TrkTrack::GetClusterY(int ip) -- momentaneamente fuori servizio --"<< endl;      if(XGood(ip))return (Int_t)((Int_t)fabs(xgood[ip]/10000000)%10)-1;
704      if(!cly)return NULL;      if(YGood(ip))return (Int_t)((Int_t)fabs(ygood[ip]/10000000)%10)-1;
705      TrkCluster *pt = (TrkCluster*)(cly->At(ip));      return -1;
     return pt;  
706  };  };
707    
708    /**
709     * \brief Method to include a x-cluster to the track.
710     * @param ip Tracker plane (0-5)
711     * @param clid Cluster ID (0,1,...)
712     * @param is Sensor (0-1, increasing y)
713     * @see Fit(double pfixed, int& fail, int iprint, int froml1)
714     */
715    void TrkTrack::SetXGood(int ip, int clid, int is){
716        int il=0;       //ladder (temporary)
717        bool bad=false; //ladder (temporary)
718        xgood[ip]=il*100000000+is*10000000+clid;
719        if(bad)xgood[ip]=-xgood[ip];
720    };
721    /**
722     * \brief Method to include a y-cluster to the track.
723     * @param ip Tracker plane (0-5)
724     * @param clid Cluster ID (0,1,...)
725     * @param is Sensor (0-1)
726     * @see Fit(double pfixed, int& fail, int iprint, int froml1)
727     */
728    void TrkTrack::SetYGood(int ip, int clid, int is){
729        int il=0;       //ladder (temporary)
730        bool bad=false; //ladder (temporary)
731        ygood[ip]=il*100000000+is*10000000+clid;
732        if(bad)ygood[ip]=-ygood[ip];
733    };
734    
735  //--------------------------------------  //--------------------------------------
736  //  //
# Line 501  void TrkTrack::Clear(){ Line 754  void TrkTrack::Clear(){
754          zm[ip]     = 0;          zm[ip]     = 0;
755          resx[ip]   = 0;          resx[ip]   = 0;
756          resy[ip]   = 0;          resy[ip]   = 0;
757            tailx[ip]  = 0;
758            taily[ip]  = 0;
759          xv[ip]     = 0;          xv[ip]     = 0;
760          yv[ip]     = 0;          yv[ip]     = 0;
761          zv[ip]     = 0;          zv[ip]     = 0;
# Line 510  void TrkTrack::Clear(){ Line 765  void TrkTrack::Clear(){
765          dedx_y[ip] = 0;          dedx_y[ip] = 0;
766    
767      };      };
768      if(clx)clx->Clear();  //     if(clx)clx->Clear();
769      if(cly)cly->Clear();  //     if(cly)cly->Clear();
770    //    clx.Clear();
771    //    cly.Clear();
772  };  };
773  //--------------------------------------  //--------------------------------------
774  //  //
# Line 519  void TrkTrack::Clear(){ Line 776  void TrkTrack::Clear(){
776  //--------------------------------------  //--------------------------------------
777  void TrkTrack::Delete(){  void TrkTrack::Delete(){
778  //    cout << "TrkTrack::Delete()"<<endl;  //    cout << "TrkTrack::Delete()"<<endl;
779  //    Clear();      Clear();
780      if(clx)delete clx;  //    if(clx)delete clx;
781      if(cly)delete cly;  //    if(cly)delete cly;
782  };  };
783  //--------------------------------------  //--------------------------------------
784  //  //
# Line 551  TrkSinglet::TrkSinglet(const TrkSinglet& Line 808  TrkSinglet::TrkSinglet(const TrkSinglet&
808      coord[1] = s.coord[1];      coord[1] = s.coord[1];
809      sgnl     = s.sgnl;      sgnl     = s.sgnl;
810  //      cls      = 0;//<<<<pointer  //      cls      = 0;//<<<<pointer
811      cls      = TRef(s.cls);  //    cls      = TRef(s.cls);
812  };  };
813  //--------------------------------------  //--------------------------------------
814  //  //
# Line 584  void TrkSinglet::Clear(){ Line 841  void TrkSinglet::Clear(){
841  TrkLevel2::TrkLevel2(){  TrkLevel2::TrkLevel2(){
842    //    cout <<"TrkLevel2::TrkLevel2()"<<endl;    //    cout <<"TrkLevel2::TrkLevel2()"<<endl;
843      for(Int_t i=0; i<12 ; i++){      for(Int_t i=0; i<12 ; i++){
844                  good[i] = -1;          good[i] = -1;
845          };          VKmask[i] = 0;
846  // okkio!! memory-leak          VKflag[i] = 0;  
847  //     Track    = new TClonesArray("TrkTrack");      };
 //     SingletX = new TClonesArray("TrkSinglet");  
 //     SingletY = new TClonesArray("TrkSinglet");  
848      Track    = 0;      Track    = 0;
849      SingletX = 0;      SingletX = 0;
850      SingletY = 0;      SingletY = 0;
# Line 616  void TrkLevel2::Dump(){ Line 871  void TrkLevel2::Dump(){
871      cout << endl << "ntrk()   : " << this->ntrk() ;      cout << endl << "ntrk()   : " << this->ntrk() ;
872      cout << endl << "nclsx()  : " << this->nclsx();      cout << endl << "nclsx()  : " << this->nclsx();
873      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();  
874      if(Track){      if(Track){
875          TClonesArray &t  = *Track;          TClonesArray &t  = *Track;
876          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();
# Line 640  void TrkLevel2::Dump(){ Line 889  void TrkLevel2::Dump(){
889  //  //
890  //--------------------------------------  //--------------------------------------
891  /**  /**
892   * 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  
893     * either apriori ,on the basis of the mask read from the DB,
894     * or run-by-run, on the basis of the calibration parameters)
895     * @param iv Tracker view (0-11)
896     * @param ivk Viking-chip number (0-23)
897     */
898    Bool_t TrkLevel2::GetVKMask(int iv, int ivk){
899        Int_t whichbit = (Int_t)pow(2,ivk);
900        return (whichbit&VKmask[iv])!=0;    
901    }
902    /**
903     * The method returns false if the viking-chip was masked  
904     * for this event due to common-noise computation failure.
905     * @param iv Tracker view (0-11)
906     * @param ivk Viking-chip number (0-23)
907     */
908    Bool_t TrkLevel2::GetVKFlag(int iv, int ivk){
909        Int_t whichbit = (Int_t)pow(2,ivk);
910        return (whichbit&VKflag[iv])!=0;    
911    }
912    /**
913     * The method returns true if the viking-chip was masked, either
914     * forced (see TrkLevel2::GetVKMask(int,int)) or
915     * for this event only (TrkLevel2::GetVKFlag(int,int)).
916     * @param iv Tracker view (0-11)
917     * @param ivk Viking-chip number (0-23)
918   */   */
919  // void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2){  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){
920        return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );
921    };
922    
 //      //  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;  
 //     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];  
 // //                   t_track->clx[ip] = 0;  
 // //                   t_track->cly[ip] = 0;  
 //      };  
 //      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];  
 // //           t_singlet->cls      = 0;  
 //      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];  
 // //           t_singlet->cls      = 0;  
 //      new(sy[i]) TrkSinglet(*t_singlet);  
 //      t_singlet->Clear();  
 //     };  
           
 //     delete t_track;  
 //     delete t_singlet;  
 // }  
923  //--------------------------------------  //--------------------------------------
924  //  //
925  //  //
# Line 729  void TrkLevel2::SetFromLevel2Struct(cTrk Line 933  void TrkLevel2::SetFromLevel2Struct(cTrk
933    
934  //    cout << "void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1)"<<endl;  //    cout << "void TrkLevel2::SetFromLevel2Struct(cTrkLevel2 *l2, TrkLevel1 *l1)"<<endl;
935      Clear();      Clear();
936    
937  //  temporary objects:  //  temporary objects:
938      TrkSinglet* t_singlet = new TrkSinglet();      TrkSinglet* t_singlet = new TrkSinglet();
939      TrkTrack*   t_track   = new TrkTrack();      TrkTrack*   t_track   = new TrkTrack();
# Line 738  void TrkLevel2::SetFromLevel2Struct(cTrk Line 943  void TrkLevel2::SetFromLevel2Struct(cTrk
943  //  -----------------  //  -----------------
944      for(Int_t i=0; i<12 ; i++){      for(Int_t i=0; i<12 ; i++){
945          good[i] = l2->good[i];          good[i] = l2->good[i];
946            VKmask[i]=0;
947            VKflag[i]=0;
948            for(Int_t ii=0; ii<24 ; ii++){
949                Int_t setbit = (Int_t)pow(2,ii);
950                if( l2->vkflag[ii][i]!=-1 )VKmask[i]=VKmask[i]|setbit;
951                if( l2->vkflag[ii][i]!=0  )VKflag[i]=VKflag[i]|setbit;
952            };
953      };      };
954  //  --------------  //  --------------
955  //  *** TRACKS ***  //  *** TRACKS ***
956  //  --------------  //  --------------
957      if(!Track) Track = new TClonesArray("TrkTrack");      if(!Track) Track = new TClonesArray("TrkTrack");
958      TClonesArray &t = *Track;      TClonesArray &t = *Track;
959      //-----------------------------------------------------  
     if( l1 && !t_track->clx )t_track->clx = new TRefArray(6,0);  
     if( l1 && !t_track->cly )t_track->cly = new TRefArray(6,0);  
     //-----------------------------------------------------  
960      for(int i=0; i<l2->ntrk; i++){      for(int i=0; i<l2->ntrk; i++){
 //      cout <<" TRACK "<<i<<" ------------------ "<<endl;  
961          t_track->seqno = i;// NBNBNBNB deve sempre essere = i          t_track->seqno = i;// NBNBNBNB deve sempre essere = i
962          t_track->image = l2->image[i]-1;          t_track->image = l2->image[i]-1;
963          t_track->chi2  = l2->chi2_nt[i];          t_track->chi2  = l2->chi2_nt[i];
# Line 760  void TrkLevel2::SetFromLevel2Struct(cTrk Line 968  void TrkLevel2::SetFromLevel2Struct(cTrk
968                  t_track->coval[it1][it2] = l2->coval[i][it2][it1];                  t_track->coval[it1][it2] = l2->coval[i][it2][it1];
969          };          };
970          for(int ip=0;ip<6;ip++){          for(int ip=0;ip<6;ip++){
971              t_track->xgood[ip]  = l2->cltrx[i][ip];//l2->xgood_nt[i][ip];              // ---------------------------------
972              t_track->ygood[ip]  = l2->cltry[i][ip];//l2->ygood_nt[i][ip];              // new implementation of xgood/ygood
973                // ---------------------------------
974                t_track->xgood[ip]  = l2->cltrx[i][ip]; //cluster ID
975                t_track->ygood[ip]  = l2->cltry[i][ip]; //cluster ID
976                t_track->xgood[ip] += 10000000*l2->ls[i][ip]; // ladder+sensor
977                t_track->ygood[ip] += 10000000*l2->ls[i][ip]; // ladder+sensor
978                if(l2->xbad[i][ip]>0)t_track->xgood[ip]=-t_track->xgood[ip];
979                if(l2->ybad[i][ip]>0)t_track->ygood[ip]=-t_track->ygood[ip];
980    //          if(l2->xbad[i][ip]>0 || l2->ybad[i][ip]>0){
981    //          if(l2->dedx_x[i][ip]<0 || l2->dedx_y[i][ip]<0){
982    //              cout << ip << " - "<< l2->cltrx[i][ip] << " "<<l2->cltry[i][ip]<<" "<<l2->ls[i][ip]<<endl;
983    //              cout << ip << " - "<<t_track->xgood[ip]<<" "<<t_track->ygood[ip]<<endl;
984    //              cout << ip << " - "<<t_track->GetClusterX_ID(ip)<<" "<<t_track->GetClusterY_ID(ip)<<" "<<t_track->GetLadder(ip)<<" "<<t_track->GetSensor(ip)<<endl;
985    //              cout << ip << " - "<<t_track->BadClusterX(ip)<<" "<<t_track->BadClusterY(ip)<<endl;
986    //              cout << ip << " - "<<t_track->SaturatedClusterX(ip)<<" "<<t_track->SaturatedClusterY(ip)<<endl;
987    //          }
988              t_track->xm[ip]     = l2->xm_nt[i][ip];              t_track->xm[ip]     = l2->xm_nt[i][ip];
989              t_track->ym[ip]     = l2->ym_nt[i][ip];              t_track->ym[ip]     = l2->ym_nt[i][ip];
990              t_track->zm[ip]     = l2->zm_nt[i][ip];              t_track->zm[ip]     = l2->zm_nt[i][ip];
991              t_track->resx[ip]   = l2->resx_nt[i][ip];              t_track->resx[ip]   = l2->resx_nt[i][ip];
992              t_track->resy[ip]   = l2->resy_nt[i][ip];              t_track->resy[ip]   = l2->resy_nt[i][ip];
993                t_track->tailx[ip]  = l2->tailx[i][ip];
994                t_track->taily[ip]  = l2->taily[i][ip];
995              t_track->xv[ip]     = l2->xv_nt[i][ip];              t_track->xv[ip]     = l2->xv_nt[i][ip];
996              t_track->yv[ip]     = l2->yv_nt[i][ip];              t_track->yv[ip]     = l2->yv_nt[i][ip];
997              t_track->zv[ip]     = l2->zv_nt[i][ip];              t_track->zv[ip]     = l2->zv_nt[i][ip];
# Line 774  void TrkLevel2::SetFromLevel2Struct(cTrk Line 999  void TrkLevel2::SetFromLevel2Struct(cTrk
999              t_track->ayv[ip]    = l2->ayv_nt[i][ip];              t_track->ayv[ip]    = l2->ayv_nt[i][ip];
1000              t_track->dedx_x[ip] = l2->dedx_x[i][ip];              t_track->dedx_x[ip] = l2->dedx_x[i][ip];
1001              t_track->dedx_y[ip] = l2->dedx_y[i][ip];              t_track->dedx_y[ip] = l2->dedx_y[i][ip];
 //          cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<endl;  
 //          cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<endl;  
1002              //-----------------------------------------------------              //-----------------------------------------------------
1003              //-----------------------------------------------------              //-----------------------------------------------------
 //          if(l1 && t_track->xgood[ip])t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip);  
 //          if(l1 && t_track->ygood[ip])t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip);  
             if(l2->xgood_nt[i][ip]){  
 //                  cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<endl;  
 //                  cout << " ip "<<ip<<" l2->cltrx[i][ip] "<< l2->cltrx[i][ip]<<" ";  
 //                  if( l1->GetCluster(l2->cltrx[i][ip]-1)->TestBit(l1->GetCluster(l2->cltrx[i][ip]-1)->kIsReferenced) )cout << ">> is referenced ";  
                 if(l1)t_track->clx->AddAt(l1->GetCluster(l2->cltrx[i][ip]-1),ip);  
 //                  cout << " --- "<<l1->GetCluster(l2->cltrx[i][ip]-1)->GetUniqueID()<<endl;  
 //              t_track->xgood[ip] = l2->cltrx[i][ip]; // WORK-AROUND *****  
             }else{  
                 if(l1)t_track->clx->RemoveAt(ip);  
             }  
             if(l2->ygood_nt[i][ip]){  
 //                  cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<endl;  
 //                  cout << " ip "<<ip<<" l2->cltry[i][ip] "<< l2->cltry[i][ip]<<" ";  
 //                  if( l1->GetCluster(l2->cltry[i][ip]-1)->TestBit(l1->GetCluster(l2->cltry[i][ip]-1)->kIsReferenced) )cout << ">> is referenced ";  
                 if(l1)t_track->cly->AddAt(l1->GetCluster(l2->cltry[i][ip]-1),ip);  
 //                  cout << " --- "<<l1->GetCluster(l2->cltry[i][ip]-1)->GetUniqueID()<<endl;  
 //              t_track->ygood[ip] = l2->cltry[i][ip]; // WORK-AROUND *****  
             }else{  
                 if(l1)t_track->cly->RemoveAt(ip);  
             }  
1004              //-----------------------------------------------------              //-----------------------------------------------------
1005              //-----------------------------------------------------              //-----------------------------------------------------
1006          };          };
1007    //      if(t_track->IsSaturated())t_track->Dump();
1008          new(t[i]) TrkTrack(*t_track);          new(t[i]) TrkTrack(*t_track);
1009          t_track->Clear();          t_track->Clear();
1010      };      };
1011    
1012  //  ----------------  //  ----------------
1013  //  *** SINGLETS ***  //  *** SINGLETS ***
1014  //  ----------------  //  ----------------
# Line 817  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1020  void TrkLevel2::SetFromLevel2Struct(cTrk
1020          t_singlet->coord[1] = l2->xs[i][1];          t_singlet->coord[1] = l2->xs[i][1];
1021          t_singlet->sgnl     = l2->signlxs[i];          t_singlet->sgnl     = l2->signlxs[i];
1022          //-----------------------------------------------------          //-----------------------------------------------------
1023          if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);
1024          //-----------------------------------------------------          //-----------------------------------------------------
1025          new(sx[i]) TrkSinglet(*t_singlet);          new(sx[i]) TrkSinglet(*t_singlet);
1026          t_singlet->Clear();          t_singlet->Clear();
# Line 830  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1033  void TrkLevel2::SetFromLevel2Struct(cTrk
1033          t_singlet->coord[1] = l2->ys[i][1];          t_singlet->coord[1] = l2->ys[i][1];
1034          t_singlet->sgnl     = l2->signlys[i];          t_singlet->sgnl     = l2->signlys[i];
1035          //-----------------------------------------------------          //-----------------------------------------------------
1036          if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);
1037          //-----------------------------------------------------          //-----------------------------------------------------
1038          new(sy[i]) TrkSinglet(*t_singlet);          new(sy[i]) TrkSinglet(*t_singlet);
1039          t_singlet->Clear();          t_singlet->Clear();
# Line 865  void TrkLevel2::GetLevel2Struct(cTrkLeve Line 1068  void TrkLevel2::GetLevel2Struct(cTrkLeve
1068                      l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2];                      l2->coval[i][it2][it1] = ((TrkTrack *)Track->At(i))->coval[it1][it2];
1069              };              };
1070              for(int ip=0;ip<6;ip++){              for(int ip=0;ip<6;ip++){
1071                  l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->xgood[ip];                  l2->xgood_nt[i][ip] = ((TrkTrack *)Track->At(i))->XGood(ip);
1072                  l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->ygood[ip];                  l2->ygood_nt[i][ip] = ((TrkTrack *)Track->At(i))->YGood(ip);
1073                  l2->xm_nt[i][ip]    = ((TrkTrack *)Track->At(i))->xm[ip];                  l2->xm_nt[i][ip]    = ((TrkTrack *)Track->At(i))->xm[ip];
1074                  l2->ym_nt[i][ip]    = ((TrkTrack *)Track->At(i))->ym[ip];                  l2->ym_nt[i][ip]    = ((TrkTrack *)Track->At(i))->ym[ip];
1075                  l2->zm_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zm[ip];                  l2->zm_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zm[ip];
1076                  l2->resx_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resx[ip];                  l2->resx_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resx[ip];
1077                  l2->resy_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resy[ip];                  l2->resy_nt[i][ip]  = ((TrkTrack *)Track->At(i))->resy[ip];
1078                    l2->tailx[i][ip]  = ((TrkTrack *)Track->At(i))->tailx[ip];
1079                    l2->taily[i][ip]  = ((TrkTrack *)Track->At(i))->taily[ip];
1080                  l2->xv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->xv[ip];                  l2->xv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->xv[ip];
1081                  l2->yv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->yv[ip];                  l2->yv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->yv[ip];
1082                  l2->zv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zv[ip];                  l2->zv_nt[i][ip]    = ((TrkTrack *)Track->At(i))->zv[ip];
# Line 910  void TrkLevel2::GetLevel2Struct(cTrkLeve Line 1115  void TrkLevel2::GetLevel2Struct(cTrkLeve
1115  void TrkLevel2::Clear(){  void TrkLevel2::Clear(){
1116      for(Int_t i=0; i<12 ; i++){      for(Int_t i=0; i<12 ; i++){
1117          good[i] = -1;          good[i] = -1;
1118            VKflag[i] = 0;
1119            VKmask[i] = 0;
1120      };      };
1121  //    if(Track)Track->Clear("C");  //    if(Track)Track->Clear("C");
1122  //    if(SingletX)SingletX->Clear("C");  //    if(SingletX)SingletX->Clear("C");
# Line 1144  void TrkLevel2::LoadField(TString path){ Line 1351  void TrkLevel2::LoadField(TString path){
1351  //     path_.error   = 0;  //     path_.error   = 0;
1352  //     readb_();  //     readb_();
1353    
1354        TrkParams::SetTrackingMode();
1355        TrkParams::SetPrecisionFactor();
1356        TrkParams::SetStepMin();
1357    
1358      TrkParams::Set(path,1);      TrkParams::Set(path,1);
1359      TrkParams::Load(1);      TrkParams::Load(1);
1360    
1361  //  //
1362  };  };
1363  /**  // /**
1364   * Get BY (kGauss)  //  * Get BY (kGauss)
1365   * @param v (x,y,z) coordinates in cm  //  * @param v (x,y,z) coordinates in cm
1366   */  //  */
1367  float TrkLevel2::GetBX(float* v){  // float TrkLevel2::GetBX(float* v){
1368      float b[3];  //     float b[3];
1369      gufld_(v,b);  //     gufld_(v,b);
1370      return b[0]/10.;  //     return b[0]/10.;
1371  }  // }
1372  /**  // /**
1373   * Get BY (kGauss)  //  * Get BY (kGauss)
1374   * @param v (x,y,z) coordinates in cm  //  * @param v (x,y,z) coordinates in cm
1375   */  //  */
1376  float TrkLevel2::GetBY(float* v){  // float TrkLevel2::GetBY(float* v){
1377      float b[3];  //     float b[3];
1378      gufld_(v,b);  //     gufld_(v,b);
1379      return b[1]/10.;  //     return b[1]/10.;
1380  }  // }
1381  /**  // /**
1382   * Get BY (kGauss)  //  * Get BY (kGauss)
1383   * @param v (x,y,z) coordinates in cm  //  * @param v (x,y,z) coordinates in cm
1384   */  //  */
1385  float TrkLevel2::GetBZ(float* v){  // float TrkLevel2::GetBZ(float* v){
1386      float b[3];  //     float b[3];
1387      gufld_(v,b);  //     gufld_(v,b);
1388      return b[2]/10.;  //     return b[2]/10.;
1389  }  // }
1390  //--------------------------------------  //--------------------------------------
1391  //  //
1392  //  //

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.33

  ViewVC Help
Powered by ViewVC 1.1.23