CMS 3D CMS Logo

CSCSP_SPblock.h
Go to the documentation of this file.
1 #ifndef CSCSP_SPblock_h
2 #define CSCSP_SPblock_h
3 #include <vector>
4 #include <cstring>
7 
8 class CSCSP_SPblock {
9 private:
11  unsigned phi_ : 5; // azimuth coordinate
12  unsigned sign_ : 1; // deltaPhi sign bit, part of the PT LUT address
13  unsigned front_rear : 1; // front/rear bit
14  unsigned charge_ : 1; // muon charge bit
15  unsigned eta_ : 5; // pseudo rapidity, eta[4:1] is a part of the PT LUT address
16  unsigned halo_ : 1; // halo bit
17  // synchronization error: OR of 15 SM bits for all LCTs and similar bits for 2 MB Stubs, passed to the MS
18  unsigned se : 1;
19  unsigned zero_1 : 1; // format specific
21  unsigned deltaPhi12_ : 8; // difference in phi between station 1 and 2, part of the PT LUT address
22  unsigned deltaPhi23_ : 4; // difference in phi between station 2 and 3, part of the PT LUT address
23  unsigned zero_2 : 1; // format specific
24  unsigned bxn0_ : 1; // OR of BX0 signals received with ME LCTs and MB stubs, passed to the MS
25  unsigned bc0_ : 1; // OR of BC0 signals received with ME LCTs and MB stubs, passed to the MS
26  unsigned zero_3 : 1; // format specific
28  unsigned me1_id : 3; // track stubs used to build up the track
29  unsigned me2_id : 2; // ...
30  unsigned me3_id : 2; // ...
31  unsigned me4_id : 2; // ...
32  unsigned mb_id : 3; // ...
33  unsigned ms_id : 3; // Muon Sorter Winner bit positional code
34  unsigned zero_4 : 1; // format specific
36  unsigned me1_tbin : 3; // time bins of the above track stubs used to build up a track
37  unsigned me2_tbin : 3; // ...
38  unsigned me3_tbin : 3; // ...
39  unsigned me4_tbin : 3; // ...
40  unsigned mb_tbin : 3; //
41  unsigned zero_5 : 1; // format specific
42 
43  // LCTs and MB stub, that formed this track should be easily accessible through the track interface
44  // Hence we keep copies of the data here and let top-level unpacking set these data
45  friend class CSCSPEvent;
46  CSCSP_MEblock lct_[4]; // LCTs from four stations
47  CSCSP_MBblock dt_; // MB stub
48  // LCTs and stub were used (=true) in this record
49  bool lctFilled[4], dtFilled;
50 
51  // Other data members logically belong to SP Block record,
52  // but physically are located in Data Block Header, which implementation is:
53  friend class CSCSPRecord;
54  friend class CSCTFPacker;
55  unsigned int tbin_; // time bin, that this SP block belongs to
56  unsigned int mode_; // stations, that this track crossed (they gave LCTs to build it)
57  unsigned int id_; // track number (1, 2, or 3)
58 
59 public:
60  bool check(void) const throw() { return zero_1 != 0 || zero_2 != 0 || zero_3 != 0 || zero_4 != 0 || zero_5 != 0; }
61 
62  unsigned int phi(void) const throw() { return phi_; }
63  unsigned int sign(void) const throw() { return sign_; }
64  unsigned int f_r(void) const throw() { return front_rear; };
65  unsigned int charge(void) const throw() { return charge_; }
66  unsigned int eta(void) const throw() { return eta_; }
67  unsigned int halo(void) const throw() { return halo_; }
68  unsigned int syncErr(void) const throw() { return se; }
69 
70  unsigned int deltaPhi12(void) const throw() { return deltaPhi12_; }
71  unsigned int deltaPhi23(void) const throw() { return deltaPhi23_; }
72  unsigned int bx0(void) const throw() { return bxn0_; }
73  unsigned int bc0(void) const throw() { return bc0_; }
74 
75  unsigned int ME1_id(void) const throw() { return me1_id; }
76  unsigned int ME2_id(void) const throw() { return me2_id; }
77  unsigned int ME3_id(void) const throw() { return me3_id; }
78  unsigned int ME4_id(void) const throw() { return me4_id; }
79  unsigned int MB_id(void) const throw() { return mb_id; }
80  unsigned int MS_id(void) const throw() { return ms_id; }
81 
82  unsigned int ME1_tbin(void) const throw() { return me1_tbin; }
83  unsigned int ME2_tbin(void) const throw() { return me2_tbin; }
84  unsigned int ME3_tbin(void) const throw() { return me3_tbin; }
85  unsigned int ME4_tbin(void) const throw() { return me4_tbin; }
86  unsigned int MB_tbin(void) const throw() { return mb_tbin; }
87 
88  unsigned int tbin(void) const throw() { return tbin_; }
89  unsigned int id(void) const throw() { return id_; }
90 
91  // vector may have up to 4 elements (one per station)
92  std::vector<CSCSP_MEblock> LCTs(void) const throw() {
93  std::vector<CSCSP_MEblock> result;
94  for (int station = 0; station < 4; station++)
95  if (lctFilled[station])
96  result.push_back(lct_[station]);
97  return result;
98  }
99 
100  // vector either empty or has one element
101  std::vector<CSCSP_MBblock> dtStub(void) const throw() {
102  std::vector<CSCSP_MBblock> result;
103  if (dtFilled)
104  result.push_back(dt_);
105  return result;
106  }
107 
108  unsigned int ptLUTaddress(void) const throw() {
109  return (sign_ << 20) | (mode_ << 16) | ((eta_ & 0x1E) << 11) | (deltaPhi23_ << 8) | deltaPhi12_;
110  }
111  unsigned int mode(void) const throw() { return mode_; }
112 
113  bool unpack(const unsigned short *&buf) throw() {
114  std::memcpy((void *)this, buf, 4 * sizeof(short));
115  buf += 4;
116  return check();
117  }
118 
119  CSCSP_SPblock(void) {}
120 };
121 
122 #endif
CSCSP_SPblock::zero_5
unsigned zero_5
Definition: CSCSP_SPblock.h:41
CSCSP_SPblock::ME4_id
unsigned int ME4_id(void) const
Definition: CSCSP_SPblock.h:78
CSCSP_SPblock::sign
unsigned int sign(void) const
Definition: CSCSP_SPblock.h:63
CSCSP_SPblock::ms_id
unsigned ms_id
Definition: CSCSP_SPblock.h:33
CSCSP_SPblock::MS_id
unsigned int MS_id(void) const
Definition: CSCSP_SPblock.h:80
CSCSP_MBblock
Definition: CSCSP_MBblock.h:6
CSCSP_SPblock::deltaPhi23
unsigned int deltaPhi23(void) const
Definition: CSCSP_SPblock.h:71
CSCSP_SPblock::eta
unsigned int eta(void) const
Definition: CSCSP_SPblock.h:66
CSCSP_SPblock::sign_
unsigned sign_
Definition: CSCSP_SPblock.h:12
CSCSP_SPblock::zero_2
unsigned zero_2
Definition: CSCSP_SPblock.h:23
CSCSP_SPblock::mb_id
unsigned mb_id
Definition: CSCSP_SPblock.h:32
relativeConstraints.station
station
Definition: relativeConstraints.py:67
CSCSPEvent
Definition: CSCSPEvent.h:9
CSCSP_SPblock::tbin_
unsigned int tbin_
Definition: CSCSP_SPblock.h:55
CSCSP_SPblock::mode_
unsigned int mode_
Definition: CSCSP_SPblock.h:56
CSCSP_SPblock::eta_
unsigned eta_
Definition: CSCSP_SPblock.h:15
CSCSP_SPblock::halo
unsigned int halo(void) const
Definition: CSCSP_SPblock.h:67
CSCSP_SPblock::dt_
CSCSP_MBblock dt_
Definition: CSCSP_SPblock.h:47
CSCSP_SPblock::deltaPhi12
unsigned int deltaPhi12(void) const
Definition: CSCSP_SPblock.h:70
CSCSP_SPblock::ME3_id
unsigned int ME3_id(void) const
Definition: CSCSP_SPblock.h:77
CSCSP_SPblock::lct_
CSCSP_MEblock lct_[4]
Definition: CSCSP_SPblock.h:46
CSCSP_SPblock::tbin
unsigned int tbin(void) const
Definition: CSCSP_SPblock.h:88
CSCSP_SPblock::check
bool check(void) const
Definition: CSCSP_SPblock.h:60
CSCSP_SPblock::halo_
unsigned halo_
Definition: CSCSP_SPblock.h:16
CSCSP_SPblock::deltaPhi23_
unsigned deltaPhi23_
Definition: CSCSP_SPblock.h:22
CSCSP_SPblock::syncErr
unsigned int syncErr(void) const
Definition: CSCSP_SPblock.h:68
CSCSP_SPblock::deltaPhi12_
unsigned deltaPhi12_
Definition: CSCSP_SPblock.h:21
CSCSP_SPblock::front_rear
unsigned front_rear
Definition: CSCSP_SPblock.h:13
CSCSP_SPblock::me3_tbin
unsigned me3_tbin
Definition: CSCSP_SPblock.h:38
CSCSPRecord
Definition: CSCSPRecord.h:9
CSCSP_MEblock
Definition: CSCSP_MEblock.h:6
CSCSP_SPblock::se
unsigned se
Definition: CSCSP_SPblock.h:18
CSCSP_SPblock::CSCSP_SPblock
CSCSP_SPblock(void)
Definition: CSCSP_SPblock.h:119
CSCSP_SPblock::charge_
unsigned charge_
Definition: CSCSP_SPblock.h:14
CSCSP_SPblock::unpack
bool unpack(const unsigned short *&buf)
Definition: CSCSP_SPblock.h:113
CSCTFPacker
Definition: CSCTFPacker.h:18
CSCSP_SPblock::MB_id
unsigned int MB_id(void) const
Definition: CSCSP_SPblock.h:79
CSCSP_SPblock::id
unsigned int id(void) const
Definition: CSCSP_SPblock.h:89
CSCSP_SPblock::bc0
unsigned int bc0(void) const
Definition: CSCSP_SPblock.h:73
CSCSP_SPblock::LCTs
std::vector< CSCSP_MEblock > LCTs(void) const
Definition: CSCSP_SPblock.h:92
CSCSP_SPblock::bx0
unsigned int bx0(void) const
Definition: CSCSP_SPblock.h:72
CSCSP_SPblock::dtFilled
bool dtFilled
Definition: CSCSP_SPblock.h:49
CSCSP_SPblock::ME1_id
unsigned int ME1_id(void) const
Definition: CSCSP_SPblock.h:75
CSCSP_SPblock::lctFilled
bool lctFilled[4]
Definition: CSCSP_SPblock.h:49
CSCSP_SPblock
Definition: CSCSP_SPblock.h:8
CSCSP_SPblock::me2_id
unsigned me2_id
Definition: CSCSP_SPblock.h:29
CSCSP_SPblock::charge
unsigned int charge(void) const
Definition: CSCSP_SPblock.h:65
CSCSP_SPblock::me2_tbin
unsigned me2_tbin
Definition: CSCSP_SPblock.h:37
CSCSP_SPblock::MB_tbin
unsigned int MB_tbin(void) const
Definition: CSCSP_SPblock.h:86
CSCSP_SPblock::bxn0_
unsigned bxn0_
Definition: CSCSP_SPblock.h:24
CSCSP_SPblock::phi_
unsigned phi_
Definition: CSCSP_SPblock.h:11
CSCSP_SPblock::me4_tbin
unsigned me4_tbin
Definition: CSCSP_SPblock.h:39
CSCSP_SPblock::ptLUTaddress
unsigned int ptLUTaddress(void) const
Definition: CSCSP_SPblock.h:108
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCSP_SPblock::id_
unsigned int id_
Definition: CSCSP_SPblock.h:57
CSCSP_SPblock::mode
unsigned int mode(void) const
Definition: CSCSP_SPblock.h:111
CSCSP_SPblock::bc0_
unsigned bc0_
Definition: CSCSP_SPblock.h:25
CSCSP_SPblock::ME4_tbin
unsigned int ME4_tbin(void) const
Definition: CSCSP_SPblock.h:85
CSCSP_SPblock::me4_id
unsigned me4_id
Definition: CSCSP_SPblock.h:31
CSCSP_SPblock::me3_id
unsigned me3_id
Definition: CSCSP_SPblock.h:30
CSCSP_SPblock::dtStub
std::vector< CSCSP_MBblock > dtStub(void) const
Definition: CSCSP_SPblock.h:101
CSCSP_SPblock::ME1_tbin
unsigned int ME1_tbin(void) const
Definition: CSCSP_SPblock.h:82
CSCSP_SPblock::phi
unsigned int phi(void) const
Definition: CSCSP_SPblock.h:62
CSCSP_SPblock::ME2_id
unsigned int ME2_id(void) const
Definition: CSCSP_SPblock.h:76
CSCSP_SPblock::ME3_tbin
unsigned int ME3_tbin(void) const
Definition: CSCSP_SPblock.h:84
CSCSP_SPblock::zero_3
unsigned zero_3
Definition: CSCSP_SPblock.h:26
mps_fire.result
result
Definition: mps_fire.py:303
CSCSP_SPblock::me1_tbin
unsigned me1_tbin
Definition: CSCSP_SPblock.h:36
CSCSP_SPblock::ME2_tbin
unsigned int ME2_tbin(void) const
Definition: CSCSP_SPblock.h:83
CSCSP_SPblock::zero_4
unsigned zero_4
Definition: CSCSP_SPblock.h:34
CSCSP_SPblock::me1_id
unsigned me1_id
Definition: CSCSP_SPblock.h:28
CSCSP_SPblock::f_r
unsigned int f_r(void) const
Definition: CSCSP_SPblock.h:64
CSCSP_SPblock::zero_1
unsigned zero_1
Definition: CSCSP_SPblock.h:19
CSCSP_SPblock::mb_tbin
unsigned mb_tbin
Definition: CSCSP_SPblock.h:40
CSCSP_MBblock.h
CSCSP_MEblock.h