Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1GCTINTERNHFDATA_H
0002 #define L1GCTINTERNHFDATA_H
0003 
0004 #include <ostream>
0005 #include <string>
0006 #include <cstdint>
0007 
0008 /// \class L1GctInternHFData
0009 /// \brief L1 GCT internal ring sums and/or bit counts
0010 /// \author Jim Brooke
0011 /// \date June 2008
0012 ///
0013 /// Will store 4 sums/counts of up to 8 bits each
0014 ///
0015 
0016 class L1GctInternHFData {
0017 public:
0018   /// et sum type - not clear this is required
0019   enum L1GctInternHFDataType {
0020     null,
0021     conc_hf_ring_et_sums,
0022     conc_hf_bit_counts,
0023     wheel_hf_ring_et_sums,
0024     wheel_hf_bit_counts
0025   };
0026 
0027   /// default constructor (for vector initialisation etc.)
0028   L1GctInternHFData();
0029 
0030   /// destructor
0031   ~L1GctInternHFData();
0032 
0033   static L1GctInternHFData fromConcRingSums(const uint16_t capBlock,
0034                                             const uint16_t capIndex,
0035                                             const int16_t bx,
0036                                             const uint32_t data);
0037 
0038   static L1GctInternHFData fromConcBitCounts(const uint16_t capBlock,
0039                                              const uint16_t capIndex,
0040                                              const int16_t bx,
0041                                              const uint32_t data);
0042 
0043   static L1GctInternHFData fromWheelRingSums(const uint16_t capBlock,
0044                                              const uint16_t capIndex,
0045                                              const int16_t bx,
0046                                              const uint32_t data);
0047 
0048   static L1GctInternHFData fromWheelBitCounts(const uint16_t capBlock,
0049                                               const uint16_t capIndex,
0050                                               const int16_t bx,
0051                                               const uint32_t data);
0052 
0053   /// metadata
0054 
0055   /// 'type' of object
0056   L1GctInternHFData::L1GctInternHFDataType type() const { return type_; }
0057 
0058   /// get capture block
0059   uint16_t capBlock() const { return capBlock_; }
0060 
0061   /// get index within capture block
0062   uint16_t capIndex() const { return capIndex_; }
0063 
0064   /// get BX number
0065   int16_t bx() const { return bx_; }
0066 
0067   /// is the sum non-zero
0068   bool empty() const { return (data_ == 0); }
0069 
0070   /// get the actual data
0071 
0072   /// is this ring sums or bit counts?
0073   bool isRingSums() const { return (type_ == conc_hf_ring_et_sums || type_ == wheel_hf_ring_et_sums); }
0074 
0075   /// get the raw data
0076   uint32_t raw() const { return data_; }
0077 
0078   /// get value
0079   uint16_t value(unsigned i) const;
0080 
0081   /// get the et sums
0082   uint16_t et(unsigned i) const;
0083 
0084   /// get the counts
0085   uint16_t count(unsigned i) const;
0086 
0087   // setters
0088 
0089   /// set cap block
0090   void setCapBlock(uint16_t const capBlock) { capBlock_ = capBlock; }
0091 
0092   /// set cap index
0093   void setCapIndex(uint16_t const capIndex) { capIndex_ = capIndex; }
0094 
0095   /// set bx
0096   void setBx(int16_t const bx) { bx_ = bx; }
0097 
0098   /// set type
0099   void setType(L1GctInternHFDataType type) { type_ = type; }
0100 
0101   /// set value
0102   void setValue(unsigned const i, uint16_t const val);
0103 
0104   /// set the sum
0105   void setEt(unsigned const i, uint16_t const et);
0106 
0107   /// set the count
0108   void setCount(unsigned const i, uint16_t const count);
0109 
0110   void setData(uint32_t const data) { data_ = data; }
0111 
0112   /// operators
0113 
0114   /// equality operator
0115   bool operator==(const L1GctInternHFData& c) const;
0116 
0117   /// inequality operator
0118   bool operator!=(const L1GctInternHFData& c) const { return !(*this == c); }
0119 
0120 private:
0121   // type of data
0122   L1GctInternHFDataType type_;
0123 
0124   // source of the data
0125   uint16_t capBlock_;
0126   uint16_t capIndex_;
0127   int16_t bx_;
0128 
0129   // the captured data
0130   uint32_t data_;
0131 };
0132 
0133 std::ostream& operator<<(std::ostream& s, const L1GctInternHFData& cand);
0134 
0135 #endif