CMS 3D CMS Logo

EMTFTrack.h
Go to the documentation of this file.
1 // Class for muon tracks in EMTF - AWB 04.01.16
2 // Mostly copied from L1Trigger/L1TMuonEndCap/interface/MuonInternalTrack.h
3 
4 #ifndef DataFormats_L1TMuon_EMTFTrack_h
5 #define DataFormats_L1TMuon_EMTFTrack_h
6 
7 #include <cstdint>
8 #include <vector>
9 
13 
14 namespace l1t {
15 
16  namespace emtf {
17  // Want a scoped enum, not necessarily a strongly-typed enum.
18  // This is because of all the casting that will be required throughout legacy code
19  // (usage will likely rely on implicit integer casting)
20  enum class EMTFCSCStation { ME1 = 0, ME2, ME3, ME4 };
21  enum class EMTFCSCSection { ME1sub1 = 0, ME1sub2, ME2, ME3, ME4 };
22  } // namespace emtf
23 
24  struct EMTFPtLUT {
26  uint16_t mode;
27  uint16_t theta;
28  uint16_t st1_ring2;
29  uint16_t eta;
30  uint16_t delta_ph[6]; // index: 0=12, 1=13, 2=14, 3=23, 4=24, 5=34
31  uint16_t delta_th[6]; // ^
32  uint16_t sign_ph[6]; // ^
33  uint16_t sign_th[6]; // ^
34  uint16_t cpattern[4]; // index: 0=ME1, 1=ME2, 2=ME3, 3=ME4
35  uint16_t csign[4]; // index: 0=ME1, 1=ME2, 2=ME3, 3=ME4
36  uint16_t slope[4]; // index: 0=ME1, 1=ME2, 2=ME3, 3=ME4
37  uint16_t fr[4]; // ^
38  uint16_t bt_vi[5]; // index: 0=ME1sub1, 1=ME1sub2, 2=ME2, 3=ME3, 4=ME4
39  uint16_t bt_hi[5]; // ^
40  uint16_t bt_ci[5]; // ^
41  uint16_t bt_si[5]; // ^
42  };
43 
44  class EMTFTrack {
45  public:
47  : _PtLUT(),
48  endcap(-99),
49  sector(-99),
50  sector_idx(-99),
51  mode(-99),
52  mode_CSC(0),
53  mode_RPC(0),
54  mode_GEM(0),
55  mode_neighbor(0),
56  mode_inv(-99),
57  rank(-99),
58  winner(-99),
59  charge(-99),
60  bx(-99),
61  first_bx(-99),
62  second_bx(-99),
63  pt(-99),
64  pt_XML(-99),
65  pt_dxy(-99),
66  dxy(-99),
67  zone(-99),
68  ph_num(-99),
69  ph_q(-99),
70  theta_fp(-99),
71  theta(-99),
72  eta(-99),
73  phi_fp(-99),
74  phi_loc(-99),
75  phi_glob(-999),
76  gmt_pt(-99),
77  gmt_pt_dxy(-99),
78  gmt_dxy(-99),
79  gmt_phi(-999),
80  gmt_eta(-999),
81  gmt_quality(-99),
82  gmt_charge(-99),
83  gmt_charge_valid(-99),
84  track_num(-99),
85  numHits(-99) {}
86 
87  virtual ~EMTFTrack() {}
88 
89  void ImportSP(const emtf::SP _SP, int _sector);
90  // void ImportPtLUT( int _mode, unsigned long _address );
91 
92  void clear_Hits() {
93  _Hits.clear();
94  numHits = 0;
95  mode_CSC = 0;
96  mode_RPC = 0;
97  mode_GEM = 0;
98  mode_neighbor = 0;
99  }
100 
101  void push_Hit(const EMTFHit& hit) {
102  _Hits.push_back(hit);
103  numHits = _Hits.size();
104  if (hit.Is_CSC())
105  mode_CSC |= (1 << (4 - hit.Station()));
106  if (hit.Is_RPC())
107  mode_RPC |= (1 << (4 - hit.Station()));
108  if (hit.Is_GEM())
109  mode_GEM |= (1 << (4 - hit.Station()));
110  if (hit.Neighbor())
111  mode_neighbor |= (1 << (4 - hit.Station()));
112  }
113 
115  clear_Hits();
116  for (const auto& hit : hits)
117  push_Hit(hit);
118  }
119 
120  void clear_HitIdx() { _HitIdx.clear(); }
121  void push_HitIdx(unsigned int bits) { _HitIdx.push_back(bits); }
122  void set_HitIdx(const std::vector<unsigned int>& bits) { _HitIdx = bits; }
123 
124  int NumHits() const { return numHits; }
125  EMTFHitCollection Hits() const { return _Hits; }
126  std::vector<unsigned int> HitIdx() const { return _HitIdx; }
127 
129  EMTFPtLUT PtLUT() const { return _PtLUT; }
130 
131  void set_endcap(int bits) { endcap = bits; }
132  void set_sector(int bits) { sector = bits; }
134  void set_mode(int bits) { mode = bits; }
135  void set_mode_inv(int bits) { mode_inv = bits; }
136  void set_rank(int bits) { rank = bits; }
137  void set_winner(int bits) { winner = bits; }
138  void set_charge(int bits) { charge = bits; }
139  void set_bx(int bits) { bx = bits; }
140  void set_first_bx(int bits) { first_bx = bits; }
141  void set_second_bx(int bits) { second_bx = bits; }
142  void set_pt(float val) { pt = val; }
143  void set_pt_XML(float val) { pt_XML = val; }
144  void set_pt_dxy(float val) { pt_dxy = val; }
145  void set_dxy(float val) { dxy = val; }
146  void set_zone(int bits) { zone = bits; }
147  void set_ph_num(int bits) { ph_num = bits; }
148  void set_ph_q(int bits) { ph_q = bits; }
149  void set_theta_fp(int bits) { theta_fp = bits; }
150  void set_theta(float val) { theta = val; }
151  void set_eta(float val) { eta = val; }
152  void set_phi_fp(int bits) { phi_fp = bits; }
153  void set_phi_loc(float val) { phi_loc = val; }
154  void set_phi_glob(float val) { phi_glob = val; }
155  void set_gmt_pt(int bits) { gmt_pt = bits; }
157  void set_gmt_dxy(int bits) { gmt_dxy = bits; }
158  void set_gmt_phi(int bits) { gmt_phi = bits; }
159  void set_gmt_eta(int bits) { gmt_eta = bits; }
163  void set_track_num(int bits) { track_num = bits; }
164 
165  int Endcap() const { return endcap; }
166  int Sector() const { return sector; }
167  int Sector_idx() const { return sector_idx; }
168  int Mode() const { return mode; }
169  int Mode_CSC() const { return mode_CSC; }
170  int Mode_RPC() const { return mode_RPC; }
171  int Mode_GEM() const { return mode_GEM; }
172  int Mode_neighbor() const { return mode_neighbor; }
173  int Mode_inv() const { return mode_inv; }
174  int Rank() const { return rank; }
175  int Winner() const { return winner; }
176  int Charge() const { return charge; }
177  int BX() const { return bx; }
178  int First_BX() const { return first_bx; }
179  int Second_BX() const { return second_bx; }
180  float Pt() const { return pt; }
181  float Pt_XML() const { return pt_XML; }
182  float Pt_dxy() const { return pt_dxy; }
183  float Dxy() const { return dxy; }
184  int Zone() const { return zone; }
185  int Ph_num() const { return ph_num; }
186  int Ph_q() const { return ph_q; }
187  int Theta_fp() const { return theta_fp; }
188  float Theta() const { return theta; }
189  float Eta() const { return eta; }
190  int Phi_fp() const { return phi_fp; }
191  float Phi_loc() const { return phi_loc; }
192  float Phi_glob() const { return phi_glob; }
193  int GMT_pt() const { return gmt_pt; }
194  int GMT_pt_dxy() const { return gmt_pt_dxy; }
195  int GMT_dxy() const { return gmt_dxy; }
196  int GMT_phi() const { return gmt_phi; }
197  int GMT_eta() const { return gmt_eta; }
198  int GMT_quality() const { return gmt_quality; }
199  int GMT_charge() const { return gmt_charge; }
200  int GMT_charge_valid() const { return gmt_charge_valid; }
201  int Track_num() const { return track_num; }
202 
203  private:
205  std::vector<unsigned int> _HitIdx;
206 
208 
209  int endcap; // +/-1. For ME+ and ME-.
210  int sector; // 1 - 6.
211  int sector_idx; // 0 - 11. 0 - 5 for ME+, 6 - 11 for ME-.
212  int mode; // 0 - 15.
213  int mode_CSC; // 0 - 15, CSC-only
214  int mode_RPC; // 0 - 15, RPC-only
215  int mode_GEM; // 0 - 15, GEM-only // TODO: verify if needed when including GEM, also start the good habit of documenting these
216  int mode_neighbor; // 0 - 15, only neighbor hits
217  int mode_inv; // 15 - 0.
218  int rank; // 0 - 127 (Range? - AWB 03.03.17)
219  int winner; // 0 - 2. (Range? - AWB 03.03.17)
220  int charge; // +/-1. For physical charge (reversed from GMT convention)
221  int bx; // -3 - +3.
222  int first_bx; // -3 - +3.
223  int second_bx; // -3 - +3.
224  float pt; // 0 - 255
225  float pt_XML; // 0 - 999
226  float pt_dxy; // 0 - 127
227  float dxy; // 0 - 3
228  int zone; // 0 - 3.
229  int ph_num;
230  int ph_q;
231  int theta_fp; // 0 - 127
232  float theta; // 0 - 90.
233  float eta; // +/-2.5.
234  int phi_fp; // 0 - 4920
235  float phi_loc; // -22 - 60 (Range? - AWB 03.03.17)
236  float phi_glob; // +/-180.
237  int gmt_pt;
239  int gmt_dxy;
240  int gmt_phi;
241  int gmt_eta;
245  int track_num; // 0 - ??. (Range? - AWB 03.03.17)
246  int numHits; // 1 - 4.
247 
248  }; // End of class EMTFTrack
249 
250  // Define a vector of EMTFTrack
251  typedef std::vector<EMTFTrack> EMTFTrackCollection;
252 
253 } // End of namespace l1t
254 
255 #endif /* define DataFormats_L1TMuon_EMTFTrack_h */
void set_mode(int bits)
Definition: EMTFTrack.h:134
void clear_Hits()
Definition: EMTFTrack.h:92
int Mode_neighbor() const
Definition: EMTFTrack.h:172
int Winner() const
Definition: EMTFTrack.h:175
int Sector_idx() const
Definition: EMTFTrack.h:167
void set_bx(int bits)
Definition: EMTFTrack.h:139
int Mode_RPC() const
Definition: EMTFTrack.h:170
float Pt() const
Definition: EMTFTrack.h:180
void set_second_bx(int bits)
Definition: EMTFTrack.h:141
float Theta() const
Definition: EMTFTrack.h:188
uint16_t bt_si[5]
Definition: EMTFTrack.h:41
uint16_t bt_ci[5]
Definition: EMTFTrack.h:40
void set_gmt_eta(int bits)
Definition: EMTFTrack.h:159
int First_BX() const
Definition: EMTFTrack.h:178
uint16_t sign_ph[6]
Definition: EMTFTrack.h:32
void set_sector(int bits)
Definition: EMTFTrack.h:132
float Dxy() const
Definition: EMTFTrack.h:183
EMTFPtLUT _PtLUT
Definition: EMTFTrack.h:207
float Pt_dxy() const
Definition: EMTFTrack.h:182
int Mode_inv() const
Definition: EMTFTrack.h:173
void set_phi_fp(int bits)
Definition: EMTFTrack.h:152
int Sector() const
Definition: EMTFTrack.h:166
int Theta_fp() const
Definition: EMTFTrack.h:187
int Mode_CSC() const
Definition: EMTFTrack.h:169
void set_first_bx(int bits)
Definition: EMTFTrack.h:140
int Charge() const
Definition: EMTFTrack.h:176
int GMT_charge() const
Definition: EMTFTrack.h:199
void set_charge(int bits)
Definition: EMTFTrack.h:138
uint16_t bt_vi[5]
Definition: EMTFTrack.h:38
int GMT_pt_dxy() const
Definition: EMTFTrack.h:194
uint16_t mode
Definition: EMTFTrack.h:26
int Rank() const
Definition: EMTFTrack.h:174
void set_ph_num(int bits)
Definition: EMTFTrack.h:147
int gmt_charge_valid
Definition: EMTFTrack.h:244
Definition: Event.h:15
delete x;
Definition: CaloConfig.h:22
uint16_t eta
Definition: EMTFTrack.h:29
void ImportSP(const emtf::SP _SP, int _sector)
EMTFCSCSection
Definition: EMTFTrack.h:21
uint16_t delta_ph[6]
Definition: EMTFTrack.h:30
int Mode() const
Definition: EMTFTrack.h:168
void set_PtLUT(EMTFPtLUT bits)
Definition: EMTFTrack.h:128
float phi_glob
Definition: EMTFTrack.h:236
void set_sector_idx(int bits)
Definition: EMTFTrack.h:133
void set_gmt_phi(int bits)
Definition: EMTFTrack.h:158
void set_pt(float val)
Definition: EMTFTrack.h:142
uint16_t delta_th[6]
Definition: EMTFTrack.h:31
float Phi_loc() const
Definition: EMTFTrack.h:191
float Eta() const
Definition: EMTFTrack.h:189
void set_gmt_pt_dxy(int bits)
Definition: EMTFTrack.h:156
EMTFHitCollection Hits() const
Definition: EMTFTrack.h:125
void set_zone(int bits)
Definition: EMTFTrack.h:146
int NumHits() const
Definition: EMTFTrack.h:124
uint16_t theta
Definition: EMTFTrack.h:27
int GMT_quality() const
Definition: EMTFTrack.h:198
void set_gmt_quality(int bits)
Definition: EMTFTrack.h:160
int BX() const
Definition: EMTFTrack.h:177
int Endcap() const
Definition: EMTFTrack.h:165
std::vector< EMTFHit > EMTFHitCollection
Definition: EMTFHit.h:381
uint16_t slope[4]
Definition: EMTFTrack.h:36
float Pt_XML() const
Definition: EMTFTrack.h:181
int Ph_num() const
Definition: EMTFTrack.h:185
int Second_BX() const
Definition: EMTFTrack.h:179
uint16_t cpattern[4]
Definition: EMTFTrack.h:34
void set_track_num(int bits)
Definition: EMTFTrack.h:163
int Ph_q() const
Definition: EMTFTrack.h:186
uint16_t fr[4]
Definition: EMTFTrack.h:37
int Zone() const
Definition: EMTFTrack.h:184
void set_rank(int bits)
Definition: EMTFTrack.h:136
void set_theta_fp(int bits)
Definition: EMTFTrack.h:149
void set_gmt_dxy(int bits)
Definition: EMTFTrack.h:157
int GMT_eta() const
Definition: EMTFTrack.h:197
void clear_HitIdx()
Definition: EMTFTrack.h:120
std::vector< unsigned int > _HitIdx
Definition: EMTFTrack.h:205
int GMT_dxy() const
Definition: EMTFTrack.h:195
void set_eta(float val)
Definition: EMTFTrack.h:151
void set_winner(int bits)
Definition: EMTFTrack.h:137
void set_gmt_charge(int bits)
Definition: EMTFTrack.h:161
void set_theta(float val)
Definition: EMTFTrack.h:150
uint16_t sign_th[6]
Definition: EMTFTrack.h:33
unsigned long long uint64_t
Definition: Time.h:13
void push_HitIdx(unsigned int bits)
Definition: EMTFTrack.h:121
float Phi_glob() const
Definition: EMTFTrack.h:192
int GMT_pt() const
Definition: EMTFTrack.h:193
uint16_t st1_ring2
Definition: EMTFTrack.h:28
EMTFHitCollection _Hits
Definition: EMTFTrack.h:204
void set_endcap(int bits)
Definition: EMTFTrack.h:131
uint64_t address
Definition: EMTFTrack.h:25
void set_ph_q(int bits)
Definition: EMTFTrack.h:148
EMTFCSCStation
Definition: EMTFTrack.h:20
int Phi_fp() const
Definition: EMTFTrack.h:190
void set_pt_XML(float val)
Definition: EMTFTrack.h:143
EMTFPtLUT PtLUT() const
Definition: EMTFTrack.h:129
void set_HitIdx(const std::vector< unsigned int > &bits)
Definition: EMTFTrack.h:122
int Mode_GEM() const
Definition: EMTFTrack.h:171
int Track_num() const
Definition: EMTFTrack.h:201
void push_Hit(const EMTFHit &hit)
Definition: EMTFTrack.h:101
void set_Hits(const EMTFHitCollection &hits)
Definition: EMTFTrack.h:114
void set_phi_loc(float val)
Definition: EMTFTrack.h:153
virtual ~EMTFTrack()
Definition: EMTFTrack.h:87
void set_gmt_charge_valid(int bits)
Definition: EMTFTrack.h:162
std::vector< EMTFTrack > EMTFTrackCollection
Definition: EMTFTrack.h:251
void set_phi_glob(float val)
Definition: EMTFTrack.h:154
uint16_t csign[4]
Definition: EMTFTrack.h:35
uint16_t bt_hi[5]
Definition: EMTFTrack.h:39
int GMT_phi() const
Definition: EMTFTrack.h:196
void set_mode_inv(int bits)
Definition: EMTFTrack.h:135
void set_gmt_pt(int bits)
Definition: EMTFTrack.h:155
std::vector< unsigned int > HitIdx() const
Definition: EMTFTrack.h:126
void set_dxy(float val)
Definition: EMTFTrack.h:145
int GMT_charge_valid() const
Definition: EMTFTrack.h:200
void set_pt_dxy(float val)
Definition: EMTFTrack.h:144