File indexing completed on 2025-06-20 01:53:35
0001 #include "L1Trigger/Phase2L1ParticleFlow/interface/l1-converters/gcteminput_ref.h"
0002
0003 #ifdef CMSSW_GIT_HASH
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0006
0007
0008 l1ct::GctEmClusterDecoderEmulator::GctEmClusterDecoderEmulator(const edm::ParameterSet &iConfig)
0009 : corrector_(iConfig.getParameter<std::string>("gctEmCorrector"), -1),
0010 resol_(iConfig.getParameter<edm::ParameterSet>("gctEmResol")) {}
0011
0012 edm::ParameterSetDescription l1ct::GctEmClusterDecoderEmulator::getParameterSetDescription() {
0013 edm::ParameterSetDescription description;
0014 description.add<std::string>("gctEmCorrector");
0015 edm::ParameterSetDescription gctEmResolPSD;
0016 gctEmResolPSD.add<std::vector<double>>("etaBins");
0017 gctEmResolPSD.add<std::vector<double>>("offset");
0018 gctEmResolPSD.add<std::vector<double>>("scale");
0019 gctEmResolPSD.add<std::string>("kind");
0020 description.add<edm::ParameterSetDescription>("gctEmResol", gctEmResolPSD);
0021 return description;
0022 }
0023 #endif
0024
0025 l1ct::EmCaloObjEmu l1ct::GctEmClusterDecoderEmulator::decode(const l1ct::PFRegionEmu §or,
0026 const ap_uint<64> &in) const {
0027 constexpr float ETA_RANGE_ONE_SIDE = 1.4841;
0028 constexpr float ETA_LSB = 2 * ETA_RANGE_ONE_SIDE / 170.;
0029 constexpr float PHI_LSB = 2 * M_PI / 360.;
0030
0031
0032 l1ct::EmCaloObjEmu calo;
0033 calo.clear();
0034 calo.hwPt = pt(in) * l1ct::pt_t(0.5);
0035
0036 calo.hwEta = l1ct::Scales::makeGlbEta(eta(in) * ETA_LSB + ETA_LSB / 2.);
0037 calo.hwPhi = l1ct::Scales::makePhi(phi(in) * PHI_LSB + (PHI_LSB / 2));
0038
0039 if (corrector_.valid()) {
0040 float newpt =
0041 corrector_.correctedPt(calo.floatPt(), calo.floatPt(), calo.floatEta());
0042 calo.hwPt = l1ct::Scales::makePtFromFloat(newpt);
0043 }
0044
0045
0046 calo.hwPtErr =
0047 l1ct::Scales::makePtFromFloat(resol_(calo.floatPt(), calo.floatEta()));
0048
0049
0050
0051
0052
0053 calo.hwEmID = (passes_iso(in) && passes_ss(in)) | ((passes_looseTkiso(in) && passes_looseTkss(in)) << 1) |
0054 ((passes_looseTkiso(in) && passes_looseTkss(in)) << 2);
0055
0056
0057 if (sector.hwEtaCenter < 0) {
0058 calo.hwEta = -calo.hwEta - sector.hwEtaCenter;
0059 } else {
0060 calo.hwEta = calo.hwEta - sector.hwEtaCenter;
0061 }
0062
0063 return calo;
0064 }