Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:42

0001 #ifndef RecoHI_HiEvtPlaneAlgos_EPCuts_h
0002 #define RecoHI_HiEvtPlaneAlgos_EPCuts_h
0003 
0004 namespace hi {
0005 
0006   enum class EP_ERA { ppReco, HIReco, Pixel, GenMC };
0007 
0008   struct TrackStructure {
0009     int centbin;
0010     float eta;
0011     float phi;
0012     float et;
0013     float pt;
0014     int charge;
0015     int pdgid;
0016     int hits;
0017     int algos;
0018     int collection;
0019     float dz;
0020     float dxy;
0021     float dzError;
0022     float dxyError;
0023     float ptError;
0024     bool highPurity;
0025     float dzSig;
0026     float dxySig;
0027     float normalizedChi2;
0028     float dzError_Pix;
0029     float chi2layer;
0030     int numberOfValidHits;
0031     int pixel;
0032   };
0033 
0034   class EPCuts {
0035   public:
0036     explicit EPCuts(EP_ERA cutEra = EP_ERA::ppReco,
0037                     double pterror = 0.1,
0038                     double dzerror = 3.0,
0039                     double dxyerror = 3.0,
0040                     double chi2perlayer = 0.18,
0041                     double dzError_Pix = 10.0,
0042                     double chi2Pix = 40.,
0043                     int numberOfValidHits = 11) {
0044       cutera_ = cutEra;
0045       pterror_ = pterror;
0046       dzerror_ = dzerror;
0047       dxyerror_ = dxyerror;
0048       chi2perlayer_ = chi2perlayer;
0049       dzerror_Pix_ = dzError_Pix;
0050       chi2Pix_ = chi2Pix;
0051       numberOfValidHits_ = numberOfValidHits;
0052     }
0053 
0054     bool isGoodHF(const TrackStructure& track) const {
0055       if (track.pdgid != 1 && track.pdgid != 2)
0056         return false;
0057       if (std::abs(track.eta) < 3 || std::abs(track.eta) > 5)
0058         return false;
0059       return true;
0060     }
0061 
0062     bool isGoodCastor(const TrackStructure& track) const { return true; }
0063 
0064     bool isGoodTrack(const TrackStructure& track) const {
0065       if (cutera_ == EP_ERA::ppReco)
0066         return trackQuality_ppReco(track);
0067       if (cutera_ == EP_ERA::HIReco)
0068         return trackQuality_HIReco(track);
0069       if (cutera_ == EP_ERA::Pixel)
0070         return trackQuality_Pixel(track);
0071       return false;
0072     }
0073 
0074     bool trackQuality_ppReco(const TrackStructure& track) const {
0075       if (track.charge == 0)
0076         return false;
0077       if (!track.highPurity)
0078         return false;
0079       if (track.ptError > pterror_ * track.pt)
0080         return false;
0081       if (track.numberOfValidHits < numberOfValidHits_)
0082         return false;
0083       if (track.chi2layer > chi2perlayer_)
0084         return false;
0085       if (std::abs(track.dxy) > dxyerror_ * track.dxyError)
0086         return false;
0087       if (std::abs(track.dz) > dzerror_ * track.dzError)
0088         return false;
0089       return true;
0090     }
0091 
0092     bool trackQuality_HIReco(const TrackStructure& track) const {
0093       if (track.charge == 0)
0094         return false;
0095       if (!track.highPurity)
0096         return false;
0097       if (track.numberOfValidHits < numberOfValidHits_)
0098         return false;
0099       if (track.ptError > pterror_ * track.pt)
0100         return false;
0101       if (std::abs(track.dxy) > dxyerror_ * track.dxyError)
0102         return false;
0103       if (std::abs(track.dz) > dzerror_ * track.dzError)
0104         return false;
0105       if (track.chi2layer > chi2perlayer_)
0106         return false;
0107       //if (track.algos != 4 && track.algos != 5 && track.algos != 6 && track.algos != 7)
0108       if (track.algos != reco::TrackBase::initialStep && track.algos != reco::TrackBase::lowPtTripletStep &&
0109           track.algos != reco::TrackBase::pixelPairStep && track.algos != reco::TrackBase::detachedTripletStep)
0110         return false;
0111       return true;
0112     }
0113 
0114     bool trackQuality_Pixel(const TrackStructure& track) const {
0115       if (track.charge == 0)
0116         return false;
0117       if (!track.highPurity)
0118         return false;
0119       bool bPix = false;
0120       int nHits = track.numberOfValidHits;
0121       if (track.ptError > pterror_ * track.pt)
0122         return false;
0123       if (track.pt < 2.4 and (nHits <= 6))
0124         bPix = true;
0125       if (not bPix) {
0126         if (nHits < numberOfValidHits_)
0127           return false;
0128         if (track.chi2layer > chi2perlayer_)
0129           return false;
0130         if (track.ptError > pterror_ * track.pt)
0131           return false;
0132         int algo = track.algos;
0133         if (track.pt > 2.4 && algo != reco::TrackBase::initialStep && algo != reco::TrackBase::lowPtTripletStep &&
0134             algo != reco::TrackBase::pixelPairStep && algo != reco::TrackBase::detachedTripletStep)
0135           return false;
0136         if (std::abs(track.dxy) > dxyerror_ * track.dxyError)
0137           return false;
0138         if (std::abs(track.dz) > dzerror_ * track.dzError)
0139           return false;
0140       } else {
0141         if (track.chi2layer > chi2Pix_)
0142           return false;
0143         if (std::abs(track.dz) > dzerror_Pix_ * track.dzError)
0144           return false;
0145       }
0146       return true;
0147     }
0148 
0149     bool trackQuality_GenMC(const TrackStructure& track) const {
0150       if (track.charge == 0)
0151         return false;
0152       if (std::abs(track.eta) > 2.4)
0153         return false;
0154       return true;
0155     }
0156 
0157   private:
0158     EP_ERA cutera_;
0159     double pterror_;
0160     double dzerror_;
0161     double dxyerror_;
0162     double chi2perlayer_;
0163     double dzerror_Pix_;
0164     double chi2Pix_;
0165     int numberOfValidHits_;
0166   };
0167 }  // namespace hi
0168 #endif