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
CSCSP_MBblock::mb_bxn_
unsigned mb_bxn_
Definition: CSCSP_MBblock.h:23
CSCSP_MBblock::timingError
unsigned int timingError(void) const
Definition: CSCSP_MBblock.h:61
CSCSP_MBblock::bc0_
unsigned bc0_
Definition: CSCSP_MBblock.h:20
CSCSP_MBblock::cal_
unsigned cal_
Definition: CSCSP_MBblock.h:14
CSCSP_MBblock::BXN
unsigned int BXN(void) const
Definition: CSCSP_MBblock.h:55
CSCSP_MBblock::bc0
unsigned int bc0(void) const
Definition: CSCSP_MBblock.h:54
CSCSP_MBblock
Definition: CSCSP_MBblock.h:6
CSCSP_MBblock::af
unsigned int af(void) const
Definition: CSCSP_MBblock.h:60
CSCSP_MBblock::spare_2
unsigned spare_2
Definition: CSCSP_MBblock.h:27
CSCSP_MBblock::flag
unsigned int flag(void) const
Definition: CSCSP_MBblock.h:49
CSCSP_MBblock::zero_3
unsigned zero_3
Definition: CSCSP_MBblock.h:15
CSCSP_MBblock::bxn
unsigned int bxn(void) const
Definition: CSCSP_MBblock.h:53
CSCSP_MBblock::bxBit
unsigned int bxBit
Definition: CSCSP_MBblock.h:38
CSCSP_MBblock::valid_quality
unsigned int valid_quality
Definition: CSCSP_MBblock.h:36
CSCSP_MBblock::tbin_
unsigned int tbin_
Definition: CSCSP_MBblock.h:35
CSCSP_MBblock::tbin
unsigned int tbin(void) const
Definition: CSCSP_MBblock.h:58
CSCSP_MBblock::zero_4
unsigned zero_4
Definition: CSCSP_MBblock.h:21
CSCSP_MBblock::unpack
bool unpack(const unsigned short *&buf)
Definition: CSCSP_MBblock.h:63
CSCSPRecord
Definition: CSCSPRecord.h:9
CSCSP_MBblock::phi_
unsigned phi_
Definition: CSCSP_MBblock.h:17
CSCSP_MBblock::vq
unsigned int vq(void) const
Definition: CSCSP_MBblock.h:59
CSCSP_MBblock::phi_bend_
unsigned phi_bend_
Definition: CSCSP_MBblock.h:11
CSCTFPacker
Definition: CSCTFPacker.h:18
CSCSP_MBblock::bxn1_
unsigned bxn1_
Definition: CSCSP_MBblock.h:18
CSCSP_MBblock::spare_1
unsigned spare_1
Definition: CSCSP_MBblock.h:24
CSCSP_MBblock::bxn0_
unsigned bxn0_
Definition: CSCSP_MBblock.h:19
CSCSP_MBblock::CSCSP_MBblock
CSCSP_MBblock(void)
Definition: CSCSP_MBblock.h:69
CSCSP_MBblock::phi_bend
unsigned int phi_bend(void) const
Definition: CSCSP_MBblock.h:48
CSCSP_MBblock::zero_5
unsigned zero_5
Definition: CSCSP_MBblock.h:25
CSCSP_MBblock::alignment_fifo
unsigned int alignment_fifo
Definition: CSCSP_MBblock.h:37
CSCSP_MBblock::phi
unsigned int phi(void) const
Definition: CSCSP_MBblock.h:52
CSCSP_MBblock::check
bool check(void) const
Definition: CSCSP_MBblock.h:42
CSCSP_MBblock::id
unsigned int id(void) const
Definition: CSCSP_MBblock.h:57
CSCSP_MBblock::quality
unsigned int quality(void) const
Definition: CSCSP_MBblock.h:47
CSCSP_MBblock::zero_2
unsigned zero_2
Definition: CSCSP_MBblock.h:12
CSCSP_MBblock::cal
unsigned int cal(void) const
Definition: CSCSP_MBblock.h:50
CSCSP_MBblock::zero_1
unsigned zero_1
Definition: CSCSP_MBblock.h:10
visDQMUpload.buf
buf
Definition: visDQMUpload.py:160
CSCSP_MBblock::zero_6
unsigned zero_6
Definition: CSCSP_MBblock.h:28
CSCSP_MBblock::quality_
unsigned quality_
Definition: CSCSP_MBblock.h:9
CSCSP_MBblock::flag_
unsigned flag_
Definition: CSCSP_MBblock.h:13
CSCSP_MBblock::id_
unsigned int id_
Definition: CSCSP_MBblock.h:39