CMS 3D CMS Logo

CSCSP_MBblock.h
Go to the documentation of this file.
1 #ifndef CSCSP_MBblock_h
2 #define CSCSP_MBblock_h
3 
4 #include <cstring>
5 
6 class CSCSP_MBblock {
7 private:
9  unsigned quality_ : 3; // muon quality (0-7), quality > 0 for valid data;
10  unsigned zero_1 : 1; // format specific
11  unsigned phi_bend_ : 5; // phi bend angle
12  unsigned zero_2 : 3; // format specific
13  unsigned flag_ : 1; // if 1 then it is a second muon from previous bunch crossing
14  unsigned cal_ : 1; // MBy special mode flag
15  unsigned zero_3 : 2; // format specific
17  unsigned phi_ : 12; // azimuth coordinate;
18  unsigned bxn1_ : 1; // next to the least significant bit of the MB BX number
19  unsigned bxn0_ : 1; // least significant bit of the MB BX number
20  unsigned bc0_ : 1; // BX zero timing mark
21  unsigned zero_4 : 1; // format specific
23  unsigned mb_bxn_ : 12; // Stub arrival time picked from a local 12-bit Bunch Counter, that runs at data stream timing
24  unsigned spare_1 : 3; // not used
25  unsigned zero_5 : 1; // format specific
27  unsigned spare_2 : 15; // not used
28  unsigned zero_6 : 1; // format specific
29 
30  // Other data members logically belong to MB block record,
31  // but physically are located in Data Block Header, which implementation is:
32  friend class CSCSPRecord;
33  friend class CSCTFPacker;
34  // Let this class set following data memebers:
35  unsigned int tbin_; // time bin, that this MB block belongs to in global SP record
36  unsigned int valid_quality; // valid quality
37  unsigned int alignment_fifo; // AF error
38  unsigned int bxBit; // monitors the MB(DT) timing
39  unsigned int id_; // stub id (1-MB1a, 2-MB1d)
40 
41 public:
42  bool check(void) const throw() {
43  return zero_1 != 0 || zero_2 != 0 || zero_3 != 0 || zero_4 != 0 || zero_5 != 0 || zero_6 != 0 || spare_1 != 0 ||
44  spare_2 != 0;
45  }
46 
47  unsigned int quality(void) const throw() { return quality_; }
48  unsigned int phi_bend(void) const throw() { return phi_bend_; }
49  unsigned int flag(void) const throw() { return flag_; }
50  unsigned int cal(void) const throw() { return cal_; }
51 
52  unsigned int phi(void) const throw() { return phi_; }
53  unsigned int bxn(void) const throw() { return (bxn1_ << 1) | bxn0_; }
54  unsigned int bc0(void) const throw() { return bc0_; }
55  unsigned int BXN(void) const throw() { return mb_bxn_; }
56 
57  unsigned int id(void) const throw() { return id_; }
58  unsigned int tbin(void) const throw() { return tbin_; }
59  unsigned int vq(void) const throw() { return valid_quality; }
60  unsigned int af(void) const throw() { return alignment_fifo; }
61  unsigned int timingError(void) const throw() { return bxBit; }
62 
63  bool unpack(const unsigned short *&buf) throw() {
64  std::memcpy(this, buf, 4 * sizeof(short));
65  buf += 4;
66  return check();
67  }
68 
69  CSCSP_MBblock(void) {}
70 };
71 
72 #endif
unsigned phi_
Definition: CSCSP_MBblock.h:17
unsigned int BXN(void) const
Definition: CSCSP_MBblock.h:55
unsigned int bxBit
Definition: CSCSP_MBblock.h:38
bool check(void) const
Definition: CSCSP_MBblock.h:42
unsigned int phi(void) const
Definition: CSCSP_MBblock.h:52
unsigned int tbin(void) const
Definition: CSCSP_MBblock.h:58
unsigned int id(void) const
Definition: CSCSP_MBblock.h:57
unsigned int alignment_fifo
Definition: CSCSP_MBblock.h:37
unsigned zero_5
Definition: CSCSP_MBblock.h:25
unsigned zero_1
Definition: CSCSP_MBblock.h:10
unsigned bc0_
Definition: CSCSP_MBblock.h:20
unsigned cal_
Definition: CSCSP_MBblock.h:14
unsigned flag_
Definition: CSCSP_MBblock.h:13
unsigned int phi_bend(void) const
Definition: CSCSP_MBblock.h:48
unsigned bxn1_
Definition: CSCSP_MBblock.h:18
unsigned int cal(void) const
Definition: CSCSP_MBblock.h:50
unsigned spare_1
Definition: CSCSP_MBblock.h:24
unsigned int timingError(void) const
Definition: CSCSP_MBblock.h:61
CSCSP_MBblock(void)
Definition: CSCSP_MBblock.h:69
unsigned int flag(void) const
Definition: CSCSP_MBblock.h:49
unsigned zero_2
Definition: CSCSP_MBblock.h:12
unsigned zero_6
Definition: CSCSP_MBblock.h:28
unsigned int bc0(void) const
Definition: CSCSP_MBblock.h:54
unsigned phi_bend_
Definition: CSCSP_MBblock.h:11
unsigned int id_
Definition: CSCSP_MBblock.h:39
unsigned int tbin_
Definition: CSCSP_MBblock.h:35
unsigned int af(void) const
Definition: CSCSP_MBblock.h:60
unsigned spare_2
Definition: CSCSP_MBblock.h:27
bool unpack(const unsigned short *&buf)
Definition: CSCSP_MBblock.h:63
unsigned int quality(void) const
Definition: CSCSP_MBblock.h:47
unsigned zero_3
Definition: CSCSP_MBblock.h:15
unsigned int bxn(void) const
Definition: CSCSP_MBblock.h:53
unsigned int valid_quality
Definition: CSCSP_MBblock.h:36
unsigned zero_4
Definition: CSCSP_MBblock.h:21
unsigned int vq(void) const
Definition: CSCSP_MBblock.h:59
unsigned bxn0_
Definition: CSCSP_MBblock.h:19
unsigned mb_bxn_
Definition: CSCSP_MBblock.h:23
unsigned quality_
Definition: CSCSP_MBblock.h:9