Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:31

0001 #include "L1Trigger/Phase2L1ParticleFlow/interface/l1-converters/hgcalinput_ref.h"
0002 
0003 #ifdef CMSSW_GIT_HASH
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0006 
0007 l1ct::HgcalClusterDecoderEmulator::HgcalClusterDecoderEmulator(const edm::ParameterSet &pset)
0008     : slim_(pset.getParameter<bool>("slim")) {}
0009 
0010 edm::ParameterSetDescription l1ct::HgcalClusterDecoderEmulator::getParameterSetDescription() {
0011   edm::ParameterSetDescription description;
0012   description.add<bool>("slim", false);
0013   return description;
0014 }
0015 #endif
0016 
0017 l1ct::HgcalClusterDecoderEmulator::~HgcalClusterDecoderEmulator() {}
0018 
0019 l1ct::HadCaloObjEmu l1ct::HgcalClusterDecoderEmulator::decode(const ap_uint<256> &in) const {
0020   ap_uint<14> w_pt = in(13, 0);
0021   ap_uint<14> w_empt = in(27, 14);
0022   ap_int<9> w_eta = in(72, 64);
0023   ap_int<9> w_phi = in(81, 73);
0024   ap_uint<10> w_qual = in(115, 106);
0025   ap_uint<13> w_srrtot = in(213, 201);
0026   ap_uint<12> w_meanz = in(94, 83);
0027   // FIXME: we use a spare space in the word for hoe which is not in the current interface
0028   ap_uint<12> w_hoe = in(127, 116);
0029 
0030   l1ct::HadCaloObjEmu out;
0031   out.clear();
0032   out.hwPt = w_pt * l1ct::pt_t(l1ct::Scales::INTPT_LSB);
0033   out.hwEta = w_eta;
0034   out.hwPhi = w_phi;  // relative to the region center, at calo
0035   out.hwEmPt = w_empt * l1ct::pt_t(l1ct::Scales::INTPT_LSB);
0036   out.hwEmID = w_qual;
0037   if (!slim_) {
0038     out.hwSrrTot = w_srrtot * l1ct::srrtot_t(l1ct::Scales::SRRTOT_LSB);
0039     out.hwMeanZ =
0040         (w_meanz == 0) ? l1ct::meanz_t(0) : l1ct::meanz_t(w_meanz - l1ct::meanz_t(l1ct::Scales::MEANZ_OFFSET));
0041     out.hwHoe = w_hoe * l1ct::hoe_t(l1ct::Scales::HOE_LSB);
0042   }
0043   return out;
0044 }