File indexing completed on 2024-04-06 12:10:29
0001 #ifndef CSCSPCounters_h
0002 #define CSCSPCounters_h
0003
0004 #include <cstring>
0005
0006 class CSCSPCounters {
0007 private:
0008
0009
0010 unsigned track_counter_low : 15;
0011 unsigned zero_1 : 1;
0012
0013 unsigned track_counter_high : 15;
0014 unsigned zero_2 : 1;
0015
0016 unsigned orbit_counter_low : 15;
0017 unsigned zero_3 : 1;
0018
0019 unsigned orbit_counter_high : 15;
0020 unsigned zero_4 : 1;
0021
0022 friend class CSCTFPacker;
0023
0024 public:
0025 bool check(void) const throw() { return zero_1 != 0 || zero_2 != 0 || zero_3 != 0 || zero_4 != 0; }
0026
0027 bool unpack(const unsigned short *&buf) throw() {
0028 std::memcpy((void *)this, buf, 4 * sizeof(short));
0029 buf += 4;
0030 return check();
0031 }
0032
0033 int track_counter(void) const throw() { return (track_counter_high << 15) | track_counter_low; }
0034 int orbit_counter(void) const throw() { return (orbit_counter_high << 15) | orbit_counter_low; }
0035
0036 CSCSPCounters(void) {}
0037 };
0038
0039 #endif