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() { return zero_1!=0||zero_2!=0||zero_3!=0||zero_4!=0||zero_5!=0||zero_6!=0||spare_1!=0||spare_2!=0; }
43 
44  unsigned int quality (void) const throw() { return quality_; }
45  unsigned int phi_bend(void) const throw() { return phi_bend_; }
46  unsigned int flag (void) const throw() { return flag_; }
47  unsigned int cal (void) const throw() { return cal_; }
48 
49  unsigned int phi(void) const throw() { return phi_; }
50  unsigned int bxn(void) const throw() { return (bxn1_<<1)|bxn0_; }
51  unsigned int bc0(void) const throw() { return bc0_; }
52  unsigned int BXN(void) const throw() { return mb_bxn_; }
53 
54  unsigned int id (void) const throw() { return id_; }
55  unsigned int tbin(void) const throw() { return tbin_; }
56  unsigned int vq (void) const throw() { return valid_quality; }
57  unsigned int af (void) const throw() { return alignment_fifo;}
58  unsigned int timingError(void) const throw() { return bxBit; }
59 
60  bool unpack(const unsigned short *&buf) throw() { std::memcpy(this, buf, 4*sizeof(short)); buf+=4; return check(); }
61 
62  CSCSP_MBblock(void){}
63 };
64 
65 #endif
unsigned phi_
Definition: CSCSP_MBblock.h:17
unsigned int bxBit
Definition: CSCSP_MBblock.h:38
unsigned int timingError(void) const
Definition: CSCSP_MBblock.h:58
unsigned int alignment_fifo
Definition: CSCSP_MBblock.h:37
unsigned zero_5
Definition: CSCSP_MBblock.h:25
unsigned int quality(void) const
Definition: CSCSP_MBblock.h:44
unsigned int af(void) const
Definition: CSCSP_MBblock.h:57
unsigned zero_1
Definition: CSCSP_MBblock.h:10
unsigned bc0_
Definition: CSCSP_MBblock.h:20
unsigned int tbin(void) const
Definition: CSCSP_MBblock.h:55
unsigned cal_
Definition: CSCSP_MBblock.h:14
unsigned flag_
Definition: CSCSP_MBblock.h:13
unsigned int cal(void) const
Definition: CSCSP_MBblock.h:47
unsigned bxn1_
Definition: CSCSP_MBblock.h:18
unsigned spare_1
Definition: CSCSP_MBblock.h:24
bool check(void) const
Definition: CSCSP_MBblock.h:42
CSCSP_MBblock(void)
Definition: CSCSP_MBblock.h:62
unsigned int id(void) const
Definition: CSCSP_MBblock.h:54
unsigned int bc0(void) const
Definition: CSCSP_MBblock.h:51
unsigned int flag(void) const
Definition: CSCSP_MBblock.h:46
unsigned zero_2
Definition: CSCSP_MBblock.h:12
unsigned zero_6
Definition: CSCSP_MBblock.h:28
unsigned int bxn(void) const
Definition: CSCSP_MBblock.h:50
unsigned int vq(void) const
Definition: CSCSP_MBblock.h:56
unsigned phi_bend_
Definition: CSCSP_MBblock.h:11
unsigned int id_
Definition: CSCSP_MBblock.h:39
unsigned int BXN(void) const
Definition: CSCSP_MBblock.h:52
unsigned int tbin_
Definition: CSCSP_MBblock.h:35
unsigned spare_2
Definition: CSCSP_MBblock.h:27
unsigned int phi_bend(void) const
Definition: CSCSP_MBblock.h:45
bool unpack(const unsigned short *&buf)
Definition: CSCSP_MBblock.h:60
unsigned zero_3
Definition: CSCSP_MBblock.h:15
unsigned int valid_quality
Definition: CSCSP_MBblock.h:36
unsigned zero_4
Definition: CSCSP_MBblock.h:21
unsigned bxn0_
Definition: CSCSP_MBblock.h:19
unsigned int phi(void) const
Definition: CSCSP_MBblock.h:49
unsigned mb_bxn_
Definition: CSCSP_MBblock.h:23
unsigned quality_
Definition: CSCSP_MBblock.h:9