Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:51

0001 #ifndef L1GCTMET_H
0002 #define L1GCTMET_H
0003 
0004 /*!
0005  * \author Greg Heath
0006  * \date April 2008
0007  */
0008 
0009 /*! \class L1GctMet
0010  * \brief Stores Level-1 missing Et in (Ex, Ey) form, allowing it to be retrieved as (magnitude, angle)
0011  * 
0012  * Allows the implementation of alternative algorithms
0013  */
0014 
0015 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctWheelEnergyFpga.h"
0016 
0017 class L1CaloEtScale;
0018 class L1GctHtMissLut;
0019 
0020 class L1GctMet {
0021 public:
0022   enum metAlgoType { cordicTranslate, useHtMissLut, oldGct, floatingPoint };
0023 
0024   typedef L1GctUnsignedInt<L1GctEtMiss::kEtMissNBits> etMissType;
0025   typedef L1GctUnsignedInt<L1GctEtMiss::kEtMissPhiNBits> etMissPhiType;
0026   typedef L1GctWheelEnergyFpga::etComponentType etComponentType;
0027 
0028   struct etmiss_vec {
0029     etMissType mag;
0030     etMissPhiType phi;
0031   };
0032 
0033   L1GctMet(const unsigned ex = 0, const unsigned ey = 0, const metAlgoType algo = cordicTranslate);
0034   L1GctMet(const etComponentType& ex, const etComponentType& ey, const metAlgoType algo = cordicTranslate);
0035   ~L1GctMet();
0036 
0037   // return the missing Et as (magnitude, angle)
0038   etmiss_vec metVector() const;
0039 
0040   // set and get the components
0041   void setComponents(const unsigned ex, const unsigned ey) {
0042     setExComponent(ex);
0043     setEyComponent(ey);
0044   }
0045   void setComponents(const etComponentType& ex, const etComponentType& ey) {
0046     setExComponent(ex);
0047     setEyComponent(ey);
0048   }
0049   void setExComponent(const unsigned ex);
0050   void setEyComponent(const unsigned ey);
0051   void setExComponent(const etComponentType& ex) { m_exComponent = ex; }
0052   void setEyComponent(const etComponentType& ey) { m_eyComponent = ey; }
0053   etComponentType getExComponent() const { return m_exComponent; }
0054   etComponentType getEyComponent() const { return m_eyComponent; }
0055 
0056   // set and get the algorithm type
0057   void setAlgoType(const metAlgoType algo) { m_algoType = algo; }
0058   metAlgoType getAlgoType() const { return m_algoType; }
0059 
0060   // set and get the bit shift
0061   // This parameter can be used to scale the output relative to the input
0062   void setBitShift(const unsigned nbits) { m_bitShift = nbits; }
0063   unsigned getBitShift() const { return m_bitShift; }
0064 
0065   // get the LUT (used by L1GctPrintLuts)
0066   const L1GctHtMissLut* getHtMissLut() const { return m_htMissLut; }
0067 
0068   // set and get the LUT parameters
0069   void setEtScale(const L1CaloEtScale* const fn);
0070   void setEtComponentLsb(const double lsb);
0071 
0072   const L1CaloEtScale* etScale() const;
0073   const double componentLsb() const;
0074 
0075 private:
0076   enum etComponentShift { kExOrEyMissComponentShift = 4 };
0077 
0078   struct etmiss_internal {
0079     unsigned mag;
0080     unsigned phi;
0081   };
0082 
0083   /// Private method to check for an overflow condition on the input components
0084   /// Allows the check to depend on the algorithm type
0085   const bool inputOverFlow() const;
0086 
0087   etComponentType m_exComponent;
0088   etComponentType m_eyComponent;
0089   metAlgoType m_algoType;
0090   unsigned short m_bitShift;
0091 
0092   L1GctHtMissLut* m_htMissLut;
0093 
0094   etmiss_internal cordicTranslateAlgo(const int ex, const int ey, const bool of) const;
0095   etmiss_internal useHtMissLutAlgo(const int ex, const int ey, const bool of) const;
0096   etmiss_internal oldGctAlgo(const int ex, const int ey) const;
0097   etmiss_internal floatingPointAlgo(const int ex, const int ey) const;
0098 
0099   int cordicShiftAndRoundBits(const int e, const unsigned nBits) const;
0100 };
0101 
0102 #endif