CMS 3D CMS Logo

TkEm.h
Go to the documentation of this file.
1 #ifndef DataFormatsL1TCorrelator_TkEm_h
2 #define DataFormatsL1TCorrelator_TkEm_h
3 
4 // -*- C++ -*-
5 //
6 // Package: L1Trigger
7 // Class : TkEm
8 //
9 
12 
14 
18 
19 #include <ap_int.h>
20 
21 namespace l1t {
22 
23  class TkEm : public L1Candidate {
24  public:
25  TkEm();
26 
27  TkEm(const LorentzVector& p4, float tkisol = -999., float tkisolPV = -999);
28 
29  TkEm(const LorentzVector& p4, const edm::Ptr<L1Candidate>& egCaloPtr, float tkisol = -999., float tkisolPV = -999);
30 
31  enum class HWEncoding { None, CT, GT };
32 
33  // ---------- const member functions ---------------------
34 
35  const edm::Ptr<L1Candidate>& egCaloPtr() const { return egCaloPtr_; }
36 
37  float trkIsol() const { return trkIsol_; } // not constrained to the PV, just track ptSum
38  float trkIsolPV() const { return trkIsolPV_; } // constrained to the PV by DZ
39  float pfIsol() const { return pfIsol_; } // not constrained to the PV, just track ptSum
40  float pfIsolPV() const { return pfIsolPV_; } // constrained to the PV by DZ
41  float puppiIsol() const { return puppiIsol_; } // not constrained to the PV, just track ptSum
42  float puppiIsolPV() const { return puppiIsolPV_; } // constrained to the PV by DZ
43 
44  // ---------- member functions ---------------------------
45 
46  void setTrkIsol(float TrkIsol) { trkIsol_ = TrkIsol; }
47  void setTrkIsolPV(float TrkIsolPV) { trkIsolPV_ = TrkIsolPV; }
48  void setPFIsol(float pfIsol) { pfIsol_ = pfIsol; }
52  void setEgCaloPtr(const edm::Ptr<L1Candidate>& egPtr) { egCaloPtr_ = egPtr; }
53 
54  template <int N>
57  egBinaryWord1_ = (word >> 32);
58  egBinaryWord2_ = (word >> 64);
60  }
61 
62  l1gt::Photon hwObj() const {
63  if (encoding() != HWEncoding::GT) {
64  throw cms::Exception("RuntimeError") << "TkEm::hwObj : encoding is not in GT format!" << std::endl;
65  }
66  return l1gt::Photon::unpack_ap(egBinaryWord<l1gt::Photon::BITWIDTH>());
67  }
68 
69  template <int N>
70  ap_uint<N> egBinaryWord() const {
71  return ap_uint<N>(egBinaryWord0_) | (ap_uint<N>(egBinaryWord1_) << 32) | (ap_uint<N>(egBinaryWord2_) << 64);
72  }
73 
74  HWEncoding encoding() const { return encoding_; }
75 
76  private:
78  float trkIsol_;
79  float trkIsolPV_;
80  float pfIsol_;
81  float pfIsolPV_;
82  float puppiIsol_;
83  float puppiIsolPV_;
84  uint32_t egBinaryWord0_;
85  uint32_t egBinaryWord1_;
86  uint32_t egBinaryWord2_;
88  };
89 } // namespace l1t
90 
91 #endif
void setEgBinaryWord(ap_uint< N > word, HWEncoding encoding)
Definition: TkEm.h:55
l1gt::Photon hwObj() const
Definition: TkEm.h:62
float trkIsolPV() const
Definition: TkEm.h:38
float trkIsol() const
Definition: TkEm.h:37
float puppiIsol_
Definition: TkEm.h:82
uint32_t egBinaryWord2_
Definition: TkEm.h:86
void setPuppiIsol(float puppiIsol)
Definition: TkEm.h:50
delete x;
Definition: CaloConfig.h:22
uint32_t egBinaryWord0_
Definition: TkEm.h:84
const LorentzVector & p4() const final
four-momentum Lorentz vector
float trkIsolPV_
Definition: TkEm.h:79
float trkIsol_
Definition: TkEm.h:78
HWEncoding encoding_
Definition: TkEm.h:87
uint64_t word
Definition: TkEm.h:23
ap_uint< N > egBinaryWord() const
Definition: TkEm.h:70
const edm::Ptr< L1Candidate > & egCaloPtr() const
Definition: TkEm.h:35
float pfIsolPV() const
Definition: TkEm.h:40
void setTrkIsolPV(float TrkIsolPV)
Definition: TkEm.h:47
static Photon unpack_ap(const ap_uint< BITWIDTH > &src)
Definition: gt_datatypes.h:336
float pfIsolPV_
Definition: TkEm.h:81
float puppiIsolPV_
Definition: TkEm.h:83
TkEm()
Definition: TkEm.cc:13
void setTrkIsol(float TrkIsol)
Definition: TkEm.h:46
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
float pfIsol_
Definition: TkEm.h:80
edm::Ptr< L1Candidate > egCaloPtr_
Definition: TkEm.h:77
void setPFIsolPV(float pfIsolPV)
Definition: TkEm.h:49
HWEncoding encoding() const
Definition: TkEm.h:74
void setPuppiIsolPV(float puppiIsolPV)
Definition: TkEm.h:51
uint32_t egBinaryWord1_
Definition: TkEm.h:85
void setPFIsol(float pfIsol)
Definition: TkEm.h:48
float pfIsol() const
Definition: TkEm.h:39
float puppiIsolPV() const
Definition: TkEm.h:42
HWEncoding
Definition: TkEm.h:31
void setEgCaloPtr(const edm::Ptr< L1Candidate > &egPtr)
Definition: TkEm.h:52
float puppiIsol() const
Definition: TkEm.h:41