CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCSPCounters.h
Go to the documentation of this file.
1 #ifndef CSCSPCounters_h
2 #define CSCSPCounters_h
3 
4 #include <cstring>
5 
6 class CSCSPCounters {
7 private:
8  // Block of counters
10  unsigned track_counter_low : 15; //
11  unsigned zero_1 : 1; //
13  unsigned track_counter_high : 15; //
14  unsigned zero_2 : 1; //
16  unsigned orbit_counter_low : 15; //
17  unsigned zero_3 : 1; //
19  unsigned orbit_counter_high : 15; //
20  unsigned zero_4 : 1; //
21 
22  friend class CSCTFPacker;
23 
24 public:
25  bool check(void) const throw() { return zero_1 != 0 || zero_2 != 0 || zero_3 != 0 || zero_4 != 0; }
26 
27  bool unpack(const unsigned short *&buf) throw() {
28  std::memcpy((void *)this, buf, 4 * sizeof(short));
29  buf += 4;
30  return check();
31  }
32 
33  int track_counter(void) const throw() { return (track_counter_high << 15) | track_counter_low; }
34  int orbit_counter(void) const throw() { return (orbit_counter_high << 15) | orbit_counter_low; }
35 
36  CSCSPCounters(void) {}
37 };
38 
39 #endif
unsigned orbit_counter_low
Definition: CSCSPCounters.h:16
unsigned orbit_counter_high
Definition: CSCSPCounters.h:19
unsigned zero_2
Definition: CSCSPCounters.h:14
unsigned zero_3
Definition: CSCSPCounters.h:17
bool check(void) const
Definition: CSCSPCounters.h:25
unsigned track_counter_low
Definition: CSCSPCounters.h:10
unsigned zero_1
Definition: CSCSPCounters.h:11
int orbit_counter(void) const
Definition: CSCSPCounters.h:34
int track_counter(void) const
Definition: CSCSPCounters.h:33
unsigned track_counter_high
Definition: CSCSPCounters.h:13
CSCSPCounters(void)
Definition: CSCSPCounters.h:36
unsigned zero_4
Definition: CSCSPCounters.h:20
bool unpack(const unsigned short *&buf)
Definition: CSCSPCounters.h:27