CMS 3D CMS Logo

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