/[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.37 by pam-fi, Wed Jun 6 09:36:07 2007 UTC revision 1.44 by pam-fi, Wed Mar 5 17:00:19 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 292  Float_t TrkTrack::GetDEDX(){ Line 322  Float_t TrkTrack::GetDEDX(){
322      return dedx;      return dedx;
323  };  };
324  /**  /**
325   * Returns 1 if the cluster on a tracker view includes bad strips.   * Returns 1 if the cluster on a tracker view includes bad strips
326     * (at least one bad strip among the four strip used by p.f.a.)
327   * @param ip plane (0-5)   * @param ip plane (0-5)
328   * @param iv view (0=x 1=y)   * @param iv view (0=x 1=y)
329   */   */
# Line 397  Float_t TrkTrack::GetLnLX(){ Line 428  Float_t TrkTrack::GetLnLX(){
428              lnl += (tailx[ip]+1.) * log( (tailx[ip]*pow(resx[ip],2.) + pow(xv[ip]-xm[ip],2.)) / (tailx[ip]*pow(resx[ip],2)) );              lnl += (tailx[ip]+1.) * log( (tailx[ip]*pow(resx[ip],2.) + pow(xv[ip]-xm[ip],2.)) / (tailx[ip]*pow(resx[ip],2)) );
429      if(GetNX()>3)lnl=lnl/(GetNX()-3);      if(GetNX()>3)lnl=lnl/(GetNX()-3);
430      else lnl=0;      else lnl=0;
431      if(lnl==0)cout << " Float_t  TrkTrack::GetLnLX() -- WARNING -- value not defined "<<lnl<<endl;      if(lnl==0){
432            cout << " Float_t  TrkTrack::GetLnLX() -- WARNING -- value not defined "<<lnl<<endl;
433            Dump();
434        }
435      return lnl;      return lnl;
436            
437  }  }
# Line 411  Float_t TrkTrack::GetLnLY(){ Line 445  Float_t TrkTrack::GetLnLY(){
445              lnl += (taily[ip]+1.) * log( (taily[ip]*pow(resy[ip],2.) + pow(yv[ip]-ym[ip],2.)) / (taily[ip]*pow(resy[ip],2)) );              lnl += (taily[ip]+1.) * log( (taily[ip]*pow(resy[ip],2.) + pow(yv[ip]-ym[ip],2.)) / (taily[ip]*pow(resy[ip],2)) );
446      if(GetNY()>2)lnl=lnl/(GetNY()-2);      if(GetNY()>2)lnl=lnl/(GetNY()-2);
447      else lnl=0;      else lnl=0;
448      if(lnl==0)cout << " Float_t  TrkTrack::GetLnLY() -- WARNING -- value not defined "<<lnl<<endl;      if(lnl==0){
449            cout << " Float_t  TrkTrack::GetLnLY() -- WARNING -- value not defined "<<lnl<<endl;
450            Dump();
451        }
452      return lnl;      return lnl;
453            
454  }  }
455    /**
456     * Returns the effective angle, relative to the sensor, on each plane.
457     * @param ip plane (0-5)
458     * @param iv view (0=x 1=y)
459     */
460    Float_t TrkTrack::GetEffectiveAngle(int ip, int iv){
461    
462        if(ip<0 || ip>5){
463            cout << "Float_t TrkTrack::GetEffectiveAngle(int "<<ip<<", int "<<iv<<") ==> wrong input"<<endl;
464            return 0.;
465        }
466    
467        float v[3]={xv[ip],yv[ip],zv[ip]};
468        //-----------------------------------------
469        // effective angle (relative to the sensor)
470        //-----------------------------------------
471        float axv_geo  = axv[ip];
472        float muhall_h = 297.61; //cm**2/Vs
473        float BY = TrkParams::GetBY(v);
474        float axv_eff = 0;
475        if(ip==5) axv_geo = -1*axv_geo;
476        if(ip==5) BY      = -1*BY;
477        axv_eff = 180.*atan( tan(axv_geo*acos(-1.)/180.) + muhall_h * BY * 0.0001)/acos(-1.);
478        //-----------------------------------------
479        // effective angle (relative to the sensor)
480        //-----------------------------------------
481        float ayv_geo = ayv[ip];
482        float muhall_e = 1258.18; //cm**2/Vs
483        float BX = TrkParams::GetBX(v);
484        float ayv_eff = 0;
485        ayv_eff = 180.*atan( tan(ayv_geo*acos(-1.)/180.) + muhall_e * BX * 0.0001)/acos(-1.);
486      
487        if     (iv==0)return axv_eff;
488        else if(iv==1)return ayv_eff;
489        else{
490            cout << "Float_t TrkTrack::GetEffectiveAngle(int "<<ip<<", int "<<iv<<") ==> wrong input"<<endl;
491            return 0.;
492        }
493      
494    };
495    
496  //--------------------------------------  //--------------------------------------
497  //  //
498  //  //
# Line 445  void TrkTrack::Dump(){ Line 523  void TrkTrack::Dump(){
523      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]<<" ";
524      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] << " ";
525      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] << " ";
526        cout << endl << "maxs x   : "; for(int i=0; i<6; i++)cout << GetClusterX_MaxStrip(i) << " ";
527        cout << endl << "maxs y   : "; for(int i=0; i<6; i++)cout << GetClusterY_MaxStrip(i) << " ";
528        cout << endl << "mult x   : "; for(int i=0; i<6; i++)cout << GetClusterX_Multiplicity(i) << " ";
529        cout << endl << "mult y   : "; for(int i=0; i<6; i++)cout << GetClusterY_Multiplicity(i) << " ";
530        cout << endl << "seed x   : "; for(int i=0; i<6; i++)cout << GetClusterX_Seed(i) << " ";
531        cout << endl << "seed y   : "; for(int i=0; i<6; i++)cout << GetClusterY_Seed(i) << " ";
532        cout << endl << "xpu      : "; for(int i=0; i<6; i++)cout << xpu[i] << " ";
533        cout << endl << "ypu      : "; for(int i=0; i<6; i++)cout << ypu[i] << " ";
534    
535      cout << endl;      cout << endl;
536  }  }
537  /**  /**
# Line 560  void TrkTrack::LoadField(TString path){ Line 647  void TrkTrack::LoadField(TString path){
647  //     path_.error   = 0;  //     path_.error   = 0;
648  //     readb_();  //     readb_();
649    
650      TrkParams::SetTrackingMode();  //     TrkParams::SetTrackingMode();
651      TrkParams::SetPrecisionFactor();  //     TrkParams::SetPrecisionFactor();
652      TrkParams::SetStepMin();  //     TrkParams::SetStepMin();
653        TrkParams::SetMiniDefault();
654    
655      TrkParams::Set(path,1);      TrkParams::Set(path,1);
656      TrkParams::Load(1);      TrkParams::Load(1);
# Line 663  void TrkTrack::SetFromMiniStruct(cMini2t Line 751  void TrkTrack::SetFromMiniStruct(cMini2t
751   */   */
752  Bool_t TrkTrack::EvaluateClusterPositions(){  Bool_t TrkTrack::EvaluateClusterPositions(){
753            
754  //     cout << "void TrkTrack::GetClusterPositions() "<<endl;  //     cout << "void TrkTrack::GetClusterositions() "<<endl;
755    
756      TrkParams::Load( );      TrkParams::Load( );
757      if( !TrkParams::IsLoaded() )return false;      if( !TrkParams::IsLoaded() )return false;
# Line 711  Bool_t TrkTrack::EvaluateClusterPosition Line 799  Bool_t TrkTrack::EvaluateClusterPosition
799   * @see EvaluateClusterPositions()   * @see EvaluateClusterPositions()
800   *   *
801   * The fitting procedure can be varied by changing the tracking mode,   * The fitting procedure can be varied by changing the tracking mode,
802   * the fit-precision factor and the minimum number of step.   * the fit-precision factor, the minimum number of step, etc.
803   * @see SetTrackingMode(int)   * @see SetTrackingMode(int)
804   * @see SetPrecisionFactor(double)   * @see SetPrecisionFactor(double)
805   * @see SetStepMin(int)   * @see SetStepMin(int)
806     * @see SetDeltaB(int,double)
807   */   */
808  void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){  void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){
809    
# Line 817  void TrkTrack::SetStepMin(int istepmin){ Line 906  void TrkTrack::SetStepMin(int istepmin){
906      track_.istepmin = istepmin;      track_.istepmin = istepmin;
907  }  }
908  /**  /**
909   * 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  
910   */   */
911  Bool_t TrkTrack::IsInsideCavity(){  void TrkTrack::SetDeltaB(int id, double db){
912      float xmagntop, ymagntop, xmagnbottom, ymagnbottom;      if(id!=0 && id!=1)cout << "void TrkTrack::SetDeltaB(int id,double db) -- wrong input parameters: "<<id<<" "<<db<<endl;
913      xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*axv[0]/180.);      TrkParams::SetDeltaB(id,db);
914      ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*ayv[0]/180.);  }
915      xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*axv[5]/180.);  
916      ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*ayv[5]/180.);  /**
917      if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&   * Returns true if the track is inside the magnet cavity.
918          ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&   * @param toll Tolerance around the nominal volume (toll>0 define an inner fiducial volume)
919          xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&   */
920          ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);  Bool_t TrkTrack::IsInsideCavity(float toll){
921      else return(false);  
922    //     float xmagntop, ymagntop, xmagnbottom, ymagnbottom;
923    //     xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*axv[0]/180.);
924    //     ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*ayv[0]/180.);
925    //     xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*axv[5]/180.);
926    //     ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*ayv[5]/180.);
927    //     if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&
928    //      ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&
929    //      xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&
930    //      ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);
931    //     else return(false);
932    
933        int ngf = TrkParams::nGF;
934        for(int i=0; i<ngf; i++){
935            //
936    //      cout << endl << TrkParams::GF_element[i];
937            if(
938                TrkParams::GF_element[i].CompareTo("CUF") &&
939                TrkParams::GF_element[i].CompareTo("T2")  &&
940                TrkParams::GF_element[i].CompareTo("T3")  &&
941                TrkParams::GF_element[i].CompareTo("T4")  &&
942                TrkParams::GF_element[i].CompareTo("T5")  &&
943                TrkParams::GF_element[i].CompareTo("CLF") &&
944                true)continue;
945            // apply condition only within the cavity
946    //      cout << " -- "<<xGF[i]<<" "<<yGF[i];
947            if(
948                xGF[i] <= TrkParams::xGF_min[i] + toll ||
949                xGF[i] >= TrkParams::xGF_max[i] - toll ||
950                yGF[i] <= TrkParams::yGF_min[i] + toll ||
951                yGF[i] >= TrkParams::yGF_max[i] - toll ||
952                false){
953                
954                return false;
955            }
956        }
957        return true;
958    
959    
960    }
961    /**
962     * Returns true if the track is inside the nominal acceptance, which is defined
963     * by the intersection among magnet cavity, silicon-plane sensitive area and
964     * ToF sensitive area (nominal values from the official document used to
965     * calculate the geometrical factor)
966     */
967    Bool_t TrkTrack::IsInsideAcceptance(){
968    
969        int ngf = TrkParams::nGF;
970        for(int i=0; i<ngf; i++){
971            if(
972                xGF[i] <= TrkParams::xGF_min[i] ||
973                xGF[i] >= TrkParams::xGF_max[i] ||
974                yGF[i] <= TrkParams::yGF_min[i] ||
975                yGF[i] >= TrkParams::yGF_max[i] ||
976                false)return false;
977        }
978        return true;
979    
980  }  }
981  /**  /**
982   * 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 848  Int_t TrkTrack::GetClusterX_ID(int ip){ Line 994  Int_t TrkTrack::GetClusterX_ID(int ip){
994  Int_t TrkTrack::GetClusterY_ID(int ip){  Int_t TrkTrack::GetClusterY_ID(int ip){
995      return ((Int_t)fabs(ygood[ip]))%10000000-1;      return ((Int_t)fabs(ygood[ip]))%10000000-1;
996  };  };
997    
998  /**  /**
999   * Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane.   * Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane.
1000   * If no ladder is traversed (dead area) the metod retuns -1.   * If no ladder is traversed (dead area) the metod retuns -1.
# Line 896  void TrkTrack::SetYGood(int ip, int clid Line 1043  void TrkTrack::SetYGood(int ip, int clid
1043      if(bad)ygood[ip]=-ygood[ip];      if(bad)ygood[ip]=-ygood[ip];
1044  };  };
1045    
1046    /**
1047     * \brief Average X
1048     * Average value of <xv>, evaluated from the first to the last hit x view.
1049     */
1050    Float_t TrkTrack::GetXav(){
1051    
1052        int first_plane = -1;
1053        int last_plane  = -1;
1054        for(Int_t ip=0; ip<6; ip++){
1055            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1056            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1057        }
1058        if( first_plane == -1 || last_plane == -1){
1059            return -100;
1060        }
1061        if( last_plane-first_plane+1 ==0 )return -100;
1062    
1063        Float_t av = 0;    
1064        for(int ip=first_plane; ip<=last_plane; ip++)av+=xv[ip];
1065        
1066        return (av/(last_plane-first_plane+1));    
1067    }
1068    /**
1069     * \brief Average Y
1070     * Average value of <yv>, evaluated from the first to the last hit x view.
1071     */
1072    Float_t TrkTrack::GetYav(){
1073    
1074        int first_plane = -1;
1075        int last_plane  = -1;
1076        for(Int_t ip=0; ip<6; ip++){
1077            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1078            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1079        }
1080        if( first_plane == -1 || last_plane == -1){
1081            return -100;
1082        }
1083        if( last_plane-first_plane+1 ==0 )return -100;
1084    
1085        Float_t av = 0;    
1086        for(int ip=first_plane; ip<=last_plane; ip++)av+=yv[ip];
1087    
1088        return (av/(last_plane-first_plane+1));    
1089    }
1090    /**
1091     * \brief Average Z
1092     * Average value of <zv>, evaluated from the first to the last hit x view.
1093     */
1094    Float_t TrkTrack::GetZav(){
1095    
1096        int first_plane = -1;
1097        int last_plane  = -1;
1098        for(Int_t ip=0; ip<6; ip++){
1099            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1100            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1101        }
1102        if( first_plane == -1 || last_plane == -1){
1103            return -100;
1104        }
1105        if( last_plane-first_plane+1 ==0 )return -100;
1106    
1107        Float_t av = 0;    
1108        for(int ip=first_plane; ip<=last_plane; ip++)av+=zv[ip];
1109        
1110        return (av/(last_plane-first_plane+1));    
1111    }
1112    
1113    /**
1114     * \brief Number of column traversed
1115     */
1116    Int_t TrkTrack::GetNColumns(){
1117        int sensors[] = {0,0,0,0,0,0};
1118        for(int ip=0; ip<6; ip++){
1119            int sensorid = GetLadder(ip)+3*GetSensor(ip);    
1120            if(XGood(ip)||YGood(ip))
1121                if(sensorid>=0 && sensorid<6)sensors[sensorid]=1;
1122        }
1123        int nsensors=0;
1124        for(int is=0; is<6; is++)nsensors += sensors[is];
1125        return nsensors;
1126    };
1127    /**
1128     * \brief Give the maximum energy release
1129     */
1130    Float_t TrkTrack::GetDEDX_max(int ip, int iv){
1131        Float_t max=0;
1132        int pfrom = 0;
1133        int pto   = 6;
1134        int vfrom = 0;
1135        int vto   = 2;
1136        if(ip>=0&&ip<6){
1137            pfrom = ip;
1138            pto   = ip+1;
1139        }
1140        if(iv>=0&&iv<2){
1141            vfrom = iv;
1142            vto   = iv+1;
1143        }
1144        for(int i=pfrom; i<pto; i++)
1145            for(int j=0; j<vto; j++)
1146                if(GetDEDX(i,j)>max)max=GetDEDX(i,j);
1147    
1148        return max;
1149    
1150    };
1151    
1152    /**
1153     * \brief Give the minimum energy release
1154     */
1155    Float_t TrkTrack::GetDEDX_min(int ip, int iv){
1156        Float_t min=100000000;
1157        int pfrom = 0;
1158        int pto   = 6;
1159        int vfrom = 0;
1160        int vto   = 2;
1161        if(ip>=0&&ip<6){
1162            pfrom = ip;
1163            pto   = ip+1;
1164        }
1165        if(iv>=0&&iv<2){
1166            vfrom = iv;
1167            vto   = iv+1;
1168        }
1169        for(int i=pfrom; i<pto; i++)
1170            for(int j=0; j<vto; j++)
1171                if(GetDEDX(i,j)<min)min=GetDEDX(i,j);
1172    
1173        return min;
1174    
1175    };
1176    
1177    /**
1178     * \brief Give the maximum spatial residual release
1179     */
1180    Float_t TrkTrack::GetResidual_max(int ip, int iv){
1181        Float_t max=0;
1182        int pfrom = 0;
1183        int pto   = 6;
1184        int vfrom = 0;
1185        int vto   = 2;
1186        if(ip>=0&&ip<6){
1187            pfrom = ip;
1188            pto   = ip+1;
1189        }
1190        if(iv>=0&&iv<2){
1191            vfrom = iv;
1192            vto   = iv+1;
1193        }
1194        for(int i=pfrom; i<pto; i++){
1195            for(int j=0; j<vto; j++){
1196                if(j==0 && XGood(i) && fabs(xm[i]-xv[i])>fabs(max))max=xv[i]-xm[i];
1197                if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=yv[i]-ym[i];
1198            }
1199        }
1200        return max;
1201    
1202    };
1203    
1204    
1205    /**
1206     * \brief Give the maximum multiplicity on the x view
1207     */
1208    Int_t TrkTrack::GetClusterX_Multiplicity_max(){
1209        int max=0;
1210        for(int ip=0; ip<6; ip++)
1211            if(GetClusterX_Multiplicity(ip)>max)max=GetClusterX_Multiplicity(ip);
1212        return max;
1213    };
1214    /**
1215     * \brief Give the minimum multiplicity on the x view
1216     */
1217    Int_t TrkTrack::GetClusterX_Multiplicity_min(){
1218        int min=50;
1219        for(int ip=0; ip<6; ip++)
1220            if(GetClusterX_Multiplicity(ip)<min)min=GetClusterX_Multiplicity(ip);
1221        return min;
1222    };
1223    /**
1224     * \brief Give the maximum multiplicity on the x view
1225     */
1226    Int_t TrkTrack::GetClusterY_Multiplicity_max(){
1227        int max=0;
1228        for(int ip=0; ip<6; ip++)
1229            if(GetClusterY_Multiplicity(ip)>max)max=GetClusterY_Multiplicity(ip);
1230        return max;
1231    };
1232    /**
1233     * \brief Give the minimum multiplicity on the x view
1234     */
1235    Int_t TrkTrack::GetClusterY_Multiplicity_min(){
1236        int min=50;
1237        for(int ip=0; ip<6; ip++)
1238            if(GetClusterY_Multiplicity(ip)<min)min=GetClusterY_Multiplicity(ip);
1239        return min;
1240    };
1241    
1242    /**
1243     * \brief Give the minimum seed on the x view
1244     */
1245    Float_t TrkTrack::GetClusterX_Seed_min(){
1246        Float_t min=100000;
1247        for(int ip=0; ip<6; ip++)
1248            if(XGood(ip) && GetClusterX_Seed(ip)<min)min=GetClusterX_Seed(ip);
1249        return min;
1250    };
1251    /**
1252     * \brief Give the minimum seed on the x view
1253     */
1254    Float_t TrkTrack::GetClusterY_Seed_min(){
1255        Float_t min=100000;
1256        for(int ip=0; ip<6; ip++)
1257            if(YGood(ip) && GetClusterY_Seed(ip)<min)min=GetClusterY_Seed(ip);
1258        return min;
1259    };
1260    
1261    
1262  //--------------------------------------  //--------------------------------------
1263  //  //
1264  //  //
# Line 929  void TrkTrack::Clear(){ Line 1292  void TrkTrack::Clear(){
1292          dedx_y[ip] = 0;          dedx_y[ip] = 0;
1293    
1294      };      };
1295        int ngf = TrkParams::nGF;
1296        for(int i=0; i<ngf; i++){
1297            xGF[i] = 0.;
1298            yGF[i] = 0.;
1299        }
1300  //     if(clx)clx->Clear();  //     if(clx)clx->Clear();
1301  //     if(cly)cly->Clear();  //     if(cly)cly->Clear();
1302  //    clx.Clear();  //    clx.Clear();
# Line 955  void TrkTrack::Delete(){ Line 1323  void TrkTrack::Delete(){
1323  //--------------------------------------  //--------------------------------------
1324  TrkSinglet::TrkSinglet(){  TrkSinglet::TrkSinglet(){
1325  //    cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl;  //    cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl;
1326      plane    = 0;  //     plane    = 0;
1327      coord[0] = 0;  //     coord[0] = 0;
1328      coord[1] = 0;  //     coord[1] = 0;
1329      sgnl     = 0;  //     sgnl     = 0;
1330    //     multmax  = 0;
1331  //    cls      = 0;  //    cls      = 0;
1332        Clear();
1333  };  };
1334  //--------------------------------------  //--------------------------------------
1335  //  //
# Line 971  TrkSinglet::TrkSinglet(const TrkSinglet& Line 1341  TrkSinglet::TrkSinglet(const TrkSinglet&
1341      coord[0] = s.coord[0];      coord[0] = s.coord[0];
1342      coord[1] = s.coord[1];      coord[1] = s.coord[1];
1343      sgnl     = s.sgnl;      sgnl     = s.sgnl;
1344        multmax  = s.multmax;
1345  //      cls      = 0;//<<<<pointer  //      cls      = 0;//<<<<pointer
1346  //    cls      = TRef(s.cls);  //    cls      = TRef(s.cls);
1347  };  };
# Line 981  TrkSinglet::TrkSinglet(const TrkSinglet& Line 1352  TrkSinglet::TrkSinglet(const TrkSinglet&
1352  void TrkSinglet::Dump(){  void TrkSinglet::Dump(){
1353      int i=0;      int i=0;
1354      cout << endl << "========== Singlet " ;      cout << endl << "========== Singlet " ;
1355      cout << endl << "plane    : " << plane;      cout << endl << "plane        : " << plane;
1356      cout << endl << "coord[2] : "; while( i<2 && cout << coord[i] << " ") i++;      cout << endl << "coord[2]     : "; while( i<2 && cout << coord[i] << " ") i++;
1357      cout << endl << "sgnl     : " << sgnl;      cout << endl << "sgnl         : " << sgnl;
1358        cout << endl << "max.strip    : ";
1359        cout << endl << "multiplicity : ";
1360  }  }
1361  //--------------------------------------  //--------------------------------------
1362  //  //
# Line 996  void TrkSinglet::Clear(){ Line 1369  void TrkSinglet::Clear(){
1369      coord[0]=-999;      coord[0]=-999;
1370      coord[1]=-999;      coord[1]=-999;
1371      sgnl=0;      sgnl=0;
1372        multmax  = 0;
1373            
1374  }  }
1375  //--------------------------------------  //--------------------------------------
# Line 1031  void TrkLevel2::Dump(){ Line 1405  void TrkLevel2::Dump(){
1405                    
1406          //          //
1407      cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";      cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
1408      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;
1409      cout << endl << "ntrk()   : " << this->ntrk() ;      cout << endl << "ntrk()   : " << ntrk() ;
1410      cout << endl << "nclsx()  : " << this->nclsx();      cout << endl << "nclsx()  : " << nclsx();
1411      cout << endl << "nclsy()  : " << this->nclsy();      cout << endl << "nclsy()  : " << nclsy();
1412      if(Track){      if(Track){
1413          TClonesArray &t  = *Track;          TClonesArray &t  = *Track;
1414          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();
1415      }            }      
1416      if(SingletX){  //     if(SingletX){
1417          TClonesArray &sx = *SingletX;  //      TClonesArray &sx = *SingletX;
1418          for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();  //      for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();
1419      }  //     }
1420      if(SingletY){  //     if(SingletY){
1421          TClonesArray &sy = *SingletY;  //      TClonesArray &sy = *SingletY;
1422          for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();  //      for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();
1423      }  //     }
1424        cout << endl;
1425  }  }
1426  /**  /**
1427   * \brief Dump processing status   * \brief Dump processing status
# Line 1105  Bool_t TrkLevel2::GetVKFlag(int iv, int Line 1480  Bool_t TrkLevel2::GetVKFlag(int iv, int
1480   * forced (see TrkLevel2::GetVKMask(int,int)) or   * forced (see TrkLevel2::GetVKMask(int,int)) or
1481   * for this event only (TrkLevel2::GetVKFlag(int,int)).   * for this event only (TrkLevel2::GetVKFlag(int,int)).
1482   * @param iv Tracker view (0-11)   * @param iv Tracker view (0-11)
1483   * @param ivk Viking-chip number (0-23)   * @param ivk Viking-chip number (0-23)
1484   */   */
1485  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){
1486      return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );      return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );
# Line 1190  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1565  void TrkLevel2::SetFromLevel2Struct(cTrk
1565              t_track->ayv[ip]    = l2->ayv_nt[i][ip];              t_track->ayv[ip]    = l2->ayv_nt[i][ip];
1566              t_track->dedx_x[ip] = l2->dedx_x[i][ip];              t_track->dedx_x[ip] = l2->dedx_x[i][ip];
1567              t_track->dedx_y[ip] = l2->dedx_y[i][ip];              t_track->dedx_y[ip] = l2->dedx_y[i][ip];
1568                t_track->multmaxx[ip] = l2->multmaxx[i][ip];
1569                t_track->multmaxy[ip] = l2->multmaxy[i][ip];
1570                t_track->seedx[ip]  = l2->seedx[i][ip];  
1571                t_track->seedy[ip]  = l2->seedy[i][ip];
1572                t_track->xpu[ip]    = l2->xpu[i][ip];  
1573                t_track->ypu[ip]    = l2->ypu[i][ip];  
1574              //-----------------------------------------------------              //-----------------------------------------------------
1575              //-----------------------------------------------------              //-----------------------------------------------------
1576              //-----------------------------------------------------              //-----------------------------------------------------
1577              //-----------------------------------------------------              //-----------------------------------------------------
1578          };          };
1579            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1580            // evaluated coordinates (to define GF)
1581            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1582            int    ngf = TrkParams::nGF;
1583            float *zgf = TrkParams::zGF;
1584            Trajectory tgf = Trajectory(ngf,zgf);
1585            tgf.DoTrack2(t_track->al);//<<<< integrate the trajectory
1586            for(int ip=0; ip<ngf; ip++){
1587                t_track->xGF[ip] = tgf.x[ip];
1588                t_track->yGF[ip] = tgf.y[ip];
1589            }
1590            
1591  //      if(t_track->IsSaturated())t_track->Dump();  //      if(t_track->IsSaturated())t_track->Dump();
1592          new(t[i]) TrkTrack(*t_track);          new(t[i]) TrkTrack(*t_track);
1593          t_track->Clear();          t_track->Clear();
1594      };      };//end loop over track
1595    
1596  //  ----------------  //  ----------------
1597  //  *** SINGLETS ***  //  *** SINGLETS ***
# Line 1210  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1603  void TrkLevel2::SetFromLevel2Struct(cTrk
1603          t_singlet->coord[0] = l2->xs[i][0];          t_singlet->coord[0] = l2->xs[i][0];
1604          t_singlet->coord[1] = l2->xs[i][1];          t_singlet->coord[1] = l2->xs[i][1];
1605          t_singlet->sgnl     = l2->signlxs[i];          t_singlet->sgnl     = l2->signlxs[i];
1606            t_singlet->multmax = l2->multmaxsx[i];
1607            if(l2->sxbad[i]>0) t_singlet->multmax = -1*t_singlet->multmax;
1608          //-----------------------------------------------------          //-----------------------------------------------------
1609  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);
1610          //-----------------------------------------------------          //-----------------------------------------------------
# Line 1223  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1618  void TrkLevel2::SetFromLevel2Struct(cTrk
1618          t_singlet->coord[0] = l2->ys[i][0];          t_singlet->coord[0] = l2->ys[i][0];
1619          t_singlet->coord[1] = l2->ys[i][1];          t_singlet->coord[1] = l2->ys[i][1];
1620          t_singlet->sgnl     = l2->signlys[i];          t_singlet->sgnl     = l2->signlys[i];
1621            t_singlet->multmax  = l2->multmaxsy[i];
1622            if(l2->sybad[i]>0) t_singlet->multmax = -1*t_singlet->multmax;
1623          //-----------------------------------------------------          //-----------------------------------------------------
1624  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);
1625          //-----------------------------------------------------          //-----------------------------------------------------
1626          new(sy[i]) TrkSinglet(*t_singlet);          new(sy[i]) TrkSinglet(*t_singlet);
1627          t_singlet->Clear();          t_singlet->Clear();
1628      };      };
1629    
1630    
1631                    
1632      delete t_track;      delete t_track;
1633      delete t_singlet;      delete t_singlet;
# Line 1404  TRefArray *TrkLevel2::GetTracks_NFitSort Line 1803  TRefArray *TrkLevel2::GetTracks_NFitSort
1803  TrkTrack *TrkLevel2::GetStoredTrack(int is){  TrkTrack *TrkLevel2::GetStoredTrack(int is){
1804    
1805      if(is >= this->ntrk()){      if(is >= this->ntrk()){
1806          cout << "** TrkLevel2 ** Track "<< is << "doen not exits! " << endl;          cout << "TrkTrack *TrkLevel2::GetStoredTrack(int) >> Track "<< is << "doen not exits! " << endl;
1807          cout << "                Stored tracks ntrk() = "<< this->ntrk() << endl;          cout << "Stored tracks ntrk() = "<< this->ntrk() << endl;
1808          return 0;          return 0;
1809      }      }
1810      if(!Track){      if(!Track){
# Line 1426  TrkTrack *TrkLevel2::GetStoredTrack(int Line 1825  TrkTrack *TrkLevel2::GetStoredTrack(int
1825  TrkSinglet *TrkLevel2::GetSingletX(int is){  TrkSinglet *TrkLevel2::GetSingletX(int is){
1826    
1827          if(is >= this->nclsx()){          if(is >= this->nclsx()){
1828                  cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;                  cout << "TrkSinglet *TrkLevel2::GetSingletX(int) >> Singlet "<< is << "doen not exits! " << endl;
1829                  cout << "                Stored x-singlets nclsx() = "<< this->nclsx() << endl;                  cout << "Stored x-singlets nclsx() = "<< this->nclsx() << endl;
1830                  return 0;                  return 0;
1831          }          }
1832          if(!SingletX)return 0;          if(!SingletX)return 0;
# Line 1446  TrkSinglet *TrkLevel2::GetSingletX(int i Line 1845  TrkSinglet *TrkLevel2::GetSingletX(int i
1845  TrkSinglet *TrkLevel2::GetSingletY(int is){  TrkSinglet *TrkLevel2::GetSingletY(int is){
1846    
1847          if(is >= this->nclsy()){          if(is >= this->nclsy()){
1848                  cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;                  cout << "TrkSinglet *TrkLevel2::GetSingletY(int) >> Singlet "<< is << "doen not exits! " << endl;
1849                  cout << "                Stored y-singlets nclsy() = "<< this->nclsx() << endl;                  cout << "Stored y-singlets nclsx() = "<< this->nclsx() << endl;
1850                  return 0;                  return 0;
1851          }          }
1852          if(!SingletY)return 0;          if(!SingletY)return 0;
# Line 1467  TrkSinglet *TrkLevel2::GetSingletY(int i Line 1866  TrkSinglet *TrkLevel2::GetSingletY(int i
1866  TrkTrack *TrkLevel2::GetTrack(int it){  TrkTrack *TrkLevel2::GetTrack(int it){
1867            
1868          if(it >= this->GetNTracks()){          if(it >= this->GetNTracks()){
1869                  cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;                  cout << "TrkTrack *TrkLevel2::GetTrack(int) >> Track "<< it << "does not exits! " << endl;
1870                  cout << "                Physical tracks GetNTracks() = "<< this->ntrk() << endl;                  cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl;
1871                  return 0;                  return 0;
1872          }          }
1873                    
# Line 1505  Int_t TrkLevel2::GetNTracks(){ Line 1904  Int_t TrkLevel2::GetNTracks(){
1904  TrkTrack *TrkLevel2::GetTrackImage(int it){  TrkTrack *TrkLevel2::GetTrackImage(int it){
1905    
1906      if(it >= this->GetNTracks()){      if(it >= this->GetNTracks()){
1907          cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;          cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not exits! " << endl;
1908          cout << "                Physical tracks GetNTracks() = "<< this->ntrk() << endl;          cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl;
1909          return 0;          return 0;
1910      }      }
1911                    
# Line 1515  TrkTrack *TrkLevel2::GetTrackImage(int i Line 1914  TrkTrack *TrkLevel2::GetTrackImage(int i
1914      TrkTrack *track = (TrkTrack*)sorted->At(it);      TrkTrack *track = (TrkTrack*)sorted->At(it);
1915                    
1916      if(!track->HasImage()){      if(!track->HasImage()){
1917          cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl;          cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not have image! " << endl;
1918          return 0;          return 0;
1919      }      }
1920      if(!Track)return 0;      if(!Track)return 0;
# Line 1542  void TrkLevel2::LoadField(TString path){ Line 1941  void TrkLevel2::LoadField(TString path){
1941  //     path_.error   = 0;  //     path_.error   = 0;
1942  //     readb_();  //     readb_();
1943    
1944      TrkParams::SetTrackingMode();  //     TrkParams::SetTrackingMode();
1945      TrkParams::SetPrecisionFactor();  //     TrkParams::SetPrecisionFactor();
1946      TrkParams::SetStepMin();  //     TrkParams::SetStepMin();
1947        TrkParams::SetMiniDefault();
1948    
1949      TrkParams::Set(path,1);      TrkParams::Set(path,1);
1950      TrkParams::Load(1);      TrkParams::Load(1);

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.44

  ViewVC Help
Powered by ViewVC 1.1.23