L1GctEtTotal

numberOfBits

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
#ifndef L1GCTETTOTAL_H
#define L1GCTETTOTAL_H

#include <ostream>
#include <cstdint>

/*! \file L1GctEtTotal.h
 * \Header file for the GCT energy sum output
 * 
 * \author: Jim Brooke
 *
 */

/// \class L1GctEtTotal
/// \brief Persistable copy of total Et measured at Level-1

class L1GctEtTotal {
public:
  enum numberOfBits {
    kEtTotalNBits = 12,
    kEtTotalOFlowBit = 1 << kEtTotalNBits,
    kEtTotalMaxValue = kEtTotalOFlowBit - 1,
    kRawCtorMask = kEtTotalOFlowBit | kEtTotalMaxValue
  };

  L1GctEtTotal();
  L1GctEtTotal(uint16_t rawData);
  L1GctEtTotal(uint16_t rawData, int16_t bx);
  L1GctEtTotal(unsigned et, bool oflow);
  L1GctEtTotal(unsigned et, bool oflow, int16_t bx);
  virtual ~L1GctEtTotal();

  /// name method
  std::string name() const { return "EtTotal"; }

  /// empty method (= false; total Et is always calculated)
  bool empty() const { return false; }

  /// get the data
  uint16_t raw() const { return m_data; }

  /// get the Et
  unsigned et() const { return m_data & kEtTotalMaxValue; }

  /// get the overflow
  bool overFlow() const { return (m_data & kEtTotalOFlowBit) != 0; }

  /// get bunch-crossing index
  int16_t bx() const { return m_bx; }

  /// equality operator
  int operator==(const L1GctEtTotal& e) const { return m_data == e.raw(); }

  /// inequality operator
  int operator!=(const L1GctEtTotal& e) const { return m_data != e.raw(); }

private:
  uint16_t m_data;
  int16_t m_bx;
};

/// Pretty-print operator for L1GctEtTotal
std::ostream& operator<<(std::ostream& s, const L1GctEtTotal& c);

#endif