/[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.2 by pam-ts, Wed Jun 4 07:57:03 2014 UTC revision 1.5 by mocchiut, Thu Aug 7 16:04:14 2014 UTC
# Line 190  void ExtTrack::Set( TrkTrack& t , int in Line 190  void ExtTrack::Set( TrkTrack& t , int in
190      Clear();//deallocate vectors      Clear();//deallocate vectors
191      cout << "SetDimension("<<t.GetNhit()<<")"<<endl;      cout << "SetDimension("<<t.GetNhit()<<")"<<endl;
192      SetDimension(t.GetNhit()); //allocate vectors      SetDimension(t.GetNhit()); //allocate vectors
193    //   }else{
194    //       SetDimension(6+index);
195    }    }
196    // default fit settings (the same as TrkTrack)    // default fit settings (the same as TrkTrack)
197    SetMiniDefault();    SetMiniDefault();
# Line 816  int ExtTrack::GetClusterY_ID(int ip){ Line 818  int ExtTrack::GetClusterY_ID(int ip){
818  };  };
819    
820  /**  /**
821     * Method to retrieve the dE/dx measured on a tracker view.
822     * @param ip plane (0-5)
823     * @param iv view (0=x 1=y)
824     */
825    Float_t ExtTrack::GetDEDX(int ip, int iv){
826        if(iv==0 && ip>=0 && ip<6)return fabs(dedx_x[ip]);
827        else if(iv==1 && ip>=0 && ip<6)return fabs(dedx_y[ip]);
828        else {
829            cout << "TrkTrack::GetDEDX(int ip, int iv) -- wrong input parameters "<<ip<<iv<<endl;
830            return 0.;
831        }
832    }
833    /**
834     * Method to evaluate the dE/dx measured on a tracker plane.
835     * The two measurements on x- and y-view are averaged.
836     * @param ip plane (0-5)
837     */
838    Float_t ExtTrack::GetDEDX(int ip){
839        if( (Int_t)XGood(ip)+(Int_t)YGood(ip) == 0 ) return 0;
840        return (GetDEDX(ip,0)+GetDEDX(ip,1))/((Int_t)XGood(ip)+(Int_t)YGood(ip));
841    };
842    
843    /**
844     * Method to evaluate the dE/dx averaged over all planes.
845     */
846    Float_t ExtTrack::GetDEDX(){
847        Float_t dedx=0;
848        for(Int_t ip=0; ip<6; ip++)dedx+=GetDEDX(ip,0)*XGood(ip)+GetDEDX(ip,1)*YGood(ip);
849        dedx = dedx/(GetNX()+GetNY());
850        return dedx;
851    };
852    
853    /**
854   * Method to retrieve the ladder, if assigned   * Method to retrieve the ladder, if assigned
855   */   */
856  int ExtTrack::GetLadder(int ip){  int ExtTrack::GetLadder(int ip){
# Line 880  Float_t ExtTrack::GetRigidity(){ Line 915  Float_t ExtTrack::GetRigidity(){
915          if(rig<0) rig=-rig;          if(rig<0) rig=-rig;
916          return rig;          return rig;
917  };  };
918    //
919    Float_t ExtTrack::GetDeflection(){
920            Float_t def=0;
921            if(chi2>0)def=al[4];
922            return def;
923    };
924    
925    
926    //
927    // all that follows: EM porting from TrkLevel2
928    //
929    Bool_t ExtTrack::IsInsideAcceptance(float toll){
930        int ngf = TrkParams::nGF;
931        for(int i=0; i<ngf; i++){
932            //
933    //      cout << endl << TrkParams::GF_element[i];
934            if(
935                TrkParams::GF_element[i].CompareTo("S11") &&
936                TrkParams::GF_element[i].CompareTo("S12") &&
937                TrkParams::GF_element[i].CompareTo("S21") &&
938                TrkParams::GF_element[i].CompareTo("S22") &&
939                TrkParams::GF_element[i].CompareTo("T1")  &&
940                TrkParams::GF_element[i].CompareTo("CUF") &&
941                TrkParams::GF_element[i].CompareTo("T2")  &&
942                TrkParams::GF_element[i].CompareTo("T3")  &&
943                TrkParams::GF_element[i].CompareTo("T4")  &&
944                TrkParams::GF_element[i].CompareTo("T5")  &&
945                TrkParams::GF_element[i].CompareTo("CLF") &&
946                TrkParams::GF_element[i].CompareTo("T6")  &&
947                TrkParams::GF_element[i].CompareTo("S31") &&
948                TrkParams::GF_element[i].CompareTo("S32") &&
949                true)continue;
950            // apply condition only within the cavity
951    //      cout << " -- "<<xGF[i]<<" "<<yGF[i];
952            if(
953                xGF[i] <= TrkParams::xGF_min[i] + toll ||
954                xGF[i] >= TrkParams::xGF_max[i] - toll ||
955                yGF[i] <= TrkParams::yGF_min[i] + toll ||
956                yGF[i] >= TrkParams::yGF_max[i] - toll ||
957                false){
958                
959                return false;
960            }
961        }
962        return true;
963    }
964    
965    /**
966     * Returns the reduced chi-square of track x-projection
967     */
968    Float_t  ExtTrack::GetChi2X(){
969        float chiq=0;
970        for(int ip=0; ip<nplanes; ip++)if(XGood(ip))chiq+= pow((xv[ip]-xm[ip])/resx[ip],2.);
971        if(GetNX()>3)chiq=chiq/(GetNX()-3);
972        else chiq=0;
973        if(chiq==0)cout << " Float_t  ExtTrack::GetChi2X() -- WARNING -- value not defined "<<chiq<<endl;
974        return chiq;
975    }
976    /**
977     * Returns the reduced chi-square of track y-projection
978     */
979    Float_t  ExtTrack::GetChi2Y(){
980        float chiq=0;
981        for(int ip=0; ip<nplanes; ip++)if(YGood(ip))chiq+= pow((yv[ip]-ym[ip])/resy[ip],2.);
982        if(GetNY()>2)chiq=chiq/(GetNY()-2);
983        else chiq=0;
984        if(chiq==0)cout << " Float_t  ExtTrack::GetChi2Y() -- WARNING -- value not defined "<<chiq<<endl;
985        return chiq;
986    }
987    
988  ClassImp(ExtTrack);  ClassImp(ExtTrack);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.23