Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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