CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
unsigned int halo(void) const
Definition: CSCSP_SPblock.h:67
unsigned int MB_tbin(void) const
Definition: CSCSP_SPblock.h:86
unsigned me1_id
Definition: CSCSP_SPblock.h:28
unsigned deltaPhi23_
Definition: CSCSP_SPblock.h:22
unsigned eta_
Definition: CSCSP_SPblock.h:15
unsigned int ME4_tbin(void) const
Definition: CSCSP_SPblock.h:85
unsigned int bx0(void) const
Definition: CSCSP_SPblock.h:72
unsigned mb_tbin
Definition: CSCSP_SPblock.h:40
unsigned int deltaPhi23(void) const
Definition: CSCSP_SPblock.h:71
unsigned front_rear
Definition: CSCSP_SPblock.h:13
unsigned int MB_id(void) const
Definition: CSCSP_SPblock.h:79
unsigned zero_3
Definition: CSCSP_SPblock.h:26
std::vector< CSCSP_MBblock > dtStub(void) const
unsigned zero_5
Definition: CSCSP_SPblock.h:41
unsigned mb_id
Definition: CSCSP_SPblock.h:32
unsigned me3_tbin
Definition: CSCSP_SPblock.h:38
unsigned int tbin_
Definition: CSCSP_SPblock.h:55
unsigned zero_1
Definition: CSCSP_SPblock.h:19
unsigned sign_
Definition: CSCSP_SPblock.h:12
unsigned me2_id
Definition: CSCSP_SPblock.h:29
unsigned int syncErr(void) const
Definition: CSCSP_SPblock.h:68
unsigned deltaPhi12_
Definition: CSCSP_SPblock.h:21
unsigned int deltaPhi12(void) const
Definition: CSCSP_SPblock.h:70
unsigned int ptLUTaddress(void) const
unsigned int mode(void) const
unsigned zero_2
Definition: CSCSP_SPblock.h:23
unsigned int phi(void) const
Definition: CSCSP_SPblock.h:62
unsigned int sign(void) const
Definition: CSCSP_SPblock.h:63
tuple result
Definition: mps_fire.py:311
bool lctFilled[4]
Definition: CSCSP_SPblock.h:49
unsigned me2_tbin
Definition: CSCSP_SPblock.h:37
unsigned halo_
Definition: CSCSP_SPblock.h:16
unsigned int id(void) const
Definition: CSCSP_SPblock.h:89
unsigned int ME3_id(void) const
Definition: CSCSP_SPblock.h:77
CSCSP_MEblock lct_[4]
Definition: CSCSP_SPblock.h:46
unsigned int f_r(void) const
Definition: CSCSP_SPblock.h:64
unsigned int charge(void) const
Definition: CSCSP_SPblock.h:65
CSCSP_MBblock dt_
Definition: CSCSP_SPblock.h:47
unsigned int tbin(void) const
Definition: CSCSP_SPblock.h:88
unsigned int ME3_tbin(void) const
Definition: CSCSP_SPblock.h:84
unsigned me3_id
Definition: CSCSP_SPblock.h:30
unsigned int id_
Definition: CSCSP_SPblock.h:57
unsigned charge_
Definition: CSCSP_SPblock.h:14
bool check(void) const
Definition: CSCSP_SPblock.h:60
unsigned int ME2_tbin(void) const
Definition: CSCSP_SPblock.h:83
unsigned int bc0(void) const
Definition: CSCSP_SPblock.h:73
unsigned int ME1_id(void) const
Definition: CSCSP_SPblock.h:75
bool unpack(const unsigned short *&buf)
unsigned int eta(void) const
Definition: CSCSP_SPblock.h:66
unsigned int ME1_tbin(void) const
Definition: CSCSP_SPblock.h:82
unsigned int MS_id(void) const
Definition: CSCSP_SPblock.h:80
unsigned int ME2_id(void) const
Definition: CSCSP_SPblock.h:76
unsigned zero_4
Definition: CSCSP_SPblock.h:34
unsigned me4_tbin
Definition: CSCSP_SPblock.h:39
unsigned int mode_
Definition: CSCSP_SPblock.h:56
unsigned int ME4_id(void) const
Definition: CSCSP_SPblock.h:78
unsigned bc0_
Definition: CSCSP_SPblock.h:25
unsigned bxn0_
Definition: CSCSP_SPblock.h:24
unsigned phi_
Definition: CSCSP_SPblock.h:11
std::vector< CSCSP_MEblock > LCTs(void) const
Definition: CSCSP_SPblock.h:92
unsigned ms_id
Definition: CSCSP_SPblock.h:33
unsigned me1_tbin
Definition: CSCSP_SPblock.h:36
unsigned me4_id
Definition: CSCSP_SPblock.h:31