Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-20 01:53:08

0001 #ifndef DataFormats_L1TParticleFlow_PFCandidate_h
0002 #define DataFormats_L1TParticleFlow_PFCandidate_h
0003 
0004 #include <vector>
0005 #include "DataFormats/L1TMuonPhase2/interface/SAMuon.h"
0006 #include "DataFormats/L1TParticleFlow/interface/PFTrack.h"
0007 #include "DataFormats/L1Trigger/interface/RegionalOutput.h"
0008 
0009 namespace l1t {
0010 
0011   class PFCandidate : public L1Candidate {
0012   public:
0013     typedef l1t::SAMuonRef MuonRef;
0014     typedef edm::Ptr<l1t::L1Candidate> L1CandPtr;
0015     enum ParticleType { ChargedHadron = 0, Electron = 1, NeutralHadron = 2, Photon = 3, Muon = 4 };
0016 
0017     PFCandidate() {}
0018     PFCandidate(ParticleType kind,
0019                 int charge,
0020                 const LorentzVector& p,
0021                 float puppiWeight = -1,
0022                 int hwpt = 0,
0023                 int hweta = 0,
0024                 int hwphi = 0)
0025         : PFCandidate(kind, charge, PolarLorentzVector(p), puppiWeight, hwpt, hweta, hwphi) {}
0026     PFCandidate(ParticleType kind,
0027                 int charge,
0028                 const PolarLorentzVector& p,
0029                 float puppiWeight = -1,
0030                 int hwpt = 0,
0031                 int hweta = 0,
0032                 int hwphi = 0);
0033 
0034     ParticleType id() const { return ParticleType(hwQual()); }
0035 
0036     const PFTrackRef& pfTrack() const { return trackRef_; }
0037     void setPFTrack(const PFTrackRef& ref) { trackRef_ = ref; }
0038 
0039     const L1CandPtr& caloPtr() const { return caloPtr_; }
0040     void setCaloPtr(const L1CandPtr& ptr) { caloPtr_ = ptr; }
0041 
0042     const MuonRef& muon() const { return muonRef_; }
0043     void setMuon(const MuonRef& ref) { muonRef_ = ref; }
0044 
0045     /// PUPPI weight (-1 if not available)
0046     float puppiWeight() const { return puppiWeight_; }
0047 
0048     void setZ0(float z0) { setVertex(reco::Particle::Point(0, 0, z0)); }
0049     void setDxy(float dxy) { dxy_ = dxy; }
0050     void setCaloEta(float caloeta) { caloEta_ = caloeta; }
0051     void setCaloPhi(float calophi) { caloPhi_ = calophi; }
0052 
0053     float z0() const { return vz(); }
0054     float dxy() const { return dxy_; }
0055     float caloEta() const { return caloEta_; }
0056     float caloPhi() const { return caloPhi_; }
0057 
0058     int16_t hwZ0() const { return hwZ0_; }
0059     int16_t hwDxy() const { return hwDxy_; }
0060     uint16_t hwTkQuality() const { return hwTkQuality_; }
0061     uint16_t hwPuppiWeight() const { return hwPuppiWeight_; }
0062     uint16_t hwEmID() const { return hwEmID_; }
0063     uint64_t encodedPuppi64() const { return encodedPuppi64_; }
0064 
0065     void setHwZ0(int16_t hwZ0) { hwZ0_ = hwZ0; }
0066     void setHwDxy(int16_t hwDxy) { hwDxy_ = hwDxy; }
0067     void setHwTkQuality(uint16_t hwTkQuality) { hwTkQuality_ = hwTkQuality; }
0068     void setHwPuppiWeight(uint16_t hwPuppiWeight) { hwPuppiWeight_ = hwPuppiWeight; }
0069     void setHwEmID(uint16_t hwEmID) { hwEmID_ = hwEmID; }
0070     void setEncodedPuppi64(uint64_t encodedPuppi64) { encodedPuppi64_ = encodedPuppi64; }
0071 
0072   private:
0073     L1CandPtr caloPtr_;
0074     PFTrackRef trackRef_;
0075     MuonRef muonRef_;
0076     float dxy_, puppiWeight_, caloEta_, caloPhi_;
0077 
0078     int16_t hwZ0_, hwDxy_;
0079     uint16_t hwTkQuality_, hwPuppiWeight_, hwEmID_;
0080     uint64_t encodedPuppi64_;
0081 
0082     void setPdgIdFromParticleType(int charge, ParticleType kind);
0083   };
0084 
0085   typedef std::vector<l1t::PFCandidate> PFCandidateCollection;
0086   typedef edm::Ref<l1t::PFCandidateCollection> PFCandidateRef;
0087   typedef edm::RefVector<l1t::PFCandidateCollection> PFCandidateRefVector;
0088   typedef l1t::RegionalOutput<l1t::PFCandidateCollection> PFCandidateRegionalOutput;
0089 }  // namespace l1t
0090 #endif