/[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.46 by pam-fi, Fri Apr 11 13:44:38 2008 UTC revision 1.52 by pam-fi, Tue Feb 3 10:14:27 2009 UTC
# Line 400  Int_t TrkTrack::GetLeverArmY(){ Line 400  Int_t TrkTrack::GetLeverArmY(){
400      return (last_plane-first_plane+1);      return (last_plane-first_plane+1);
401  }  }
402  /**  /**
403     * Returns the track "lever-arm" on the x+y view, defined as the distance (in planes) between
404     * the upper and lower x,y (couple) measurements (the maximum value of lever-arm is 6).
405     */
406    Int_t TrkTrack::GetLeverArmXY(){
407        int first_plane = -1;
408        int last_plane  = -1;
409        for(Int_t ip=0; ip<6; ip++){
410            if( XGood(ip)*YGood(ip) && first_plane == -1 )first_plane = ip;
411            if( XGood(ip)*YGood(ip) && first_plane != -1 )last_plane = ip;
412        }
413        if( first_plane == -1 || last_plane == -1){
414            cout<< "Int_t TrkTrack::GetLeverArmXY() -- XGood(ip)*YGood(ip) always false ??? "<<endl;
415            return 0;
416        }
417        return (last_plane-first_plane+1);
418    }
419    /**
420   * Returns the reduced chi-square of track x-projection   * Returns the reduced chi-square of track x-projection
421   */   */
422  Float_t  TrkTrack::GetChi2X(){  Float_t  TrkTrack::GetChi2X(){
# Line 610  void TrkTrack::SetStudentParam(int flag) Line 627  void TrkTrack::SetStudentParam(int flag)
627                     4.52043,                     4.52043,
628                     4.29926};                     4.29926};
629      int index;      int index;
630      float fact;      float fact=0.;
631      for(int i=0; i<6; i++) {      for(int i=0; i<6; i++) {
632          index = int((fabs(axv[i])+1.)/2.);          index = int((fabs(axv[i])+1.)/2.);
633          if(index>10) index=10;          if(index>10) index=10;
# Line 657  void TrkTrack::LoadField(TString path){ Line 674  void TrkTrack::LoadField(TString path){
674    
675      TrkParams::Set(path,1);      TrkParams::Set(path,1);
676      TrkParams::Load(1);      TrkParams::Load(1);
677        if( !TrkParams::IsLoaded(1) ){
678            cout << "void TrkTrack::LoadField(TString path) --- ERROR --- m.field not loaded"<<endl;
679        }
680    
681  };  };
682    
# Line 798  Bool_t TrkTrack::EvaluateClusterPosition Line 818  Bool_t TrkTrack::EvaluateClusterPosition
818            
819  //     cout << "void TrkTrack::GetClusterositions() "<<endl;  //     cout << "void TrkTrack::GetClusterositions() "<<endl;
820    
821      TrkParams::Load( );      bool OK=true;
822      if( !TrkParams::IsLoaded() )return false;      TrkParams::Load(1); if( !TrkParams::IsLoaded(1) )cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- m.field not loaded "<<endl;
823            TrkParams::Load(4); if( !TrkParams::IsLoaded(4) )cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- p.f.a. par. not loaded "<<endl;
824        TrkParams::Load(5); if( !TrkParams::IsLoaded(5) )cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- alignment par. not loaded "<<endl;
825        if(!OK)return false;
826    
827      for(int ip=0; ip<6; ip++){      for(int ip=0; ip<6; ip++){
828  //      cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;;  //      cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;;
829          int icx = GetClusterX_ID(ip)+1;          int icx = GetClusterX_ID(ip)+1;
# Line 852  Bool_t TrkTrack::EvaluateClusterPosition Line 875  Bool_t TrkTrack::EvaluateClusterPosition
875   */   */
876  void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){  void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){
877    
878      float al_ini[] = {0.,0.,0.,0.,0.};      bool OK=true;
879        TrkParams::Load(1); if( !TrkParams::IsLoaded(1) )cout << "void TrkTrack::Fit(double,int&,int,int) ---ERROR--- m.field not loaded "<<endl;
880        if(!OK)return;
881    
882      TrkParams::Load( );      float al_ini[] = {0.,0.,0.,0.,0.};
     if( !TrkParams::IsLoaded() )return;  
883    
884      extern cMini2track track_;      extern cMini2track track_;
885      fail = 0;      fail = 0;
# Line 891  void TrkTrack::Fit(double pfixed, int& f Line 915  void TrkTrack::Fit(double pfixed, int& f
915    
916      //  ------------------------------------------      //  ------------------------------------------
917      //  call mini routine      //  call mini routine
918  //     TrkParams::Load(1);      //  ------------------------------------------
 //     if( !TrkParams::IsLoaded(1) ){  
 //      cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl;  
 //      return;  
 //     }  
919      int istep=0;      int istep=0;
920      int ifail=0;      int ifail=0;
921      mini2_(&istep,&ifail, &iprint);      mini2_(&istep,&ifail, &iprint);
# Line 1195  Float_t TrkTrack::GetDEDX_max(int ip, in Line 1215  Float_t TrkTrack::GetDEDX_max(int ip, in
1215          vto   = iv+1;          vto   = iv+1;
1216      }      }
1217      for(int i=pfrom; i<pto; i++)      for(int i=pfrom; i<pto; i++)
1218          for(int j=0; j<vto; j++)          for(int j=vfrom; j<vto; j++){
1219              if(GetDEDX(i,j)>max)max=GetDEDX(i,j);              if(j==0 && XGood(i) && GetDEDX(i,j)>max)max=GetDEDX(i,j);
1220                if(j==1 && YGood(i) && GetDEDX(i,j)>max)max=GetDEDX(i,j);
1221            }
1222      return max;      return max;
1223    
1224  };  };
# Line 1220  Float_t TrkTrack::GetDEDX_min(int ip, in Line 1241  Float_t TrkTrack::GetDEDX_min(int ip, in
1241          vto   = iv+1;          vto   = iv+1;
1242      }      }
1243      for(int i=pfrom; i<pto; i++)      for(int i=pfrom; i<pto; i++)
1244          for(int j=0; j<vto; j++)          for(int j=vfrom; j<vto; j++){
1245              if(GetDEDX(i,j)<min)min=GetDEDX(i,j);              if(j==0 && XGood(i) && GetDEDX(i,j)<min)min=GetDEDX(i,j);
1246                if(j==1 && YGood(i) && GetDEDX(i,j)<min)min=GetDEDX(i,j);
1247            }
1248      return min;      return min;
1249    
1250  };  };
1251    
1252  /**  /**
1253   * \brief Give the maximum spatial residual release   * \brief Give the maximum spatial residual  
1254   */   */
1255  Float_t TrkTrack::GetResidual_max(int ip, int iv){  Float_t TrkTrack::GetResidual_max(int ip, int iv){
1256      Float_t max=0;      Float_t max=0;
# Line 1245  Float_t TrkTrack::GetResidual_max(int ip Line 1267  Float_t TrkTrack::GetResidual_max(int ip
1267          vto   = iv+1;          vto   = iv+1;
1268      }      }
1269      for(int i=pfrom; i<pto; i++){      for(int i=pfrom; i<pto; i++){
1270          for(int j=0; j<vto; j++){          for(int j=vfrom; j<vto; j++){
1271              if(j==0 && XGood(i) && fabs(xm[i]-xv[i])>fabs(max))max=xv[i]-xm[i];              if(j==0 && XGood(i) && fabs(xm[i]-xv[i])>fabs(max))max=xm[i]-xv[i];
1272              if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=yv[i]-ym[i];              if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=ym[i]-yv[i];
1273          }          }
1274      }      }
1275      return max;      return max;
1276    
1277  };  };
1278    /**
1279     * \brief Give the anerage spatial residual
1280     */
1281    Float_t TrkTrack::GetResidual_av(int ip, int iv){
1282        //
1283    //Sum$((xm>-50)*(xm-xv)/resx)/sqrt(TrkTrack.GetNX()*TrkTrack.GetChi2X())<0.3
1284    
1285        Float_t av  = 0.;
1286        int     nav = 0;
1287        //
1288        int pfrom = 0;
1289        int pto   = 6;
1290        int vfrom = 0;
1291        int vto   = 2;
1292        if(ip>=0&&ip<6){
1293            pfrom = ip;
1294            pto   = ip+1;
1295        }
1296        if(iv>=0&&iv<2){
1297            vfrom = iv;
1298            vto   = iv+1;
1299        }
1300        for(int i=pfrom; i<pto; i++){
1301            for(int j=vfrom; j<vto; j++){
1302                nav++;
1303                if(j==0 && XGood(i)) av += (xm[i]-xv[i])/resx[i];
1304                if(j==1 && YGood(i)) av += (ym[i]-yv[i])/resy[i];
1305            }
1306        }
1307        if(nav==0)return -100.;
1308        return av/nav;
1309    
1310    };
1311    
1312    
1313  /**  /**
# Line 1793  TRefArray *TrkLevel2::GetTracks_NFitSort Line 1848  TRefArray *TrkLevel2::GetTracks_NFitSort
1848    
1849      if(!Track)return 0;      if(!Track)return 0;
1850    
1851      TRefArray *sorted = new TRefArray();      //    TRefArray *sorted = new TRefArray();
1852        TRefArray *sorted = NULL;
1853                    
1854      TClonesArray &t  = *Track;      TClonesArray &t  = *Track;
1855  //    TClonesArray &ts = *PhysicalTrack;  //    TClonesArray &ts = *PhysicalTrack;
# Line 1831  TRefArray *TrkLevel2::GetTracks_NFitSort Line 1887  TRefArray *TrkLevel2::GetTracks_NFitSort
1887                    
1888  //          cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl;  //          cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl;
1889          };          };
1890            if(!sorted)sorted = new TRefArray( TProcessID::GetProcessWithUID(t[indi]));
1891          sorted->Add( (TrkTrack*)t[indi] );                sorted->Add( (TrkTrack*)t[indi] );      
1892                                    
1893          m[indi] = 0;          m[indi] = 0;
# Line 2001  void TrkLevel2::LoadField(TString path){ Line 2058  void TrkLevel2::LoadField(TString path){
2058    
2059      TrkParams::Set(path,1);      TrkParams::Set(path,1);
2060      TrkParams::Load(1);      TrkParams::Load(1);
2061        if( !TrkParams::IsLoaded(1) ){
2062            cout << "void TrkLevel2::LoadField(TString path) --- ERROR --- m.field not loaded"<<endl;
2063        }
2064    
2065  //  //
2066  };  };

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

  ViewVC Help
Powered by ViewVC 1.1.23