Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-10 01:50:15

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