Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:39:24

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     void setCaloEta(float caloeta) { caloEta_ = caloeta; }
0052     void setCaloPhi(float calophi) { caloPhi_ = calophi; }
0053 
0054     float z0() const { return vz(); }
0055     float dxy() const { return dxy_; }
0056     float caloEta() const { return caloEta_; }
0057     float caloPhi() const { return caloPhi_; }
0058 
0059     int16_t hwZ0() const { return hwZ0_; }
0060     int16_t hwDxy() const { return hwDxy_; }
0061     uint16_t hwTkQuality() const { return hwTkQuality_; }
0062     uint16_t hwPuppiWeight() const { return hwPuppiWeight_; }
0063     uint16_t hwEmID() const { return hwEmID_; }
0064     uint64_t encodedPuppi64() const { return encodedPuppi64_; }
0065 
0066     void setHwZ0(int16_t hwZ0) { hwZ0_ = hwZ0; }
0067     void setHwDxy(int16_t hwDxy) { hwDxy_ = hwDxy; }
0068     void setHwTkQuality(uint16_t hwTkQuality) { hwTkQuality_ = hwTkQuality; }
0069     void setHwPuppiWeight(uint16_t hwPuppiWeight) { hwPuppiWeight_ = hwPuppiWeight; }
0070     void setHwEmID(uint16_t hwEmID) { hwEmID_ = hwEmID; }
0071     void setEncodedPuppi64(uint64_t encodedPuppi64) { encodedPuppi64_ = encodedPuppi64; }
0072 
0073   private:
0074     PFClusterRef clusterRef_;
0075     PFTrackRef trackRef_;
0076     MuonRef muonRef_;
0077     float dxy_, puppiWeight_, caloEta_, caloPhi_;
0078 
0079     int16_t hwZ0_, hwDxy_;
0080     uint16_t hwTkQuality_, hwPuppiWeight_, hwEmID_;
0081     uint64_t encodedPuppi64_;
0082 
0083     void setPdgIdFromParticleType(int charge, ParticleType kind);
0084   };
0085 
0086   typedef std::vector<l1t::PFCandidate> PFCandidateCollection;
0087   typedef edm::Ref<l1t::PFCandidateCollection> PFCandidateRef;
0088   typedef edm::RefVector<l1t::PFCandidateCollection> PFCandidateRefVector;
0089   typedef l1t::RegionalOutput<l1t::PFCandidateCollection> PFCandidateRegionalOutput;
0090 }  // namespace l1t
0091 #endif