/[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.9 by pam-fi, Fri Feb 26 12:03:36 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        //this is a patch, to assign correctly xGF and yGF cordinates.
1018    
1019        Trajectory tj = Trajectory(ngf,zgf);
1020        tj.DoTrack(al,zini);
1021    
1022        //NB the folowing assignment is NOT permanent!!!
1023        for(int i=0; i<14; i++){
1024            xGF[i] = tj.x[i];
1025            yGF[i] = tj.y[i];
1026        }
1027    
1028      for(int i=0; i<ngf; i++){      for(int i=0; i<ngf; i++){
1029          //          //
1030  //      cout << endl << TrkParams::GF_element[i];  //      cout << endl << TrkParams::GF_element[i];
1031          if(  //      if(
1032              TrkParams::GF_element[i].CompareTo("S11") &&  //          TrkParams::GF_element[i].CompareTo("S11") &&
1033              TrkParams::GF_element[i].CompareTo("S12") &&  //          TrkParams::GF_element[i].CompareTo("S12") &&
1034              TrkParams::GF_element[i].CompareTo("S21") &&  //          TrkParams::GF_element[i].CompareTo("S21") &&
1035              TrkParams::GF_element[i].CompareTo("S22") &&  //          TrkParams::GF_element[i].CompareTo("S22") &&
1036              TrkParams::GF_element[i].CompareTo("T1")  &&  //          TrkParams::GF_element[i].CompareTo("T1")  &&
1037              TrkParams::GF_element[i].CompareTo("CUF") &&  //          TrkParams::GF_element[i].CompareTo("CUF") &&
1038              TrkParams::GF_element[i].CompareTo("T2")  &&  //          TrkParams::GF_element[i].CompareTo("T2")  &&
1039              TrkParams::GF_element[i].CompareTo("T3")  &&  //          TrkParams::GF_element[i].CompareTo("T3")  &&
1040              TrkParams::GF_element[i].CompareTo("T4")  &&  //          TrkParams::GF_element[i].CompareTo("T4")  &&
1041              TrkParams::GF_element[i].CompareTo("T5")  &&  //          TrkParams::GF_element[i].CompareTo("T5")  &&
1042              TrkParams::GF_element[i].CompareTo("CLF") &&  //          TrkParams::GF_element[i].CompareTo("CLF") &&
1043              TrkParams::GF_element[i].CompareTo("T6")  &&  //          TrkParams::GF_element[i].CompareTo("T6")  &&
1044              TrkParams::GF_element[i].CompareTo("S31") &&  //          TrkParams::GF_element[i].CompareTo("S31") &&
1045              TrkParams::GF_element[i].CompareTo("S32") &&  //          TrkParams::GF_element[i].CompareTo("S32") &&
1046              true)continue;  //          true)continue;
1047          // apply condition only within the cavity          // apply condition only within the cavity
1048  //      cout << " -- "<<xGF[i]<<" "<<yGF[i];  //      cout << " -- "<<xGF[i]<<" "<<yGF[i];
1049          if(          if(
1050              xGF[i] <= TrkParams::xGF_min[i] + toll ||  //          xGF[i] <= TrkParams::xGF_min[i] + toll ||
1051              xGF[i] >= TrkParams::xGF_max[i] - toll ||  //          xGF[i] >= TrkParams::xGF_max[i] - toll ||
1052              yGF[i] <= TrkParams::yGF_min[i] + toll ||  //          yGF[i] <= TrkParams::yGF_min[i] + toll ||
1053              yGF[i] >= TrkParams::yGF_max[i] - toll ||  //          yGF[i] >= TrkParams::yGF_max[i] - toll ||
1054                tj.x[i] <= TrkParams::xGF_min[i] + toll ||
1055                tj.x[i] >= TrkParams::xGF_max[i] - toll ||
1056                tj.y[i] <= TrkParams::yGF_min[i] + toll ||
1057                tj.y[i] >= TrkParams::yGF_max[i] - toll ||
1058              false){              false){
1059                            
1060              return false;              return false;
# Line 1050  Int_t ExtTrack::GetLeverArmXY(){ Line 1139  Int_t ExtTrack::GetLeverArmXY(){
1139  }  }
1140    
1141    
1142    /**
1143     * Returns 1 if the signal on a tracker view is saturated.
1144     * @param ip plane (0-5)
1145     * @param iv view (0=x 1=y)
1146     */
1147    Bool_t ExtTrack::IsSaturated(int ip,int iv){
1148        if(ip>=6 && ip<8)return false;
1149        if(iv==0 && ip>=0 && ip<6)return (dedx_x[ip]<0) ;
1150        else if(iv==1 && ip>=0 && ip<6)return (dedx_y[ip]<0) ;
1151        else {
1152            cout << "ExtTrack::IsSaturated(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
1153            return 0.;
1154        }
1155    };
1156    /**
1157     * Returns 1 if either the x or the y signal on a tracker plane is saturated.
1158     * @param ip plane (0-5)
1159     */
1160    Bool_t ExtTrack::IsSaturated(int ip){
1161        return (IsSaturated(ip,0)||IsSaturated(ip,1));
1162    };
1163    /**
1164     * Returns 1 if there is at least a saturated signal along the track.
1165     */
1166    Bool_t ExtTrack::IsSaturated(){
1167        for(int ip=0; ip<nplanes; ip++)for(int iv=0; iv<2; iv++)if(IsSaturated(ip,iv))return true;
1168        return false;
1169    }
1170    
1171    
1172    
1173    
1174    
1175  ClassImp(ExtTrack);  ClassImp(ExtTrack);

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

  ViewVC Help
Powered by ViewVC 1.1.23