Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:36

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               float absZBarycenter = 0.,
0027               float sigmaRR = 0.)
0028         : L1Candidate(PolarLorentzVector(pt, eta, phi, 0), hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0),
0029           hOverE_(hOverE),
0030           ptError_(ptError),
0031           absZBarycenter_(absZBarycenter),
0032           sigmaRR_(sigmaRR) {
0033       setPdgId(isEM ? 22 : 130);  // photon : non-photon(K0)
0034     }
0035     PFCluster(
0036         const LorentzVector& p4, float hOverE, bool isEM, float ptError = 0, int hwpt = 0, int hweta = 0, int hwphi = 0)
0037         : L1Candidate(p4, hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0), hOverE_(hOverE), ptError_(ptError) {
0038       setPdgId(isEM ? 22 : 130);  // photon : non-photon(K0)
0039     }
0040 
0041     float hOverE() const { return hOverE_; }
0042     void setHOverE(float hOverE) { hOverE_ = hOverE; }
0043 
0044     void setSigmaRR(float sigmaRR) { sigmaRR_ = sigmaRR; }
0045     float absZBarycenter() const { return absZBarycenter_; }
0046 
0047     void setAbsZBarycenter(float absZBarycenter) { absZBarycenter_ = absZBarycenter; }
0048     float sigmaRR() const { return sigmaRR_; }
0049 
0050     float emEt() const {
0051       if (hOverE_ == -1)
0052         return 0;
0053       return pt() / (1 + hOverE_);
0054     }
0055 
0056     // change the pt. H/E also recalculated to keep emEt constant
0057     void calibratePt(float newpt, float preserveEmEt = true);
0058 
0059     /// constituent information. note that this is not going to be available in the hardware!
0060     const ConstituentsAndFractions& constituentsAndFractions() const { return constituents_; }
0061     /// 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
0062     void addConstituent(const edm::Ptr<l1t::L1Candidate>& cand, float fraction = 1.0) {
0063       constituents_.emplace_back(cand, fraction);
0064     }
0065 
0066     float ptError() const { return ptError_; }
0067     void setPtError(float ptError) { ptError_ = ptError; }
0068 
0069     bool isEM() const { return hwQual(); }
0070     void setIsEM(bool isEM) { setHwQual(isEM); }
0071     unsigned int hwEmID() const { return hwQual(); }
0072 
0073     float egVsPionMVAOut() const { return egVsPionMVAOut_; }
0074     void setEgVsPionMVAOut(float egVsPionMVAOut) { egVsPionMVAOut_ = egVsPionMVAOut; }
0075 
0076     float egVsPUMVAOut() const { return egVsPUMVAOut_; }
0077     void setEgVsPUMVAOut(float egVsPUMVAOut) { egVsPUMVAOut_ = egVsPUMVAOut; }
0078 
0079   private:
0080     float hOverE_, ptError_, egVsPionMVAOut_, egVsPUMVAOut_;
0081     // HGC dedicated quantities (0ed by default)
0082     float absZBarycenter_, sigmaRR_;
0083 
0084     ConstituentsAndFractions constituents_;
0085   };
0086 
0087   typedef std::vector<l1t::PFCluster> PFClusterCollection;
0088   typedef edm::Ref<l1t::PFClusterCollection> PFClusterRef;
0089 }  // namespace l1t
0090 #endif