1 #ifndef L1Trigger_Phase2L1ParticleFlow_DiscretePFInputs_H
2 #define L1Trigger_Phase2L1ParticleFlow_DiscretePFInputs_H
4 #if defined(__GXX_EXPERIMENTAL_CXX0X__) or defined(CMSSW)
7 #define L1Trigger_Phase2L1ParticleFlow_DiscretePFInputs_MORE
38 #ifdef L1Trigger_Phase2L1ParticleFlow_DiscretePFInputs_MORE
39 static constexpr
float PT_SCALE = 4.0;
40 static constexpr
float ETAPHI_FACTOR = 4;
41 static constexpr
float ETAPHI_SCALE =
44 static constexpr int16_t PHI_WRAP = 360 * ETAPHI_FACTOR;
46 static int16_t ptToInt16(
float pt) {
59 hwPt = CaloCluster::ptToInt16(
pt);
60 hwEmPt = CaloCluster::ptToInt16(emPt);
62 hwEta = round(
eta * CaloCluster::ETAPHI_SCALE);
63 hwPhi = int16_t(round(phi * CaloCluster::ETAPHI_SCALE)) % CaloCluster::PHI_WRAP;
70 float floatPt()
const {
return float(
hwPt) / CaloCluster::PT_SCALE; }
71 float floatEmPt()
const {
return float(
hwEmPt) / CaloCluster::PT_SCALE; }
72 float floatPtErr()
const {
return float(
hwPtErr) / CaloCluster::PT_SCALE; }
73 static float minFloatPt() {
return float(1.0) / CaloCluster::PT_SCALE; }
74 float floatEta()
const {
return float(
hwEta) / CaloCluster::ETAPHI_SCALE; }
75 float floatPhi()
const {
return float(
hwPhi) / CaloCluster::ETAPHI_SCALE; }
76 void setFloatPt(
float pt) {
hwPt = round(
pt * CaloCluster::PT_SCALE); }
77 void setFloatEmPt(
float emPt) {
hwEmPt = round(emPt * CaloCluster::PT_SCALE); }
92 #ifdef L1Trigger_Phase2L1ParticleFlow_DiscretePFInputs_MORE
93 static constexpr
float INVPT_SCALE = 2E4;
94 static constexpr
float VTX_PHI_SCALE = 1 / 1.6E-3;
95 static constexpr
float VTX_ETA_SCALE = 1 / 1E-4;
96 static constexpr
float Z0_SCALE = 20;
97 static constexpr int32_t VTX_ETA_1p3 = 1.3 * InputTrack::VTX_ETA_SCALE;
104 hwVtxPhi = round(phi * InputTrack::VTX_PHI_SCALE);
106 hwZ0 = round(
dz * InputTrack::Z0_SCALE);
111 float floatVtxPt()
const {
return 1 / (
float(
hwInvpt) / InputTrack::INVPT_SCALE); }
112 float floatVtxEta()
const {
return float(
hwVtxEta) / InputTrack::VTX_ETA_SCALE; }
113 float floatVtxPhi()
const {
return float(
hwVtxPhi) / InputTrack::VTX_PHI_SCALE; }
114 float floatDZ()
const {
return float(
hwZ0) / InputTrack::Z0_SCALE; }
115 int intCharge()
const {
return hwCharge ? +1 : -1; }
132 #ifdef L1Trigger_Phase2L1ParticleFlow_DiscretePFInputs_MORE
134 float pt,
float ptErr,
float caloPtErr,
float caloEta,
float caloPhi,
unsigned int quality,
bool isMuon) {
135 hwPt = CaloCluster::ptToInt16(
pt);
142 hwEta = round(caloEta * CaloCluster::ETAPHI_SCALE);
143 hwPhi = int16_t(round(caloPhi * CaloCluster::ETAPHI_SCALE)) % CaloCluster::PHI_WRAP;
148 float floatPt()
const {
return float(
hwPt) / CaloCluster::PT_SCALE; }
149 float floatPtErr()
const {
return float(
hwPtErr) / CaloCluster::PT_SCALE; }
150 float floatCaloPtErr()
const {
return float(
hwCaloPtErr) / CaloCluster::PT_SCALE; }
151 float floatEta()
const {
return float(
hwEta) / CaloCluster::ETAPHI_SCALE; }
152 float floatPhi()
const {
return float(
hwPhi) / CaloCluster::ETAPHI_SCALE; }
167 #ifdef L1Trigger_Phase2L1ParticleFlow_DiscretePFInputs_MORE
170 hwPt = round(
pt * CaloCluster::PT_SCALE);
171 hwEta = round(
eta * CaloCluster::ETAPHI_SCALE);
172 hwPhi = int16_t(round(phi * CaloCluster::ETAPHI_SCALE)) % CaloCluster::PHI_WRAP;
177 float floatPt()
const {
return float(
hwPt) / CaloCluster::PT_SCALE; }
178 float floatEta()
const {
return float(
hwEta) / CaloCluster::ETAPHI_SCALE; }
179 float floatPhi()
const {
return float(
hwPhi) / CaloCluster::ETAPHI_SCALE; }
180 int intCharge()
const {
return hwCharge ? +1 : -1; }
203 #ifdef L1Trigger_Phase2L1ParticleFlow_DiscretePFInputs_MORE
204 static constexpr
float PUPPI_SCALE = 100;
206 float floatPt()
const {
return float(
hwPt) / CaloCluster::PT_SCALE; }
207 float floatEta()
const {
return float(
hwEta) / CaloCluster::ETAPHI_SCALE; }
208 float floatPhi()
const {
return float(
hwPhi) / CaloCluster::ETAPHI_SCALE; }
209 float floatVtxEta()
const {
212 float floatVtxPhi()
const {
215 float floatDZ()
const {
return float(
track.
hwZ0) / InputTrack::Z0_SCALE; }
217 int intCharge()
const {
return (
track.
hwPt > 0 ?
track.intCharge() : 0); }
218 void setPuppiW(
float w) {
hwPuppiWeight = std::round(
w * PUPPI_SCALE); }
219 void setFloatPt(
float pt) {
hwPt = round(
pt * CaloCluster::PT_SCALE); }
244 float etacenter,
float etamin,
float etamax,
float phicenter,
float phihalfwidth,
float etaextra,
float phiextra)