1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#ifndef CSCSPCounters_h
#define CSCSPCounters_h
#include <cstring>
class CSCSPCounters {
private:
// Block of counters
/////// word 1 ///////
unsigned track_counter_low : 15; //
unsigned zero_1 : 1; //
/////// word 2 ///////
unsigned track_counter_high : 15; //
unsigned zero_2 : 1; //
/////// word 3 ///////
unsigned orbit_counter_low : 15; //
unsigned zero_3 : 1; //
/////// word 4 ///////
unsigned orbit_counter_high : 15; //
unsigned zero_4 : 1; //
friend class CSCTFPacker;
public:
bool check(void) const throw() { return zero_1 != 0 || zero_2 != 0 || zero_3 != 0 || zero_4 != 0; }
bool unpack(const unsigned short *&buf) throw() {
std::memcpy((void *)this, buf, 4 * sizeof(short));
buf += 4;
return check();
}
int track_counter(void) const throw() { return (track_counter_high << 15) | track_counter_low; }
int orbit_counter(void) const throw() { return (orbit_counter_high << 15) | orbit_counter_low; }
CSCSPCounters(void) {}
};
#endif
|