/[PAMELA software]/DarthVader/TrackerLevel2/src/TrkLevel1.cpp
ViewVC logotype

Diff of /DarthVader/TrackerLevel2/src/TrkLevel1.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by pam-fi, Tue Nov 27 11:43:50 2007 UTC revision 1.26 by pam-fi, Tue Mar 12 11:02:03 2013 UTC
# Line 17  extern "C" { Line 17  extern "C" {
17      float pfaeta3_(int*,float*);      float pfaeta3_(int*,float*);
18      float pfaeta4_(int*,float*);      float pfaeta4_(int*,float*);
19      float pfaetal_(int*,float*);      float pfaetal_(int*,float*);
20        float digsat_(int*);
21      int   npfastrips_(int*,float*);      int   npfastrips_(int*,float*);
22                    
23  }  }
# Line 481  Float_t TrkCluster::GetETA(Int_t neta, f Line 482  Float_t TrkCluster::GetETA(Int_t neta, f
482  };  };
483    
484  /**  /**
485     * Evaluates the cluster position, in pitch units, relative to the strip
486     *  with the maximum signal (TrkCluster::maxs), by applying the digital
487     *  algorithm for saturated clusters.
488     *
489     *  @return The cluster position (0 also if if no saturated strip is found).
490     */
491    Float_t TrkCluster::GetDigSat() {
492    
493      GetLevel1Struct();
494      int ic = 1;
495      return digsat_(&ic);
496    
497    }
498    
499    /**
500   * Evaluates the cluster position, in pitch unit, relative to the strip with   * Evaluates the cluster position, in pitch unit, relative to the strip with
501   * the maximum signal (TrkCluster::maxs), by applying the PFA set as default (see TrkParams).   * the maximum signal (TrkCluster::maxs), by applying the PFA set as default (see TrkParams).
502   *  @param angle Projected (effective) angle between particle track and detector plane.   *  @param angle Projected (effective) angle between particle track and detector plane.
# Line 762  TrkCluster *TrkLevel1::GetCluster(int is Line 778  TrkCluster *TrkLevel1::GetCluster(int is
778      TrkCluster *cluster = (TrkCluster*)t[is];      TrkCluster *cluster = (TrkCluster*)t[is];
779      return cluster;      return cluster;
780  }  }
 //--------------------------------------  
 //  
 //  
 //--------------------------------------  
 // /**  
 //  * Load Position-Finding-Algorythm parameters (call the F77 routine).  
 //  *  
 //  */  
 // int TrkLevel1::LoadPfaParam(TString path){  
           
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadPfaParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/eta_param-0/");  
 //     }  
781    
 //     strcpy(path_.path,path.Data());  
 //     path_.pathlen = path.Length();  
 //     path_.error   = 0;  
 //     cout <<"Loading p.f.a. parameters: "<<path<<endl;  
 //     return readetaparam_();  
 // }  
782    
783  // /**  // int TrkLevel1::GetPfaNbinsAngle(){
784  //  * Load magnetic field parameters (call the F77 routine).  //     TrkParams::Load(4);
785  //  *  //     if( !TrkParams::IsLoaded(4) ){
786  //  */  //      cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters  not loaded"<<endl;
787  // int TrkLevel1::LoadFieldParam(TString path){  //      return 0;
           
 // //    if( strcmp(path_.path,path.Data()) ){  
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadFieldParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/field_param-0/");  
788  //     }  //     }
789  //     cout <<"Loading magnetic field "<<path<<endl;  //     return pfa_.nangbin;
790  //     strcpy(path_.path,path.Data());  // };
791  //     path_.pathlen = path.Length();  
792  //     path_.error   = 0;  // int TrkLevel1::GetPfaNbinsETA(){
793  //     return readb_();  //     TrkParams::Load(4);
794  // //    }        //     if( !TrkParams::IsLoaded(4) ){
795  // //    return 0;  //      cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters  not loaded"<<endl;
796  // }  //      return 0;
 // /**  
 //  * Load magnetic field parameters (call the F77 routine).  
 //  *  
 //  */  
 // int TrkLevel1::LoadChargeParam(TString path){  
           
 // //    if( strcmp(path_.path,path.Data()) ){  
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadChargeParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/charge_param-1/");  
 //     }  
 //     cout <<"Loading charge-correlation parameters: "<<path<<endl;  
 //     strcpy(path_.path,path.Data());  
 //     path_.pathlen = path.Length();  
 //     path_.error   = 0;  
 //     return readchargeparam_();  
 // //    }        
 // //    return 0;  
 // }  
 // /**  
 //  * Load magnetic field parameters (call the F77 routine).  
 //  *  
 //  */  
 // int TrkLevel1::LoadAlignmentParam(TString path){  
           
 // //    if( strcmp(path_.path,path.Data()) ){  
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadAlignmentParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/align_param-0/");  
 //     }  
 //     cout <<"Loading alignment parameters: "<<path<<endl;  
 //     strcpy(path_.path,path.Data());  
 //     path_.pathlen = path.Length();  
 //     path_.error   = 0;  
 //     return readalignparam_();  
 // //    }        
 // //    return 0;  
 // }  
 // /**  
 //  * Load magnetic field parameters (call the F77 routine).  
 //  *  
 //  */  
 // int TrkLevel1::LoadMipParam(TString path){  
           
 // //    if( strcmp(path_.path,path.Data()) ){  
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadMipParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/mip_param-0/");  
 //     }  
 //     cout <<"Loading ADC-to-MIP conversion parameters: "<<path<<endl;  
 //     strcpy(path_.path,path.Data());  
 //     path_.pathlen = path.Length();  
 //     path_.error   = 0;  
 //     return readmipparam_();  
 // //    }        
 // //    return 0;  
 // }  
 // /**  
 //  * Load magnetic field parameters (call the F77 routine).  
 //  *  
 //  */  
 // int TrkLevel1::LoadVKMaskParam(TString path){  
           
 // //    if( strcmp(path_.path,path.Data()) ){  
 //     if( path.IsNull() ){  
 //      path = gSystem->Getenv("PAM_CALIB");  
 //      if(path.IsNull()){  
 //          cout << " TrkLevel1::LoadVKMaskParam() ==> No PAMELA environment variables defined "<<endl;  
 //          return 0;  
 //      }  
 //      path.Append("/trk-param/mask_param-1/");  
