/[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.45 by pam-fi, Sat Mar 22 08:32:50 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 710  void TrkTrack::SetFromMiniStruct(cMini2t Line 754  void TrkTrack::SetFromMiniStruct(cMini2t
754   */   */
755  Bool_t TrkTrack::EvaluateClusterPositions(){  Bool_t TrkTrack::EvaluateClusterPositions(){
756            
757  //     cout << "void TrkTrack::GetClusterPositions() "<<endl;  //     cout << "void TrkTrack::GetClusterositions() "<<endl;
758    
759      TrkParams::Load( );      TrkParams::Load( );
760      if( !TrkParams::IsLoaded() )return false;      if( !TrkParams::IsLoaded() )return false;
# Line 758  Bool_t TrkTrack::EvaluateClusterPosition Line 802  Bool_t TrkTrack::EvaluateClusterPosition
802   * @see EvaluateClusterPositions()   * @see EvaluateClusterPositions()
803   *   *
804   * The fitting procedure can be varied by changing the tracking mode,   * The fitting procedure can be varied by changing the tracking mode,
805   * the fit-precision factor and the minimum number of step.   * the fit-precision factor, the minimum number of step, etc.
806   * @see SetTrackingMode(int)   * @see SetTrackingMode(int)
807   * @see SetPrecisionFactor(double)   * @see SetPrecisionFactor(double)
808   * @see SetStepMin(int)   * @see SetStepMin(int)
809     * @see SetDeltaB(int,double)
810   */   */
811  void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){  void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){
812    
# Line 864  void TrkTrack::SetStepMin(int istepmin){ Line 909  void TrkTrack::SetStepMin(int istepmin){
909      track_.istepmin = istepmin;      track_.istepmin = istepmin;
910  }  }
911  /**  /**
912   * 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  
913   */   */
914  Bool_t TrkTrack::IsInsideCavity(){  void TrkTrack::SetDeltaB(int id, double db){
915      float xmagntop, ymagntop, xmagnbottom, ymagnbottom;      if(id!=0 && id!=1)cout << "void TrkTrack::SetDeltaB(int id,double db) -- wrong input parameters: "<<id<<" "<<db<<endl;
916      xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*axv[0]/180.);      TrkParams::SetDeltaB(id,db);
917      ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*ayv[0]/180.);  }
918      xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*axv[5]/180.);  
919      ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*ayv[5]/180.);  /**
920      if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&   * Returns true if the track is inside the magnet cavity.
921          ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&   * @param toll Tolerance around the nominal volume (toll>0 define an inner fiducial volume)
922          xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&   */
923          ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);  Bool_t TrkTrack::IsInsideCavity(float toll){
924      else return(false);  
925    //     float xmagntop, ymagntop, xmagnbottom, ymagnbottom;
926    //     xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*axv[0]/180.);
927    //     ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(acos(-1.0)*ayv[0]/180.);
928    //     xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*axv[5]/180.);
929    //     ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(acos(-1.0)*ayv[5]/180.);
930    //     if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&
931    //      ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&
932    //      xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&
933    //      ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);
934    //     else return(false);
935    
936        int ngf = TrkParams::nGF;
937        for(int i=0; i<ngf; i++){
938            //
939    //      cout << endl << TrkParams::GF_element[i];
940            if(
941                TrkParams::GF_element[i].CompareTo("CUF") &&
942                TrkParams::GF_element[i].CompareTo("T2")  &&
943                TrkParams::GF_element[i].CompareTo("T3")  &&
944                TrkParams::GF_element[i].CompareTo("T4")  &&
945                TrkParams::GF_element[i].CompareTo("T5")  &&
946                TrkParams::GF_element[i].CompareTo("CLF") &&
947                true)continue;
948            // apply condition only within the cavity
949    //      cout << " -- "<<xGF[i]<<" "<<yGF[i];
950            if(
951                xGF[i] <= TrkParams::xGF_min[i] + toll ||
952                xGF[i] >= TrkParams::xGF_max[i] - toll ||
953                yGF[i] <= TrkParams::yGF_min[i] + toll ||
954                yGF[i] >= TrkParams::yGF_max[i] - toll ||
955                false){
956                
957                return false;
958            }
959        }
960        return true;
961    
962    
963    }
964    /**
965     * Returns true if the track is inside the nominal acceptance, which is defined
966     * by the intersection among magnet cavity, silicon-plane sensitive area and
967     * ToF sensitive area (nominal values from the official document used to
968     * calculate the geometrical factor)
969     */
970    Bool_t TrkTrack::IsInsideAcceptance(){
971    
972        int ngf = TrkParams::nGF;
973        for(int i=0; i<ngf; i++){
974            if(
975                xGF[i] <= TrkParams::xGF_min[i] ||
976                xGF[i] >= TrkParams::xGF_max[i] ||
977                yGF[i] <= TrkParams::yGF_min[i] ||
978                yGF[i] >= TrkParams::yGF_max[i] ||
979                false)return false;
980        }
981        return true;
982    
983  }  }
984  /**  /**
985   * 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 997  Int_t TrkTrack::GetClusterX_ID(int ip){
997  Int_t TrkTrack::GetClusterY_ID(int ip){  Int_t TrkTrack::GetClusterY_ID(int ip){
998      return ((Int_t)fabs(ygood[ip]))%10000000-1;      return ((Int_t)fabs(ygood[ip]))%10000000-1;
999  };  };
1000    
1001  /**  /**
1002   * 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.
1003   * If no ladder is traversed (dead area) the metod retuns -1.   * If no ladder is traversed (dead area) the metod retuns -1.
# Line 943  void TrkTrack::SetYGood(int ip, int clid Line 1046  void TrkTrack::SetYGood(int ip, int clid
1046      if(bad)ygood[ip]=-ygood[ip];      if(bad)ygood[ip]=-ygood[ip];
1047  };  };
1048    
1049    /**
1050     * \brief Average X
1051     * Average value of <xv>, evaluated from the first to the last hit x view.
1052     */
1053    Float_t TrkTrack::GetXav(){
1054    
1055        int first_plane = -1;
1056        int last_plane  = -1;
1057        for(Int_t ip=0; ip<6; ip++){
1058            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1059            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1060        }
1061        if( first_plane == -1 || last_plane == -1){
1062            return -100;
1063        }
1064        if( last_plane-first_plane+1 ==0 )return -100;
1065    
1066        Float_t av = 0;    
1067        for(int ip=first_plane; ip<=last_plane; ip++)av+=xv[ip];
1068        
1069        return (av/(last_plane-first_plane+1));    
1070    }
1071    /**
1072     * \brief Average Y
1073     * Average value of <yv>, evaluated from the first to the last hit x view.
1074     */
1075    Float_t TrkTrack::GetYav(){
1076    
1077        int first_plane = -1;
1078        int last_plane  = -1;
1079        for(Int_t ip=0; ip<6; ip++){
1080            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1081            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1082        }
1083        if( first_plane == -1 || last_plane == -1){
1084            return -100;
1085        }
1086        if( last_plane-first_plane+1 ==0 )return -100;
1087    
1088        Float_t av = 0;    
1089        for(int ip=first_plane; ip<=last_plane; ip++)av+=yv[ip];
1090    
1091        return (av/(last_plane-first_plane+1));    
1092    }
1093    /**
1094     * \brief Average Z
1095     * Average value of <zv>, evaluated from the first to the last hit x view.
1096     */
1097    Float_t TrkTrack::GetZav(){
1098    
1099        int first_plane = -1;
1100        int last_plane  = -1;
1101        for(Int_t ip=0; ip<6; ip++){
1102            if( XGood(ip) && first_plane == -1 )first_plane = ip;
1103            if( XGood(ip) && first_plane != -1 )last_plane = ip;
1104        }
1105        if( first_plane == -1 || last_plane == -1){
1106            return -100;
1107        }
1108        if( last_plane-first_plane+1 ==0 )return -100;
1109    
1110        Float_t av = 0;    
1111        for(int ip=first_plane; ip<=last_plane; ip++)av+=zv[ip];
1112        
1113        return (av/(last_plane-first_plane+1));    
1114    }
1115    
1116    /**
1117     * \brief Number of column traversed
1118     */
1119    Int_t TrkTrack::GetNColumns(){
1120        int sensors[] = {0,0,0,0,0,0};
1121        for(int ip=0; ip<6; ip++){
1122            int sensorid = GetLadder(ip)+3*GetSensor(ip);    
1123            if(XGood(ip)||YGood(ip))
1124                if(sensorid>=0 && sensorid<6)sensors[sensorid]=1;
1125        }
1126        int nsensors=0;
1127        for(int is=0; is<6; is++)nsensors += sensors[is];
1128        return nsensors;
1129    };
1130    /**
1131     * \brief Give the maximum energy release
1132     */
1133    Float_t TrkTrack::GetDEDX_max(int ip, int iv){
1134        Float_t max=0;
1135        int pfrom = 0;
1136        int pto   = 6;
1137        int vfrom = 0;
1138        int vto   = 2;
1139        if(ip>=0&&ip<6){
1140            pfrom = ip;
1141            pto   = ip+1;
1142        }
1143        if(iv>=0&&iv<2){
1144            vfrom = iv;
1145            vto   = iv+1;
1146        }
1147        for(int i=pfrom; i<pto; i++)
1148            for(int j=0; j<vto; j++)
1149                if(GetDEDX(i,j)>max)max=GetDEDX(i,j);
1150    
1151        return max;
1152    
1153    };
1154    
1155    /**
1156     * \brief Give the minimum energy release
1157     */
1158    Float_t TrkTrack::GetDEDX_min(int ip, int iv){
1159        Float_t min=100000000;
1160        int pfrom = 0;
1161        int pto   = 6;
1162        int vfrom = 0;
1163        int vto   = 2;
1164        if(ip>=0&&ip<6){
1165            pfrom = ip;
1166            pto   = ip+1;
1167        }
1168        if(iv>=0&&iv<2){
1169            vfrom = iv;
1170            vto   = iv+1;
1171        }
1172        for(int i=pfrom; i<pto; i++)
1173            for(int j=0; j<vto; j++)
1174                if(GetDEDX(i,j)<min)min=GetDEDX(i,j);
1175    
1176        return min;
1177    
1178    };
1179    
1180    /**
1181     * \brief Give the maximum spatial residual release
1182     */
1183    Float_t TrkTrack::GetResidual_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(j==0 && XGood(i) && fabs(xm[i]-xv[i])>fabs(max))max=xv[i]-xm[i];
1200                if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=yv[i]-ym[i];
1201            }
1202        }
1203        return max;
1204    
1205    };
1206    
1207    
1208    /**
1209     * \brief Give the maximum multiplicity on the x view
1210     */
1211    Int_t TrkTrack::GetClusterX_Multiplicity_max(){
1212        int max=0;
1213        for(int ip=0; ip<6; ip++)
1214            if(GetClusterX_Multiplicity(ip)>max)max=GetClusterX_Multiplicity(ip);
1215        return max;
1216    };
1217    /**
1218     * \brief Give the minimum multiplicity on the x view
1219     */
1220    Int_t TrkTrack::GetClusterX_Multiplicity_min(){
1221        int min=50;
1222        for(int ip=0; ip<6; ip++)
1223            if(GetClusterX_Multiplicity(ip)<min)min=GetClusterX_Multiplicity(ip);
1224        return min;
1225    };
1226    /**
1227     * \brief Give the maximum multiplicity on the x view
1228     */
1229    Int_t TrkTrack::GetClusterY_Multiplicity_max(){
1230        int max=0;
1231        for(int ip=0; ip<6; ip++)
1232            if(GetClusterY_Multiplicity(ip)>max)max=GetClusterY_Multiplicity(ip);
1233        return max;
1234    };
1235    /**
1236     * \brief Give the minimum multiplicity on the x view
1237     */
1238    Int_t TrkTrack::GetClusterY_Multiplicity_min(){
1239        int min=50;
1240        for(int ip=0; ip<6; ip++)
1241            if(GetClusterY_Multiplicity(ip)<min)min=GetClusterY_Multiplicity(ip);
1242        return min;
1243    };
1244    
1245    /**
1246     * \brief Give the minimum seed on the x view
1247     */
1248    Float_t TrkTrack::GetClusterX_Seed_min(){
1249        Float_t min=100000;
1250        for(int ip=0; ip<6; ip++)
1251            if(XGood(ip) && GetClusterX_Seed(ip)<min)min=GetClusterX_Seed(ip);
1252        return min;
1253    };
1254    /**
1255     * \brief Give the minimum seed on the x view
1256     */
1257    Float_t TrkTrack::GetClusterY_Seed_min(){
1258        Float_t min=100000;
1259        for(int ip=0; ip<6; ip++)
1260            if(YGood(ip) && GetClusterY_Seed(ip)<min)min=GetClusterY_Seed(ip);
1261        return min;
1262    };
1263    
1264    
1265  //--------------------------------------  //--------------------------------------
1266  //  //
1267  //  //
# Line 976  void TrkTrack::Clear(){ Line 1295  void TrkTrack::Clear(){
1295          dedx_y[ip] = 0;          dedx_y[ip] = 0;
1296    
1297      };      };
1298        int ngf = TrkParams::nGF;
1299        for(int i=0; i<ngf; i++){
1300            xGF[i] = 0.;
1301            yGF[i] = 0.;
1302        }
1303  //     if(clx)clx->Clear();  //     if(clx)clx->Clear();
1304  //     if(cly)cly->Clear();  //     if(cly)cly->Clear();
1305  //    clx.Clear();  //    clx.Clear();
# Line 1002  void TrkTrack::Delete(){ Line 1326  void TrkTrack::Delete(){
1326  //--------------------------------------  //--------------------------------------
1327  TrkSinglet::TrkSinglet(){  TrkSinglet::TrkSinglet(){
1328  //    cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl;  //    cout << "TrkSinglet::TrkSinglet() " << GetUniqueID()<<endl;
1329      plane    = 0;  //     plane    = 0;
1330      coord[0] = 0;  //     coord[0] = 0;
1331      coord[1] = 0;  //     coord[1] = 0;
1332      sgnl     = 0;  //     sgnl     = 0;
1333    //     multmax  = 0;
1334  //    cls      = 0;  //    cls      = 0;
1335        Clear();
1336  };  };
1337  //--------------------------------------  //--------------------------------------
1338  //  //
# Line 1018  TrkSinglet::TrkSinglet(const TrkSinglet& Line 1344  TrkSinglet::TrkSinglet(const TrkSinglet&
1344      coord[0] = s.coord[0];      coord[0] = s.coord[0];
1345      coord[1] = s.coord[1];      coord[1] = s.coord[1];
1346      sgnl     = s.sgnl;      sgnl     = s.sgnl;
1347        multmax  = s.multmax;
1348  //      cls      = 0;//<<<<pointer  //      cls      = 0;//<<<<pointer
1349  //    cls      = TRef(s.cls);  //    cls      = TRef(s.cls);
1350  };  };
# Line 1028  TrkSinglet::TrkSinglet(const TrkSinglet& Line 1355  TrkSinglet::TrkSinglet(const TrkSinglet&
1355  void TrkSinglet::Dump(){  void TrkSinglet::Dump(){
1356      int i=0;      int i=0;
1357      cout << endl << "========== Singlet " ;      cout << endl << "========== Singlet " ;
1358      cout << endl << "plane    : " << plane;      cout << endl << "plane        : " << plane;
1359      cout << endl << "coord[2] : "; while( i<2 && cout << coord[i] << " ") i++;      cout << endl << "coord[2]     : "; while( i<2 && cout << coord[i] << " ") i++;
1360      cout << endl << "sgnl     : " << sgnl;      cout << endl << "sgnl         : " << sgnl;
1361        cout << endl << "max.strip    : ";
1362        cout << endl << "multiplicity : ";
1363  }  }
1364  //--------------------------------------  //--------------------------------------
1365  //  //
# Line 1043  void TrkSinglet::Clear(){ Line 1372  void TrkSinglet::Clear(){
1372      coord[0]=-999;      coord[0]=-999;
1373      coord[1]=-999;      coord[1]=-999;
1374      sgnl=0;      sgnl=0;
1375        multmax  = 0;
1376            
1377  }  }
1378  //--------------------------------------  //--------------------------------------
# Line 1078  void TrkLevel2::Dump(){ Line 1408  void TrkLevel2::Dump(){
1408                    
1409          //          //
1410      cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";      cout << endl << endl << "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
1411      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;
1412      cout << endl << "ntrk()   : " << this->ntrk() ;      cout << endl << "ntrk()   : " << ntrk() ;
1413      cout << endl << "nclsx()  : " << this->nclsx();      cout << endl << "nclsx()  : " << nclsx();
1414      cout << endl << "nclsy()  : " << this->nclsy();      cout << endl << "nclsy()  : " << nclsy();
1415      if(Track){      if(Track){
1416          TClonesArray &t  = *Track;          TClonesArray &t  = *Track;
1417          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();          for(int i=0; i<ntrk(); i++)     ((TrkTrack *)t[i])->Dump();
1418      }            }      
1419      if(SingletX){  //     if(SingletX){
1420          TClonesArray &sx = *SingletX;  //      TClonesArray &sx = *SingletX;
1421          for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();  //      for(int i=0; i<nclsx(); i++) ((TrkSinglet *)sx[i])->Dump();
1422      }  //     }
1423      if(SingletY){  //     if(SingletY){
1424          TClonesArray &sy = *SingletY;  //      TClonesArray &sy = *SingletY;
1425          for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();  //      for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();
1426      }  //     }
1427        cout << endl;
1428  }  }
1429  /**  /**
1430   * \brief Dump processing status   * \brief Dump processing status
# Line 1152  Bool_t TrkLevel2::GetVKFlag(int iv, int Line 1483  Bool_t TrkLevel2::GetVKFlag(int iv, int
1483   * forced (see TrkLevel2::GetVKMask(int,int)) or   * forced (see TrkLevel2::GetVKMask(int,int)) or
1484   * for this event only (TrkLevel2::GetVKFlag(int,int)).   * for this event only (TrkLevel2::GetVKFlag(int,int)).
1485   * @param iv Tracker view (0-11)   * @param iv Tracker view (0-11)
1486   * @param ivk Viking-chip number (0-23)   * @param ivk Viking-chip number (0-23)
1487   */   */
1488  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){  Bool_t TrkLevel2::IsMaskedVK(int iv, int ivk){
1489      return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );      return !(GetVKMask(iv,ivk)&&GetVKFlag(iv,ivk) );
# Line 1237  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1568  void TrkLevel2::SetFromLevel2Struct(cTrk
1568              t_track->ayv[ip]    = l2->ayv_nt[i][ip];              t_track->ayv[ip]    = l2->ayv_nt[i][ip];
1569              t_track->dedx_x[ip] = l2->dedx_x[i][ip];              t_track->dedx_x[ip] = l2->dedx_x[i][ip];
1570              t_track->dedx_y[ip] = l2->dedx_y[i][ip];              t_track->dedx_y[ip] = l2->dedx_y[i][ip];
1571                t_track->multmaxx[ip] = l2->multmaxx[i][ip];
1572                t_track->multmaxy[ip] = l2->multmaxy[i][ip];
1573                t_track->seedx[ip]  = l2->seedx[i][ip];  
1574                t_track->seedy[ip]  = l2->seedy[i][ip];
1575                t_track->xpu[ip]    = l2->xpu[i][ip];  
1576                t_track->ypu[ip]    = l2->ypu[i][ip];  
1577              //-----------------------------------------------------              //-----------------------------------------------------
1578              //-----------------------------------------------------              //-----------------------------------------------------
1579              //-----------------------------------------------------              //-----------------------------------------------------
1580              //-----------------------------------------------------              //-----------------------------------------------------
1581          };          };
1582            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1583            // evaluated coordinates (to define GF)
1584            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1585            int    ngf = TrkParams::nGF;
1586            float *zgf = TrkParams::zGF;
1587            Trajectory tgf = Trajectory(ngf,zgf);
1588            tgf.DoTrack2(t_track->al);//<<<< integrate the trajectory
1589            for(int ip=0; ip<ngf; ip++){
1590                t_track->xGF[ip] = tgf.x[ip];
1591                t_track->yGF[ip] = tgf.y[ip];
1592            }
1593            
1594  //      if(t_track->IsSaturated())t_track->Dump();  //      if(t_track->IsSaturated())t_track->Dump();
1595          new(t[i]) TrkTrack(*t_track);          new(t[i]) TrkTrack(*t_track);
1596          t_track->Clear();          t_track->Clear();
1597      };      };//end loop over track
1598    
1599  //  ----------------  //  ----------------
1600  //  *** SINGLETS ***  //  *** SINGLETS ***
# Line 1257  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1606  void TrkLevel2::SetFromLevel2Struct(cTrk
1606          t_singlet->coord[0] = l2->xs[i][0];          t_singlet->coord[0] = l2->xs[i][0];
1607          t_singlet->coord[1] = l2->xs[i][1];          t_singlet->coord[1] = l2->xs[i][1];
1608          t_singlet->sgnl     = l2->signlxs[i];          t_singlet->sgnl     = l2->signlxs[i];
1609            t_singlet->multmax = l2->multmaxsx[i];
1610            if(l2->sxbad[i]>0) t_singlet->multmax = -1*t_singlet->multmax;
1611          //-----------------------------------------------------          //-----------------------------------------------------
1612  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsx[i]-1);
1613          //-----------------------------------------------------          //-----------------------------------------------------
# Line 1270  void TrkLevel2::SetFromLevel2Struct(cTrk Line 1621  void TrkLevel2::SetFromLevel2Struct(cTrk
1621          t_singlet->coord[0] = l2->ys[i][0];          t_singlet->coord[0] = l2->ys[i][0];
1622          t_singlet->coord[1] = l2->ys[i][1];          t_singlet->coord[1] = l2->ys[i][1];
1623          t_singlet->sgnl     = l2->signlys[i];          t_singlet->sgnl     = l2->signlys[i];
1624            t_singlet->multmax  = l2->multmaxsy[i];
1625            if(l2->sybad[i]>0) t_singlet->multmax = -1*t_singlet->multmax;
1626          //-----------------------------------------------------          //-----------------------------------------------------
1627  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);  //      if(l1) t_singlet->cls      = l1->GetCluster(l2->clsy[i]-1);
1628          //-----------------------------------------------------          //-----------------------------------------------------
1629          new(sy[i]) TrkSinglet(*t_singlet);          new(sy[i]) TrkSinglet(*t_singlet);
1630          t_singlet->Clear();          t_singlet->Clear();
1631      };      };
1632    
1633    
1634                    
1635      delete t_track;      delete t_track;
1636      delete t_singlet;      delete t_singlet;
# Line 1451  TRefArray *TrkLevel2::GetTracks_NFitSort Line 1806  TRefArray *TrkLevel2::GetTracks_NFitSort
1806  TrkTrack *TrkLevel2::GetStoredTrack(int is){  TrkTrack *TrkLevel2::GetStoredTrack(int is){
1807    
1808      if(is >= this->ntrk()){      if(is >= this->ntrk()){
1809          cout << "** TrkLevel2 ** Track "<< is << "doen not exits! " << endl;          cout << "TrkTrack *TrkLevel2::GetStoredTrack(int) >> Track "<< is << "doen not exits! " << endl;
1810          cout << "                Stored tracks ntrk() = "<< this->ntrk() << endl;          cout << "Stored tracks ntrk() = "<< this->ntrk() << endl;
1811          return 0;          return 0;
1812      }      }
1813      if(!Track){      if(!Track){
# Line 1473  TrkTrack *TrkLevel2::GetStoredTrack(int Line 1828  TrkTrack *TrkLevel2::GetStoredTrack(int
1828  TrkSinglet *TrkLevel2::GetSingletX(int is){  TrkSinglet *TrkLevel2::GetSingletX(int is){
1829    
1830          if(is >= this->nclsx()){          if(is >= this->nclsx()){
1831                  cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;                  cout << "TrkSinglet *TrkLevel2::GetSingletX(int) >> Singlet "<< is << "doen not exits! " << endl;
1832                  cout << "                Stored x-singlets nclsx() = "<< this->nclsx() << endl;                  cout << "Stored x-singlets nclsx() = "<< this->nclsx() << endl;
1833                  return 0;                  return 0;
1834          }          }
1835          if(!SingletX)return 0;          if(!SingletX)return 0;
# Line 1493  TrkSinglet *TrkLevel2::GetSingletX(int i Line 1848  TrkSinglet *TrkLevel2::GetSingletX(int i
1848  TrkSinglet *TrkLevel2::GetSingletY(int is){  TrkSinglet *TrkLevel2::GetSingletY(int is){
1849    
1850          if(is >= this->nclsy()){          if(is >= this->nclsy()){
1851                  cout << "** TrkLevel2 ** Singlet "<< is << "doen not exits! " << endl;                  cout << "TrkSinglet *TrkLevel2::GetSingletY(int) >> Singlet "<< is << "doen not exits! " << endl;
1852                  cout << "                Stored y-singlets nclsy() = "<< this->nclsx() << endl;                  cout << "Stored y-singlets nclsx() = "<< this->nclsx() << endl;
1853                  return 0;                  return 0;
1854          }          }
1855          if(!SingletY)return 0;          if(!SingletY)return 0;
# Line 1514  TrkSinglet *TrkLevel2::GetSingletY(int i Line 1869  TrkSinglet *TrkLevel2::GetSingletY(int i
1869  TrkTrack *TrkLevel2::GetTrack(int it){  TrkTrack *TrkLevel2::GetTrack(int it){
1870            
1871          if(it >= this->GetNTracks()){          if(it >= this->GetNTracks()){
1872                  cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;                  cout << "TrkTrack *TrkLevel2::GetTrack(int) >> Track "<< it << "does not exits! " << endl;
1873                  cout << "                Physical tracks GetNTracks() = "<< this->ntrk() << endl;                  cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl;
1874                  return 0;                  return 0;
1875          }          }
1876                    
# Line 1552  Int_t TrkLevel2::GetNTracks(){ Line 1907  Int_t TrkLevel2::GetNTracks(){
1907  TrkTrack *TrkLevel2::GetTrackImage(int it){  TrkTrack *TrkLevel2::GetTrackImage(int it){
1908    
1909      if(it >= this->GetNTracks()){      if(it >= this->GetNTracks()){
1910          cout << "** TrkLevel2 ** Track "<< it << "does not exits! " << endl;          cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not exits! " << endl;
1911          cout << "                Physical tracks GetNTracks() = "<< this->ntrk() << endl;          cout << "Physical tracks GetNTracks() = "<< this->ntrk() << endl;
1912          return 0;          return 0;
1913      }      }
1914                    
# Line 1562  TrkTrack *TrkLevel2::GetTrackImage(int i Line 1917  TrkTrack *TrkLevel2::GetTrackImage(int i
1917      TrkTrack *track = (TrkTrack*)sorted->At(it);      TrkTrack *track = (TrkTrack*)sorted->At(it);
1918                    
1919      if(!track->HasImage()){      if(!track->HasImage()){
1920          cout << "** TrkLevel2 ** Track "<< it << "does not have image! " << endl;          cout << "TrkTrack *TrkLevel2::GetTrackImage(int) >> Track "<< it << "does not have image! " << endl;
1921          return 0;          return 0;
1922      }      }
1923      if(!Track)return 0;      if(!Track)return 0;
# Line 1589  void TrkLevel2::LoadField(TString path){ Line 1944  void TrkLevel2::LoadField(TString path){
1944  //     path_.error   = 0;  //     path_.error   = 0;
1945  //     readb_();  //     readb_();
1946    
1947      TrkParams::SetTrackingMode();  //     TrkParams::SetTrackingMode();
1948      TrkParams::SetPrecisionFactor();  //     TrkParams::SetPrecisionFactor();
1949      TrkParams::SetStepMin();  //     TrkParams::SetStepMin();
1950        TrkParams::SetMiniDefault();
1951    
1952      TrkParams::Set(path,1);      TrkParams::Set(path,1);
1953      TrkParams::Load(1);      TrkParams::Load(1);
# Line 1789  float Trajectory::GetLength(int ifirst, Line 2145  float Trajectory::GetLength(int ifirst,
2145   */   */
2146  int Trajectory::DoTrack2(float* al){  int Trajectory::DoTrack2(float* al){
2147    
2148      double *dxout   = new double[npoint];  //      double *dxout   = new double[npoint];
2149      double *dyout   = new double[npoint];  //      double *dyout   = new double[npoint];
2150      double *dthxout = new double[npoint];  //      double *dthxout = new double[npoint];
2151      double *dthyout = new double[npoint];  //      double *dthyout = new double[npoint];
2152      double *dtlout  = new double[npoint];  //      double *dtlout  = new double[npoint];
2153      double *dzin    = new double[npoint];  //      double *dzin    = new double[npoint];
2154      double dal[5];      
2155         double *dxout;
2156         double *dyout;
2157         double *dthxout;
2158         double *dthyout;
2159         double *dtlout;
2160         double *dzin;
2161    
2162         dxout   = (double*) malloc(npoint*sizeof(double));
2163         dyout   = (double*) malloc(npoint*sizeof(double));
2164         dthxout = (double*) malloc(npoint*sizeof(double));
2165         dthyout = (double*) malloc(npoint*sizeof(double));
2166         dtlout  = (double*) malloc(npoint*sizeof(double));
2167         dzin    = (double*) malloc(npoint*sizeof(double));
2168    
2169         double dal[5];
2170    
2171      int ifail = 0;      int ifail = 0;
2172    
# Line 1810  int Trajectory::DoTrack2(float* al){ Line 2181  int Trajectory::DoTrack2(float* al){
2181      dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);      dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail);
2182            
2183      for (int i=0; i<npoint; i++){      for (int i=0; i<npoint; i++){
2184          x[i]   = (float)*dxout++;          x[i]   = (float)*(dxout+i);
2185          y[i]   = (float)*dyout++;          y[i]   = (float)*(dyout+i);
2186          thx[i] = (float)*dthxout++;          thx[i] = (float)*(dthxout+i);
2187          thy[i] = (float)*dthyout++;          thy[i] = (float)*(dthyout+i);
2188          tl[i]  = (float)*dtlout++;          tl[i]  = (float)*(dtlout+i);
2189      }      }
2190    
2191        if(dxout)  free( dxout );
2192        if(dyout)  free( dyout );
2193        if(dthxout)free( dthxout );
2194        if(dthyout)free( dthyout );
2195        if(dtlout) free( dtlout );
2196        if(dzin)   free( dzin );
2197    
2198    //      delete [] dxout;
2199    //      delete [] dyout;
2200    //      delete [] dthxout;
2201    //      delete [] dthyout;
2202    //      delete [] dtlout;
2203    //      delete [] dzin;
2204    
2205    
2206      return ifail;      return ifail;
2207  };  };

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

  ViewVC Help
Powered by ViewVC 1.1.23