/[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.39 by pam-fi, Wed Aug 22 07:03:45 2007 UTC revision 1.50 by pam-fi, Fri Dec 5 08:26:46 2008 UTC
# Line 52  TrkTrack::TrkTrack(){ Line 52  TrkTrack::TrkTrack(){
52          ayv[ip]    = 0;          ayv[ip]    = 0;
53          dedx_x[ip] = 0;          dedx_x[ip] = 0;
54          dedx_y[ip] = 0;          dedx_y[ip] = 0;
55            multmaxx[ip] = 0;
56            multmaxy[ip] = 0;
57            seedx[ip]  = 0;  
58            seedy[ip]  = 0;
59            xpu[ip]    = 0;  
60            ypu[ip]    = 0;  
61    
62      };      };
63  //    clx = 0;      
64  //    cly = 0;  //     TrkParams::SetTrackingMode();
65  //    clx = new TRefArray(6,0); //forse causa memory leak???  //     TrkParams::SetPrecisionFactor();
66  //    cly = new TRefArray(6,0); //forse causa memory leak???  //     TrkParams::SetStepMin();
67  //    clx = TRefArray(6,0);      TrkParams::SetMiniDefault();
 //    cly = TRefArray(6,0);  
   
     TrkParams::SetTrackingMode();  
     TrkParams::SetPrecisionFactor();  
     TrkParams::SetStepMin();  
68      TrkParams::SetPFA();      TrkParams::SetPFA();
69    
70        int ngf = TrkParams::nGF;
71        for(int i=0; i<ngf; i++){
72            xGF[i] = 0.;
73            yGF[i] = 0.;
74        }
75    
76    
77  };  };
78  //--------------------------------------  //--------------------------------------
79  //  //
# Line 96  TrkTrack::TrkTrack(const TrkTrack& t){ Line 105  TrkTrack::TrkTrack(const TrkTrack& t){
105          ayv[ip]    = t.ayv[ip];          ayv[ip]    = t.ayv[ip];
106          dedx_x[ip] = t.dedx_x[ip];          dedx_x[ip] = t.dedx_x[ip];
107          dedx_y[ip] = t.dedx_y[ip];          dedx_y[ip] = t.dedx_y[ip];
108            multmaxx[ip] = t.multmaxx[ip];
109            multmaxy[ip] = t.multmaxy[ip];
110            seedx[ip]    = t.seedx[ip];  
111            seedy[ip]    = t.seedy[ip];
112            xpu[ip]      = t.xpu[ip];  
113            ypu[ip]      = t.ypu[ip];  
114      };      };
115  //    clx = 0;  
116  //    cly = 0;  //     TrkParams::SetTrackingMode();
117  //    if(t.clx)clx = new TRefArray(*(t.clx));  //     TrkParams::SetPrecisionFactor();
118  //    if(t.cly)cly = new TRefArray(*(t.cly));  //     TrkParams::SetStepMin();  
119  //    clx = TRefArray(t.clx);      TrkParams::SetMiniDefault();
 //    cly = TRefArray(t.cly);  
   
     TrkParams::SetTrackingMode();  
     TrkParams::SetPrecisionFactor();  
     TrkParams::SetStepMin();    
120      TrkParams::SetPFA();      TrkParams::SetPFA();
121    
122        int ngf = TrkParams::nGF;
123        for(int i=0; i<ngf; i++){
124            xGF[i] = t.xGF[i];
125            yGF[i] = t.yGF[i];
126        }
127  };  };
128  //--------------------------------------  //--------------------------------------
129  //  //
# Line 141  void TrkTrack::Copy(TrkTrack& t){ Line 156  void TrkTrack::Copy(TrkTrack& t){
156          t.ayv[ip]    = ayv[ip];          t.ayv[ip]    = ayv[ip];
157          t.dedx_x[ip] = dedx_x[ip];          t.dedx_x[ip] = dedx_x[ip];
158          t.dedx_y[ip] = dedx_y[ip];          t.dedx_y[ip] = dedx_y[ip];
159            t.multmaxx[ip] = multmaxx[ip];
160            t.multmaxy[ip] = multmaxy[ip];
161            t.seedx[ip]    = seedx[ip];  
162            t.seedy[ip]    = seedy[ip];
163            t.xpu[ip]      = xpu[ip];  
164            t.ypu[ip]      = ypu[ip];  
165                            
166      };      };
167        int ngf = TrkParams::nGF;
168        for(int i=0; i<ngf; i++){
169            t.xGF[i] = xGF[i];
170            t.yGF[i] = yGF[i];
171        }
172    
 //    t.clx = TRefArray(clx);  
 //    t.cly = TRefArray(cly);  
