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
reco::PreId::mvaSelected
bool mvaSelected(unsigned n=0) const
Definition: PreId.h:94
reco::PreId::mva
float mva(unsigned n=0) const
Definition: PreId.cc:18
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
reco::PreId::pt
float pt() const
Definition: PreId.h:80
reco::PreId::meanShower
const math::XYZPoint & meanShower() const
Definition: PreId.h:86
reco::PreId::setMVA
void setMVA(bool accepted, float mva, unsigned n=0)
Definition: PreId.h:63
reco::PreId::setMatching
void setMatching(MatchingType type, bool result, unsigned n=0)
Definition: PreId.cc:6
reco::PreId::clusterRef_
PFClusterRef clusterRef_
Definition: PreId.h:104
reco::PreId::geomMatching
const std::vector< float > & geomMatching() const
Access methods.
Definition: PreId.h:78
reco::PreId::preIded
bool preIded(unsigned n=0) const
Definition: PreId.h:95
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::PreId::geomMatching_
std::vector< float > geomMatching_
Definition: PreId.h:106
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
reco::PreId
Definition: PreId.h:13
reco::PreId::ecalMatching
bool ecalMatching(unsigned n=0) const
Definition: PreId.h:91
reco::PreId::MVA
Definition: PreId.h:15
reco::PreId::trackRef
reco::TrackRef trackRef() const
Definition: PreId.h:99
reco::PreId::MatchingType
MatchingType
Definition: PreId.h:15
edm::Ref< TrackCollection >
reco::PreId::chi2Ratio
float chi2Ratio() const
Definition: PreId.h:88
reco::PreId::meanShower_
math::XYZPoint meanShower_
Definition: PreId.h:109
reco::PreId::PreId
PreId(unsigned nselection=1)
Definition: PreId.h:18
Track.h
TrackFwd.h
reco::PreId::trackFiltered
bool trackFiltered(unsigned n=0) const
Definition: PreId.h:93
reco::PreId::mva_
std::vector< float > mva_
Definition: PreId.h:114
reco::PreId::TRACKFILTERING
Definition: PreId.h:15
reco::PreId::EcalPos_
math::XYZPoint EcalPos_
Definition: PreId.h:108
reco::PreId::trackRef_
reco::TrackRef trackRef_
Definition: PreId.h:103
reco::PreId::setECALMatching
void setECALMatching(bool accepted, unsigned n=0)
Definition: PreId.h:60
reco::PreId::ecalPos
const math::XYZPoint & ecalPos() const
Definition: PreId.h:85
reco::PreId::kfChi2
float kfChi2() const
Definition: PreId.h:82
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::PreId::ESMATCH
Definition: PreId.h:15
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
reco::PreId::matchingEop_
float matchingEop_
Definition: PreId.h:107
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
PFClusterFwd.h
reco::PreId::esMatching
bool esMatching(unsigned n=0) const
Definition: PreId.h:92
reco::PreId::setTrack
void setTrack(reco::TrackRef trackref)
Definition: PreId.h:31
reco::PreId::matching
bool matching(MatchingType type, unsigned n=0) const
Definition: PreId.h:70
reco::PreId::ECALMATCH
Definition: PreId.h:15
reco::PreId::clusterRef
PFClusterRef clusterRef() const
Definition: PreId.h:100
reco::PreId::setESMatching
void setESMatching(bool accepted, unsigned n=0)
Definition: PreId.h:61
reco::PreId::matching_
std::vector< int > matching_
Definition: PreId.h:120
reco::PreId::dpt
float dpt() const
Definition: PreId.h:98
reco::PreId::NONE
Definition: PreId.h:15
math
Definition: choleskyInversion.h:19
reco::PreId::dpt_
float dpt_
Definition: PreId.h:112
Point3D.h
reco::PreId::eopMatch
float eopMatch() const
Definition: PreId.h:79
reco::PreId::setFinalDecision
void setFinalDecision(bool accepted, unsigned n=0)
Definition: PreId.h:59
PFRecTrackFwd.h
mps_fire.result
result
Definition: mps_fire.py:311
reco::PreId::FINAL
Definition: PreId.h:15
reco::PreId::gsfChi2_
float gsfChi2_
Definition: PreId.h:111
reco::PreId::setTrackProperties
void setTrackProperties(float newchi2, float chi2ratio, float dpt)
Definition: PreId.h:53
reco::PreId::gsfChi2
float gsfChi2() const
Definition: PreId.h:89
reco::PreId::eta
float eta() const
Definition: PreId.h:81
reco::PreId::setECALMatchingProperties
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
reco::PreId::setTrackFiltering
void setTrackFiltering(bool accepted, unsigned n=0)
Definition: PreId.h:62
reco::PreId::kfNHits
float kfNHits() const
Definition: PreId.h:83
reco::PreId::chi2Ratio_
float chi2Ratio_
Definition: PreId.h:113