CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/L1Trigger/GlobalCaloTrigger/interface/L1GctMet.h

Go to the documentation of this file.
00001 #ifndef L1GCTMET_H
00002 #define L1GCTMET_H
00003 
00015 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctWheelEnergyFpga.h"
00016 
00017 class L1CaloEtScale;
00018 class L1GctHtMissLut;
00019 
00020 class L1GctMet
00021 {
00022  public:
00023 
00024   enum metAlgoType { cordicTranslate, useHtMissLut, oldGct, floatingPoint };
00025 
00026   typedef L1GctUnsignedInt<  L1GctEtMiss::kEtMissNBits    > etMissType;
00027   typedef L1GctUnsignedInt<  L1GctEtMiss::kEtMissPhiNBits > etMissPhiType;
00028   typedef L1GctWheelEnergyFpga::etComponentType etComponentType;
00029 
00030   struct etmiss_vec {
00031     etMissType    mag;
00032     etMissPhiType phi;
00033   };
00034 
00035   L1GctMet(const unsigned ex=0, const unsigned ey=0, const metAlgoType algo=cordicTranslate);
00036   L1GctMet(const etComponentType& ex, const etComponentType& ey, const metAlgoType algo=cordicTranslate);
00037   ~L1GctMet();
00038 
00039   // return the missing Et as (magnitude, angle)
00040   etmiss_vec metVector() const ;
00041 
00042   // set and get the components
00043   void setComponents(const unsigned ex, const unsigned ey) { setExComponent(ex); setEyComponent(ey); }
00044   void setComponents(const etComponentType& ex, const etComponentType& ey) { setExComponent(ex); setEyComponent(ey); }
00045   void setExComponent(const unsigned ex);
00046   void setEyComponent(const unsigned ey);
00047   void setExComponent(const etComponentType& ex) { m_exComponent = ex; }
00048   void setEyComponent(const etComponentType& ey) { m_eyComponent = ey; }
00049   etComponentType getExComponent() const { return m_exComponent; }
00050   etComponentType getEyComponent() const { return m_eyComponent; }
00051 
00052   // set and get the algorithm type
00053   void setAlgoType(const metAlgoType algo) { m_algoType = algo; }
00054   metAlgoType getAlgoType() const { return m_algoType; }
00055 
00056   // set and get the bit shift
00057   // This parameter can be used to scale the output relative to the input
00058   void setBitShift(const unsigned nbits) { m_bitShift = nbits; }
00059   unsigned getBitShift() const { return m_bitShift; }
00060 
00061   // get the LUT (used by L1GctPrintLuts)
00062   const L1GctHtMissLut* getHtMissLut() const { return m_htMissLut; }
00063 
00064   // set and get the LUT parameters
00065   void setEtScale(const L1CaloEtScale* const fn);
00066   void setEtComponentLsb(const double lsb);
00067 
00068   const L1CaloEtScale* etScale() const;
00069   const double componentLsb() const;
00070  private:
00071 
00072   enum etComponentShift { kExOrEyMissComponentShift=4 };
00073 
00074   struct etmiss_internal {
00075     unsigned mag;
00076     unsigned phi;
00077   };
00078 
00079 
00082   const bool inputOverFlow() const;
00083 
00084   etComponentType m_exComponent;
00085   etComponentType m_eyComponent;
00086   metAlgoType     m_algoType;
00087   unsigned short  m_bitShift;
00088 
00089   L1GctHtMissLut* m_htMissLut;
00090 
00091   etmiss_internal cordicTranslateAlgo (const int ex, const int ey, const bool of) const;
00092   etmiss_internal useHtMissLutAlgo    (const int ex, const int ey, const bool of) const;
00093   etmiss_internal oldGctAlgo          (const int ex, const int ey) const;
00094   etmiss_internal floatingPointAlgo   (const int ex, const int ey) const;
00095 
00096   int cordicShiftAndRoundBits (const int e, const unsigned nBits) const;
00097 };
00098 
00099 #endif