173            
174  };  };
175  //--------------------------------------  //--------------------------------------
# Line 158  void TrkTrack::Copy(TrkTrack& t){ Line 182  void TrkTrack::Copy(TrkTrack& t){
182   * @param t pointer to an object of the class Trajectory,   * @param t pointer to an object of the class Trajectory,
183   * which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ).   * which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ).
184   * @return error flag.   * @return error flag.
185     *
186     * >>> OBSOLETE !!! use TrkTrack::DoTrack2(Trajectory* t) instead
187     *
188   */   */
189  int TrkTrack::DoTrack(Trajectory* t){  int TrkTrack::DoTrack(Trajectory* t){
190    
191        cout << " int TrkTrack::DoTrack(Trajectory* t) --->> OBSOLETE !!! "<<endl;
192        cout << " use int TrkTrack::DoTrack2(Trajectory* t)"<<endl;
193    
194      double *dxout = new double[t->npoint];      double *dxout = new double[t->npoint];
195      double *dyout = new double[t->npoint];      double *dyout = new double[t->npoint];
196      double *dzin = new double[t->npoint];      double *dzin = new double[t->npoint];
# Line 179  int TrkTrack::DoTrack(Trajectory* t){ Line 209  int TrkTrack::DoTrack(Trajectory* t){
209      dotrack_(&(t->npoint),dzin,dxout,dyout,dal,&ifail);      dotrack_(&(t->npoint),dzin,dxout,dyout,dal,&ifail);
210            
211      for (int i=0; i<t->npoint; i++){      for (int i=0; i<t->npoint; i++){
212          t->x[i] = (float)*dxout++;          t->x[i] = (float)*(dxout+i);
213          t->y[i] = (float)*dyout++;          t->y[i] = (float)*(dyout+i);
214      }      }
215    
216  //    delete [] dxout;      delete [] dxout;
217  //    delete [] dyout;      delete [] dyout;
218  //    delete [] dzin;      delete [] dzin;
219    
220      return ifail;      return ifail;
221  };  };
# Line 223  int TrkTrack::DoTrack2(Trajectory* t){ Line 253  int TrkTrack::DoTrack2(Trajectory* t){
253      dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);      dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);
254            
255      for (int i=0; i<t->npoint; i++){      for (int i=0; i<t->npoint; i++){
256          t->x[i]   = (float)*dxout++;          t->x[i]   = (float)*(dxout+i);
257          t->y[i]   = (float)*dyout++;          t->y[i]   = (float)*(dyout+i);
258          t->thx[i] = (float)*dthxout++;          t->thx[i] = (float)*(dthxout+i);
259          t->thy[i] = (float)*dthyout++;          t->thy[i] = (float)*(dthyout+i);
260          t->tl[i]  = (float)*dtlout++;          t->tl[i]  = (float)*(dtlout+i);
261      }      }
262    
263  //    delete [] dxout;      delete [] dxout;
264  //    delete [] dyout;      delete [] dyout;
265  //    delete [] dzin;      delete [] dzin;
266        delete [] dthxout;
267        delete [] dthyout;
268        delete [] dtlout;
269    
270      return ifail;      return ifail;
271  };  };
# Line 292  Float_t TrkTrack::GetDEDX(){ Line 325  Float_t TrkTrack::GetDEDX(){
325      return dedx;      return dedx;
326  };  };
327  /**  /**
328   * Returns 1 if the cluster on a tracker view includes bad strips.   * Returns 1 if the cluster on a tracker view includes bad strips
329     * (at least one bad strip among the four strip used by p.f.a.)
330   * @param ip plane (0-5)   * @param ip plane (0-5)
331   * @param iv view (0=x 1=y)   * @param iv view (0=x 1=y)
332   */   */
# Line 366  Int_t TrkTrack::GetLeverArmY(){ Line 400  Int_t TrkTrack::GetLeverArmY(){
400      return (last_plane-first_plane+1);      return (last_plane-first_plane+1);
401  }  }
402  /**  /**
403     * Returns the track "lever-arm" on the x+y view, defined as the distance (in planes) between
404     * the upper and lower x,y (couple) measurements (the maximum value of lever-arm is 6).
405     */
406    Int_t TrkTrack::GetLeverArmXY(){
407        int first_plane = -1;
408        int last_plane  = -1;
409        for(Int_t ip=0; ip<6; ip++){
410            if( XGood(ip)*YGood(ip) && first_plane == -1 )first_plane = ip;
411            if( XGood(ip)*YGood(ip) && first_plane != -1 )last_plane = ip;
412        }
413        if( first_plane == -1 || last_plane == -1){
414            cout<< "Int_t TrkTrack::GetLeverArmXY() -- XGood(ip)*YGood(ip) always false ??? "<<endl;
415            return 0;
416        }
417        return (last_plane-first_plane+1);
418    }
419    /**
420   * Returns the reduced chi-square of track x-projection   * Returns the reduced chi-square of track x-projection
421   */   */
422  Float_t  TrkTrack::GetChi2X(){  Float_t  TrkTrack::GetChi2X(){
# Line 492  void TrkTrack::Dump(){ Line 543  void TrkTrack::Dump(){
543      cout << endl << "           "; for(int i=0; i<5; i++)cout << coval[4][i]<<" ";      cout << endl << "           "; for(int i=0; i<5; i++)cout << coval[4][i]<<" ";
544      cout << endl << "dedx_x   : "; for(int i=0; i<6; i++)cout << dedx_x[i] << " ";      cout << endl << "dedx_x   : "; for(int i=0; i<6; i++)cout << dedx_x[i] << " ";
545      cout << endl << "dedx_y   : "; for(int i=0; i<6; i++)cout << dedx_y[i] << " ";      cout << endl << "dedx_y   : "; for(int i=0; i<6; i++)cout << dedx_y[i] << " ";
546        cout << endl << "maxs x   : "; for(int i=0; i<6; i++)cout << GetClusterX_MaxStrip(i) << " ";
547        cout << endl << "maxs y   : "; for(int i=0; i<6; i++)cout << GetClusterY_MaxStrip(i) << " ";
548        cout << endl << "mult x   : "; for(int i=0; i<6; i++)cout << GetClusterX_Multiplicity(i) << " ";
549        cout << endl << "mult y   : "; for(int i=0; i<6; i++)cout << GetClusterY_Multiplicity(i) << " ";
550        cout << endl << "seed x   : "; for(int i=0; i<6; i++)cout << GetClusterX_Seed(i) << " ";
551        cout << endl << "seed y   : "; for(int i=0; i<6; i++)cout << GetClusterY_Seed(i) << " ";
552        cout << endl << "xpu      : "; for(int i=0; i<6; i++)cout << xpu[i] << " ";
553        cout << endl << "ypu      : "; for(int i=0; i<6; i++)cout << ypu[i] << " ";
554    
555      cout << endl;      cout << endl;
556  }  }
557  /**  /**
# Line 607  void TrkTrack::LoadField(TString path){ Line 667  void TrkTrack::LoadField(TString path){
667  //     path_.error   = 0;  //     path_.error   = 0;
668  //     readb_();  //     readb_();
669    
670      TrkParams::SetTrackingMode();  //     TrkParams::SetTrackingMode();
671      TrkParams::SetPrecisionFactor();  //     TrkParams::SetPrecisionFactor();
672      TrkParams::SetStepMin();  //     TrkParams::SetStepMin();
673        TrkParams::SetMiniDefault();
674    
675      TrkParams::Set(path,1);      TrkParams::Set(path,1);
676      TrkParams::Load(1);      TrkParams::Load(1);
677        if( !TrkParams::IsLoaded(1) ){
678            cout << "void TrkTrack::LoadField(TString path) --- ERROR --- m.field not loaded"<<endl;
679        }
680    
681  };  };
682    
# Line 634  void TrkTrack::FillMiniStruct(cMini2trac Line 698  void TrkTrack::FillMiniStruct(cMini2trac
698          track.zm[i]=zm[i];          track.zm[i]=zm[i];
699                    
700  //      --- temporaneo ----------------------------  //      --- temporaneo ----------------------------
701  //      andrebbe inserita la dimensione del sensore  //      float segment = 100.;
702          float segment = 100.;  //      track.xm_a[i]=xm[i];
703          track.xm_a[i]=xm[i];  //      track.xm_b[i]=xm[i];
704          track.xm_b[i]=xm[i];  //      track.ym_a[i]=ym[i];
705          track.ym_a[i]=ym[i];  //      track.ym_b[i]=ym[i];
706          track.ym_b[i]=ym[i];  //      if(       XGood(i) && !YGood(i) ){
707          if(       XGood(i) && !YGood(i) ){  //          track.ym_a[i] = track.ym_a[i]+segment;
708              track.ym_a[i] = track.ym_a[i]+segment;  //          track.ym_b[i] = track.ym_b[i]-segment;
709              track.ym_b[i] = track.ym_b[i]-segment;  //      }else if( !XGood(i) && YGood(i)){
710          }else if( !XGood(i) && YGood(i)){  //          track.xm_a[i] = track.xm_a[i]+segment;
711              track.xm_a[i] = track.xm_a[i]+segment;  //          track.xm_b[i] = track.xm_b[i]-segment;
712              track.xm_b[i] = track.xm_b[i]-segment;  //      }
         }  
713  //      --- temporaneo ----------------------------  //      --- temporaneo ----------------------------
714    
715            if( XGood(i) || YGood(i) ){
716                double segment = 2.;//cm
717                // NB: i parametri di allineamento hanno una notazione particolare!!!
718                // sensor = 0 (hybrid side), 1
719                // ladder = 0-2 (increasing x)
720                // plane  = 0-5 (from bottom to top!!!)
721                int is = (int)GetSensor(i); if(i==5)is=1-is;
722                int ip = 5-i;
723                int il = (int)GetLadder(i);
724                
725                double omega   = 0.;
726                double beta    = 0.;
727                double gamma   = 0.;
728                if(
729                    (is < 0 || is > 1 || ip < 0 || ip > 5 || il < 0 || il > 2) &&
730                    true){
731                    // se il piano risulta colpito, ladder e sensore devono essere
732                    // assegnati correttamente
733                    cout << " void TrkTrack::FillMiniStruct(cMini2track&) --- WARNING --- sensor not defined, cannot read alignment parameters "<<endl;
734                    cout << " is ip il = "<<is<<" "<<ip<<" "<<il<<endl;
735                }else{
736                    omega   = alignparameters_.omega[is][il][ip];
737                    beta    = alignparameters_.beta[is][il][ip];
738                    gamma   = alignparameters_.gamma[is][il][ip];
739                }
740                
741                if(       XGood(i) && !YGood(i) ){
742                    track.xm_a[i] = xm[i] - omega * segment;
743                    track.ym_a[i] = ym[i] + segment;
744    //          track.zm_a[i] = zm[i] + beta * segment;//not used yet
745                    track.xm_b[i] = xm[i] + omega * segment;
746                    track.ym_b[i] = ym[i] - segment;
747    //          track.zm_b[i] = zm[i] - beta * segment;//not used yet
748                }else if( !XGood(i) && YGood(i) ){
749                    track.xm_a[i] = xm[i] + segment;
750                    track.ym_a[i] = ym[i] + omega * segment;
751    //          track.zm_a[i] = zm[i] - gamma * segment;//not used yet
752                    track.xm_b[i] = xm[i] - segment;
753                    track.ym_b[i] = ym[i] - omega * segment;
754    //          track.zm_b[i] = zm[i] + gamma * segment;//not used yet
755                }
756            }
757                    
758          track.resx[i]=resx[i];          track.resx[i]=resx[i];
759          track.resy[i]=resy[i];          track.resy[i]=resy[i];
760          track.tailx[i]=tailx[i];          track.tailx[i]=tailx[i];
761          track.taily[i]=taily[i];          track.taily[i]=taily[i];
# Line 710  void TrkTrack::SetFromMiniStruct(cMini2t Line 816  void TrkTrack::SetFromMiniStruct(cMini2t
816   */   */
817  Bool_t TrkTrack::EvaluateClusterPositions(){  Bool_t TrkTrack::EvaluateClusterPositions(){
818            
819  //     cout << "void TrkTrack::GetClusterPositions() "<<endl;  //     cout << "void TrkTrack::GetClusterositions() "<<endl;
820    
821        bool OK=true;
822        TrkParams::Load(1); if( !TrkParams::IsLoaded(1) )cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- m.field not loaded "<<endl;
823        TrkParams::Load(4); if( !TrkParams::IsLoaded(4) )cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- p.f.a. par. not loaded "<<endl;
824        TrkParams::Load(5); if( !TrkParams::IsLoaded(5) )cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- alignment par. not loaded "<<endl;
825        if(!OK)return false;
826    
     TrkParams::Load( );  
     if( !TrkParams::IsLoaded() )return false;  
       
827      for(int ip=0; ip<6; ip++){      for(int ip=0; ip<6; ip++){
828  //      cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;;  //      cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;;
829          int icx = GetClusterX_ID(ip)+1;          int icx = GetClusterX_ID(ip)+1;
# Line 758  Bool_t TrkTrack::EvaluateClusterPosition Line 867  Bool_t TrkTrack::EvaluateClusterPosition
867   * @see EvaluateClusterPositions()   * @see EvaluateClusterPositions()
868   *   *
869   * The fitting procedure can be varied by changing the tracking mode,   * The fitting procedure can be varied by changing the tracking mode,
870   * the fit-precision factor and the minimum number of step.   * the fit-precision factor, the minimum number of step, etc.
871   * @see SetTrackingMode(int)   * @see SetTrackingMode(int)
872   * @see SetPrecisionFactor(double)   * @see SetPrecisionFactor(double)
873   * @see SetStepMin(int)   * @see SetStepMin(int)
874     * @see SetDeltaB(int,double)
875   */   */
876  void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){  void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){
877    
878      float al_ini[] = {0.,0.,0.,0.,0.};      bool OK=true;
879        TrkParams::Load(1); if( !TrkParams::IsLoaded(1) )cout << "void TrkTrack::Fit(double,int&,int,int) ---ERROR--- m.field not loaded "<<endl;
880        if(!OK)return;
881    
882      TrkParams::Load( );      float al_ini[] = {0.,0.,0.,0.,0.};
     if( !TrkParams::IsLoaded() )return;  
883    
884      extern cMini2track track_;      extern cMini2track track_;
885      fail = 0;      fail = 0;
# Line 804  void TrkTrack::Fit(double pfixed, int& f Line 915  void TrkTrack::Fit(double pfixed, int& f
915    
916      //  ------------------------------------------      //  ------------------------------------------
917      //  call mini routine      //  call mini routine
918  //     TrkParams::Load(1);      //  ------------------------------------------
 //     if( !TrkParams::IsLoaded(1) ){  
 //      cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl;  
 //      return;  
 //     }  
919      int istep=0;      int istep=0;
920      int ifail=0;      int ifail=0;
921      mini2_(&istep,&ifail, &iprint);      mini2_(&istep,&ifail, &iprint);
# Line 864  void TrkTrack::SetStepMin(int istepmin){ Line 971  void TrkTrack::SetStepMin(int istepmin){
971      track_.istepmin = istepmin;      track_.istepmin = istepmin;
972  }  }
973  /**  /**
974   * Returns 1 if the track is inside the magnet cavity   * Set deltaB parameters (id=0,1). By default they are set to zero.
  * Set the minimum number of steps for tracking precision  
975   */   */
976  Bool_t TrkTrack::IsInsideCavity(){  void TrkTrack::SetDeltaB(int id, double db){
977      float xmagntop, ymagntop, xmagnbottom, ymagnbottom;      if(id!=0 && id!=1)cout << "void TrkTrack::SetDeltaB(int id,double db) -- wrong input parameters: "<<id<<" "<<db<<endl;
978      xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*axv[0]/180.);      TrkParams::SetDeltaB(id,db);
979      ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*ayv[0]/180.);  }
980      xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*axv[5]/180.);  
981      ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*ayv[5]/180.);  /**
982      if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&   * Returns true if the track is inside the magnet cavity.
983          ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&   * @param toll Tolerance around the nominal volume (toll>0 define an inner fiducial volume)
984          xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&   */
985          ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);  Bool_t TrkTrack::IsInsideCavity(float toll){
986      else return(false);  
987    //     float xmagntop, ymagntop, xmagnbottom, ymagnbottom;
988    //     xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*axv[0]/180.);
989    //     ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*ayv[0]/180.);
990    //     xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*axv[5]/180.);
991    //     ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*ayv[5]/180.);
992    //     if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&
993    //      ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&
994    //      xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&
995    //      ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);
996    //     else return(false);
997    
998        int ngf = TrkParams::nGF;
999        for(int i=0; i<ngf; i++){
1000            //
1001    //      cout << endl << TrkParams::GF_element[i];
1002            if(
1003                TrkParams::GF_element[i].CompareTo("CUF") &&
1004                TrkParams::GF_element[i].CompareTo("T2")  &&
1005                TrkParams::GF_element[i].CompareTo("T3")  &&
1006                TrkParams::GF_element[i].CompareTo("T4")  &&
1007                TrkParams::GF_element[i].CompareTo("T5")  &&
1008                TrkParams::GF_element[i].CompareTo("CLF") &&
1009                true)continue;
1010            // apply condition only within the cavity
1011    //      cout << " -- "<<xGF[i]<<" "<<yGF[i];
1012            if(
1013                xGF[i] <= TrkParams::xGF_min[i] + toll ||
1014                xGF[i] >= TrkParams::xGF_max[i] - toll ||
1015                yGF[i] <= TrkParams::yGF_min[i] + toll ||
1016                yGF[i] >= TrkParams::yGF_max[i] - toll ||
1017                false){
1018                
1019                return false;
1020            }
1021        }
1022        return true;
1023    
1024    
1025    }
1026    /**
1027     * Returns true if the track is inside the nominal acceptance, which is defined
1028     * by the intersection among magnet cavity, silicon-plane sensitive area and
1029     * ToF sensitive area (nominal values from the official document used to
1030     * calculate the geometrical factor)
1031     */
1032    Bool_t TrkTrack::IsInsideAcceptance(){
1033    
1034        int ngf = TrkParams::nGF;
1035        for(int i=0; i<ngf; i++){
1036            if(
1037                xGF[i] <= TrkParams::xGF_min[i] ||
1038                xGF[i] >= TrkParams::xGF_max[i] ||
1039                yGF[i] <= TrkParams::yGF_min[i] ||
1040                yGF[i] >= TrkParams::yGF_max[i] ||
1041                false)return false;
1042        }
1043        return true;
1044    
1045  }  }
1046  /**  /**
1047   * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track.   * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track.
# Line 895  Int_t TrkTrack::GetClusterX_ID(int ip){ Line 1059  Int_t TrkTrack::GetClusterX_ID(int ip){
1059  Int_t TrkTrack::GetClusterY_ID(int ip){  Int_t TrkTrack::GetClusterY_ID(int ip){
1060      return ((Int_t)fabs(ygood[ip]))%10000000-1;      return ((Int_t)fabs(ygood[ip]))%10000000-1;
1061  };  };
1062    
1063  /**  /**
1064   * Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane.   * Method to retrieve the ladder (0-2, increasing x) traversed by the track on this plane.
1065   * If no ladder is traversed (dead area) the metod retuns -1.   * If no ladder is traversed (dead area) the metod retuns -1.
1066   * @param ip Tracker plane (0-5)   * @param ip Tracker plane (0-5)
1067   */   */
# Line 919  Int_t TrkTrack::GetSensor(int ip){ Line 1084  Int_t TrkTrack::GetSensor(int ip){
1084  /**  /**
1085   * \brief Method to include a x-cluster to the track.   * \brief Method to include a x-cluster to the track.
1086   * @param ip Tracker plane (0-5)   * @param ip Tracker plane (0-5)
1087   * @param clid Cluster ID (0,1,...)   * @param clid Cluster ID (0 = no-cluster, 1,2,... otherwise )
1088   * @param is Sensor (0-1, increasing y)   * @param il Ladder (0-2, increasing x, -1 if no sensitive area is hit)
1089     * @param is Sensor (0-1, increasing y, -1 if no sensitive area is hit)
1090     * @param bad True if the cluster contains bad strips  
1091   * @see Fit(double pfixed, int& fail, int iprint, int froml1)   * @see Fit(double pfixed, int& fail, int iprint, int froml1)
1092   */   */
1093  void TrkTrack::SetXGood(int ip, int clid, int is){  void TrkTrack::SetXGood(int ip, int clid, int il, int is, bool bad){
1094      int il=0;       //ladder (temporary)  //    int il=0;       //ladder (temporary)
1095      bool bad=false; //ladder (temporary)  //    bool bad=false; //ladder (temporary)
1096      xgood[ip]=il*100000000+is*10000000+clid;      if(ip<0||ip>5||clid<0||il<-1||il>2||is<-1||is>1)
1097            cout << " void TrkTrack::SetXGood(int,int,int,int,bool) --> MA SEI DI COCCIO?!?!"<<endl;
1098        xgood[ip]=(il+1)*100000000+(is+1)*10000000+clid;
1099      if(bad)xgood[ip]=-xgood[ip];      if(bad)xgood[ip]=-xgood[ip];
1100  };  };
1101  /**  /**
1102   * \brief Method to include a y-cluster to the track.   * \brief Method to include a y-cluster to the track.
1103   * @param ip Tracker plane (0-5)   * @param ip Tracker plane (0-5)
1104   * @param clid Cluster ID (0,1,...)   * @param clid Cluster ID (0 = no-cluster, 1,2,... otherwise )
1105   * @param is Sensor (0-1)   * @param il Ladder (0-2, increasing x, -1 if no sensitive area is hit)
1106     * @param is Sensor (0-1, increasing y, -1 if no sensitive area is hit)
1107     * @param bad True if the cluster contains bad strips  
1108   * @see Fit(double pfixed, int& fail, int iprint, int froml1)   * @see Fit(double pfixed, int& fail, int iprint, int froml1)
1109   */   */
1110  void TrkTrack::SetYGood(int ip, int clid, int is){  void TrkTrack::SetYGood(int ip, int clid, int il, int is, bool bad){
1111      int il=0;       //ladder (temporary)  //    int il=0;       //ladder (temporary)
1112      bool bad=false; //ladder (temporary)  //    bool bad=false; //ladder (temporary)
1113      ygood[ip]=il*100000000+is*10000000+clid;      if(ip<0||ip>5||clid<0||il<-1||il>2||is<-1||is>1)
1114            cout << " void TrkTrack::SetYGood(int,int,int,int,bool) --> MA SEI DI COCCIO?!?!"<<endl;
1115        ygood[ip]=(il+1)*100000000+(is+1)*10000000+clid;
1116      if(bad)ygood[ip]=-ygood[ip];      if(bad)ygood[ip]=-ygood[ip];
1117  };  };
1118    
1119    /**
1120     * \brief Average X
1121     * Average value of <xv>, evaluated from the first to the last hit x view.
1122     */
1123    Float_t TrkTrack::GetXav(){
1124    
1125        int first_plane = -1;
1126        int last_plane  = -1;
1127        for(Int_t ip=0; ip<6; ip++){
1128            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1129            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1130        }
1131        if( first_plane == -1 || last_plane == -1){
1132            return -100;
1133        }
1134        if( last_plane-first_plane+1 ==0 )return -100;
1135    
1136        Float_t av = 0;    
1137        for(int ip=first_plane; ip<=last_plane; ip++)av+=xv[ip];
1138        
1139        return (av/(last_plane-first_plane+1));    
1140    }
1141    /**
1142     * \brief Average Y
1143     * Average value of <yv>, evaluated from the first to the last hit x view.
1144     */
1145    Float_t TrkTrack::GetYav(){
1146    
1147        int first_plane = -1;
1148        int last_plane  = -1;
1149        for(Int_t ip=0; ip<6; ip++){
1150            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1151            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1152        }
1153        if( first_plane == -1 || last_plane == -1){
1154            return -100;
1155        }
1156        if( last_plane-first_plane+1 ==0 )return -100;
1157    
1158        Float_t av = 0;    
1159        for(int ip=first_plane; ip<=last_plane; ip++)av+=yv[ip];
1160    
1161        return (av/(last_plane-first_plane+1));    
1162    }
1163    /**
1164     * \brief Average Z
1165     * Average value of <zv>, evaluated from the first to the last hit x view.
1166     */
1167    Float_t TrkTrack::GetZav(){
1168    
1169        int first_plane = -1;
1170        int last_plane  = -1;
1171        for(Int_t ip=0; ip<6; ip++){
1172            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1173            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1174        }
1175        if( first_plane == -1 || last_plane == -1){
1176            return -100;
1177        }
1178        if( last_plane-first_plane+1 ==0 )return -100;
1179    
1180        Float_t av = 0;    
1181        for(int ip=first_plane; ip<=last_plane; ip++)av+=zv[ip];
1182        
1183        return (av/(last_plane-first_plane+1));    
1184    }
1185    
1186    /**
1187     * \brief Number of column traversed
1188     */
1189    Int_t TrkTrack::GetNColumns(){
1190        int sensors[] = {0,0,0,0,0,0};
1191        for(int ip=0; ip<6; ip++){
1192            int sensorid = GetLadder(ip)+3*GetSensor(ip);    
1193            if(XGood(ip)||YGood(ip))
1194                if(sensorid>=0 && sensorid<6)sensors[sensorid]=1;
1195        }
1196        int nsensors=0;
1197        for(int is=0; is<6; is++)nsensors += sensors[is];
1198        return nsensors;
1199    };
1200    /**
1201     * \brief Give the maximum energy release
1202     */
1203    Float_t TrkTrack::GetDEDX_max(int ip, int iv){
1204        Float_t max=0;
1205        int pfrom = 0;
1206        int pto   = 6;
1207        int vfrom = 0;
1208        int vto   = 2;
1209        if(ip>=0&&ip<6){
1210            pfrom = ip;
1211            pto   = ip+1;
1212        }
1213        if(iv>=0&&iv<2){
1214            vfrom = iv;
1215            vto   = iv+1;
1216        }
1217        for(int i=pfrom; i<pto; i++)
1218            for(int j=vfrom; j<vto; j++){
1219                if(j==0 && XGood(i) && GetDEDX(i,j)>max)max=GetDEDX(i,j);
1220                if(j==1 && YGood(i) && GetDEDX(i,j)>max)max=GetDEDX(i,j);
1221            }
1222        return max;
1223    
1224    };
1225    
1226    /**
1227     * \brief Give the minimum energy release
1228     */
1229    Float_t TrkTrack::GetDEDX_min(int ip, int iv){
1230        Float_t min=100000000;
1231        int pfrom = 0;
1232        int pto   = 6;
1233        int vfrom = 0;
1234        int vto   = 2;
1235        if(ip>=0&&ip<6){
1236            pfrom = ip;
1237            pto   = ip+1;
1238        }
1239        if(iv>=0&&iv<2){
1240            vfrom = iv;
1241            vto   = iv+1;
1242        }
1243        for(int i=pfrom; i<pto; i++)
1244            for(int j=vfrom; j<vto; j++){
1245                if(j==0 && XGood(i) && GetDEDX(i,j)<min)min=GetDEDX(i,j);
1246                if(j==1 && YGood(i) && GetDEDX(i,j)<min)min=GetDEDX(i,j);
1247            }
1248        return min;
1249    
1250    };
1251    
1252    /**
1253     * \brief Give the maximum spatial residual  
1254     */
1255    Float_t TrkTrack::GetResidual_max(int ip, int iv){
1256        Float_t max=0;
1257        int pfrom = 0;
1258        int pto   = 6;
1259        int vfrom = 0;
1260        int vto   = 2;
1261        if(ip>=0&&ip<6){
1262            pfrom = ip;
1263            pto   = ip+1;
1264        }
1265        if(iv>=0&&iv<2){
1266            vfrom = iv;
1267            vto   = iv+1;
1268        }
1269        for(int i=pfrom; i<pto; i++){
1270            for(int j=vfrom; j<vto; j++){
1271                if(j==0 && XGood(i) && fabs(xm[i]-xv[i])>fabs(max))max=xm[i]-xv[i];
1272                if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=ym[i]-yv[i];
1273            }
1274        }
1275        return max;
1276    
1277    };
1278    /**
1279     * \brief Give the anerage spatial residual
1280     */
1281    Float_t TrkTrack::GetResidual_av(int ip, int iv){
1282        //
1283    //Sum$((xm>-50)*(xm-xv)/resx)/sqrt(TrkTrack.GetNX()*TrkTrack.GetChi2X())<0.3
1284    
1285        Float_t av  = 0.;
1286        int     nav = 0;
1287        //
1288        int pfrom = 0;
1289        int pto   = 6;
1290        int vfrom = 0;
1291        int vto   = 2;
1292        if(ip>=0&&ip<6){
1293            pfrom = ip;
1294            pto   = ip+1;
1295        }
1296        if(iv>=0&&iv<2){
1297            vfrom = iv;
1298            vto   = iv+1;
1299        }
1300        for(int i=pfrom; i<pto; i++){
1301            for(int j=vfrom; j<vto; j++){
1302                nav++;
1303                if(j==0 && XGood(i)) av += (xm[i]-xv[i])/resx[i];
1304                if(j==1 && YGood(i)) av += (ym[i]-yv[i])/resy[i];
1305            }
1306        }
1307        if(nav==0)return -100.;
1308        return av/nav;
1309    
1310    };
1311    
1312    
1313    /**
1314     * \brief Give the maximum multiplicity on the x view
1315     */
1316    Int_t TrkTrack::GetClusterX_Multiplicity_max(){
1317        int max=0;
1318        for(int ip=0; ip<6; ip++)
1319            if(GetClusterX_Multiplicity(ip)>max)max=GetClusterX_Multiplicity(ip);
1320        return max;
1321    };
1322    /**
1323     * \brief Give the minimum multiplicity on the x view
1324     */
1325    Int_t TrkTrack::GetClusterX_Multiplicity_min(){
1326        int min=50;
1327        for(int ip=0; ip<6; ip++)
1328            if(GetClusterX_Multiplicity(ip)<min)min=GetClusterX_Multiplicity(ip);
1329        return min;
1330    };
1331    /**
1332     * \brief Give the maximum multiplicity on the x view
1333     */
1334    Int_t TrkTrack::GetClusterY_Multiplicity_max(){
1335        int max=0;
1336        for(int ip=0; ip<6; ip++)
1337            if(GetClusterY_Multiplicity(ip)>max)max=GetClusterY_Multiplicity(ip);
1338        return max;
1339    };
1340    /**
1341     * \brief Give the minimum multiplicity on the x view
1342     */
1343    Int_t TrkTrack::GetClusterY_Multiplicity_min(){
1344        int min=50;
1345        for(int ip=0; ip<6; ip++)
1346            if(GetClusterY_Multiplicity(ip)<min)min=GetClusterY_Multiplicity(ip);
1347        return min;
1348    };
1349    
1350    /**
1351     * \brief Give the minimum seed on the x view
1352     */
1353    Float_t TrkTrack::GetClusterX_Seed_min(){
1354        Float_t min=100000;
1355        for(int ip=0; ip<6; ip++)
1356            if(XGood(ip) && GetClusterX_Seed(ip)<min)min=GetClusterX_Seed(ip);
1357        return min;
1358    };
1359    /**
1360     * \brief Give the minimum seed on the x view
1361     */
1362    Float_t TrkTrack::GetClusterY_Seed_min(){
1363        Float_t min=100000;
1364        for(int ip=0; ip<6; ip++)
1365            if(YGood(ip) && GetClusterY_Seed(ip)<min)min=GetClusterY_Seed(ip);
1366        return min;
1367    };
1368    
1369    
1370  //--------------------------------------  //--------------------------------------
1371  //  //
1372  //  //
# Line 976  void TrkTrack::Clear(){ Line 1400  void TrkTrack::Clear(){
1400          dedx_y[ip] = 0;          dedx_y[ip] = 0;
1401    
1402      };      };
1403        int ngf = TrkParams::nGF;
1404        for(int i=0; i<ngf; i++){
1405            xGF[i] = 0.;
1406            yGF[i] = 0.;
1407        }
1408  //     if(clx)clx->Clear();  //     if(clx)clx->Clear();
1409  //     if(cly)cly->Clear();  //     if(cly)cly->Clear();
1410  //    clx.Clear();  //    clx.Clear();
# Line 1002  void TrkTrack::Delete(){ Line 1431  void TrkTrack::Delete(){
1431  //--------------------------------------  //--------------------------------------
1432  TrkSinglet::TrkSinglet(){  TrkSinglet::TrkSinglet(){
1433  //    cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl;  //    cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl;
1434      plane    = 0;  //     plane    = 0;
1435      coord[0] = 0;  //     coord[0] = 0;
1436      coord[1] = 0;  //     coord[1] = 0;
1437      sgnl     = 0;  //     sgnl     = 0;
1438    //     multmax  = 0;
1439  //    cls      = 0;  //    cls      = 0;
1440        Clear();
1441  };  };
1442  //--------------------------------------  //--------------------------------------
1443  //  //
# Line 1018  TrkSinglet::TrkSinglet(const TrkSinglet& Line 1449  TrkSinglet::TrkSinglet(const TrkSinglet&
1449      coord[0] = s.coord[0];      coord[0] = s.coord[0];
1450      coord[1] = s.coord[1];      coord[1] = s.coord[1];
1451      sgnl     = s.sgnl;      sgnl     = s.sgnl;
1452        multmax  = s.multmax;
1453  //      cls      = 0;//<<<<pointer  //      cls      = 0;//<<<<pointer
1454  //    cls      = TRef(s.cls);  //    cls      = TRef(s.cls);
1455  };  };
# Line 1028  TrkSinglet::TrkSinglet(const TrkSinglet& Line 1460  TrkSinglet::TrkSinglet(const TrkSinglet&
1460  void TrkSinglet::Dump(){  void TrkSinglet::Dump(){
1461      int i=0;      int i=0;
1462      cout << endl << "========== Singlet " ;      cout << endl << "========== Singlet " ;
1463      cout << endl << "plane    : " << plane;      cout << endl << "plane        : " << plane;
1464      cout << endl << "coord[2] : "; while( i<2 && cout << coord[i] << " ") i++;      cout << endl << "coord[2]     : "; while( i<2 && cout << coord[i] << " ") i++;
1465      cout << endl << "sgnl     : " << sgnl;      cout << endl << "sgnl         : " << sgnl;
1466        cout << endl << "max.strip    : ";
1467        cout << endl << "multiplicity : ";
1468  }  }
1469  //--------------------------------------  //--------------------------------------
1470  //  //
# Line 1043  void TrkSinglet::Clear(){ Line 1477  void TrkSinglet::Clear(){
1477      coord[0]=-999;      coord[0]=-999;
1478      coord[1]=-999;      coord[1]=-999;
1479      sgnl=0;      sgnl=0;
1480        multmax  = 0;
1481            
1482  }  }
1483  //--------------------------------------  //--------------------------------------
# Line 1078  void TrkLevel2::Dump(){ Line 1513  void TrkLevel2::Dump(){
1513                    
1514          //          //
1515      cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";      cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
1516      cout << endl << "good     : "; for(int i=0; i<12; i++) cout << good[i]<<" ";      cout << endl << "good     : "; for(int i=0; i<12; i++) cout << hex <<" 0x"<< good[i]<<dec;
1517      cout << endl << "ntrk()   : " << this->ntrk() ;      cout << endl << "ntrk()   : " << ntrk() ;
1518      cout << endl << "nclsx()  : " << this->nclsx();      cout << endl << "nclsx()  : " << nclsx();
1519      cout << endl << "nclsy()  : " << this->nclsy();      cout << endl << "nclsy()  : " << nclsy();
1520      if(Track){      if(Track){
1521          TClonesArray &t  = *Track;          TClonesArray &t  = *Track;
1522          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();
1523      }            }      
1524      if(SingletX){  //     if(SingletX){
1525          TClonesArray &sx = *SingletX;  //      TClonesArray &sx = *SingletX;
1526          for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();  //      for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();
1527      }  //     }
1528      if(SingletY){  //     if(SingletY){
1529          TClonesArray &sy = *SingletY;  //      TClonesArray &sy = *SingletY;
1530          for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();  //      for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();
1531      }  //     }
1532        cout << endl;
1533  }  }
1534  /**  /**
1535   * \brief Dump processing status   * \brief Dump processing status
# Line 1152  Bool_t TrkLevel2::GetVKFlag(int iv, int Line 1588  Bool_t TrkLevel2::GetVKFlag(int iv, int
1588   * forced (see TrkLevel2::GetVKMask(int,int)) or   * forced (see TrkLevel2::GetVKMask(int,int)) or
1589   * for this event only (TrkLevel2::GetVKFlag(int,int)).   * for this event only (TrkLevel2::GetVKFlag(int,int)).
1590   * @param iv Tracker view (0-11)   * @param iv Tracker view (0-11)
1591   * @param ivk Viking-chip number (0-23)   * @param ivk Viking-chip number (0-23)
1592   */   */
1593  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){
1594      return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );      return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );
# Line 1237  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1673  void TrkLevel2::SetFromLevel2Struct(cTrk
1673              t_track->ayv[ip]    = l2->ayv_nt[i][ip];              t_track->ayv[ip]    = l2->ayv_nt[i][ip];
1674              t_track->dedx_x[ip] = l2->dedx_x[i][ip];              t_track->dedx_x[ip] = l2->dedx_x[i][ip];
1675              t_track->dedx_y[ip] = l2->dedx_y[i][ip];              t_track->dedx_y[ip] = l2->dedx_y[i][ip];
1676                t_track->multmaxx[ip] = l2->multmaxx[i][ip];
1677                t_track->multmaxy[ip] = l2->multmaxy[i][ip];
1678                t_track->seedx[ip]  = l2->seedx[i][ip];  
1679                t_track->seedy[ip]  = l2->seedy[i][ip];
1680                t_track->xpu[ip]    = l2->xpu[i][ip];  
1681                t_track->ypu[ip]    = l2->ypu[i][ip];  
1682              //-----------------------------------------------------              //-----------------------------------------------------
1683              //-----------------------------------------------------              //-----------------------------------------------------
1684              //-----------------------------------------------------              //-----------------------------------------------------
1685              //-----------------------------------------------------              //-----------------------------------------------------
1686          };          };
1687            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1688            // evaluated coordinates (to define GF)
1689            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1690            int    ngf = TrkParams::nGF;
1691            float *zgf = TrkParams::zGF;
1692            Trajectory tgf = Trajectory(ngf,zgf);
1693            tgf.DoTrack2(t_track->al);//<<<< integrate the trajectory
1694            for(int ip=0; ip<ngf; ip++){
1695                t_track->xGF[ip] = tgf.x[ip];
1696                t_track->yGF[ip] = tgf.y[ip];
1697            }
1698            
1699  //      if(t_track->IsSaturated())t_track->Dump();  //      if(t_track->IsSaturated())t_track->Dump();
1700          new(t[i]) TrkTrack(*t_track);          new(t[i]) TrkTrack(*t_track);
1701          t_track->Clear();          t_track->Clear();
1702      };      };//end loop over track
1703    
1704  //  ----------------  //  ----------------
1705  //  *** SINGLETS ***  //  *** SINGLETS ***
# Line 1257  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1711  void TrkLevel2::SetFromLevel2Struct(cTrk
1711          t_singlet->coord[0] = l2->xs[i][0];          t_singlet->coord[0] = l2->xs[i][0];
1712          t_singlet->coord[1] = l2->xs[i][1];          t_singlet->coord[1] = l2->xs[i][1];
1713          t_singlet->sgnl     = l2->signlxs[i];          t_singlet->sgnl     = l2->signlxs[i];
1714            t_singlet->multmax = l2->multmaxsx[i];
1715            if(l2->sxbad[i]>0) t_singlet->multmax = -1*t_singlet->multmax;
1716          //-----------------------------------------------------          //-----------------------------------------------------
1717  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);
1718          //-----------------------------------------------------          //-----------------------------------------------------
# Line 1270  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1726  void TrkLevel2::SetFromLevel2Struct(cTrk
1726          t_singlet->coord[0] = l2->ys[i][0];          t_singlet->coord[0] = l2->ys[i][0];
1727          t_singlet->coord[1] = l2->ys[i][1];          t_singlet->coord[1] = l2->ys[i][1];
1728          t_singlet->sgnl     = l2->signlys[i];          t_singlet->sgnl     = l2->signlys[i];
1729            t_singlet->multmax  = l2->multmaxsy[i];
1730            if(l2->sybad[i]>0) t_singlet->multmax = -1*t_singlet->multmax;
1731          //-----------------------------------------------------          //-----------------------------------------------------
1732  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);
1733          //-----------------------------------------------------          //-----------------------------------------------------
1734          new(sy[i]) TrkSinglet(*t_singlet);          new(sy[i]) TrkSinglet(*t_singlet);
1735          t_singlet->Clear();          t_singlet->Clear();
1736      };      };
1737    
1738    
1739                    
1740      delete t_track;      delete t_track;
1741      delete t_singlet;      delete t_singlet;
# Line 1451  TRefArray *TrkLevel2::GetTracks_NFitSort Line 1911  TRefArray *TrkLevel2::GetTracks_NFitSort
1911  TrkTrack *TrkLevel2::GetStoredTrack(int is){  TrkTrack *TrkLevel2::GetStoredTrack(int is){
1912    
1913      if(is >= this->ntrk()){      if(is >= this->ntrk()){
1914          cout << "** TrkLevel2 ** Track "<< is << "doen not exits! " << endl;          cout << "TrkTrack *TrkLevel2::GetStoredTrack(int) >> Track "<< is << "doen not exits! " << endl;
1915          cout << "                Stored tracks ntrk() = "<< this->ntrk() << endl;          cout << "Stored tracks ntrk() = "<< this->ntrk() << endl;
1916          return 0;          return 0;
1917      }      }
1918      if(!Track){      if(!Track){
# Line 1473  TrkTrack *TrkLevel2::GetStoredTrack(int Line 1933  TrkTrack *TrkLevel2::GetStoredTrack(int
1933  TrkSinglet *TrkLevel2::GetSingletX(int is){  TrkSinglet *TrkLevel2::GetSingletX(int is){
1934    
1935          if(is >= this->nclsx()){          if(is >= this->nclsx()){
1936                  cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;                  cout << "TrkSinglet *TrkLevel2::GetSingletX(int) >> Singlet "<< is << "doen not exits! " << endl;
1937                  cout << "                Stored x-singlets nclsx() = "<< this->nclsx() << endl;                  cout << "Stored x-singlets nclsx() = "<< this->nclsx() << endl;
1938                  return 0;                  return 0;
1939          }          }
1940          if(!SingletX)return 0;          if(!SingletX)return 0;
# Line 1493  TrkSinglet *TrkLevel2::GetSingletX(int i Line 1953  TrkSinglet *TrkLevel2::GetSingletX(int i
1953  TrkSinglet *TrkLevel2::GetSingletY(int is){  TrkSinglet *TrkLevel2::GetSingletY(int is){
1954    
1955          if(is >= this->nclsy()){          if(is >= this->nclsy()){
1956                  cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;                  cout << "TrkSinglet *TrkLevel2::GetSingletY(int) >> Singlet "<< is << "doen not exits! " << endl;
1957                  cout << "                Stored y-singlets nclsy() = "<< this->nclsx() << endl;                  cout << "Stored y-singlets nclsx() = "<< this->nclsx() << endl;
1958                  return 0;                  return 0;
1959          }          }
1960          if(!SingletY)return 0;          if(!SingletY)return 0;
# Line 1514  TrkSinglet *TrkLevel2::GetSingletY(int i Line 1974  TrkSinglet *TrkLevel2::GetSingletY(int i
1974  TrkTrack *TrkLevel2::GetTrack(int it){  TrkTrack *TrkLevel2::GetTrack(int it){
1975            
1976          if(it >= this->GetNTracks()){          if(it >= this->GetNTracks()){
1977                  cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;                  cout << "TrkTrack *TrkLevel2::GetTrack(int) >> Track "<< it << "does not exits! " << endl;
1978                  cout << "                Physical tracks GetNTracks() = "<< this->ntrk() << endl;                  cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl;
1979                  return 0;                  return 0;
1980          }          }
1981                    
# Line 1552  Int_t TrkLevel2::GetNTracks(){ Line 2012  Int_t TrkLevel2::GetNTracks(){
2012  TrkTrack *TrkLevel2::GetTrackImage(int it){  TrkTrack *TrkLevel2::GetTrackImage(int it){
2013    
2014      if(it >= this->GetNTracks()){      if(it >= this->GetNTracks()){
2015          cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;          cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not exits! " << endl;
2016          cout << "                Physical tracks GetNTracks() = "<< this->ntrk() << endl;          cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl;
2017          return 0;          return 0;
2018      }      }
2019                    
# Line 1562  TrkTrack *TrkLevel2::GetTrackImage(int i Line 2022  TrkTrack *TrkLevel2::GetTrackImage(int i
2022      TrkTrack *track = (TrkTrack*)sorted->At(it);      TrkTrack *track = (TrkTrack*)sorted->At(it);
2023                    
2024      if(!track->HasImage()){      if(!track->HasImage()){
2025          cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl;          cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not have image! " << endl;
2026          return 0;          return 0;
2027      }      }
2028      if(!Track)return 0;      if(!Track)return 0;
# Line 1589  void TrkLevel2::LoadField(TString path){ Line 2049  void TrkLevel2::LoadField(TString path){
2049  //     path_.error   = 0;  //     path_.error   = 0;
2050  //     readb_();  //     readb_();
2051    
2052      TrkParams::SetTrackingMode();  //     TrkParams::SetTrackingMode();
2053      TrkParams::SetPrecisionFactor();  //     TrkParams::SetPrecisionFactor();
2054      TrkParams::SetStepMin();  //     TrkParams::SetStepMin();
2055        TrkParams::SetMiniDefault();
2056    
2057      TrkParams::Set(path,1);      TrkParams::Set(path,1);
2058      TrkParams::Load(1);      TrkParams::Load(1);
2059        if( !TrkParams::IsLoaded(1) ){
2060            cout << "void TrkLevel2::LoadField(TString path) --- ERROR --- m.field not loaded"<<endl;
2061        }
2062    
2063  //  //
2064  };  };
# Line 1789  float Trajectory::GetLength(int ifirst, Line 2253  float Trajectory::GetLength(int ifirst,
2253   */   */
2254  int Trajectory::DoTrack2(float* al){  int Trajectory::DoTrack2(float* al){
2255    
2256      double *dxout   = new double[npoint];  //      double *dxout   = new double[npoint];
2257      double *dyout   = new double[npoint];  //      double *dyout   = new double[npoint];
2258      double *dthxout = new double[npoint];  //      double *dthxout = new double[npoint];
2259      double *dthyout = new double[npoint];  //      double *dthyout = new double[npoint];
2260      double *dtlout  = new double[npoint];  //      double *dtlout  = new double[npoint];
2261      double *dzin    = new double[npoint];  //      double *dzin    = new double[npoint];
2262      double dal[5];      
2263         double *dxout;
2264         double *dyout;
2265         double *dthxout;
2266         double *dthyout;
2267         double *dtlout;
2268         double *dzin;
2269    
2270         dxout   = (double*) malloc(npoint*sizeof(double));
2271         dyout   = (double*) malloc(npoint*sizeof(double));
2272         dthxout = (double*) malloc(npoint*sizeof(double));
2273         dthyout = (double*) malloc(npoint*sizeof(double));
2274         dtlout  = (double*) malloc(npoint*sizeof(double));
2275         dzin    = (double*) malloc(npoint*sizeof(double));
2276    
2277         double dal[5];
2278    
2279      int ifail = 0;      int ifail = 0;
2280    
# Line 1810  int Trajectory::DoTrack2(float* al){ Line 2289  int Trajectory::DoTrack2(float* al){
2289      dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);      dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);
2290            
2291      for (int i=0; i<npoint; i++){      for (int i=0; i<npoint; i++){
2292          x[i]   = (float)*dxout++;          x[i]   = (float)*(dxout+i);
2293          y[i]   = (float)*dyout++;          y[i]   = (float)*(dyout+i);
2294          thx[i] = (float)*dthxout++;          thx[i] = (float)*(dthxout+i);
2295          thy[i] = (float)*dthyout++;          thy[i] = (float)*(dthyout+i);
2296          tl[i]  = (float)*dtlout++;          tl[i]  = (float)*(dtlout+i);
2297      }      }
2298    
2299        if(dxout)  free( dxout );
2300        if(dyout)  free( dyout );
2301        if(dthxout)free( dthxout );
2302        if(dthyout)free( dthyout );
2303        if(dtlout) free( dtlout );
2304        if(dzin)   free( dzin );
2305    
2306    //      delete [] dxout;
2307    //      delete [] dyout;
2308    //      delete [] dthxout;
2309    //      delete [] dthyout;
2310    //      delete [] dtlout;
2311    //      delete [] dzin;
2312    
2313    
2314      return ifail;      return ifail;
2315  };  };

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.50

  ViewVC Help
Powered by ViewVC 1.1.23