Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1GCTJETCOUNTS_H
0002 #define L1GCTJETCOUNTS_H
0003 
0004 #include <vector>
0005 #include <ostream>
0006 #include <cstdint>
0007 
0008 ///
0009 /// \class L1GctJetCounts
0010 ///
0011 /// \author: Jim Brooke
0012 ///
0013 /// Class to store the GCT jet count output
0014 ///
0015 
0016 class L1GctJetCounts {
0017 public:
0018   /// static maximum number of jet counts
0019   /// This can be up to 12 but we use some of the
0020   /// available bandwidth for other information.
0021   static const unsigned MAX_TOTAL_COUNTS;
0022   static const unsigned MAX_TRUE_COUNTS;
0023 
0024   /// default constructor
0025   L1GctJetCounts();
0026 
0027   /// Constructor for unpacking.
0028   /*! Expects three 5-bit jet counts in bits 14:0, and then
0029    *  three more 5-bit jet counts in bits 30:16 for both of
0030    *  the arguments; this is because in the raw format bit
0031    *  31 is a BC0 flag, and bit 15 is always 1. Thus, jet
0032    *  count 0 should be in bits 4:0 of the data0 argument. */
0033   L1GctJetCounts(uint32_t data0, uint32_t data1);
0034 
0035   L1GctJetCounts(uint32_t data0, uint32_t data1, int16_t bx);
0036 
0037   /// constructor for emulator
0038   L1GctJetCounts(const std::vector<unsigned>& counts);
0039 
0040   L1GctJetCounts(const std::vector<unsigned>& counts, int16_t bx);
0041 
0042   /// destructor
0043   virtual ~L1GctJetCounts();
0044 
0045   /// name method
0046   std::string name() const { return "JetCounts"; }
0047 
0048   /// empty method
0049   bool empty() const { return false; }
0050 
0051   /// get raw word 0
0052   uint32_t raw0() const { return m_data0; }
0053 
0054   /// get raw word 1
0055   uint32_t raw1() const { return m_data1; }
0056 
0057   /// get count by index
0058   unsigned count(unsigned i) const;
0059 
0060   /// get individual counts (for use with FWLite)
0061   unsigned count00() const { return (MAX_TRUE_COUNTS < 1 ? 0 : count(0)); }
0062   unsigned count01() const { return (MAX_TRUE_COUNTS < 2 ? 0 : count(1)); }
0063   unsigned count02() const { return (MAX_TRUE_COUNTS < 3 ? 0 : count(2)); }
0064   unsigned count03() const { return (MAX_TRUE_COUNTS < 4 ? 0 : count(3)); }
0065   unsigned count04() const { return (MAX_TRUE_COUNTS < 5 ? 0 : count(4)); }
0066   unsigned count05() const { return (MAX_TRUE_COUNTS < 6 ? 0 : count(5)); }
0067   unsigned count06() const { return (MAX_TRUE_COUNTS < 7 ? 0 : count(6)); }
0068   unsigned count07() const { return (MAX_TRUE_COUNTS < 8 ? 0 : count(7)); }
0069   unsigned count08() const { return (MAX_TRUE_COUNTS < 9 ? 0 : count(8)); }
0070   unsigned count09() const { return (MAX_TRUE_COUNTS < 10 ? 0 : count(9)); }
0071   unsigned count10() const { return (MAX_TRUE_COUNTS < 11 ? 0 : count(10)); }
0072   unsigned count11() const { return (MAX_TRUE_COUNTS < 12 ? 0 : count(11)); }
0073 
0074   /// get bunch-crossing index
0075   int16_t bx() const { return m_bx; }
0076 
0077   /// equality operator
0078   int operator==(const L1GctJetCounts& c) const { return (m_data0 == c.raw0() && m_data1 == c.raw1()); }
0079 
0080   /// inequality operator
0081   int operator!=(const L1GctJetCounts& c) const { return !(*this == c); }
0082 
0083 private:
0084   uint32_t m_data0;
0085   uint32_t m_data1;
0086   int16_t m_bx;
0087 };
0088 
0089 std::ostream& operator<<(std::ostream& s, const L1GctJetCounts& c);
0090 
0091 #endif