Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1GCTETTOTAL_H
0002 #define L1GCTETTOTAL_H
0003 
0004 #include <ostream>
0005 #include <cstdint>
0006 
0007 /*! \file L1GctEtTotal.h
0008  * \Header file for the GCT energy sum output
0009  * 
0010  * \author: Jim Brooke
0011  *
0012  */
0013 
0014 /// \class L1GctEtTotal
0015 /// \brief Persistable copy of total Et measured at Level-1
0016 
0017 class L1GctEtTotal {
0018 public:
0019   enum numberOfBits {
0020     kEtTotalNBits = 12,
0021     kEtTotalOFlowBit = 1 << kEtTotalNBits,
0022     kEtTotalMaxValue = kEtTotalOFlowBit - 1,
0023     kRawCtorMask = kEtTotalOFlowBit | kEtTotalMaxValue
0024   };
0025 
0026   L1GctEtTotal();
0027   L1GctEtTotal(uint16_t rawData);
0028   L1GctEtTotal(uint16_t rawData, int16_t bx);
0029   L1GctEtTotal(unsigned et, bool oflow);
0030   L1GctEtTotal(unsigned et, bool oflow, int16_t bx);
0031   virtual ~L1GctEtTotal();
0032 
0033   /// name method
0034   std::string name() const { return "EtTotal"; }
0035 
0036   /// empty method (= false; total Et is always calculated)
0037   bool empty() const { return false; }
0038 
0039   /// get the data
0040   uint16_t raw() const { return m_data; }
0041 
0042   /// get the Et
0043   unsigned et() const { return m_data & kEtTotalMaxValue; }
0044 
0045   /// get the overflow
0046   bool overFlow() const { return (m_data & kEtTotalOFlowBit) != 0; }
0047 
0048   /// get bunch-crossing index
0049   int16_t bx() const { return m_bx; }
0050 
0051   /// equality operator
0052   int operator==(const L1GctEtTotal& e) const { return m_data == e.raw(); }
0053 
0054   /// inequality operator
0055   int operator!=(const L1GctEtTotal& e) const { return m_data != e.raw(); }
0056 
0057 private:
0058   uint16_t m_data;
0059   int16_t m_bx;
0060 };
0061 
0062 /// Pretty-print operator for L1GctEtTotal
0063 std::ostream& operator<<(std::ostream& s, const L1GctEtTotal& c);
0064 
0065 #endif