Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:26

0001 #ifndef L1GCTHTMISS_H
0002 #define L1GCTHTMISS_H
0003 
0004 #include <ostream>
0005 #include <cstdint>
0006 
0007 /*! \file L1GctHtMiss.h
0008  * 
0009  * \author: Jim Brooke
0010  *
0011  */
0012 
0013 /// \class L1GctHtMiss
0014 /// \brief Persistable copy of missing Et measured at Level-1
0015 
0016 class L1GctHtMiss {
0017 public:
0018   /*! To match the RAW format:
0019    *  HtMissPhi is on bits 4:0,
0020    *  HtMissMagnitude is on bits 11:5,
0021    *  Overflow flag on bit 12,
0022    *  All other bits will be be zero. */
0023   enum numberOfBits {
0024     kHtMissPhiNBits = 5,
0025     kHtMissMagNBits = 7,
0026     kHtMissPhiMask = (1 << kHtMissPhiNBits) - 1,
0027     kHtMissMagMask = (1 << kHtMissMagNBits) - 1,
0028     kHtMissPhiShift = 0,
0029     kHtMissMagShift = kHtMissPhiNBits,
0030     kHtMissOFlowBit = (1 << (kHtMissPhiNBits + kHtMissMagNBits)),
0031     kHtMissPhiNBins = 18,
0032     kRawCtorMask = kHtMissOFlowBit | (kHtMissMagMask << kHtMissMagShift) | (kHtMissPhiMask << kHtMissPhiShift)
0033   };
0034 
0035   L1GctHtMiss();
0036 
0037   /// For use with raw data from the unpacker.
0038   L1GctHtMiss(uint32_t rawData);
0039 
0040   /// For use with raw data from the unpacker.
0041   L1GctHtMiss(uint32_t rawData, int16_t bx);
0042 
0043   L1GctHtMiss(unsigned et, unsigned phi, bool oflow);
0044 
0045   L1GctHtMiss(unsigned et, unsigned phi, bool oflow, int16_t bx);
0046 
0047   virtual ~L1GctHtMiss();
0048 
0049   /// name method
0050   std::string name() const { return "HtMiss"; }
0051 
0052   /// empty method (= false; missing Et is always calculated)
0053   bool empty() const { return false; }
0054 
0055   /// get the data
0056   uint32_t raw() const { return m_data; }
0057 
0058   /// get the magnitude
0059   unsigned et() const { return (m_data >> kHtMissMagShift) & kHtMissMagMask; }
0060 
0061   /// get the overflow
0062   bool overFlow() const { return (m_data & kHtMissOFlowBit) != 0; }
0063 
0064   /// get the Et
0065   unsigned phi() const { return (m_data >> kHtMissPhiShift) & kHtMissPhiMask; }
0066 
0067   /// get bunch-crossing index
0068   int16_t bx() const { return m_bx; }
0069 
0070   /// equality operator
0071   int operator==(const L1GctHtMiss& e) const { return m_data == e.raw(); }
0072 
0073   /// inequality operator
0074   int operator!=(const L1GctHtMiss& e) const { return !(*this == e); }
0075 
0076 private:
0077   uint32_t m_data;
0078   int16_t m_bx;
0079 };
0080 
0081 /// Pretty-print operator for L1GctHtMiss
0082 std::ostream& operator<<(std::ostream& s, const L1GctHtMiss& c);
0083 
0084 #endif