@@ -20,31 +20,17 @@ double l1ct::GctHadClusterDecoderEmulator::fracPart(const double total, const un
2020
2121l1ct::HadCaloObjEmu l1ct::GctHadClusterDecoderEmulator::decode (const l1ct::PFRegionEmu §or,
2222 const ap_uint<64 > &in) const {
23+ constexpr float ETA_RANGE_ONE_SIDE = 1.4841 ; // barrel goes from (-1.4841, +1.4841)
24+ constexpr float ETA_LSB = 2 * ETA_RANGE_ONE_SIDE / 170 .;
25+ constexpr float PHI_LSB = 2 * M_PI / 360 .;
26+
2327 l1ct::HadCaloObjEmu calo;
2428 calo.clear ();
25- calo.hwPt = pt (in) * l1ct::pt_t (0.5 ); // the LSB for GCT objects
26- calo.hwEta = eta (in) * 4 ; // at this point eta is abs(globalEta)
27- calo.hwPhi = phi (in) * 4 ;
28-
29- // The proposal is that hoe is going away, to be replaced by EmPt, which is not there yet.
30-
31- // // TODO: this should change
32- // // need to add empt
33- // ap_uint<4> hoeVal = hoe(in);
34- // // the lsb indicates what's bigger, EM or HAD
35- // auto isEMBigger = static_cast<bool>(hoeVal[0]);
36- // // This is not quite true. If HAD energy goes down to 0, then it flips and says that HAD is bigger
37- // ap_uint<3> hoe = hoeVal(3, 1);
38-
39- // if (isEMBigger) {
40- // auto em = fracPart(calo.hwPt.to_double(), hoe.to_uint());
41- // calo.hwEmPt = em;
42- // } else {
43- // pt_t had = fracPart(calo.hwPt.to_double(), hoe.to_uint());
44- // calo.hwEmPt = calo.hwPt - had;
45- // }
46-
47- // calo.hwHoe = hoe.to_uint(); // might need to scale
29+ calo.hwPt = pt (in) * l1ct::pt_t (0.5 ); // the LSB for GCT objects
30+ calo.hwEta = l1ct::Scales::makeGlbEta (eta (in) * ETA_LSB + ETA_LSB / 2 .); // at this point eta is abs(globalEta)
31+ calo.hwPhi = l1ct::Scales::makePhi (phi (in) * PHI_LSB + (PHI_LSB / 2 )); // This is already in the local frame
32+
33+ // need to add EmPt when it becomes available
4834
4935 // need to add emid
5036 calo.hwEmID = 1 ;
0 commit comments