Skip to content

Commit ea6ce19

Browse files
jmitrevscerminar
authored andcommitted
throw pf clusters out of range for GCT clusters, fix converter emulator (#22)
1 parent 36ffe12 commit ea6ce19

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

L1Trigger/L1CaloTrigger/plugins/Phase2L1TCaloBarrelToCorrelator.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ void Phase2GCTBarrelToCorrelatorLayer1::produce(edm::Event& iEvent, const edm::E
278278
iEta = std::abs(temp_iEta_signed + 1);
279279
}
280280

281+
// Don't add clusters that are outside the eta range. Eta is stored in 7 bits
282+
constexpr int maxEta = 0x7f;
283+
if (iEta > maxEta) {
284+
continue;
285+
}
286+
281287
// Initialize the new cluster
282288
l1tp2::GCTHadDigiCluster pfOut =
283289
l1tp2::GCTHadDigiCluster(pfIn.clusterEt() / p2eg::ECAL_LSB, // convert to integer

L1Trigger/Phase2L1ParticleFlow/src/l1-converters/gcthadinput_ref.cpp

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,17 @@ double l1ct::GctHadClusterDecoderEmulator::fracPart(const double total, const un
2020

2121
l1ct::HadCaloObjEmu l1ct::GctHadClusterDecoderEmulator::decode(const l1ct::PFRegionEmu &sector,
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

Comments
 (0)