/[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.46 by pam-fi, Fri Apr 11 13:44:38 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 492  void TrkTrack::Dump(){ Line 526  void TrkTrack::Dump(){
526      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]<<" ";
527      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] << " ";
528      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] << " ";
529        cout << endl << "maxs x   : "; for(int i=0; i<6; i++)cout << GetClusterX_MaxStrip(i) << " ";
530        cout << endl << "maxs y   : "; for(int i=0; i<6; i++)cout << GetClusterY_MaxStrip(i) << " ";
531        cout << endl << "mult x   : "; for(int i=0; i<6; i++)cout << GetClusterX_Multiplicity(i) << " ";
532        cout << endl << "mult y   : "; for(int i=0; i<6; i++)cout << GetClusterY_Multiplicity(i) << " ";
533        cout << endl << "seed x   : "; for(int i=0; i<6; i++)cout << GetClusterX_Seed(i) << " ";
534        cout << endl << "seed y   : "; for(int i=0; i<6; i++)cout << GetClusterY_Seed(i) << " ";
535        cout << endl << "xpu      : "; for(int i=0; i<6; i++)cout << xpu[i] << " ";
536        cout << endl << "ypu      : "; for(int i=0; i<6; i++)cout << ypu[i] << " ";
537    
538      cout << endl;      cout << endl;
539  }  }
540  /**  /**
# Line 607  void TrkTrack::LoadField(TString path){ Line 650  void TrkTrack::LoadField(TString path){
650  //     path_.error   = 0;  //     path_.error   = 0;
651  //     readb_();  //     readb_();
652    
653      TrkParams::SetTrackingMode();  //     TrkParams::SetTrackingMode();
654      TrkParams::SetPrecisionFactor();  //     TrkParams::SetPrecisionFactor();
655      TrkParams::SetStepMin();  //     TrkParams::SetStepMin();
656        TrkParams::SetMiniDefault();
657    
658      TrkParams::Set(path,1);      TrkParams::Set(path,1);
659      TrkParams::Load(1);      TrkParams::Load(1);
# Line 634  void TrkTrack::FillMiniStruct(cMini2trac Line 678  void TrkTrack::FillMiniStruct(cMini2trac
678          track.zm[i]=zm[i];          track.zm[i]=zm[i];
679                    
680  //      --- temporaneo ----------------------------  //      --- temporaneo ----------------------------
681  //      andrebbe inserita la dimensione del sensore  //      float segment = 100.;
682          float segment = 100.;  //      track.xm_a[i]=xm[i];
683          track.xm_a[i]=xm[i];  //      track.xm_b[i]=xm[i];
684          track.xm_b[i]=xm[i];  //      track.ym_a[i]=ym[i];
685          track.ym_a[i]=ym[i];  //      track.ym_b[i]=ym[i];
686          track.ym_b[i]=ym[i];  //      if(       XGood(i) && !YGood(i) ){
687          if(       XGood(i) && !YGood(i) ){  //          track.ym_a[i] = track.ym_a[i]+segment;
688              track.ym_a[i] = track.ym_a[i]+segment;  //          track.ym_b[i] = track.ym_b[i]-segment;
689              track.ym_b[i] = track.ym_b[i]-segment;  //      }else if( !XGood(i) && YGood(i)){
690          }else if( !XGood(i) && YGood(i)){  //          track.xm_a[i] = track.xm_a[i]+segment;
691              track.xm_a[i] = track.xm_a[i]+segment;  //          track.xm_b[i] = track.xm_b[i]-segment;
692              track.xm_b[i] = track.xm_b[i]-segment;  //      }
         }  
693  //      --- temporaneo ----------------------------  //      --- temporaneo ----------------------------
694    
695            if( XGood(i) || YGood(i) ){
696                double segment = 2.;//cm
697                // NB: i parametri di allineamento hanno una notazione particolare!!!
698                // sensor = 0 (hybrid side), 1
699                // ladder = 0-2 (increasing x)
700                // plane  = 0-5 (from bottom to top!!!)
701                int is = (int)GetSensor(i); if(i==5)is=1-is;
702                int ip = 5-i;
703                int il = (int)GetLadder(i);
704                
705                double omega   = 0.;
706                double beta    = 0.;
707                double gamma   = 0.;
708                if(
709                    (is < 0 || is > 1 || ip < 0 || ip > 5 || il < 0 || il > 2) &&
710                    true){
711                    // se il piano risulta colpito, ladder e sensore devono essere
712                    // assegnati correttamente
713                    cout << " void TrkTrack::FillMiniStruct(cMini2track&) --- WARNING --- sensor not defined, cannot read alignment parameters "<<endl;
714                    cout << " is ip il = "<<is<<" "<<ip<<" "<<il<<endl;
715                }else{
716                    omega   = alignparameters_.omega[is][il][ip];
717                    beta    = alignparameters_.beta[is][il][ip];
718                    gamma   = alignparameters_.gamma[is][il][ip];
719                }
720                
721                if(       XGood(i) && !YGood(i) ){
722                    track.xm_a[i] = xm[i] - omega * segment;
723                    track.ym_a[i] = ym[i] + segment;
724    //          track.zm_a[i] = zm[i] + beta * segment;//not used yet
725                    track.xm_b[i] = xm[i] + omega * segment;
726                    track.ym_b[i] = ym[i] - segment;
727    //          track.zm_b[i] = zm[i] - beta * segment;//not used yet
728                }else if( !XGood(i) && YGood(i) ){
729                    track.xm_a[i] = xm[i] + segment;
730                    track.ym_a[i] = ym[i] + omega * segment;
731    //          track.zm_a[i] = zm[i] - gamma * segment;//not used yet
732                    track.xm_b[i] = xm[i] - segment;
733                    track.ym_b[i] = ym[i] - omega * segment;
734    //          track.zm_b[i] = zm[i] + gamma * segment;//not used yet
735                }
736            }
737                    
738          track.resx[i]=resx[i];          track.resx[i]=resx[i];
739          track.resy[i]=resy[i];          track.resy[i]=resy[i];
740          track.tailx[i]=tailx[i];          track.tailx[i]=tailx[i];
741          track.taily[i]=taily[i];          track.taily[i]=taily[i];
# Line 710  void TrkTrack::SetFromMiniStruct(cMini2t Line 796  void TrkTrack::SetFromMiniStruct(cMini2t
796   */   */
797  Bool_t TrkTrack::EvaluateClusterPositions(){  Bool_t TrkTrack::EvaluateClusterPositions(){
798            
799  //     cout << "void TrkTrack::GetClusterPositions() "<<endl;  //     cout << "void TrkTrack::GetClusterositions() "<<endl;
800    
801      TrkParams::Load( );      TrkParams::Load( );
802      if( !TrkParams::IsLoaded() )return false;      if( !TrkParams::IsLoaded() )return false;
# Line 758  Bool_t TrkTrack::EvaluateClusterPosition Line 844  Bool_t TrkTrack::EvaluateClusterPosition
844   * @see EvaluateClusterPositions()   * @see EvaluateClusterPositions()
845   *   *
846   * The fitting procedure can be varied by changing the tracking mode,   * The fitting procedure can be varied by changing the tracking mode,
847   * the fit-precision factor and the minimum number of step.   * the fit-precision factor, the minimum number of step, etc.
848   * @see SetTrackingMode(int)   * @see SetTrackingMode(int)
849   * @see SetPrecisionFactor(double)   * @see SetPrecisionFactor(double)
850   * @see SetStepMin(int)   * @see SetStepMin(int)
851     * @see SetDeltaB(int,double)
852   */   */
853  void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){  void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){
854    
# Line 864  void TrkTrack::SetStepMin(int istepmin){ Line 951  void TrkTrack::SetStepMin(int istepmin){
951      track_.istepmin = istepmin;      track_.istepmin = istepmin;
952  }  }
953  /**  /**
954   * 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  
955   */   */
956  Bool_t TrkTrack::IsInsideCavity(){  void TrkTrack::SetDeltaB(int id, double db){
957      float xmagntop, ymagntop, xmagnbottom, ymagnbottom;      if(id!=0 && id!=1)cout << "void TrkTrack::SetDeltaB(int id,double db) -- wrong input parameters: "<<id<<" "<<db<<endl;
958      xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*axv[0]/180.);      TrkParams::SetDeltaB(id,db);
959      ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*ayv[0]/180.);  }
960      xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*axv[5]/180.);  
961      ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*ayv[5]/180.);  /**
962      if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&   * Returns true if the track is inside the magnet cavity.
963          ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&   * @param toll Tolerance around the nominal volume (toll>0 define an inner fiducial volume)
964          xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&   */
965          ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);  Bool_t TrkTrack::IsInsideCavity(float toll){
966      else return(false);  
967    //     float xmagntop, ymagntop, xmagnbottom, ymagnbottom;
968    //     xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*axv[0]/180.);
969    //     ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*ayv[0]/180.);
970    //     xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*axv[5]/180.);
971    //     ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*ayv[5]/180.);
972    //     if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&
973    //      ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&
974    //      xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&
975    //      ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);
976    //     else return(false);
977    
978        int ngf = TrkParams::nGF;
979        for(int i=0; i<ngf; i++){
980            //
981    //      cout << endl << TrkParams::GF_element[i];
982            if(
983                TrkParams::GF_element[i].CompareTo("CUF") &&
984                TrkParams::GF_element[i].CompareTo("T2")  &&
985                TrkParams::GF_element[i].CompareTo("T3")  &&
986                TrkParams::GF_element[i].CompareTo("T4")  &&
987                TrkParams::GF_element[i].CompareTo("T5")  &&
988                TrkParams::GF_element[i].CompareTo("CLF") &&
989                true)continue;
990            // apply condition only within the cavity
991    //      cout << " -- "<<xGF[i]<<" "<<yGF[i];
992            if(
993                xGF[i] <= TrkParams::xGF_min[i] + toll ||
994                xGF[i] >= TrkParams::xGF_max[i] - toll ||
995                yGF[i] <= TrkParams::yGF_min[i] + toll ||
996                yGF[i] >= TrkParams::yGF_max[i] - toll ||
997                false){
998                
999                return false;
1000            }
1001        }
1002        return true;
1003    
1004    
1005    }
1006    /**
1007     * Returns true if the track is inside the nominal acceptance, which is defined
1008     * by the intersection among magnet cavity, silicon-plane sensitive area and
1009     * ToF sensitive area (nominal values from the official document used to
1010     * calculate the geometrical factor)
1011     */
1012    Bool_t TrkTrack::IsInsideAcceptance(){
1013    
1014        int ngf = TrkParams::nGF;
1015        for(int i=0; i<ngf; i++){
1016            if(
1017                xGF[i] <= TrkParams::xGF_min[i] ||
1018                xGF[i] >= TrkParams::xGF_max[i] ||
1019                yGF[i] <= TrkParams::yGF_min[i] ||
1020                yGF[i] >= TrkParams::yGF_max[i] ||
1021                false)return false;
1022        }
1023        return true;
1024    
1025  }  }
1026  /**  /**
1027   * 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 1039  Int_t TrkTrack::GetClusterX_ID(int ip){
1039  Int_t TrkTrack::GetClusterY_ID(int ip){  Int_t TrkTrack::GetClusterY_ID(int ip){
1040      return ((Int_t)fabs(ygood[ip]))%10000000-1;      return ((Int_t)fabs(ygood[ip]))%10000000-1;
1041  };  };
1042    
1043  /**  /**
1044   * 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.
1045   * If no ladder is traversed (dead area) the metod retuns -1.   * If no ladder is traversed (dead area) the metod retuns -1.
1046   * @param ip Tracker plane (0-5)   * @param ip Tracker plane (0-5)
1047   */   */
# Line 919  Int_t TrkTrack::GetSensor(int ip){ Line 1064  Int_t TrkTrack::GetSensor(int ip){
1064  /**  /**
1065   * \brief Method to include a x-cluster to the track.   * \brief Method to include a x-cluster to the track.
1066   * @param ip Tracker plane (0-5)   * @param ip Tracker plane (0-5)
1067   * @param clid Cluster ID (0,1,...)   * @param clid Cluster ID (0 = no-cluster, 1,2,... otherwise )
1068   * @param is Sensor (0-1, increasing y)   * @param il Ladder (0-2, increasing x, -1 if no sensitive area is hit)
1069     * @param is Sensor (0-1, increasing y, -1 if no sensitive area is hit)
1070     * @param bad True if the cluster contains bad strips  
1071   * @see Fit(double pfixed, int& fail, int iprint, int froml1)   * @see Fit(double pfixed, int& fail, int iprint, int froml1)
1072   */   */
1073  void TrkTrack::SetXGood(int ip, int clid, int is){  void TrkTrack::SetXGood(int ip, int clid, int il, int is, bool bad){
1074      int il=0;       //ladder (temporary)  //    int il=0;       //ladder (temporary)
1075      bool bad=false; //ladder (temporary)  //    bool bad=false; //ladder (temporary)
1076      xgood[ip]=il*100000000+is*10000000+clid;      if(ip<0||ip>5||clid<0||il<-1||il>2||is<-1||is>1)
1077            cout << " void TrkTrack::SetXGood(int,int,int,int,bool) --> MA SEI DI COCCIO?!?!"<<endl;
1078        xgood[ip]=(il+1)*100000000+(is+1)*10000000+clid;
1079      if(bad)xgood[ip]=-xgood[ip];      if(bad)xgood[ip]=-xgood[ip];
1080  };  };
1081  /**  /**
1082   * \brief Method to include a y-cluster to the track.   * \brief Method to include a y-cluster to the track.
1083   * @param ip Tracker plane (0-5)   * @param ip Tracker plane (0-5)
1084   * @param clid Cluster ID (0,1,...)   * @param clid Cluster ID (0 = no-cluster, 1,2,... otherwise )
1085   * @param is Sensor (0-1)   * @param il Ladder (0-2, increasing x, -1 if no sensitive area is hit)
1086     * @param is Sensor (0-1, increasing y, -1 if no sensitive area is hit)
1087     * @param bad True if the cluster contains bad strips  
1088   * @see Fit(double pfixed, int& fail, int iprint, int froml1)   * @see Fit(double pfixed, int& fail, int iprint, int froml1)
1089   */   */
1090  void TrkTrack::SetYGood(int ip, int clid, int is){  void TrkTrack::SetYGood(int ip, int clid, int il, int is, bool bad){
1091      int il=0;       //ladder (temporary)  //    int il=0;       //ladder (temporary)
1092      bool bad=false; //ladder (temporary)  //    bool bad=false; //ladder (temporary)
1093      ygood[ip]=il*100000000+is*10000000+clid;      if(ip<0||ip>5||clid<0||il<-1||il>2||is<-1||is>1)
1094            cout << " void TrkTrack::SetYGood(int,int,int,int,bool) --> MA SEI DI COCCIO?!?!"<<endl;
1095        ygood[ip]=(il+1)*100000000+(is+1)*10000000+clid;
1096      if(bad)ygood[ip]=-ygood[ip];      if(bad)ygood[ip]=-ygood[ip];
1097  };  };
1098    
1099    /**
1100     * \brief Average X
1101     * Average value of <xv>, evaluated from the first to the last hit x view.
1102     */
1103    Float_t TrkTrack::GetXav(){
1104    
1105        int first_plane = -1;
1106        int last_plane  = -1;
1107        for(Int_t ip=0; ip<6; ip++){
1108            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1109            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1110        }
1111        if( first_plane == -1 || last_plane == -1){
1112            return -100;
1113        }
1114        if( last_plane-first_plane+1 ==0 )return -100;
1115    
1116        Float_t av = 0;    
1117        for(int ip=first_plane; ip<=last_plane; ip++)av+=xv[ip];
1118        
1119        return (av/(last_plane-first_plane+1));    
1120    }
1121    /**
1122     * \brief Average Y
1123     * Average value of <yv>, evaluated from the first to the last hit x view.
1124     */
1125    Float_t TrkTrack::GetYav(){
1126    
1127        int first_plane = -1;
1128        int last_plane  = -1;
1129        for(Int_t ip=0; ip<6; ip++){
1130            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1131            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1132        }
1133        if( first_plane == -1 || last_plane == -1){
1134            return -100;
1135        }
1136        if( last_plane-first_plane+1 ==0 )return -100;
1137    
1138        Float_t av = 0;    
1139        for(int ip=first_plane; ip<=last_plane; ip++)av+=yv[ip];
1140    
1141        return (av/(last_plane-first_plane+1));    
1142    }
1143    /**
1144     * \brief Average Z
1145     * Average value of <zv>, evaluated from the first to the last hit x view.
1146     */
1147    Float_t TrkTrack::GetZav(){
1148    
1149        int first_plane = -1;
1150        int last_plane  = -1;
1151        for(Int_t ip=0; ip<6; ip++){
1152            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1153            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1154        }
1155        if( first_plane == -1 || last_plane == -1){
1156            return -100;
1157        }
1158        if( last_plane-first_plane+1 ==0 )return -100;
1159    
1160        Float_t av = 0;    
1161        for(int ip=first_plane; ip<=last_plane; ip++)av+=zv[ip];
1162        
1163        return (av/(last_plane-first_plane+1));    
1164    }
1165    
1166    /**
1167     * \brief Number of column traversed
1168     */
1169    Int_t TrkTrack::GetNColumns(){
1170        int sensors[] = {0,0,0,0,0,0};
1171        for(int ip=0; ip<6; ip++){
1172            int sensorid = GetLadder(ip)+3*GetSensor(ip);    
1173            if(XGood(ip)||YGood(ip))
1174                if(sensorid>=0 && sensorid<6)sensors[sensorid]=1;
1175        }
1176        int nsensors=0;
1177        for(int is=0; is<6; is++)nsensors += sensors[is];
1178        return nsensors;
1179    };
1180    /**
1181     * \brief Give the maximum energy release
1182     */
1183    Float_t TrkTrack::GetDEDX_max(int ip, int iv){
1184        Float_t max=0;
1185        int pfrom = 0;
1186        int pto   = 6;
1187        int vfrom = 0;
1188        int vto   = 2;
1189        if(ip>=0&&ip<6){
1190            pfrom = ip;
1191            pto   = ip+1;
1192        }
1193        if(iv>=0&&iv<2){
1194            vfrom = iv;
1195            vto   = iv+1;
1196        }
1197        for(int i=pfrom; i<pto; i++)
1198            for(int j=0; j<vto; j++)
1199                if(GetDEDX(i,j)>max)max=GetDEDX(i,j);
1200    
1201        return max;
1202    
1203    };
1204    
1205    /**
1206     * \brief Give the minimum energy release
1207     */
1208    Float_t TrkTrack::GetDEDX_min(int ip, int iv){
1209        Float_t min=100000000;
1210        int pfrom = 0;
1211        int pto   = 6;
1212        int vfrom = 0;
1213        int vto   = 2;
1214        if(ip>=0&&ip<6){
1215            pfrom = ip;
1216            pto   = ip+1;
1217        }
1218        if(iv>=0&&iv<2){
1219            vfrom = iv;
1220            vto   = iv+1;
1221        }
1222        for(int i=pfrom; i<pto; i++)
1223            for(int j=0; j<vto; j++)
1224                if(GetDEDX(i,j)<min)min=GetDEDX(i,j);
1225    
1226        return min;
1227    
1228    };
1229    
1230    /**
1231     * \brief Give the maximum spatial residual release
1232     */
1233    Float_t TrkTrack::GetResidual_max(int ip, int iv){
1234        Float_t max=0;
1235        int pfrom = 0;
1236        int pto   = 6;
1237        int vfrom = 0;
1238        int vto   = 2;
1239        if(ip>=0&&ip<6){
1240            pfrom = ip;
1241            pto   = ip+1;
1242        }
1243        if(iv>=0&&iv<2){
1244            vfrom = iv;
1245            vto   = iv+1;
1246        }
1247        for(int i=pfrom; i<pto; i++){
1248            for(int j=0; j<vto; j++){
1249                if(j==0 && XGood(i) && fabs(xm[i]-xv[i])>fabs(max))max=xv[i]-xm[i];
1250                if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=yv[i]-ym[i];
1251            }
1252        }
1253        return max;
1254    
1255    };
1256    
1257    
1258    /**
1259     * \brief Give the maximum multiplicity on the x view
1260     */
1261    Int_t TrkTrack::GetClusterX_Multiplicity_max(){
1262        int max=0;
1263        for(int ip=0; ip<6; ip++)
1264            if(GetClusterX_Multiplicity(ip)>max)max=GetClusterX_Multiplicity(ip);
1265        return max;
1266    };
1267    /**
1268     * \brief Give the minimum multiplicity on the x view
1269     */
1270    Int_t TrkTrack::GetClusterX_Multiplicity_min(){
1271        int min=50;
1272        for(int ip=0; ip<6; ip++)
1273            if(GetClusterX_Multiplicity(ip)<min)min=GetClusterX_Multiplicity(ip);
1274        return min;
1275    };
1276    /**
1277     * \brief Give the maximum multiplicity on the x view
1278     */
1279    Int_t TrkTrack::GetClusterY_Multiplicity_max(){
1280        int max=0;
1281        for(int ip=0; ip<6; ip++)
1282            if(GetClusterY_Multiplicity(ip)>max)max=GetClusterY_Multiplicity(ip);
1283        return max;
1284    };
1285    /**
1286     * \brief Give the minimum multiplicity on the x view
1287     */
1288    Int_t TrkTrack::GetClusterY_Multiplicity_min(){
1289        int min=50;
1290        for(int ip=0; ip<6; ip++)
1291            if(GetClusterY_Multiplicity(ip)<min)min=GetClusterY_Multiplicity(ip);
1292        return min;
1293    };
1294    
1295    /**
1296     * \brief Give the minimum seed on the x view
1297     */
1298    Float_t TrkTrack::GetClusterX_Seed_min(){
1299        Float_t min=100000;
1300        for(int ip=0; ip<6; ip++)
1301            if(XGood(ip) && GetClusterX_Seed(ip)<min)min=GetClusterX_Seed(ip);
1302        return min;
1303    };
1304    /**
1305     * \brief Give the minimum seed on the x view
1306     */
1307    Float_t TrkTrack::GetClusterY_Seed_min(){
1308        Float_t min=100000;
1309        for(int ip=0; ip<6; ip++)
1310            if(YGood(ip) && GetClusterY_Seed(ip)<min)min=GetClusterY_Seed(ip);
1311        return min;
1312    };
1313    
1314    
1315  //--------------------------------------  //--------------------------------------
1316  //  //
1317  //  //
# Line 976  void TrkTrack::Clear(){ Line 1345  void TrkTrack::Clear(){
1345          dedx_y[ip] = 0;          dedx_y[ip] = 0;
1346    
1347      };      };
1348        int ngf = TrkParams::nGF;
1349        for(int i=0; i<ngf; i++){
1350            xGF[i] = 0.;
1351            yGF[i] = 0.;
1352        }
1353  //     if(clx)clx->Clear();  //     if(clx)clx->Clear();
1354  //     if(cly)cly->Clear();  //     if(cly)cly->Clear();
1355  //    clx.Clear();  //    clx.Clear();
# Line 1002  void TrkTrack::Delete(){ Line 1376  void TrkTrack::Delete(){
1376  //--------------------------------------  //--------------------------------------
1377  TrkSinglet::TrkSinglet(){  TrkSinglet::TrkSinglet(){
1378  //    cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl;  //    cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl;
1379      plane    = 0;  //     plane    = 0;
1380      coord[0] = 0;  //     coord[0] = 0;
1381      coord[1] = 0;  //     coord[1] = 0;
1382      sgnl     = 0;  //     sgnl     = 0;
1383    //     multmax  = 0;
1384  //    cls      = 0;  //    cls      = 0;
1385        Clear();
1386  };  };
1387  //--------------------------------------  //--------------------------------------
1388  //  //
# Line 1018  TrkSinglet::TrkSinglet(const TrkSinglet& Line 1394  TrkSinglet::TrkSinglet(const TrkSinglet&
1394      coord[0] = s.coord[0];      coord[0] = s.coord[0];
1395      coord[1] = s.coord[1];      coord[1] = s.coord[1];
1396      sgnl     = s.sgnl;      sgnl     = s.sgnl;
1397        multmax  = s.multmax;
1398  //      cls      = 0;//<<<<pointer  //      cls      = 0;//<<<<pointer
1399  //    cls      = TRef(s.cls);  //    cls      = TRef(s.cls);
1400  };  };
# Line 1028  TrkSinglet::TrkSinglet(const TrkSinglet& Line 1405  TrkSinglet::TrkSinglet(const TrkSinglet&
1405  void TrkSinglet::Dump(){  void TrkSinglet::Dump(){
1406      int i=0;      int i=0;
1407      cout << endl << "========== Singlet " ;      cout << endl << "========== Singlet " ;
1408      cout << endl << "plane    : " << plane;      cout << endl << "plane        : " << plane;
1409      cout << endl << "coord[2] : "; while( i<2 && cout << coord[i] << " ") i++;      cout << endl << "coord[2]     : "; while( i<2 && cout << coord[i] << " ") i++;
1410      cout << endl << "sgnl     : " << sgnl;      cout << endl << "sgnl         : " << sgnl;
1411        cout << endl << "max.strip    : ";
1412        cout << endl << "multiplicity : ";
1413  }  }
1414  //--------------------------------------  //--------------------------------------
1415  //  //
# Line 1043  void TrkSinglet::Clear(){ Line 1422  void TrkSinglet::Clear(){
1422      coord[0]=-999;      coord[0]=-999;
1423      coord[1]=-999;      coord[1]=-999;
1424      sgnl=0;      sgnl=0;
1425        multmax  = 0;
1426            
1427  }  }
1428  //--------------------------------------  //--------------------------------------
# Line 1078  void TrkLevel2::Dump(){ Line 1458  void TrkLevel2::Dump(){
1458                    
1459          //          //
1460      cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";      cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
1461      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;
1462      cout << endl << "ntrk()   : " << this->ntrk() ;      cout << endl << "ntrk()   : " << ntrk() ;
1463      cout << endl << "nclsx()  : " << this->nclsx();      cout << endl << "nclsx()  : " << nclsx();
1464      cout << endl << "nclsy()  : " << this->nclsy();      cout << endl << "nclsy()  : " << nclsy();
1465      if(Track){      if(Track){
1466          TClonesArray &t  = *Track;          TClonesArray &t  = *Track;
1467          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();
1468      }            }      
1469      if(SingletX){  //     if(SingletX){
1470          TClonesArray &sx = *SingletX;  //      TClonesArray &sx = *SingletX;
1471          for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();  //      for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();
1472      }  //     }
1473      if(SingletY){  //     if(SingletY){
1474          TClonesArray &sy = *SingletY;  //      TClonesArray &sy = *SingletY;
1475          for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();  //      for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();
1476      }  //     }
1477        cout << endl;
1478  }  }
1479  /**  /**
1480   * \brief Dump processing status   * \brief Dump processing status
# Line 1152  Bool_t TrkLevel2::GetVKFlag(int iv, int Line 1533  Bool_t TrkLevel2::GetVKFlag(int iv, int
1533   * forced (see TrkLevel2::GetVKMask(int,int)) or   * forced (see TrkLevel2::GetVKMask(int,int)) or
1534   * for this event only (TrkLevel2::GetVKFlag(int,int)).   * for this event only (TrkLevel2::GetVKFlag(int,int)).
1535   * @param iv Tracker view (0-11)   * @param iv Tracker view (0-11)
1536   * @param ivk Viking-chip number (0-23)   * @param ivk Viking-chip number (0-23)
1537   */   */
1538  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){
1539      return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );      return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );
# Line 1237  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1618  void TrkLevel2::SetFromLevel2Struct(cTrk
1618              t_track->ayv[ip]    = l2->ayv_nt[i][ip];              t_track->ayv[ip]    = l2->ayv_nt[i][ip];
1619              t_track->dedx_x[ip] = l2->dedx_x[i][ip];              t_track->dedx_x[ip] = l2->dedx_x[i][ip];
1620              t_track->dedx_y[ip] = l2->dedx_y[i][ip];              t_track->dedx_y[ip] = l2->dedx_y[i][ip];
1621                t_track->multmaxx[ip] = l2->multmaxx[i][ip];
1622                t_track->multmaxy[ip] = l2->multmaxy[i][ip];
1623                t_track->seedx[ip]  = l2->seedx[i][ip];  
1624                t_track->seedy[ip]  = l2->seedy[i][ip];
1625                t_track->xpu[ip]    = l2->xpu[i][ip];  
1626                t_track->ypu[ip]    = l2->ypu[i][ip];  
1627              //-----------------------------------------------------              //-----------------------------------------------------
1628              //-----------------------------------------------------              //-----------------------------------------------------
1629              //-----------------------------------------------------              //-----------------------------------------------------
1630              //-----------------------------------------------------              //-----------------------------------------------------
1631          };          };
1632            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1633            // evaluated coordinates (to define GF)
1634            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1635            int    ngf = TrkParams::nGF;
1636            float *zgf = TrkParams::zGF;
1637            Trajectory tgf = Trajectory(ngf,zgf);
1638            tgf.DoTrack2(t_track->al);//<<<< integrate the trajectory
1639            for(int ip=0; ip<ngf; ip++){
1640                t_track->xGF[ip] = tgf.x[ip];
1641                t_track->yGF[ip] = tgf.y[ip];
1642            }
1643            
1644  //      if(t_track->IsSaturated())t_track->Dump();  //      if(t_track->IsSaturated())t_track->Dump();
1645          new(t[i]) TrkTrack(*t_track);          new(t[i]) TrkTrack(*t_track);
1646          t_track->Clear();          t_track->Clear();
1647      };      };//end loop over track
1648    
1649  //  ----------------  //  ----------------
1650  //  *** SINGLETS ***  //  *** SINGLETS ***
# Line 1257  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1656  void TrkLevel2::SetFromLevel2Struct(cTrk
1656          t_singlet->coord[0] = l2->xs[i][0];          t_singlet->coord[0] = l2->xs[i][0];
1657          t_singlet->coord[1] = l2->xs[i][1];          t_singlet->coord[1] = l2->xs[i][1];
1658          t_singlet->sgnl     = l2->signlxs[i];          t_singlet->sgnl     = l2->signlxs[i];
1659            t_singlet->multmax = l2->multmaxsx[i];
1660            if(l2->sxbad[i]>0) t_singlet->multmax = -1*t_singlet->multmax;
1661          //-----------------------------------------------------          //-----------------------------------------------------
1662  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);
1663          //-----------------------------------------------------          //-----------------------------------------------------
# Line 1270  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1671  void TrkLevel2::SetFromLevel2Struct(cTrk
1671          t_singlet->coord[0] = l2->ys[i][0];          t_singlet->coord[0] = l2->ys[i][0];
1672          t_singlet->coord[1] = l2->ys[i][1];          t_singlet->coord[1] = l2->ys[i][1];
1673          t_singlet->sgnl     = l2->signlys[i];          t_singlet->sgnl     = l2->signlys[i];
1674            t_singlet->multmax  = l2->multmaxsy[i];
1675            if(l2->sybad[i]>0) t_singlet->multmax = -1*t_singlet->multmax;
1676          //-----------------------------------------------------          //-----------------------------------------------------
1677  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);
1678          //-----------------------------------------------------          //-----------------------------------------------------
1679          new(sy[i]) TrkSinglet(*t_singlet);          new(sy[i]) TrkSinglet(*t_singlet);
1680          t_singlet->Clear();          t_singlet->Clear();
1681      };      };
1682    
1683    
1684                    
1685      delete t_track;      delete t_track;
1686      delete t_singlet;      delete t_singlet;
# Line 1451  TRefArray *TrkLevel2::GetTracks_NFitSort Line 1856  TRefArray *TrkLevel2::GetTracks_NFitSort
1856  TrkTrack *TrkLevel2::GetStoredTrack(int is){  TrkTrack *TrkLevel2::GetStoredTrack(int is){
1857    
1858      if(is >= this->ntrk()){      if(is >= this->ntrk()){
1859          cout << "** TrkLevel2 ** Track "<< is << "doen not exits! " << endl;          cout << "TrkTrack *TrkLevel2::GetStoredTrack(int) >> Track "<< is << "doen not exits! " << endl;
1860          cout << "                Stored tracks ntrk() = "<< this->ntrk() << endl;          cout << "Stored tracks ntrk() = "<< this->ntrk() << endl;
1861          return 0;          return 0;
1862      }      }
1863      if(!Track){      if(!Track){
# Line 1473  TrkTrack *TrkLevel2::GetStoredTrack(int Line 1878  TrkTrack *TrkLevel2::GetStoredTrack(int
1878  TrkSinglet *TrkLevel2::GetSingletX(int is){  TrkSinglet *TrkLevel2::GetSingletX(int is){
1879    
1880          if(is >= this->nclsx()){          if(is >= this->nclsx()){
1881                  cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;                  cout << "TrkSinglet *TrkLevel2::GetSingletX(int) >> Singlet "<< is << "doen not exits! " << endl;
1882                  cout << "                Stored x-singlets nclsx() = "<< this->nclsx() << endl;                  cout << "Stored x-singlets nclsx() = "<< this->nclsx() << endl;
1883                  return 0;                  return 0;
1884          }          }
1885          if(!SingletX)return 0;          if(!SingletX)return 0;
# Line 1493  TrkSinglet *TrkLevel2::GetSingletX(int i Line 1898  TrkSinglet *TrkLevel2::GetSingletX(int i
1898  TrkSinglet *TrkLevel2::GetSingletY(int is){  TrkSinglet *TrkLevel2::GetSingletY(int is){
1899    
1900          if(is >= this->nclsy()){          if(is >= this->nclsy()){
1901                  cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;                  cout << "TrkSinglet *TrkLevel2::GetSingletY(int) >> Singlet "<< is << "doen not exits! " << endl;
1902                  cout << "                Stored y-singlets nclsy() = "<< this->nclsx() << endl;                  cout << "Stored y-singlets nclsx() = "<< this->nclsx() << endl;
1903                  return 0;                  return 0;
1904          }          }
1905          if(!SingletY)return 0;          if(!SingletY)return 0;
# Line 1514  TrkSinglet *TrkLevel2::GetSingletY(int i Line 1919  TrkSinglet *TrkLevel2::GetSingletY(int i
1919  TrkTrack *TrkLevel2::GetTrack(int it){  TrkTrack *TrkLevel2::GetTrack(int it){
1920            
1921          if(it >= this->GetNTracks()){          if(it >= this->GetNTracks()){
1922                  cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;                  cout << "TrkTrack *TrkLevel2::GetTrack(int) >> Track "<< it << "does not exits! " << endl;
1923                  cout << "                Physical tracks GetNTracks() = "<< this->ntrk() << endl;                  cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl;
1924                  return 0;                  return 0;
1925          }          }
1926                    
# Line 1552  Int_t TrkLevel2::GetNTracks(){ Line 1957  Int_t TrkLevel2::GetNTracks(){
1957  TrkTrack *TrkLevel2::GetTrackImage(int it){  TrkTrack *TrkLevel2::GetTrackImage(int it){
1958    
1959      if(it >= this->GetNTracks()){      if(it >= this->GetNTracks()){
1960          cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;          cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not exits! " << endl;
1961          cout << "                Physical tracks GetNTracks() = "<< this->ntrk() << endl;          cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl;
1962          return 0;          return 0;
1963      }      }
1964                    
# Line 1562  TrkTrack *TrkLevel2::GetTrackImage(int i Line 1967  TrkTrack *TrkLevel2::GetTrackImage(int i
1967      TrkTrack *track = (TrkTrack*)sorted->At(it);      TrkTrack *track = (TrkTrack*)sorted->At(it);
1968                    
1969      if(!track->HasImage()){      if(!track->HasImage()){
1970          cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl;          cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not have image! " << endl;
1971          return 0;          return 0;
1972      }      }
1973      if(!Track)return 0;      if(!Track)return 0;
# Line 1589  void TrkLevel2::LoadField(TString path){ Line 1994  void TrkLevel2::LoadField(TString path){
1994  //     path_.error   = 0;  //     path_.error   = 0;
1995  //     readb_();  //     readb_();
1996    
1997      TrkParams::SetTrackingMode();  //     TrkParams::SetTrackingMode();
1998      TrkParams::SetPrecisionFactor();  //     TrkParams::SetPrecisionFactor();
1999      TrkParams::SetStepMin();  //     TrkParams::SetStepMin();
2000        TrkParams::SetMiniDefault();
2001    
2002      TrkParams::Set(path,1);      TrkParams::Set(path,1);
2003      TrkParams::Load(1);      TrkParams::Load(1);
# Line 1789  float Trajectory::GetLength(int ifirst, Line 2195  float Trajectory::GetLength(int ifirst,
2195   */   */
2196  int Trajectory::DoTrack2(float* al){  int Trajectory::DoTrack2(float* al){
2197    
2198      double *dxout   = new double[npoint];  //      double *dxout   = new double[npoint];
2199      double *dyout   = new double[npoint];  //      double *dyout   = new double[npoint];
2200      double *dthxout = new double[npoint];  //      double *dthxout = new double[npoint];
2201      double *dthyout = new double[npoint];  //      double *dthyout = new double[npoint];
2202      double *dtlout  = new double[npoint];  //      double *dtlout  = new double[npoint];
2203      double *dzin    = new double[npoint];  //      double *dzin    = new double[npoint];
2204      double dal[5];      
2205         double *dxout;
2206         double *dyout;
2207         double *dthxout;
2208         double *dthyout;
2209         double *dtlout;
2210         double *dzin;
2211    
2212         dxout   = (double*) malloc(npoint*sizeof(double));
2213         dyout   = (double*) malloc(npoint*sizeof(double));
2214         dthxout = (double*) malloc(npoint*sizeof(double));
2215         dthyout = (double*) malloc(npoint*sizeof(double));
2216         dtlout  = (double*) malloc(npoint*sizeof(double));
2217         dzin    = (double*) malloc(npoint*sizeof(double));
2218    
2219         double dal[5];
2220    
2221      int ifail = 0;      int ifail = 0;
2222    
# Line 1810  int Trajectory::DoTrack2(float* al){ Line 2231  int Trajectory::DoTrack2(float* al){
2231      dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);      dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);
2232            
2233      for (int i=0; i<npoint; i++){      for (int i=0; i<npoint; i++){
2234          x[i]   = (float)*dxout++;          x[i]   = (float)*(dxout+i);
2235          y[i]   = (float)*dyout++;          y[i]   = (float)*(dyout+i);
2236          thx[i] = (float)*dthxout++;          thx[i] = (float)*(dthxout+i);
2237          thy[i] = (float)*dthyout++;          thy[i] = (float)*(dthyout+i);
2238          tl[i]  = (float)*dtlout++;          tl[i]  = (float)*(dtlout+i);
2239      }      }
2240    
2241        if(dxout)  free( dxout );
2242        if(dyout)  free( dyout );
2243        if(dthxout)free( dthxout );
2244        if(dthyout)free( dthyout );
2245        if(dtlout) free( dtlout );
2246        if(dzin)   free( dzin );
2247    
2248    //      delete [] dxout;
2249    //      delete [] dyout;
2250    //      delete [] dthxout;
2251    //      delete [] dthyout;
2252    //      delete [] dtlout;
2253    //      delete [] dzin;
2254    
2255    
2256      return ifail;      return ifail;
2257  };  };

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

  ViewVC Help
Powered by ViewVC 1.1.23