File indexing completed on 2024-04-06 12:04:36
0001 #ifndef DataFormats_L1TParticleFlow_PFJet_h
0002 #define DataFormats_L1TParticleFlow_PFJet_h
0003
0004 #include <vector>
0005 #include "DataFormats/L1Trigger/interface/L1Candidate.h"
0006 #include "DataFormats/L1TParticleFlow/interface/PFCandidate.h"
0007 #include "DataFormats/Common/interface/Ptr.h"
0008
0009 namespace l1t {
0010
0011 class PFJet : public L1Candidate {
0012 public:
0013
0014 typedef std::vector<edm::Ptr<l1t::PFCandidate>> Constituents;
0015
0016 PFJet() {}
0017 PFJet(float pt, float eta, float phi, float mass = 0, int hwpt = 0, int hweta = 0, int hwphi = 0)
0018 : L1Candidate(PolarLorentzVector(pt, eta, phi, mass), hwpt, hweta, hwphi, 0), rawPt_(pt) {}
0019
0020 PFJet(const LorentzVector& p4, int hwpt = 0, int hweta = 0, int hwphi = 0)
0021 : L1Candidate(p4, hwpt, hweta, hwphi, 0), rawPt_(p4.Pt()) {}
0022
0023
0024 void calibratePt(float newpt);
0025
0026
0027 float rawPt() const { return rawPt_; }
0028
0029
0030 const Constituents& constituents() const { return constituents_; }
0031
0032 void addConstituent(const edm::Ptr<l1t::PFCandidate>& cand) { constituents_.emplace_back(cand); }
0033
0034
0035 size_t numberOfDaughters() const override { return constituents_.size(); }
0036 const reco::Candidate* daughter(size_type i) const override { return constituents_[i].get(); }
0037 using reco::LeafCandidate::daughter;
0038 edm::Ptr<l1t::PFCandidate> daughterPtr(size_type i) const { return constituents_[i]; }
0039
0040
0041
0042 enum class HWEncoding { CT, GT };
0043 typedef std::array<uint64_t, 2> PackedJet;
0044 const PackedJet& encodedJet(const HWEncoding encoding = HWEncoding::GT) const {
0045 return encodedJet_[static_cast<int>(encoding)];
0046 }
0047 void setEncodedJet(const HWEncoding encoding, const PackedJet jet) {
0048 encodedJet_[static_cast<int>(encoding)] = jet;
0049 }
0050
0051
0052 const PackedJet& getHWJetGT() const { return encodedJet(HWEncoding::GT); }
0053 const PackedJet& getHWJetCT() const { return encodedJet(HWEncoding::CT); }
0054
0055 private:
0056 float rawPt_;
0057 Constituents constituents_;
0058 std::array<PackedJet, 2> encodedJet_ = {{{{0, 0}}, {{0, 0}}}};
0059 };
0060
0061 typedef std::vector<l1t::PFJet> PFJetCollection;
0062 typedef edm::Ref<l1t::PFJetCollection> PFJetRef;
0063 typedef std::vector<l1t::PFJetRef> PFJetVectorRef;
0064 }
0065 #endif