CMS 3D CMS Logo

PreId.h
Go to the documentation of this file.
1 #ifndef PreId_H
2 #define PreId_H
3 
4 // Author F. Beaudette. March 2010
5 
11 
12 namespace reco {
13  class PreId {
14  public:
15  enum MatchingType { NONE = 0, ECALMATCH = 1, ESMATCH = 2, TRACKFILTERING = 3, MVA = 4, FINAL = 10 };
16 
17  public:
18  PreId(unsigned nselection = 1)
19  : trackRef_(reco::TrackRef()),
21  matchingEop_(-999.),
24  gsfChi2_(-999.),
25  dpt_(0.),
26  chi2Ratio_(0.) {
27  matching_.resize(nselection, false);
28  mva_.resize(nselection, -999.);
29  geomMatching_.resize(5, -999.);
30  }
31  void setTrack(reco::TrackRef trackref) { trackRef_ = trackref; }
32 
34  const math::XYZPoint &ecalpos,
36  float deta,
37  float dphi,
38  float chieta,
39  float chiphi,
40  float chi2,
41  float eop) {
43  EcalPos_ = ecalpos;
45  geomMatching_[0] = deta;
46  geomMatching_[1] = dphi;
47  geomMatching_[2] = chieta;
48  geomMatching_[3] = chiphi;
49  geomMatching_[4] = chi2;
50  matchingEop_ = eop;
51  }
52 
53  void setTrackProperties(float newchi2, float chi2ratio, float dpt) {
54  gsfChi2_ = newchi2;
55  chi2Ratio_ = chi2ratio;
56  dpt_ = dpt;
57  }
58 
59  void setFinalDecision(bool accepted, unsigned n = 0) { setMatching(FINAL, accepted, n); }
60  void setECALMatching(bool accepted, unsigned n = 0) { setMatching(ECALMATCH, accepted, n); }
61  void setESMatching(bool accepted, unsigned n = 0) { setMatching(ESMATCH, accepted, n); }
62  void setTrackFiltering(bool accepted, unsigned n = 0) { setMatching(TRACKFILTERING, accepted, n); }
63  void setMVA(bool accepted, float mva, unsigned n = 0) {
64  setMatching(MVA, accepted, n);
65  if (n < mva_.size())
66  mva_[n] = mva;
67  }
68 
69  void setMatching(MatchingType type, bool result, unsigned n = 0);
70  bool matching(MatchingType type, unsigned n = 0) const {
71  if (n < matching_.size()) {
72  return matching_[n] & (1 << type);
73  }
74  return false;
75  }
76 
78  inline const std::vector<float> &geomMatching() const { return geomMatching_; }
79  inline float eopMatch() const { return matchingEop_; }
80  inline float pt() const { return trackRef_->pt(); }
81  inline float eta() const { return trackRef_->eta(); }
82  inline float kfChi2() const { return trackRef_->normalizedChi2(); }
83  inline float kfNHits() const { return trackRef_->found(); }
84 
85  const math::XYZPoint &ecalPos() const { return EcalPos_; }
86  const math::XYZPoint &meanShower() const { return meanShower_; }
87 
88  inline float chi2Ratio() const { return chi2Ratio_; }
89  inline float gsfChi2() const { return gsfChi2_; }
90 
91  inline bool ecalMatching(unsigned n = 0) const { return matching(ECALMATCH, n); }
92  inline bool esMatching(unsigned n = 0) const { return matching(ESMATCH, n); }
93  inline bool trackFiltered(unsigned n = 0) const { return matching(TRACKFILTERING, n); }
94  inline bool mvaSelected(unsigned n = 0) const { return matching(MVA, n); }
95  inline bool preIded(unsigned n = 0) const { return matching(FINAL, n); }
96 
97  float mva(unsigned n = 0) const;
98  inline float dpt() const { return dpt_; }
99  reco::TrackRef trackRef() const { return trackRef_; }
100  PFClusterRef clusterRef() const { return clusterRef_; }
101 
102  private:
105 
106  std::vector<float> geomMatching_;
110 
111  float gsfChi2_;
112  float dpt_;
113  float chi2Ratio_;
114  std::vector<float> mva_;
115 
116  // bool goodpreid_;
117  // bool TkId_;
118  // bool EcalMatching_;
119  // bool PSMatching_;
120  std::vector<int> matching_;
121  };
122 } // namespace reco
123 #endif
math::XYZPoint meanShower_
Definition: PreId.h:109
float dpt() const
Definition: PreId.h:98
float matchingEop_
Definition: PreId.h:107
void setECALMatchingProperties(PFClusterRef clusterRef, const math::XYZPoint &ecalpos, const math::XYZPoint &meanShower, float deta, float dphi, float chieta, float chiphi, float chi2, float eop)
Definition: PreId.h:33
bool esMatching(unsigned n=0) const
Definition: PreId.h:92
bool mvaSelected(unsigned n=0) const
Definition: PreId.h:94
float pt() const
Definition: PreId.h:80
void setMatching(MatchingType type, bool result, unsigned n=0)
Definition: PreId.cc:6
std::vector< int > matching_
Definition: PreId.h:120
float eta() const
Definition: PreId.h:81
float kfNHits() const
Definition: PreId.h:83
bool trackFiltered(unsigned n=0) const
Definition: PreId.h:93
math::XYZPoint EcalPos_
Definition: PreId.h:108
float dpt_
Definition: PreId.h:112
float chi2Ratio_
Definition: PreId.h:113
float eopMatch() const
Definition: PreId.h:79
void setTrack(reco::TrackRef trackref)
Definition: PreId.h:31
bool matching(MatchingType type, unsigned n=0) const
Definition: PreId.h:70
float mva(unsigned n=0) const
Definition: PreId.cc:18
bool ecalMatching(unsigned n=0) const
Definition: PreId.h:91
const math::XYZPoint & meanShower() const
Definition: PreId.h:86
float gsfChi2_
Definition: PreId.h:111
void setMVA(bool accepted, float mva, unsigned n=0)
Definition: PreId.h:63
float chi2Ratio() const
Definition: PreId.h:88
void setTrackFiltering(bool accepted, unsigned n=0)
Definition: PreId.h:62
PFClusterRef clusterRef() const
Definition: PreId.h:100
reco::TrackRef trackRef_
Definition: PreId.h:103
float kfChi2() const
Definition: PreId.h:82
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const std::vector< float > & geomMatching() const
Access methods.
Definition: PreId.h:78
bool preIded(unsigned n=0) const
Definition: PreId.h:95
std::vector< float > mva_
Definition: PreId.h:114
std::vector< float > geomMatching_
Definition: PreId.h:106
void setTrackProperties(float newchi2, float chi2ratio, float dpt)
Definition: PreId.h:53
PFClusterRef clusterRef_
Definition: PreId.h:104
float gsfChi2() const
Definition: PreId.h:89
fixed size matrix
void setECALMatching(bool accepted, unsigned n=0)
Definition: PreId.h:60
const math::XYZPoint & ecalPos() const
Definition: PreId.h:85
MatchingType
Definition: PreId.h:15
PreId(unsigned nselection=1)
Definition: PreId.h:18
void setESMatching(bool accepted, unsigned n=0)
Definition: PreId.h:61
void setFinalDecision(bool accepted, unsigned n=0)
Definition: PreId.h:59
reco::TrackRef trackRef() const
Definition: PreId.h:99