File indexing completed on 2024-04-06 12:04:53
0001 #ifndef __DataFormats_PatCandidates_IsolatedTrack_h__
0002 #define __DataFormats_PatCandidates_IsolatedTrack_h__
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include "DataFormats/Candidate/interface/LeafCandidate.h"
0013 #include "DataFormats/TrackReco/interface/Track.h"
0014 #include "DataFormats/TrackReco/interface/TrackBase.h"
0015 #include "DataFormats/TrackReco/interface/HitPattern.h"
0016 #include "DataFormats/PatCandidates/interface/PackedCandidate.h"
0017 #include "DataFormats/PatCandidates/interface/PFIsolation.h"
0018
0019 namespace pat {
0020
0021 class IsolatedTrack : public reco::LeafCandidate {
0022 public:
0023 IsolatedTrack()
0024 : LeafCandidate(0, LorentzVector(0, 0, 0, 0)),
0025 pfIsolationDR03_(pat::PFIsolation()),
0026 miniIsolation_(pat::PFIsolation()),
0027 matchedCaloJetEmEnergy_(0.),
0028 matchedCaloJetHadEnergy_(0.),
0029 pfLepOverlap_(false),
0030 pfNeutralSum_(0.),
0031 dz_(0.),
0032 dxy_(0.),
0033 dzError_(0.),
0034 dxyError_(0.),
0035 fromPV_(-1),
0036 trackQuality_(0),
0037 dEdxStrip_(0),
0038 dEdxPixel_(0),
0039 hitPattern_(reco::HitPattern()),
0040 crossedEcalStatus_(std::vector<uint16_t>()),
0041 crossedHcalStatus_(std::vector<uint32_t>()),
0042 deltaEta_(0),
0043 deltaPhi_(0),
0044 packedCandRef_(PackedCandidateRef()),
0045 nearestPFPackedCandRef_(PackedCandidateRef()),
0046 nearestLostTrackPackedCandRef_(PackedCandidateRef()) {}
0047
0048 explicit IsolatedTrack(const PFIsolation& iso,
0049 const PFIsolation& miniiso,
0050 float caloJetEm,
0051 float caloJetHad,
0052 bool pfLepOverlap,
0053 float pfNeutralSum,
0054 const LorentzVector& p4,
0055 int charge,
0056 int id,
0057 float dz,
0058 float dxy,
0059 float dzError,
0060 float dxyError,
0061 const reco::HitPattern& hp,
0062 float dEdxS,
0063 float dEdxP,
0064 int fromPV,
0065 int tkQual,
0066 const std::vector<uint16_t>& ecalst,
0067 const std::vector<uint32_t>& hcalst,
0068 int dEta,
0069 int dPhi,
0070 const PackedCandidateRef& pcref,
0071 const PackedCandidateRef& refToNearestPF,
0072 const PackedCandidateRef& refToNearestLostTrack)
0073 : LeafCandidate(charge, p4, Point(0., 0., 0.), id),
0074 pfIsolationDR03_(iso),
0075 miniIsolation_(miniiso),
0076 matchedCaloJetEmEnergy_(caloJetEm),
0077 matchedCaloJetHadEnergy_(caloJetHad),
0078 pfLepOverlap_(pfLepOverlap),
0079 pfNeutralSum_(pfNeutralSum),
0080 dz_(dz),
0081 dxy_(dxy),
0082 dzError_(dzError),
0083 dxyError_(dxyError),
0084 fromPV_(fromPV),
0085 trackQuality_(tkQual),
0086 dEdxStrip_(dEdxS),
0087 dEdxPixel_(dEdxP),
0088 hitPattern_(hp),
0089 crossedEcalStatus_(ecalst),
0090 crossedHcalStatus_(hcalst),
0091 deltaEta_(dEta),
0092 deltaPhi_(dPhi),
0093 packedCandRef_(pcref),
0094 nearestPFPackedCandRef_(refToNearestPF),
0095 nearestLostTrackPackedCandRef_(refToNearestLostTrack) {}
0096
0097 ~IsolatedTrack() override {}
0098
0099 const PFIsolation& pfIsolationDR03() const { return pfIsolationDR03_; }
0100
0101 const PFIsolation& miniPFIsolation() const { return miniIsolation_; }
0102
0103 float matchedCaloJetEmEnergy() const { return matchedCaloJetEmEnergy_; }
0104 float matchedCaloJetHadEnergy() const { return matchedCaloJetHadEnergy_; }
0105
0106 bool pfLepOverlap() const { return pfLepOverlap_; }
0107 float pfNeutralSum() const { return pfNeutralSum_; }
0108
0109 float dz() const { return dz_; }
0110 float dzError() const override { return dzError_; }
0111 float dxy() const { return dxy_; }
0112 float dxyError() const override { return dxyError_; }
0113
0114 int fromPV() const { return fromPV_; }
0115
0116 bool isHighPurityTrack() const {
0117 return (trackQuality_ & (1 << reco::TrackBase::highPurity)) >> reco::TrackBase::highPurity;
0118 }
0119 bool isTightTrack() const { return (trackQuality_ & (1 << reco::TrackBase::tight)) >> reco::TrackBase::tight; }
0120 bool isLooseTrack() const { return (trackQuality_ & (1 << reco::TrackBase::loose)) >> reco::TrackBase::loose; }
0121
0122 const reco::HitPattern& hitPattern() const { return hitPattern_; }
0123
0124
0125 int lostInnerLayers() const {
0126 return hitPattern_.trackerLayersWithoutMeasurement(reco::HitPattern::MISSING_INNER_HITS);
0127 }
0128 int lostLayers() const { return hitPattern_.trackerLayersWithoutMeasurement(reco::HitPattern::TRACK_HITS); }
0129 int lostOuterLayers() const {
0130 return hitPattern_.trackerLayersWithoutMeasurement(reco::HitPattern::MISSING_OUTER_HITS);
0131 }
0132
0133 float dEdxStrip() const { return dEdxStrip_; }
0134 float dEdxPixel() const { return dEdxPixel_; }
0135
0136
0137 const std::vector<uint16_t>& crossedEcalStatus() const { return crossedEcalStatus_; }
0138
0139 const std::vector<uint32_t>& crossedHcalStatus() const { return crossedHcalStatus_; }
0140
0141
0142
0143 float deltaEta() const { return float(deltaEta_) / 500.f; }
0144 float deltaPhi() const { return float(deltaPhi_) / 500.f; }
0145
0146 const PackedCandidateRef& packedCandRef() const { return packedCandRef_; }
0147 const PackedCandidateRef& nearestPFPackedCandRef() const { return nearestPFPackedCandRef_; }
0148 const PackedCandidateRef& nearestLostTrackPackedCandRef() const { return nearestPFPackedCandRef_; }
0149
0150 protected:
0151 PFIsolation pfIsolationDR03_;
0152 PFIsolation miniIsolation_;
0153 float matchedCaloJetEmEnergy_;
0154 float matchedCaloJetHadEnergy_;
0155 bool pfLepOverlap_;
0156 float pfNeutralSum_;
0157 float dz_, dxy_, dzError_, dxyError_;
0158 int fromPV_;
0159 int trackQuality_;
0160 float dEdxStrip_, dEdxPixel_;
0161
0162 reco::HitPattern hitPattern_;
0163
0164 std::vector<uint16_t> crossedEcalStatus_;
0165 std::vector<uint32_t> crossedHcalStatus_;
0166 int deltaEta_, deltaPhi_;
0167
0168 PackedCandidateRef packedCandRef_;
0169 PackedCandidateRef nearestPFPackedCandRef_;
0170 PackedCandidateRef nearestLostTrackPackedCandRef_;
0171 };
0172
0173 typedef std::vector<IsolatedTrack> IsolatedTrackCollection;
0174
0175 }
0176
0177 #endif