Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DataFormats_L1TParticleFlow_PFCluster_h
0002 #define DataFormats_L1TParticleFlow_PFCluster_h
0003 
0004 #include <vector>
0005 #include "DataFormats/L1Trigger/interface/L1Candidate.h"
0006 #include "DataFormats/Common/interface/Ref.h"
0007 
0008 namespace l1t {
0009 
0010   class PFCluster : public L1Candidate {
0011   public:
0012     /// constituent information. note that this is not going to be available in the hardware!
0013     typedef std::pair<edm::Ptr<l1t::L1Candidate>, float> ConstituentAndFraction;
0014     typedef std::vector<ConstituentAndFraction> ConstituentsAndFractions;
0015 
0016     PFCluster() {}
0017     PFCluster(float pt,
0018               float eta,
0019               float phi,
0020               float hOverE = 0,
0021               bool isEM = false,
0022               float ptError = 0,
0023               int hwpt = 0,
0024               int hweta = 0,
0025               int hwphi = 0)
0026         : L1Candidate(PolarLorentzVector(pt, eta, phi, 0), hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0),
0027           hOverE_(hOverE),
0028           ptError_(ptError) {
0029       setPdgId(isEM ? 22 : 130);  // photon : non-photon(K0)
0030     }
0031     PFCluster(
0032         const LorentzVector& p4, float hOverE, bool isEM, float ptError = 0, int hwpt = 0, int hweta = 0, int hwphi = 0)
0033         : L1Candidate(p4, hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0), hOverE_(hOverE), ptError_(ptError) {
0034       setPdgId(isEM ? 22 : 130);  // photon : non-photon(K0)
0035     }
0036 
0037     float hOverE() const { return hOverE_; }
0038     void setHOverE(float hOverE) { hOverE_ = hOverE; }
0039 
0040     float emEt() const {
0041       if (hOverE_ == -1)
0042         return 0;
0043       return pt() / (1 + hOverE_);
0044     }
0045 
0046     // change the pt. H/E also recalculated to keep emEt constant
0047     void calibratePt(float newpt, float preserveEmEt = true);
0048 
0049     /// constituent information. note that this is not going to be available in the hardware!
0050     const ConstituentsAndFractions& constituentsAndFractions() const { return constituents_; }
0051     /// adds a candidate to this cluster; note that this only records the information, it's up to you to also set the 4-vector appropriately
0052     void addConstituent(const edm::Ptr<l1t::L1Candidate>& cand, float fraction = 1.0) {
0053       constituents_.emplace_back(cand, fraction);
0054     }
0055 
0056     float ptError() const { return ptError_; }
0057     void setPtError(float ptError) { ptError_ = ptError; }
0058 
0059     bool isEM() const { return hwQual(); }
0060     void setIsEM(bool isEM) { setHwQual(isEM); }
0061     unsigned int hwEmID() const { return hwQual(); }
0062 
0063     float egVsPionMVAOut() const { return egVsPionMVAOut_; }
0064     void setEgVsPionMVAOut(float egVsPionMVAOut) { egVsPionMVAOut_ = egVsPionMVAOut; }
0065 
0066     float egVsPUMVAOut() const { return egVsPUMVAOut_; }
0067     void setEgVsPUMVAOut(float egVsPUMVAOut) { egVsPUMVAOut_ = egVsPUMVAOut; }
0068 
0069   private:
0070     float hOverE_, ptError_, egVsPionMVAOut_, egVsPUMVAOut_;
0071     ConstituentsAndFractions constituents_;
0072   };
0073 
0074   typedef std::vector<l1t::PFCluster> PFClusterCollection;
0075   typedef edm::Ref<l1t::PFClusterCollection> PFClusterRef;
0076 }  // namespace l1t
0077 #endif