CMS 3D CMS Logo

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() {
26  return zero_1 !=0 || zero_2 !=0 || zero_3 !=0 || zero_4 !=0 ;
27  }
28 
29  bool unpack(const unsigned short *&buf) throw() { std::memcpy((void*)this,buf,4*sizeof(short)); buf+=4; return check(); }
30 
31  int track_counter(void) const throw() { return (track_counter_high<<15) | track_counter_low; }
32  int orbit_counter(void) const throw() { return (orbit_counter_high<<15) | orbit_counter_low; }
33 
34  CSCSPCounters(void){}
35 };
36 
37 #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:32
int track_counter(void) const
Definition: CSCSPCounters.h:31
unsigned track_counter_high
Definition: CSCSPCounters.h:13
CSCSPCounters(void)
Definition: CSCSPCounters.h:34
unsigned zero_4
Definition: CSCSPCounters.h:20
bool unpack(const unsigned short *&buf)
Definition: CSCSPCounters.h:29