CMS 3D CMS Logo

EMTFBlockSP.cc
Go to the documentation of this file.
1 // Code to unpack the "SP Output Data Record"
2 
4 
5 #include "EMTFCollections.h"
6 #include "EMTFUnpackerTools.h"
7 
8 // This is the "header" - no EMTFBlockSP.h file is needed
9 namespace l1t {
10  namespace stage2 {
11  namespace emtf {
12 
13  class SPBlockUnpacker : public Unpacker { // "SPBlockUnpacker" inherits from "Unpacker"
14  public:
15  virtual int checkFormat(const Block& block);
16  virtual bool unpack(const Block& block, UnpackerCollections *coll) override; // Apparently it's always good to use override in C++
17  // virtual bool packBlock(const Block& block, UnpackerCollections *coll) override;
18  };
19 
20 
21  // class SPBlockPacker : public Packer { // "SPBlockPacker" inherits from "Packer"
22  // public:
23  // virtual bool unpack(const Block& block, UnpackerCollections *coll) override; // Apparently it's always good to use override in C++
24  // };
25 
26  }
27  }
28 }
29 
30 namespace l1t {
31  namespace stage2 {
32  namespace emtf {
33 
35 
36  auto payload = block.payload();
37  int errors = 0;
38 
39  // Check the number of 16-bit words
40  if (payload.size() != 8) { errors += 1;
41  edm::LogError("L1T|EMTF") << "Payload size in 'SP Output Data Record' is different than expected"; }
42 
43  // Check that each word is 16 bits
44  for (unsigned int i = 0; i < 8; i++) {
45  if (GetHexBits(payload[i], 16, 31) != 0) { errors += 1;
46  edm::LogError("L1T|EMTF") << "Payload[" << i << "] has more than 16 bits in 'SP Output Data Record'"; }
47  }
48 
49  uint16_t SP1a = payload[0];
50  uint16_t SP1b = payload[1];
51  uint16_t SP1c = payload[2];
52  uint16_t SP1d = payload[3];
53  uint16_t SP2a = payload[4];
54  uint16_t SP2b = payload[5];
55  uint16_t SP2c = payload[6];
56  uint16_t SP2d = payload[7];
57 
58  // Check Format
59  if (GetHexBits(SP1a, 15, 15) != 1) { errors += 1;
60  edm::LogError("L1T|EMTF") << "Format identifier bits in SP1a are incorrect"; }
61  if (GetHexBits(SP1b, 15, 15) != 0) { errors += 1;
62  edm::LogError("L1T|EMTF") << "Format identifier bits in SP1b are incorrect"; }
63  if (GetHexBits(SP1c, 15, 15) != 1) { errors += 1;
64  edm::LogError("L1T|EMTF") << "Format identifier bits in SP1c are incorrect"; }
65  if (GetHexBits(SP1d, 15, 15) != 0) { errors += 1;
66  edm::LogError("L1T|EMTF") << "Format identifier bits in SP1d are incorrect"; }
67  if (GetHexBits(SP2a, 15, 15) != 0) { errors += 1;
68  edm::LogError("L1T|EMTF") << "Format identifier bits in SP2a are incorrect"; }
69  if (GetHexBits(SP2b, 15, 15) != 1) { errors += 1;
70  edm::LogError("L1T|EMTF") << "Format identifier bits in SP2b are incorrect"; }
71  if (GetHexBits(SP2c, 15, 15) != 1) { errors += 1;
72  edm::LogError("L1T|EMTF") << "Format identifier bits in SP2c are incorrect"; }
73  if (GetHexBits(SP2d, 15, 15) != 0) { errors += 1;
74  edm::LogError("L1T|EMTF") << "Format identifier bits in SP2d are incorrect"; }
75 
76  return errors;
77 
78  }
79 
80 
81  // Converts CSC_ID, sector, subsector, and neighbor
82  std::vector<int> convert_SP_location(int _csc_ID, int _sector, int _subsector, int _station) {
83  int new_sector = _sector;
84  if (_station == 1) {
85  if (_csc_ID < 0) { int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4); return vec; }
86  else if (_csc_ID == 0) { int arr[] = { -1, -1, -1, -1}; std::vector<int> vec(arr, arr+4); return vec; }
87  else if (_csc_ID <= 9) { int arr[] = {_csc_ID, new_sector, _subsector+1, 0}; std::vector<int> vec(arr, arr+4); return vec; }
88  else new_sector = (_sector != 1) ? _sector-1 : 6;
89 
90  if (_csc_ID == 10) { int arr[] = {3, new_sector, 2, 1}; std::vector<int> vec(arr, arr+4); return vec; }
91  else if (_csc_ID == 11) { int arr[] = {6, new_sector, 2, 1}; std::vector<int> vec(arr, arr+4); return vec; }
92  else if (_csc_ID == 12) { int arr[] = {9, new_sector, 2, 1}; std::vector<int> vec(arr, arr+4); return vec; }
93  else { int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4); return vec; }
94  }
95  else if (_station == 2 || _station == 3 || _station == 4) {
96  if (_csc_ID < 0) { int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4); return vec; }
97  else if (_csc_ID == 0) { int arr[] = { -1, -1, -1, -1}; std::vector<int> vec(arr, arr+4); return vec; }
98  else if (_csc_ID <= 9) { int arr[] = {_csc_ID, new_sector, -1, 0}; std::vector<int> vec(arr, arr+4); return vec; }
99  else new_sector = (_sector != 1) ? _sector-1 : 6;
100 
101  if (_csc_ID == 10) { int arr[] = {3, new_sector, -1, 1}; std::vector<int> vec(arr, arr+4); return vec; }
102  else if (_csc_ID == 11) { int arr[] = {9, new_sector, -1, 1}; std::vector<int> vec(arr, arr+4); return vec; }
103  else { int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4); return vec; }
104  }
105  else { int arr[] = {-99, -99, -99, -99}; std::vector<int> vec(arr, arr+4); return vec; }
106  }
107 
109 
110  // std::cout << "Inside EMTFBlockSP.cc: unpack" << std::endl;
111  // LogDebug("L1T|EMTF") << "Inside EMTFBlockSP.cc: unpack"; // Why doesn't this work? - AWB 09.04.16
112 
113  // Get the payload for this block, made up of 16-bit words (0xffff)
114  // Format defined in MTF7Payload::getBlock() in src/Block.cc
115  // payload[0] = bits 0-15, payload[1] = 16-31, payload[3] = 32-47, etc.
116  auto payload = block.payload();
117 
118  // Check Format of Payload
119  l1t::emtf::SP SP_;
120  for (int err = 0; err < checkFormat(block); err++) SP_.add_format_error();
121 
122  // Assign payload to 16-bit words
123  uint16_t SP1a = payload[0];
124  uint16_t SP1b = payload[1];
125  uint16_t SP1c = payload[2];
126  uint16_t SP1d = payload[3];
127  uint16_t SP2a = payload[4];
128  uint16_t SP2b = payload[5];
129  uint16_t SP2c = payload[6];
130  uint16_t SP2d = payload[7];
131 
132  // res is a pointer to a collection of EMTFDaqOut class objects
133  // There is one EMTFDaqOut for each MTF7 (60 deg. sector) in the event
135  res = static_cast<EMTFCollections*>(coll)->getEMTFDaqOuts();
136  int iOut = res->size() - 1;
137  std::vector<int> conv_vals_SP;
138  std::vector<int> conv_vals_pT_LUT;
139 
140  EMTFHitCollection* res_hit;
141  res_hit = static_cast<EMTFCollections*>(coll)->getEMTFHits();
142 
143  EMTFTrackCollection* res_track;
144  res_track = static_cast<EMTFCollections*>(coll)->getEMTFTracks();
145  EMTFTrack Track_;
146 
148  res_cand = static_cast<EMTFCollections*>(coll)->getRegionalMuonCands();
149  RegionalMuonCand mu_;
150 
152  // Unpack the SP Output Data Record
154 
155  SP_.set_phi_full ( GetHexBits(SP1a, 0, 12) );
156  SP_.set_c ( GetHexBits(SP1a, 13, 13) );
157  SP_.set_hl ( GetHexBits(SP1a, 14, 14) );
158 
159  SP_.set_phi_GMT ( TwosCompl(8, GetHexBits(SP1b, 0, 7)) );
160  SP_.set_quality_GMT ( GetHexBits(SP1b, 8, 11) );
161  SP_.set_bc0 ( GetHexBits(SP1b, 12, 12) );
162  SP_.set_se ( GetHexBits(SP1b, 13, 13) );
163  SP_.set_vc ( GetHexBits(SP1b, 14, 14) );
164 
165  SP_.set_eta_GMT ( TwosCompl(9, GetHexBits(SP1c, 0, 8)) );
166  SP_.set_mode ( GetHexBits(SP1c, 9, 12) );
167  SP_.set_bx ( GetHexBits(SP1c, 13, 14) );
168 
169  SP_.set_pt_GMT ( GetHexBits(SP1d, 0, 8) );
170  SP_.set_me1_stub_num ( GetHexBits(SP1d, 9, 9) );
171  SP_.set_me1_CSC_ID ( GetHexBits(SP1d, 10, 13) );
172  SP_.set_me1_subsector( GetHexBits(SP1d, 14, 14) );
173 
174  SP_.set_me2_stub_num ( GetHexBits(SP2a, 0, 0 ) );
175  SP_.set_me2_CSC_ID ( GetHexBits(SP2a, 1, 4 ) );
176  SP_.set_me3_stub_num ( GetHexBits(SP2a, 5, 5 ) );
177  SP_.set_me3_CSC_ID ( GetHexBits(SP2a, 6, 9 ) );
178  SP_.set_me4_stub_num ( GetHexBits(SP2a, 10, 10) );
179  SP_.set_me4_CSC_ID ( GetHexBits(SP2a, 11, 14) );
180 
181  SP_.set_me1_delay ( GetHexBits(SP2b, 0, 2) );
182  SP_.set_me2_delay ( GetHexBits(SP2b, 3, 5) );
183  SP_.set_me3_delay ( GetHexBits(SP2b, 6, 8) );
184  SP_.set_me4_delay ( GetHexBits(SP2b, 9, 11) );
185  SP_.set_tbin ( GetHexBits(SP2b, 12, 14) );
186 
187  SP_.set_pt_LUT_addr ( GetHexBits(SP2c, 0, 14, SP2d, 0, 14) );
188 
189  // SP_.set_dataword ( uint64_t dataword );
190 
191  ImportSP( Track_, SP_, (res->at(iOut)).PtrEventHeader()->Endcap(), (res->at(iOut)).PtrEventHeader()->Sector() );
192  // Track_.ImportPtLUT( Track_.Mode(), Track_.Pt_LUT_addr() ); // Deprecated ... replace? - AWB 15.03.17
193 
194  if ( (res->at(iOut)).PtrSPCollection()->size() > 0 )
195  if ( SP_.TBIN() == (res->at(iOut)).PtrSPCollection()->at( (res->at(iOut)).PtrSPCollection()->size() - 1 ).TBIN() )
196  Track_.set_track_num( (res->at(iOut)).PtrSPCollection()->size() );
197  else Track_.set_track_num( 0 );
198  else Track_.set_track_num( 0 );
199 
200  mu_.setHwSign ( SP_.C() );
201  mu_.setHwSignValid ( SP_.VC() );
202  mu_.setHwQual ( SP_.Quality_GMT() );
203  mu_.setHwEta ( SP_.Eta_GMT() );
204  mu_.setHwPhi ( SP_.Phi_GMT() );
205  mu_.setHwPt ( SP_.Pt_GMT() );
206  mu_.setTFIdentifiers ( Track_.Sector() - 1, (Track_.Endcap() == 1) ? emtf_pos : emtf_neg );
208  // mu_.set_dataword ( SP_.Dataword() );
209  // Track_.set_GMT(mu_);
210 
212  // Match hits to tracks
214 
215  // Find the track delay
216  int nDelay[3] = {0, 0, 0}; // Number of hits in the track with delay 0, 1, or 2
217  if ( Track_.Mode() >= 8) nDelay[SP_.ME1_delay()] += 1;
218  if ((Track_.Mode() % 8) >= 4) nDelay[SP_.ME2_delay()] += 1;
219  if ((Track_.Mode() % 4) >= 2) nDelay[SP_.ME3_delay()] += 1;
220  if ((Track_.Mode() % 2) == 1) nDelay[SP_.ME4_delay()] += 1;
221 
222  int trk_delay = -99;
223  // Assume 2nd-earliest LCT configuration
224  if (nDelay[2] >= 2) trk_delay = 2;
225  else if (nDelay[2] + nDelay[1] >= 2) trk_delay = 1;
226  else if (nDelay[2] + nDelay[1] + nDelay[0] >= 2) trk_delay = 0;
227 
228  // // For earliest LCT configuration
229  // if (nDelay[2] >= 1) trk_delay = 2;
230  // else if (nDelay[2] + nDelay[1] >= 1) trk_delay = 1;
231  // else if (nDelay[2] + nDelay[1] + nDelay[0] >= 1) trk_delay = 0;
232 
233  int St_hits[4] = {0, 0, 0, 0}; // Number of matched hits in each station
234 
235  for (unsigned int iHit = 0; iHit < res_hit->size(); iHit++) {
236 
237  if ( (res_hit->at(iHit)).Endcap() != Track_.Endcap() ) continue;
238 
239  int hit_delay = -99;
240  if ( (res_hit->at(iHit)).Station() == 1 ) hit_delay = SP_.ME1_delay();
241  else if ( (res_hit->at(iHit)).Station() == 2 ) hit_delay = SP_.ME2_delay();
242  else if ( (res_hit->at(iHit)).Station() == 3 ) hit_delay = SP_.ME3_delay();
243  else if ( (res_hit->at(iHit)).Station() == 4 ) hit_delay = SP_.ME4_delay();
244 
245  // Require exact matching according to TBIN and delays
246  if ( (res_hit->at(iHit)).BX() + 3 + hit_delay != SP_.TBIN() + trk_delay ) continue;
247 
248  // Match hit in station 1
249  conv_vals_SP = convert_SP_location( SP_.ME1_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), SP_.ME1_subsector(), 1 );
250 
251  if ( (res_hit->at(iHit)).Station() == 1 &&
252  (res_hit->at(iHit)).Sector() == conv_vals_SP.at(1) &&
253  (res_hit->at(iHit)).Neighbor() == conv_vals_SP.at(3) &&
254  (res_hit->at(iHit)).Stub_num() == SP_.ME1_stub_num() ) {
255 
256  if ( (res_hit->at(iHit)).Is_CSC() == 1 &&
257  ( (res_hit->at(iHit)).CSC_ID() != conv_vals_SP.at(0) ||
258  (res_hit->at(iHit)).Subsector() != conv_vals_SP.at(2) ) ) continue;
259 
260  int RPC_subsector = (((res_hit->at(iHit)).Subsector() - 1) / 3) + 1; // Map RPC subsector to equivalent CSC subsector
261  int RPC_CSC_ID = (((res_hit->at(iHit)).Subsector() - 1) % 3) + 4; // Map RPC subsector and ring to equivalent CSC ID
262 
263  if ( (res_hit->at(iHit)).Is_RPC() == 1 &&
264  ( RPC_CSC_ID != conv_vals_SP.at(0) ||
265  RPC_subsector != conv_vals_SP.at(2) ) ) continue;
266 
267  if (St_hits[0] == 0 ) { // Only add the first matched hit to the track
268  Track_.push_Hit( res_hit->at(iHit) );
271  L1TMuonEndCap::calc_uGMT_chamber( conv_vals_SP.at(0),
272  conv_vals_SP.at(2),
273  conv_vals_SP.at(3), 1) );
274  }
275  St_hits[0] += 1; // Count the total number of matches for debugging purposes
276  } // End conditional: if ( (res_hit->at(iHit)).Station() == 1
277 
278 
279  // Match hit in station 2
280  conv_vals_SP = convert_SP_location( SP_.ME2_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), -99, 2 );
281 
282  if ( (res_hit->at(iHit)).Station() == 2 &&
283  (res_hit->at(iHit)).Sector() == conv_vals_SP.at(1) &&
284  (res_hit->at(iHit)).Neighbor() == conv_vals_SP.at(3) &&
285  (res_hit->at(iHit)).Stub_num() == SP_.ME2_stub_num() ) {
286 
287  if ( (res_hit->at(iHit)).Is_CSC() == 1 &&
288  (res_hit->at(iHit)).CSC_ID() != conv_vals_SP.at(0) ) continue;
289 
290  if ( (res_hit->at(iHit)).Is_RPC() == 1 &&
291  (res_hit->at(iHit)).Subsector() + 3 != conv_vals_SP.at(0) ) continue;
292 
293  if (St_hits[1] == 0 ) {
294  Track_.push_Hit( res_hit->at(iHit) );
297  L1TMuonEndCap::calc_uGMT_chamber( conv_vals_SP.at(0),
298  conv_vals_SP.at(2),
299  conv_vals_SP.at(3), 2) );
300  }
301  St_hits[1] += 1;
302  } // End conditional: if ( (res_hit->at(iHit)).Station() == 2
303 
304 
305  // Match hit in station 3
306  conv_vals_SP = convert_SP_location( SP_.ME3_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), -99, 3 );
307 
308  if ( (res_hit->at(iHit)).Station() == 3 &&
309  (res_hit->at(iHit)).Sector() == conv_vals_SP.at(1) &&
310  (res_hit->at(iHit)).Neighbor() == conv_vals_SP.at(3) &&
311  (res_hit->at(iHit)).Stub_num() == SP_.ME3_stub_num() ) {
312 
313  if ( (res_hit->at(iHit)).Is_CSC() == 1 &&
314  (res_hit->at(iHit)).CSC_ID() != conv_vals_SP.at(0) ) continue;
315 
316  if ( (res_hit->at(iHit)).Is_RPC() == 1 &&
317  (res_hit->at(iHit)).Subsector() + 3 != conv_vals_SP.at(0) ) continue;
318 
319  if (St_hits[2] == 0 ) {
320  Track_.push_Hit( res_hit->at(iHit) );
323  L1TMuonEndCap::calc_uGMT_chamber( conv_vals_SP.at(0),
324  conv_vals_SP.at(2),
325  conv_vals_SP.at(3), 3) );
326  }
327  St_hits[2] += 1;
328  } // End conditional: if ( (res_hit->at(iHit)).Station() == 3
329 
330 
331  // Match hit in station 4
332  conv_vals_SP = convert_SP_location( SP_.ME4_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), -99, 4 );
333 
334  if ( (res_hit->at(iHit)).Station() == 4 &&
335  (res_hit->at(iHit)).Sector() == conv_vals_SP.at(1) &&
336  (res_hit->at(iHit)).Neighbor() == conv_vals_SP.at(3) &&
337  (res_hit->at(iHit)).Stub_num() == SP_.ME4_stub_num() ) {
338 
339  if ( (res_hit->at(iHit)).Is_CSC() == 1 &&
340  (res_hit->at(iHit)).CSC_ID() != conv_vals_SP.at(0) ) continue;
341 
342  if ( (res_hit->at(iHit)).Is_RPC() == 1 &&
343  (res_hit->at(iHit)).Subsector() + 3 != conv_vals_SP.at(0) ) continue;
344 
345  if (St_hits[3] == 0 ) {
346  Track_.push_Hit( res_hit->at(iHit) );
349  L1TMuonEndCap::calc_uGMT_chamber( conv_vals_SP.at(0),
350  conv_vals_SP.at(2),
351  conv_vals_SP.at(3), 4) );
352  }
353  St_hits[3] += 1;
354  } // End conditional: if ( (res_hit->at(iHit)).Station() == 4
355 
356  } // End loop: for (unsigned int iHit = 0; iHit < res_hit->size(); iHit++)
357 
358 
359  // if ( Track_.Mode() != St_hits[0]*8 + St_hits[1]*4 + St_hits[2]*2 + St_hits[3] && Track_.BX() == 0) {
360  // std::cout << "\n\n***********************************************************" << std::endl;
361  // std::cout << "Bug in unpacked EMTF event! Mode " << Track_.Mode() << " track in sector " << Track_.Sector()*Track_.Endcap()
362  // << ", BX " << Track_.BX() << " (delay = " << trk_delay << ") with (" << St_hits[0] << ", " << St_hits[1]
363  // << ", " << St_hits[2] << ", " << St_hits[3] << ") hits in stations (1, 2, 3, 4)" << std::endl;
364 
365  // std::cout << "\nME1_stub_num = " << SP_.ME1_stub_num() << ", ME1_delay = " << SP_.ME1_delay()
366  // << ", ME1_CSC_ID = " << SP_.ME1_CSC_ID() << ", ME1_subsector = " << SP_.ME1_subsector() << std::endl;
367  // std::cout << "ME2_stub_num = " << SP_.ME2_stub_num() << ", ME2_delay = " << SP_.ME2_delay()
368  // << ", ME2_CSC_ID = " << SP_.ME2_CSC_ID() << std::endl;
369  // std::cout << "ME3_stub_num = " << SP_.ME3_stub_num() << ", ME3_delay = " << SP_.ME3_delay()
370  // << ", ME3_CSC_ID = " << SP_.ME3_CSC_ID() << std::endl;
371  // std::cout << "ME4_stub_num = " << SP_.ME4_stub_num() << ", ME4_delay = " << SP_.ME4_delay()
372  // << ", ME4_CSC_ID = " << SP_.ME4_CSC_ID() << std::endl;
373 
374  // conv_vals_SP = convert_SP_location( SP_.ME1_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), SP_.ME1_subsector(), 1 );
375  // std::cout << "\nConverted ME1 CSC ID = " << conv_vals_SP.at(0) << ", sector = " << conv_vals_SP.at(1)
376  // << ", subsector = " << conv_vals_SP.at(2) << ", neighbor = " << conv_vals_SP.at(3) << std::endl;
377  // conv_vals_SP = convert_SP_location( SP_.ME2_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), -99, 2 );
378  // std::cout << "Converted ME2 CSC ID = " << conv_vals_SP.at(0) << ", sector = " << conv_vals_SP.at(1)
379  // << ", subsector = " << conv_vals_SP.at(2) << ", neighbor = " << conv_vals_SP.at(3) << std::endl;
380  // conv_vals_SP = convert_SP_location( SP_.ME3_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), -99, 3 );
381  // std::cout << "Converted ME3 CSC ID = " << conv_vals_SP.at(0) << ", sector = " << conv_vals_SP.at(1)
382  // << ", subsector = " << conv_vals_SP.at(2) << ", neighbor = " << conv_vals_SP.at(3) << std::endl;
383  // conv_vals_SP = convert_SP_location( SP_.ME4_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), -99, 4 );
384  // std::cout << "Converted ME4 CSC ID = " << conv_vals_SP.at(0) << ", sector = " << conv_vals_SP.at(1)
385  // << ", subsector = " << conv_vals_SP.at(2) << ", neighbor = " << conv_vals_SP.at(3) << "\n" << std::endl;
386 
387 
388  // for (unsigned int iHit = 0; iHit < res_hit->size(); iHit++)
389  // std::cout << "Hit: Is CSC = " << (res_hit->at(iHit)).Is_CSC() << ", CSC ID = " << (res_hit->at(iHit)).CSC_ID()
390  // << ", sector = " << (res_hit->at(iHit)).Sector() << ", sub = " << (res_hit->at(iHit)).Subsector()
391  // << ", neighbor = " << (res_hit->at(iHit)).Neighbor() << ", station = " << (res_hit->at(iHit)).Station()
392  // << ", ring = " << (res_hit->at(iHit)).Ring() << ", chamber = " << (res_hit->at(iHit)).Chamber()
393  // << ", stub = " << (res_hit->at(iHit)).Stub_num() << ", BX = " << (res_hit->at(iHit)).BX() << std::endl;
394 
395  // // for (unsigned int iHit = 0; iHit < res_hit->size(); iHit++) {
396  // // if (iHit == 0) (res_hit->at(iHit)).PrintSimulatorHeader();
397  // // (res_hit->at(iHit)).PrintForSimulator();
398  // // }
399  // std::cout << "***********************************************************" << std::endl;
400  // std::cout << "" << std::endl;
401  // }
402 
403  (res->at(iOut)).push_SP(SP_);
404 
405  res_track->push_back( Track_ );
406 
407  // TBIN_num can range from 0 through 7, i.e. BX = -3 through +4. - AWB 04.04.16
408  res_cand->setBXRange(-3, 4);
409  res_cand->push_back(SP_.TBIN() - 3, mu_);
410 
411  // Finished with unpacking one SP Output Data Record
412  return true;
413 
414  } // End bool SPBlockUnpacker::unpack
415 
416  // bool SPBlockPacker::pack(const Block& block, UnpackerCollections *coll) {
417  // std::cout << "Inside SPBlockPacker::pack" << std::endl;
418  // return true;
419  // } // End bool SPBlockPacker::pack
420 
421  } // End namespace emtf
422  } // End namespace stage2
423 } // End namespace l1t
424 
426 // DEFINE_L1T_PACKER(l1t::stage2::SPBlockPacker);
int ME3_stub_num() const
Definition: SP.h:76
void set_me3_stub_num(int bits)
Definition: SP.h:45
void setHwPhi(int bits)
Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits)
void set_me2_stub_num(int bits)
Definition: SP.h:43
int ME4_delay() const
Definition: SP.h:83
int Endcap() const
Definition: EMTFTrack.h:119
void set_me3_CSC_ID(int bits)
Definition: SP.h:44
virtual int checkFormat(const Block &block)
Definition: EMTFBlockSP.cc:34
int Sector() const
Definition: EMTFTrack.h:120
int calc_uGMT_chamber(int _csc_ID, int _subsector, int _neighbor, int _station)
void set_bx(int bits)
Definition: SP.h:35
Definition: Event.h:15
int TBIN() const
Definition: SP.h:79
delete x;
Definition: CaloConfig.h:22
std::vector< uint32_t > payload() const
Definition: Block.h:61
int ME3_CSC_ID() const
Definition: SP.h:75
Definition: Electron.h:4
void set_se(int bits)
Definition: SP.h:31
void set_me2_CSC_ID(int bits)
Definition: SP.h:42
int ME1_delay() const
Definition: SP.h:80
void set_me1_stub_num(int bits)
Definition: SP.h:41
void set_pt_GMT(int bits)
Definition: SP.h:38
void set_me4_delay(int bits)
Definition: SP.h:52
int ME3_delay() const
Definition: SP.h:82
void set_phi_GMT(int bits)
Definition: SP.h:34
int TwosCompl(int nBits, int bits)
payload
payload postfix for testing
void set_me1_delay(int bits)
Definition: SP.h:49
int Phi_GMT() const
Definition: SP.h:65
int ME1_subsector() const
Definition: SP.h:70
void set_me2_delay(int bits)
Definition: SP.h:50
void set_hl(int bits)
Definition: SP.h:26
int VC() const
Definition: SP.h:60
void setTFIdentifiers(int processor, tftype trackFinder)
Set the processor ID, track-finder type. From these two, the link is set.
void set_tbin(int bits)
Definition: SP.h:48
int ME2_CSC_ID() const
Definition: SP.h:73
std::vector< EMTFHit > EMTFHitCollection
Definition: EMTFHit.h:241
int ME1_CSC_ID() const
Definition: SP.h:71
std::vector< EMTFDaqOut > EMTFDaqOutCollection
Definition: EMTFDaqOut.h:130
void setTrackSubAddress(bmtfAddress subAddress, int value)
Set a part of the muon candidates track address; specialised for BMTF.
void set_bc0(int bits)
Definition: SP.h:32
void set_track_num(int bits)
Definition: EMTFTrack.h:116
void set_eta_GMT(int bits)
Definition: SP.h:37
void set_c(int bits)
Definition: SP.h:27
void set_vc(int bits)
Definition: SP.h:29
int ME1_stub_num() const
Definition: SP.h:72
int Track_num() const
Definition: EMTFTrack.h:150
void setHwQual(int bits)
Set compressed quality code as transmitted by hardware (4 bits)
int ME4_CSC_ID() const
Definition: SP.h:77
void setHwPt(int bits)
Set compressed pT as transmitted by hardware LSB = 0.5 (9 bits)
void set_me4_CSC_ID(int bits)
Definition: SP.h:46
void setHwEta(int bits)
Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits)
JetCorrectorParametersCollection coll
Definition: classes.h:10
void set_me4_stub_num(int bits)
Definition: SP.h:47
int Pt_GMT() const
Definition: SP.h:69
virtual bool unpack(const Block &block, UnpackerCollections *coll) override
Definition: EMTFBlockSP.cc:108
void set_me3_delay(int bits)
Definition: SP.h:51
int ME4_stub_num() const
Definition: SP.h:78
int ME2_delay() const
Definition: SP.h:81
void setBXRange(int bxFirst, int bxLast)
int Eta_GMT() const
Definition: SP.h:68
void set_pt_LUT_addr(unsigned long bits)
Definition: SP.h:53
void ImportSP(EMTFTrack &_track, const l1t::emtf::SP _SP, const int _endcap, const int _evt_sector)
void push_Hit(const EMTFHit &hit)
Definition: EMTFTrack.h:59
int C() const
Definition: SP.h:58
#define DEFINE_L1T_UNPACKER(type)
void set_me1_CSC_ID(int bits)
Definition: SP.h:40
int Mode() const
Definition: EMTFTrack.h:122
void setHwSignValid(int bits)
Set whether charge measurement is valid (0 for high pT muons)
std::vector< int > convert_SP_location(int _csc_ID, int _sector, int _subsector, int _station)
Definition: EMTFBlockSP.cc:82
Definition: errors.py:1
std::vector< EMTFTrack > EMTFTrackCollection
Definition: EMTFTrack.h:200
uint16_t GetHexBits(uint16_t word, uint16_t lowBit, uint16_t highBit)
int ME2_stub_num() const
Definition: SP.h:74
void set_me1_subsector(int bits)
Definition: SP.h:39
int Quality_GMT() const
Definition: SP.h:64
void set_quality_GMT(int bits)
Definition: SP.h:33
void add_format_error()
Definition: SP.h:54
void push_back(int bx, T object)
void set_phi_full(int bits)
Definition: SP.h:28
void setHwSign(int bits)
Set charge sign bit (charge = (-1)^(sign))
void set_mode(int bits)
Definition: SP.h:36