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

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

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

revision 1.7 by pam-ts, Wed Oct 15 08:45:51 2014 UTC revision 1.8 by pam-fi, Thu Jan 28 14:38:24 2016 UTC
# Line 497  bool ExtTrack::SetYGood(int ip,int icl_p Line 497  bool ExtTrack::SetYGood(int ip,int icl_p
497  //  //
498  //--------------------------------------  //--------------------------------------
499  /**  /**
500   * Clear the track. If option C is specied, deallocate the hit vectors.   * Clear the track. If option C is specified, deallocates the hit vectors.
501   */   */
502  void ExtTrack::Clear(Option_t* option){  void ExtTrack::Clear(Option_t* option){
503        
504     Reset();  //    cout << " ExtTrack::Clear( "<<option<<" )"<<this<<endl;
505            
506        Reset();
   //  cout << " ExtTrack::Clear("<<option<<")  "<<this<<endl;  
   
   
   //  cout << " xgood "<<xgood<<endl;  
     
   //  if(nplanes>0){  
507    
508     if (option && option[0] == 'C') {     if (option && option[0] == 'C') {
509    
510    //       cout << " uccidi!! "<<endl;
511    
512         if(xgood) delete []      xgood;         if(xgood) delete []      xgood;
513         if(ygood) delete []      ygood;         if(ygood) delete []      ygood;
# Line 537  void ExtTrack::Clear(Option_t* option){ Line 532  void ExtTrack::Clear(Option_t* option){
532         if(dedx_x)delete []      dedx_x;         if(dedx_x)delete []      dedx_x;
533         if(dedx_y)delete []      dedx_y;         if(dedx_y)delete []      dedx_y;
534         //}         //}
535    //        delete []     xgood;
536    //        delete []     ygood;
537    //        delete [] multmaxx;
538    //        delete [] multmaxy;
539    //        delete []     xm;
540    //        delete []     ym;
541    //        delete []     zm;
542    //        delete []     xma;
543    //        delete []     yma;
544    //        delete []     zma;
545    //        delete []     xmb;
546    //        delete []     ymb;
547    //        delete []     zmb;
548    //        delete []     resx;
549    //        delete []     resy;
550    //        delete []     xv;
551    //        delete []     yv;
552    //        delete []     zv;
553    //        delete []     axv;
554    //        delete []     ayv;
555    //        delete []     dedx_x;
556    //        delete []     dedx_y;
557    
558         xgood   = NULL;         xgood   = NULL;
559         ygood   = NULL;         ygood   = NULL;
# Line 746  void ExtTrack::Fit(double pfixed, int& f Line 763  void ExtTrack::Fit(double pfixed, int& f
763      if(iprint)cout << " >>>> fit failed "<<endl;      if(iprint)cout << " >>>> fit failed "<<endl;
764      for(int i=0; i<5; i++) al[i]=al_ini[i];      for(int i=0; i<5; i++) al[i]=al_ini[i];
765    }    }
766    
767      int ngf = TrkParams::nGF;
768      float* zgf =  TrkParams::zGF;    
769      Trajectory tj = Trajectory(ngf,zgf);
770      tj.DoTrack(al,zini);
771      for(int i=0; i<14; i++){
772          xGF[i] = tj.x[i];
773          yGF[i] = tj.y[i];
774      }
775    
776    
777  };  };
778    
779  /**  /**
# Line 862  Float_t ExtTrack::GetDEDX(){ Line 890  Float_t ExtTrack::GetDEDX(){
890      return dedx;      return dedx;
891  };  };
892    
893    
894    /**
895     * Method to evaluate the dE/dx averaged over all X views.
896     */
897    Float_t ExtTrack::GetDEDXX(bool cutSat){
898        Float_t dedx=0;
899        Int_t   np=0;
900        for(Int_t ip=0; ip<nplanes; ip++){
901            dedx += GetDEDX(ip,0)*XGood(ip)*(cutSat ? !IsSaturated(ip,0) : 1);
902            np   +=               XGood(ip)*(cutSat ? !IsSaturated(ip,0) : 1);
903        }
904        if(np>0)return dedx/np;
905        return -1;
906    };
907    /**
908     * Method to evaluate the dE/dx averaged over all Y views.
909     */
910    Float_t ExtTrack::GetDEDXY(bool cutSat){
911        Float_t dedx=0;
912        Int_t   np=0;
913        for(Int_t ip=0; ip<nplanes; ip++){
914            dedx += GetDEDX(ip,1)*YGood(ip)*(cutSat ? !IsSaturated(ip,1) : 1);
915            np   +=               YGood(ip)*(cutSat ? !IsSaturated(ip,1) : 1);
916        }
917        if(np>0)return dedx/np;
918        return -1;
919    };
920    
921    /**
922     * Returns 1 if the cluster on a tracker view includes bad strips
923     * (at least one bad strip among the four strip used by p.f.a.)
924     * @param ip plane (0-5)
925     * @param iv view (0=x 1=y)
926     */
927    Bool_t ExtTrack::IsBad(int ip,int iv){
928        if(ip>=6&&ip<8)return false;
929        if(iv==0 && ip>=0 && ip<6)return (xgood[ip]<0) ;
930        else if(iv==1 && ip>=0 && ip<6)return (ygood[ip]<0) ;
931        else {
932            cout << "ExtTrack::IsBad(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
933            return 0.;
934        }
935    };
936    
937  /**  /**
938   * Method to retrieve the ladder, if assigned   * Method to retrieve the ladder, if assigned
939   */   */
# Line 940  Float_t ExtTrack::GetDeflection(){ Line 1012  Float_t ExtTrack::GetDeflection(){
1012  //  //
1013  Bool_t ExtTrack::IsInsideAcceptance(float toll){  Bool_t ExtTrack::IsInsideAcceptance(float toll){
1014      int ngf = TrkParams::nGF;      int ngf = TrkParams::nGF;
1015        float* zgf =  TrkParams::zGF;
1016        
1017        Trajectory tj = Trajectory(ngf,zgf);
1018        tj.DoTrack(al,zini);
1019    
1020      for(int i=0; i<ngf; i++){      for(int i=0; i<ngf; i++){
1021          //          //
1022  //      cout << endl << TrkParams::GF_element[i];  //      cout << endl << TrkParams::GF_element[i];
1023          if(  //      if(
1024              TrkParams::GF_element[i].CompareTo("S11") &&  //          TrkParams::GF_element[i].CompareTo("S11") &&
1025              TrkParams::GF_element[i].CompareTo("S12") &&  //          TrkParams::GF_element[i].CompareTo("S12") &&
1026              TrkParams::GF_element[i].CompareTo("S21") &&  //          TrkParams::GF_element[i].CompareTo("S21") &&
1027              TrkParams::GF_element[i].CompareTo("S22") &&  //          TrkParams::GF_element[i].CompareTo("S22") &&
1028              TrkParams::GF_element[i].CompareTo("T1")  &&  //          TrkParams::GF_element[i].CompareTo("T1")  &&
1029              TrkParams::GF_element[i].CompareTo("CUF") &&  //          TrkParams::GF_element[i].CompareTo("CUF") &&
1030              TrkParams::GF_element[i].CompareTo("T2")  &&  //          TrkParams::GF_element[i].CompareTo("T2")  &&
1031              TrkParams::GF_element[i].CompareTo("T3")  &&  //          TrkParams::GF_element[i].CompareTo("T3")  &&
1032              TrkParams::GF_element[i].CompareTo("T4")  &&  //          TrkParams::GF_element[i].CompareTo("T4")  &&
1033              TrkParams::GF_element[i].CompareTo("T5")  &&  //          TrkParams::GF_element[i].CompareTo("T5")  &&
1034              TrkParams::GF_element[i].CompareTo("CLF") &&  //          TrkParams::GF_element[i].CompareTo("CLF") &&
1035              TrkParams::GF_element[i].CompareTo("T6")  &&  //          TrkParams::GF_element[i].CompareTo("T6")  &&
1036              TrkParams::GF_element[i].CompareTo("S31") &&  //          TrkParams::GF_element[i].CompareTo("S31") &&
1037              TrkParams::GF_element[i].CompareTo("S32") &&  //          TrkParams::GF_element[i].CompareTo("S32") &&
1038              true)continue;  //          true)continue;
1039          // apply condition only within the cavity          // apply condition only within the cavity
1040  //      cout << " -- "<<xGF[i]<<" "<<yGF[i];  //      cout << " -- "<<xGF[i]<<" "<<yGF[i];
1041          if(          if(
1042              xGF[i] <= TrkParams::xGF_min[i] + toll ||  //          xGF[i] <= TrkParams::xGF_min[i] + toll ||
1043              xGF[i] >= TrkParams::xGF_max[i] - toll ||  //          xGF[i] >= TrkParams::xGF_max[i] - toll ||
1044              yGF[i] <= TrkParams::yGF_min[i] + toll ||  //          yGF[i] <= TrkParams::yGF_min[i] + toll ||
1045              yGF[i] >= TrkParams::yGF_max[i] - toll ||  //          yGF[i] >= TrkParams::yGF_max[i] - toll ||
1046                tj.x[i] <= TrkParams::xGF_min[i] + toll ||
1047                tj.x[i] >= TrkParams::xGF_max[i] - toll ||
1048                tj.y[i] <= TrkParams::yGF_min[i] + toll ||
1049                tj.y[i] >= TrkParams::yGF_max[i] - toll ||
1050              false){              false){
1051                            
1052              return false;              return false;
# Line 1050  Int_t ExtTrack::GetLeverArmXY(){ Line 1131  Int_t ExtTrack::GetLeverArmXY(){
1131  }  }
1132    
1133    
1134    /**
1135     * Returns 1 if the signal on a tracker view is saturated.
1136     * @param ip plane (0-5)
1137     * @param iv view (0=x 1=y)
1138     */
1139    Bool_t ExtTrack::IsSaturated(int ip,int iv){
1140        if(ip>=6 && ip<8)return false;
1141        if(iv==0 && ip>=0 && ip<6)return (dedx_x[ip]<0) ;
1142        else if(iv==1 && ip>=0 && ip<6)return (dedx_y[ip]<0) ;
1143        else {
1144            cout << "ExtTrack::IsSaturated(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
1145            return 0.;
1146        }
1147    };
1148    /**
1149     * Returns 1 if either the x or the y signal on a tracker plane is saturated.
1150     * @param ip plane (0-5)
1151     */
1152    Bool_t ExtTrack::IsSaturated(int ip){
1153        return (IsSaturated(ip,0)||IsSaturated(ip,1));
1154    };
1155    /**
1156     * Returns 1 if there is at least a saturated signal along the track.
1157     */
1158    Bool_t ExtTrack::IsSaturated(){
1159        for(int ip=0; ip<nplanes; ip++)for(int iv=0; iv<2; iv++)if(IsSaturated(ip,iv))return true;
1160        return false;
1161    }
1162    
1163    
1164    
1165    
1166    
1167  ClassImp(ExtTrack);  ClassImp(ExtTrack);

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.23