Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:16

0001 #ifndef PreId_H
0002 #define PreId_H
0003 
0004 // Author F. Beaudette. March 2010
0005 
0006 #include "DataFormats/Math/interface/Point3D.h"
0007 #include "DataFormats/TrackReco/interface/Track.h"
0008 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0009 #include "DataFormats/ParticleFlowReco/interface/PFRecTrackFwd.h"
0010 #include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h"
0011 
0012 namespace reco {
0013   class PreId {
0014   public:
0015     enum MatchingType { NONE = 0, ECALMATCH = 1, ESMATCH = 2, TRACKFILTERING = 3, MVA = 4, FINAL = 10 };
0016 
0017   public:
0018     PreId(unsigned nselection = 1)
0019         : trackRef_(reco::TrackRef()),
0020           clusterRef_(reco::PFClusterRef()),
0021           matchingEop_(-999.),
0022           EcalPos_(math::XYZPoint()),
0023           meanShower_(math::XYZPoint()),
0024           gsfChi2_(-999.),
0025           dpt_(0.),
0026           chi2Ratio_(0.) {
0027       matching_.resize(nselection, false);
0028       mva_.resize(nselection, -999.);
0029       geomMatching_.resize(5, -999.);
0030     }
0031     void setTrack(reco::TrackRef trackref) { trackRef_ = trackref; }
0032 
0033     void setECALMatchingProperties(PFClusterRef clusterRef,
0034                                    const math::XYZPoint &ecalpos,
0035                                    const math::XYZPoint &meanShower,
0036                                    float deta,
0037                                    float dphi,
0038                                    float chieta,
0039                                    float chiphi,
0040                                    float chi2,
0041                                    float eop) {
0042       clusterRef_ = clusterRef;
0043       EcalPos_ = ecalpos;
0044       meanShower_ = meanShower;
0045       geomMatching_[0] = deta;
0046       geomMatching_[1] = dphi;
0047       geomMatching_[2] = chieta;
0048       geomMatching_[3] = chiphi;
0049       geomMatching_[4] = chi2;
0050       matchingEop_ = eop;
0051     }
0052 
0053     void setTrackProperties(float newchi2, float chi2ratio, float dpt) {
0054       gsfChi2_ = newchi2;
0055       chi2Ratio_ = chi2ratio;
0056       dpt_ = dpt;
0057     }
0058 
0059     void setFinalDecision(bool accepted, unsigned n = 0) { setMatching(FINAL, accepted, n); }
0060     void setECALMatching(bool accepted, unsigned n = 0) { setMatching(ECALMATCH, accepted, n); }
0061     void setESMatching(bool accepted, unsigned n = 0) { setMatching(ESMATCH, accepted, n); }
0062     void setTrackFiltering(bool accepted, unsigned n = 0) { setMatching(TRACKFILTERING, accepted, n); }
0063     void setMVA(bool accepted, float mva, unsigned n = 0) {
0064       setMatching(MVA, accepted, n);
0065       if (n < mva_.size())
0066         mva_[n] = mva;
0067     }
0068 
0069     void setMatching(MatchingType type, bool result, unsigned n = 0);
0070     bool matching(MatchingType type, unsigned n = 0) const {
0071       if (n < matching_.size()) {
0072         return matching_[n] & (1 << type);
0073       }
0074       return false;
0075     }
0076 
0077     /// Access methods
0078     inline const std::vector<float> &geomMatching() const { return geomMatching_; }
0079     inline float eopMatch() const { return matchingEop_; }
0080     inline float pt() const { return trackRef_->pt(); }
0081     inline float eta() const { return trackRef_->eta(); }
0082     inline float kfChi2() const { return trackRef_->normalizedChi2(); }
0083     inline float kfNHits() const { return trackRef_->found(); }
0084 
0085     const math::XYZPoint &ecalPos() const { return EcalPos_; }
0086     const math::XYZPoint &meanShower() const { return meanShower_; }
0087 
0088     inline float chi2Ratio() const { return chi2Ratio_; }
0089     inline float gsfChi2() const { return gsfChi2_; }
0090 
0091     inline bool ecalMatching(unsigned n = 0) const { return matching(ECALMATCH, n); }
0092     inline bool esMatching(unsigned n = 0) const { return matching(ESMATCH, n); }
0093     inline bool trackFiltered(unsigned n = 0) const { return matching(TRACKFILTERING, n); }
0094     inline bool mvaSelected(unsigned n = 0) const { return matching(MVA, n); }
0095     inline bool preIded(unsigned n = 0) const { return matching(FINAL, n); }
0096 
0097     float mva(unsigned n = 0) const;
0098     inline float dpt() const { return dpt_; }
0099     reco::TrackRef trackRef() const { return trackRef_; }
0100     PFClusterRef clusterRef() const { return clusterRef_; }
0101 
0102   private:
0103     reco::TrackRef trackRef_;
0104     PFClusterRef clusterRef_;
0105 
0106     std::vector<float> geomMatching_;
0107     float matchingEop_;
0108     math::XYZPoint EcalPos_;
0109     math::XYZPoint meanShower_;
0110 
0111     float gsfChi2_;
0112     float dpt_;
0113     float chi2Ratio_;
0114     std::vector<float> mva_;
0115 
0116     //    bool goodpreid_;
0117     //    bool TkId_;
0118     //    bool EcalMatching_;
0119     //    bool PSMatching_;
0120     std::vector<int> matching_;
0121   };
0122 }  // namespace reco
0123 #endif