Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1GCTHFRINGETSUMS_H
0002 #define L1GCTHFRINGETSUMS_H
0003 
0004 #include <ostream>
0005 #include <string>
0006 #include <cstdint>
0007 
0008 /// \class L1GctHFRingEtSums
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 L1GctHFRingEtSums {
0017 public:
0018   static const unsigned N_SUMS = 4;
0019 
0020 public:
0021   /// default constructor (for vector initialisation etc.)
0022   L1GctHFRingEtSums();
0023 
0024   /// destructor
0025   ~L1GctHFRingEtSums();
0026 
0027   /// named ctor for unpacker
0028   /// note that this expects a 32 bit word that also contains
0029   /// the HF bit counts, which are ignored
0030   static L1GctHFRingEtSums fromConcRingSums(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 L1GctHFRingEtSums fromGctEmulator(const int16_t bx,
0037                                            const uint16_t etSumPosEtaRing1,
0038                                            const uint16_t etSumNegEtaRing1,
0039                                            const uint16_t etSumPosEtaRing2,
0040                                            const uint16_t etSumNegEtaRing2);
0041 
0042   // optional named ctor for GT if required
0043   // arguments to be defined
0044   // static L1GctHfRingEtSums fromGtPsb()
0045 
0046   // get number of ring sums
0047   static unsigned nSums() { return N_SUMS; }
0048 
0049   // getters
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   /// get the raw data
0064   uint16_t raw() const { return data_; }
0065 
0066   /// get an Et sum
0067   ///  index : sum
0068   ///    0   :  Ring 1 Positive Rapidity HF Et sum
0069   ///    1   :  Ring 1 Negative Rapidity HF Et sum
0070   ///    2   :  Ring 2 Positive Rapidity HF Et sum
0071   ///    3   :  Ring 2 Negative Rapidity HF Et sum
0072   uint16_t etSum(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(uint16_t bx) { bx_ = bx; }
0084 
0085   /// set a sum
0086   void setEtSum(unsigned i, uint16_t et);
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 L1GctHFRingEtSums& c) const;
0095 
0096   /// inequality operator
0097   bool operator!=(const L1GctHFRingEtSums& 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 L1GctHFRingEtSums& cand);
0110 
0111 #endif