Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:46

0001 #ifndef L1GCTHFBITCOUNTS_H
0002 #define L1GCTHFBITCOUNTS_H
0003 
0004 #include <ostream>
0005 #include <string>
0006 #include <cstdint>
0007 
0008 /// \class L1GctHFBitCounts
0009 /// \brief L1 GCT HF ring Et sums
0010 /// \author Jim Brooke
0011 /// \date August 2008
0012 ///
0013 /// Will store four Et sums of 3 bits each
0014 ///
0015 
0016 class L1GctHFBitCounts {
0017 public:
0018   static const unsigned N_SUMS = 4;
0019 
0020 public:
0021   /// default constructor (for vector initialisation etc.)
0022   L1GctHFBitCounts();
0023 
0024   /// destructor
0025   ~L1GctHFBitCounts();
0026 
0027   /// named ctor for unpacker
0028   /// note this expects a 32 bit word that also contains the
0029   /// HF ring Et sums, which are ignored
0030   static L1GctHFBitCounts fromConcHFBitCounts(const uint16_t capBlock,
0031                                               const uint16_t capIndex,
0032                                               const int16_t bx,
0033                                               const uint32_t data);
0034 
0035   /// named ctor for GCT emulator
0036   static L1GctHFBitCounts fromGctEmulator(const int16_t bx,
0037                                           const uint16_t bitCountPosEtaRing1,
0038                                           const uint16_t bitCountNegEtaRing1,
0039                                           const uint16_t bitCountPosEtaRing2,
0040                                           const uint16_t bitCountNegEtaRing2);
0041 
0042   // optional named ctor for GT if required
0043   // arguments to be defined
0044   // static L1GctHFBitCounts fromGtPsb()
0045 
0046   // getters
0047 
0048   // get number of ring sums
0049   static unsigned nCounts() { return N_SUMS; }
0050 
0051   /// get GCT unpacker capture block
0052   uint16_t capBlock() const { return capBlock_; }
0053 
0054   /// get index within GCT unpacker capture block
0055   uint16_t capIndex() const { return capIndex_; }
0056 
0057   /// get BX number
0058   int16_t bx() const { return bx_; }
0059 
0060   /// is the sum non-zero
0061   bool empty() const { return (data_ == 0); }
0062 
0063   /// the raw data
0064   uint16_t raw() const { return data_; }
0065 
0066   /// get a bit count
0067   ///  index : sum
0068   ///    0   :  Ring 1 Positive Rapidity HF bit count
0069   ///    1   :  Ring 1 Negative Rapidity HF bit count
0070   ///    2   :  Ring 2 Positive Rapidity HF bit count
0071   ///    3   :  Ring 2 Negative Rapidity HF bit count
0072   uint16_t bitCount(unsigned const i) const;
0073 
0074   // setters
0075 
0076   /// set cap block
0077   void setCapBlock(uint16_t capBlock) { capBlock_ = capBlock; }
0078 
0079   /// set cap index
0080   void setCapIndex(uint16_t capIndex) { capIndex_ = capIndex; }
0081 
0082   /// set bx
0083   void setBx(int16_t bx) { bx_ = bx; }
0084 
0085   /// set a sum
0086   void setBitCount(unsigned i, uint16_t c);
0087 
0088   /// set the raw data
0089   void setData(uint32_t data) { data_ = data; }
0090 
0091   /// operators
0092 
0093   /// equality operator
0094   bool operator==(const L1GctHFBitCounts& c) const;
0095 
0096   /// inequality operator
0097   bool operator!=(const L1GctHFBitCounts& c) const { return !(*this == c); }
0098 
0099 private:
0100   // source of the data
0101   uint16_t capBlock_;
0102   uint16_t capIndex_;
0103   int16_t bx_;
0104 
0105   // the captured data
0106   uint16_t data_;
0107 };
0108 
0109 std::ostream& operator<<(std::ostream& s, const L1GctHFBitCounts& cand);
0110 
0111 #endif