Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-20 01:53:35

0001 #include "L1Trigger/Phase2L1ParticleFlow/interface/l1-converters/gcthadinput_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::GctHadClusterDecoderEmulator::GctHadClusterDecoderEmulator(const edm::ParameterSet &pset) {}
0008 
0009 edm::ParameterSetDescription l1ct::GctHadClusterDecoderEmulator::getParameterSetDescription() {
0010   edm::ParameterSetDescription description;
0011   return description;
0012 }
0013 #endif
0014 
0015 double l1ct::GctHadClusterDecoderEmulator::fracPart(const double total, const unsigned int hoe) const {
0016   return total * std::pow(2.0, hoe) / (std::pow(2.0, hoe) + 1);
0017 }
0018 
0019 l1ct::HadCaloObjEmu l1ct::GctHadClusterDecoderEmulator::decode(const l1ct::PFRegionEmu &sector,
0020                                                                const ap_uint<64> &in) const {
0021   constexpr float ETA_RANGE_ONE_SIDE = 1.4841;  // barrel goes from (-1.4841, +1.4841)
0022   constexpr float ETA_LSB = 2 * ETA_RANGE_ONE_SIDE / 170.;
0023   constexpr float PHI_LSB = 2 * M_PI / 360.;
0024 
0025   l1ct::HadCaloObjEmu calo;
0026   calo.clear();
0027   calo.hwPt = pt(in) * l1ct::pt_t(0.5);                                     // the LSB for GCT objects
0028   calo.hwEta = l1ct::Scales::makeGlbEta(eta(in) * ETA_LSB + ETA_LSB / 2.);  // at this point eta is abs(globalEta)
0029   calo.hwPhi = l1ct::Scales::makePhi(phi(in) * PHI_LSB + (PHI_LSB / 2));    // This is already in the local frame
0030 
0031   // need to add EmPt when it becomes available
0032 
0033   // need to add emid
0034   calo.hwEmID = 1;
0035 
0036   // convert eta to local
0037   if (sector.hwEtaCenter < 0) {
0038     calo.hwEta = -calo.hwEta - sector.hwEtaCenter;
0039   } else {
0040     calo.hwEta = calo.hwEta - sector.hwEtaCenter;
0041   }
0042 
0043   return calo;
0044 }