797  //     }  //     }
798  //     cout <<"Loading VK-mask parameters: "<<path<<endl;  //     return pfa_.netaval;
799  //     strcpy(path_.path,path.Data());  // };
 //     path_.pathlen = path.Length();  
 //     path_.error   = 0;  
 //     return readvkmask_();  
 // //    }        
 // //    return 0;  
 // }  
800    
801  // /**  // /**
802  //  * Load all (default) parameters. Environment variable must be defined.  //  *
803  //  *  //  *
804  //  */  //  */
805  // int TrkLevel1::LoadParams(){  // float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){
   
 //     int result=0;  
       
 //     result = result * LoadFieldParam();  
 //     result = result * LoadPfaParam();  
 //     result = result * LoadChargeParam();  
 //     result = result * LoadAlignmentParam();  
 //     result = result * LoadMipParam();  
 //     result = result * LoadVKMaskParam();  
   
 //     return result;  
 // }  
   
   
   
 int TrkLevel1::GetPfaNbinsAngle(){  
     TrkParams::Load(4);  
     if( !TrkParams::IsLoaded(4) ){  
         cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters  not loaded"<<endl;  
         return 0;  
     }  
     return pfa_.nangbin;  
 };  
806    
807  int TrkLevel1::GetPfaNbinsETA(){  //     TrkParams::Load(4);
808      TrkParams::Load(4);  //     if( !TrkParams::IsLoaded(4) ){
809      if( !TrkParams::IsLoaded(4) ){  //      cout << "float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters  not loaded"<<endl;
810          cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters  not loaded"<<endl;  //      return 0;
811          return 0;  //     }
     }  
     return pfa_.netaval;  
 };  
   
 /**  
  *  
  *  
  */  
 float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){  
   
     TrkParams::Load(4);  
     if( !TrkParams::IsLoaded(4) ){  
         cout << "float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters  not loaded"<<endl;  
         return 0;  
     }  
812        
813      int nbins = GetPfaNbinsETA();  //     int nbins = GetPfaNbinsETA();
814      if(!nbins)return 0;  //     if(!nbins)return 0;
815    
816      float *fcorr = new float [nbins];  //     float *fcorr = new float [nbins];
817    
818      if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){  //     if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){
819          for(int ib=0; ib<nbins; ib++){  //      for(int ib=0; ib<nbins; ib++){
820              fcorr[ib] = pfa_.feta2[nang][nladder][nview][ib];  //          fcorr[ib] = pfa_.feta2[nang][nladder][nview][ib];
821              cout << pfa_.eta2[nang][ib] << " - " <<  pfa_.feta2[nang][nladder][nview][ib]<<endl;;  //          cout << pfa_.eta2[nang][ib] << " - " <<  pfa_.feta2[nang][nladder][nview][ib]<<endl;;
822          }  //      }
823      }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){  //     }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){
824          for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta3[nang][nladder][nview][ib];  //      for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta3[nang][nladder][nview][ib];
825      }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){  //     }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){
826          for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta4[nang][nladder][nview][ib];  //      for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta4[nang][nladder][nview][ib];
827      }else{  //     }else{
828          cout << pfa<<" pfa parameters not implemented "<<endl;  //      cout << pfa<<" pfa parameters not implemented "<<endl;
829          return 0;  //      return 0;
830      }      //     }    
831    
832      return fcorr;  //     return fcorr;
833    
834  };  // };
835    
836  float* TrkLevel1::GetPfaAbs(TString pfa, int nang){  // float* TrkLevel1::GetPfaAbs(TString pfa, int nang){
837        
838      TrkParams::Load(4);  //     TrkParams::Load(4);
839      if( !TrkParams::IsLoaded(4) ){  //     if( !TrkParams::IsLoaded(4) ){
840          cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters  not loaded"<<endl;  //      cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters  not loaded"<<endl;
841          return 0;  //      return 0;
842      }  //     }
843    
844      int nbins = GetPfaNbinsETA();  //     int nbins = GetPfaNbinsETA();
845      if(!nbins)return 0;  //     if(!nbins)return 0;
846    
847      float *fcorr = new float [nbins];  //     float *fcorr = new float [nbins];
848    
849      if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){  //     if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){
850          for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta2[nang][ib];  //      for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta2[nang][ib];
851      }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){  //     }else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){
852          for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta3[nang][ib];  //      for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta3[nang][ib];
853      }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){  //     }else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){
854          for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta4[nang][ib];  //      for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta4[nang][ib];
855      }else{  //     }else{
856          cout << pfa<<" pfa parameters not implemented "<<endl;  //      cout << pfa<<" pfa parameters not implemented "<<endl;
857          return 0;  //      return 0;
858      }      //     }    
859    
860      return fcorr;  //     return fcorr;
861    
862  };  // };
863    
864  /**  /**
865   * Method to call the F77 routine that performs level1->level2 processing.   * Method to call the F77 routine that performs level1->level2 processing.

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.26

  ViewVC Help
Powered by ViewVC 1.1.23