Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1RCTLookupTables_h
0002 #define L1RCTLookupTables_h
0003 
0004 class L1RCTParameters;
0005 struct L1RCTChannelMask;
0006 struct L1RCTNoisyChannelMask;
0007 class L1CaloEcalScale;
0008 class L1CaloHcalScale;
0009 class L1CaloEtScale;
0010 
0011 class L1RCTLookupTables {
0012 public:
0013   // constructor
0014 
0015   L1RCTLookupTables()
0016       : rctParameters_(nullptr), channelMask_(nullptr), ecalScale_(nullptr), hcalScale_(nullptr), etScale_(nullptr) {}
0017 
0018   // this needs to be refreshed every event -- constructor inits to zero
0019   // to indicate that it cannot be used -- if this set function is
0020   // called, lookup after that call will use it.
0021   void setRCTParameters(const L1RCTParameters *rctParameters) { rctParameters_ = rctParameters; }
0022   // ditto for channel mask
0023   void setChannelMask(const L1RCTChannelMask *channelMask) { channelMask_ = channelMask; }
0024   void setNoisyChannelMask(const L1RCTNoisyChannelMask *channelMask) { noisyChannelMask_ = channelMask; }
0025 
0026   // ditto for hcal TPG scale
0027   void setHcalScale(const L1CaloHcalScale *hcalScale) { hcalScale_ = hcalScale; }
0028   // ditto for caloEtScale
0029   void setL1CaloEtScale(const L1CaloEtScale *etScale) { etScale_ = etScale; }
0030   // ditto for ecal TPG Scale
0031   void setEcalScale(const L1CaloEcalScale *ecalScale) { ecalScale_ = ecalScale; }
0032 
0033   const L1RCTParameters *rctParameters() const { return rctParameters_; }
0034 
0035   unsigned int lookup(unsigned short ecalInput,
0036                       unsigned short hcalInput,
0037                       unsigned short fgbit,
0038                       unsigned short crtNo,
0039                       unsigned short crdNo,
0040                       unsigned short twrNo) const;
0041 
0042   unsigned int lookup(unsigned short hfInput, unsigned short crtNo, unsigned short crdNo, unsigned short twrNo) const;
0043 
0044   unsigned int emRank(unsigned short energy) const;
0045   unsigned int eGammaETCode(float ecal, float hcal, int iAbsEta) const;
0046   unsigned int jetMETETCode(float ecal, float hcal, int iAbsEta) const;
0047   bool hOeFGVetoBit(float ecal, float hcal, bool fgbit) const;
0048   bool activityBit(float ecal, float hcal) const;
0049 
0050 private:
0051   // helper functions
0052 
0053   float convertEcal(unsigned short ecal, unsigned short iAbsEta, short sign) const;
0054   float convertHcal(unsigned short hcal, unsigned short iAbsEta, short sign) const;
0055   unsigned long convertToInteger(float et, float lsb, int precision) const;
0056 
0057   const L1RCTParameters *rctParameters_;
0058   const L1RCTChannelMask *channelMask_;
0059   const L1RCTNoisyChannelMask *noisyChannelMask_;
0060   const L1CaloEcalScale *ecalScale_;
0061   const L1CaloHcalScale *hcalScale_;
0062   const L1CaloEtScale *etScale_;
0063 };
0064 #endif