test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EMTFBlockSP.cc
Go to the documentation of this file.
1 // Code to unpack the "SP Output Data Record"
2 
4 #include "EMTFCollections.h"
5 #include "EMTFUnpackerTools.h"
6 
7 // This is the "header" - no EMTFBlockSP.h file is needed
8 namespace l1t {
9  namespace stage2 {
10  namespace emtf {
11 
12  class SPBlockUnpacker : public Unpacker { // "SPBlockUnpacker" inherits from "Unpacker"
13  public:
14  virtual int checkFormat(const Block& block);
15  virtual bool unpack(const Block& block, UnpackerCollections *coll) override; // Apparently it's always good to use override in C++
16  // virtual bool packBlock(const Block& block, UnpackerCollections *coll) override;
17  };
18 
19 
20  // class SPBlockPacker : public Packer { // "SPBlockPacker" inherits from "Packer"
21  // public:
22  // virtual bool unpack(const Block& block, UnpackerCollections *coll) override; // Apparently it's always good to use override in C++
23  // };
24 
25  }
26  }
27 }
28 
29 namespace l1t {
30  namespace stage2 {
31  namespace emtf {
32 
34 
35  auto payload = block.payload();
36  int errors = 0;
37 
38  //Check the number of 16-bit words
39  if(payload.size() != 8) { errors += 1; edm::LogError("L1T|EMTF") << "Payload size in 'SP Output Data Record' is different than expected"; }
40 
41  //Check that each word is 16 bits
42  if(GetHexBits(payload[0], 16, 31) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Payload[0] has more than 16 bits in 'SP Output Data Record'"; }
43  if(GetHexBits(payload[1], 16, 31) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Payload[1] has more than 16 bits in 'SP Output Data Record'"; }
44  if(GetHexBits(payload[2], 16, 31) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Payload[2] has more than 16 bits in 'SP Output Data Record'"; }
45  if(GetHexBits(payload[3], 16, 31) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Payload[3] has more than 16 bits in 'SP Output Data Record'"; }
46  if(GetHexBits(payload[4], 16, 31) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Payload[4] has more than 16 bits in 'SP Output Data Record'"; }
47  if(GetHexBits(payload[5], 16, 31) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Payload[5] has more than 16 bits in 'SP Output Data Record'"; }
48  if(GetHexBits(payload[6], 16, 31) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Payload[6] has more than 16 bits in 'SP Output Data Record'"; }
49  if(GetHexBits(payload[7], 16, 31) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Payload[7] has more than 16 bits in 'SP Output Data Record'"; }
50 
51  uint16_t SP1a = payload[0];
52  uint16_t SP1b = payload[1];
53  uint16_t SP1c = payload[2];
54  uint16_t SP1d = payload[3];
55  uint16_t SP2a = payload[4];
56  uint16_t SP2b = payload[5];
57  uint16_t SP2c = payload[6];
58  uint16_t SP2d = payload[7];
59 
60  //Check Format
61  if(GetHexBits(SP1a, 15, 15) != 1) { errors += 1; edm::LogError("L1T|EMTF") << "Format identifier bits in SP1a are incorrect"; }
62  if(GetHexBits(SP1b, 15, 15) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Format identifier bits in SP1b are incorrect"; }
63  if(GetHexBits(SP1c, 15, 15) != 1) { errors += 1; edm::LogError("L1T|EMTF") << "Format identifier bits in SP1c are incorrect"; }
64  if(GetHexBits(SP1d, 15, 15) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Format identifier bits in SP1d are incorrect"; }
65  if(GetHexBits(SP2a, 15, 15) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Format identifier bits in SP2a are incorrect"; }
66  if(GetHexBits(SP2b, 15, 15) != 1) { errors += 1; edm::LogError("L1T|EMTF") << "Format identifier bits in SP2b are incorrect"; }
67  if(GetHexBits(SP2c, 15, 15) != 1) { errors += 1; edm::LogError("L1T|EMTF") << "Format identifier bits in SP2c are incorrect"; }
68  if(GetHexBits(SP2d, 15, 15) != 0) { errors += 1; edm::LogError("L1T|EMTF") << "Format identifier bits in SP2d are incorrect"; }
69 
70  return errors;
71 
72  }
73 
74 
75  // Converts CSC_ID, sector, subsector, and neighbor
76  std::vector<int> convert_SP_location(int _csc_ID, int _sector, int _subsector, int _station) {
77  int new_sector = _sector;
78  if (_station == 1) {
79  if (_csc_ID < 0) { int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4); return vec; }
80  else if (_csc_ID == 0) { int arr[] = { -1, -1, -1, -1}; std::vector<int> vec(arr, arr+4); return vec; }
81  else if (_csc_ID <= 9) { int arr[] = {_csc_ID, new_sector, _subsector+1, 0}; std::vector<int> vec(arr, arr+4); return vec; }
82  else new_sector = (_sector != 1) ? _sector-1 : 6;
83 
84  if (_csc_ID == 10) { int arr[] = {3, new_sector, 2, 1}; std::vector<int> vec(arr, arr+4); return vec; }
85  else if (_csc_ID == 11) { int arr[] = {6, new_sector, 2, 1}; std::vector<int> vec(arr, arr+4); return vec; }
86  else if (_csc_ID == 12) { int arr[] = {9, new_sector, 2, 1}; std::vector<int> vec(arr, arr+4); return vec; }
87  else { int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4); return vec; }
88  }
89  else if (_station == 2 || _station == 3 || _station == 4) {
90  if (_csc_ID < 0) { int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4); return vec; }
91  else if (_csc_ID == 0) { int arr[] = { -1, -1, -1, -1}; std::vector<int> vec(arr, arr+4); return vec; }
92  else if (_csc_ID <= 9) { int arr[] = {_csc_ID, new_sector, -1, 0}; std::vector<int> vec(arr, arr+4); return vec; }
93  else new_sector = (_sector != 1) ? _sector-1 : 6;
94 
95  if (_csc_ID == 10) { int arr[] = {3, new_sector, -1, 1}; std::vector<int> vec(arr, arr+4); return vec; }
96  else if (_csc_ID == 11) { int arr[] = {9, new_sector, -1, 1}; std::vector<int> vec(arr, arr+4); return vec; }
97  else { int arr[] = {_csc_ID, -99, -99, -99}; std::vector<int> vec(arr, arr+4); return vec; }
98  }
99  else { int arr[] = {-99, -99, -99, -99}; std::vector<int> vec(arr, arr+4); return vec; }
100  }
101 
103 
104  // std::cout << "Inside EMTFBlockSP.cc: unpack" << std::endl;
105  // LogDebug("L1T|EMTF") << "Inside EMTFBlockSP.cc: unpack"; // Why doesn't this work? - AWB 09.04.16
106 
107  // Get the payload for this block, made up of 16-bit words (0xffff)
108  // Format defined in MTF7Payload::getBlock() in src/Block.cc
109  // payload[0] = bits 0-15, payload[1] = 16-31, payload[3] = 32-47, etc.
110  auto payload = block.payload();
111 
112  // Check Format of Payload
113  l1t::emtf::SP SP_;
114  for (int err = 0; err < checkFormat(block); err++) SP_.add_format_error();
115 
116  // Assign payload to 16-bit words
117  uint16_t SP1a = payload[0];
118  uint16_t SP1b = payload[1];
119  uint16_t SP1c = payload[2];
120  uint16_t SP1d = payload[3];
121  uint16_t SP2a = payload[4];
122  uint16_t SP2b = payload[5];
123  uint16_t SP2c = payload[6];
124  uint16_t SP2d = payload[7];
125 
126  // res is a pointer to a collection of EMTFDaqOut class objects
127  // There is one EMTFDaqOut for each MTF7 (60 deg. sector) in the event
129  res = static_cast<EMTFCollections*>(coll)->getEMTFDaqOuts();
130  int iOut = res->size() - 1;
131  std::vector<int> conv_vals_SP;
132  std::vector<int> conv_vals_pT_LUT;
133 
134  EMTFHitCollection* res_hit;
135  res_hit = static_cast<EMTFCollections*>(coll)->getEMTFHits();
136 
137  EMTFTrackCollection* res_track;
138  res_track = static_cast<EMTFCollections*>(coll)->getEMTFTracks();
139  EMTFTrack Track_;
140 
142  res_cand = static_cast<EMTFCollections*>(coll)->getRegionalMuonCands();
143  RegionalMuonCand mu_;
144 
145  // if (SP_.Format_Errors() > 0) goto write; // Temporarily disable for DQM operation - AWB 09.04.16
146 
148  // Unpack the SP Output Data Record
150 
151  SP_.set_phi_full ( GetHexBits(SP1a, 0, 12) );
152  SP_.set_c ( GetHexBits(SP1a, 13, 13) );
153  SP_.set_hl ( GetHexBits(SP1a, 14, 14) );
154 
155  SP_.set_phi_GMT ( TwosCompl(8, GetHexBits(SP1b, 0, 7)) );
156  SP_.set_quality_GMT ( GetHexBits(SP1b, 8, 11) );
157  SP_.set_bc0 ( GetHexBits(SP1b, 12, 12) );
158  SP_.set_se ( GetHexBits(SP1b, 13, 13) );
159  SP_.set_vc ( GetHexBits(SP1b, 14, 14) );
160 
161  SP_.set_eta_GMT ( TwosCompl(9, GetHexBits(SP1c, 0, 8)) );
162  SP_.set_mode ( GetHexBits(SP1c, 9, 12) );
163  SP_.set_bx ( GetHexBits(SP1c, 13, 14) );
164 
165  SP_.set_pt_GMT ( GetHexBits(SP1d, 0, 8) );
166  SP_.set_me1_stub_num ( GetHexBits(SP1d, 9, 9) );
167  SP_.set_me1_CSC_ID ( GetHexBits(SP1d, 10, 13) );
168  SP_.set_me1_subsector( GetHexBits(SP1d, 14, 14) );
169 
170  SP_.set_me2_stub_num ( GetHexBits(SP2a, 0, 0 ) );
171  SP_.set_me2_CSC_ID ( GetHexBits(SP2a, 1, 4 ) );
172  SP_.set_me3_stub_num ( GetHexBits(SP2a, 5, 5 ) );
173  SP_.set_me3_CSC_ID ( GetHexBits(SP2a, 6, 9 ) );
174  SP_.set_me4_stub_num ( GetHexBits(SP2a, 10, 10) );
175  SP_.set_me4_CSC_ID ( GetHexBits(SP2a, 11, 14) );
176 
177  SP_.set_me1_delay ( GetHexBits(SP2b, 0, 2) );
178  SP_.set_me2_delay ( GetHexBits(SP2b, 3, 5) );
179  SP_.set_me3_delay ( GetHexBits(SP2b, 6, 8) );
180  SP_.set_me4_delay ( GetHexBits(SP2b, 9, 11) );
181  SP_.set_tbin ( GetHexBits(SP2b, 12, 14) );
182 
183  SP_.set_pt_LUT_addr ( GetHexBits(SP2c, 0, 14, SP2d, 0, 14) );
184 
185  // SP_.set_dataword ( uint64_t dataword );
186 
187  Track_.ImportSP( SP_, (res->at(iOut)).PtrEventHeader()->Sector() );
188  Track_.ImportPtLUT( Track_.Mode(), Track_.Pt_LUT_addr() );
189  Track_.set_endcap ( ((res->at(iOut)).PtrEventHeader()->Endcap() == 1) ? 1 : -1 );
190  Track_.set_sector_index ( (Track_.Endcap() == 1) ? Track_.Sector() - 1 : Track_.Sector() + 5 );
191 
192  if ( (res->at(iOut)).PtrSPCollection()->size() > 0 )
193  if ( SP_.TBIN() == (res->at(iOut)).PtrSPCollection()->at( (res->at(iOut)).PtrSPCollection()->size() - 1 ).TBIN() )
194  Track_.set_track_num( (res->at(iOut)).PtrSPCollection()->size() );
195  else Track_.set_track_num( 0 );
196  else Track_.set_track_num( 0 );
197 
198  mu_.setHwSign ( SP_.C() );
199  mu_.setHwSignValid ( SP_.VC() );
200  mu_.setHwQual ( SP_.Quality_GMT() );
201  mu_.setHwEta ( SP_.Eta_GMT() );
202  mu_.setHwPhi ( SP_.Phi_GMT() );
203  mu_.setHwPt ( SP_.Pt_GMT() );
204  mu_.setTFIdentifiers ( Track_.Sector_GMT(), (Track_.Endcap() == 1) ? emtf_pos : emtf_neg );
206  // mu_.set_dataword ( SP_.Dataword() );
207 
208  // set_type ( _SP.() );
209  // set_rank ( _SP.() );
210  // set_layer ( _SP.() );
211  // set_straightness ( _SP.() );
212  // set_strip ( _SP.() );
213  // set_second_bx ( _SP.() );
214  // set_pt_XML ( _SP.() );
215  // set_theta_int ( _SP.() );
216  // set_isGMT ( _SP.() );
217 
219  // Match hits to tracks
221 
222  int St_hits[4] = {0, 0, 0, 0}; // Number of matched hits in each station
223  // int dBX[3] = {0, 1, 2}; // Hit - track BX values for earliest LCT configuration
224  int dBX[5] = {0, -1, 1, -2, 2}; // Hit - track BX values for 2nd-earliest LCT configuration
225 
226  Track_.set_has_neighbor(false);
227  Track_.set_all_neighbor(true);
228 
229  conv_vals_SP = convert_SP_location( SP_.ME1_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), SP_.ME1_subsector(), 1 );
230  if ( conv_vals_SP.at(3) == 1 and not Track_.Has_neighbor() ) Track_.set_has_neighbor(true);
231  if ( conv_vals_SP.at(3) == 0 and Track_.All_neighbor() ) Track_.set_all_neighbor(false);
232  // if (abs(SP_.TBIN() - 3) < 2)
233  // std::cout << "\nTrack: ID = " << conv_vals_SP.at(0) << ", sector = " << conv_vals_SP.at(1) << ", sub = " << conv_vals_SP.at(2)
234  // << ", neighbor = " << conv_vals_SP.at(3) << ", station = 1"
235  // << ", stub = " << SP_.ME1_stub_num() << ", BX = " << SP_.TBIN() - 3 << std::endl;
236  for (uint iBX = 0; iBX < 5; iBX++) { // Loop over BX values nearest to the track BX
237  for (uint iHit = 0; iHit < res_hit->size(); iHit++) {
238  // if (abs(SP_.TBIN() - 3) < 2 && iBX == 0)
239  // std::cout << "Hit: ID = " << (res_hit->at(iHit)).CSC_ID() << ", sector = " << (res_hit->at(iHit)).Sector() << ", sub = " << (res_hit->at(iHit)).Subsector()
240  // << ", neighbor = " << (res_hit->at(iHit)).Neighbor() << ", station = " << (res_hit->at(iHit)).Station()
241  // << ", stub = " << (res_hit->at(iHit)).Stub_num() << ", BX = " << (res_hit->at(iHit)).BX() << std::endl;
242  if ( (res_hit->at(iHit)).CSC_ID() == conv_vals_SP.at(0) && (res_hit->at(iHit)).Sector() == conv_vals_SP.at(1) &&
243  (res_hit->at(iHit)).Subsector() == conv_vals_SP.at(2) && (res_hit->at(iHit)).Neighbor() == conv_vals_SP.at(3) &&
244  (res_hit->at(iHit)).Station() == 1 && (res_hit->at(iHit)).Stub_num() == SP_.ME1_stub_num() &&
245  (res_hit->at(iHit)).Endcap() == Track_.Endcap() && (res_hit->at(iHit)).BX() - (SP_.TBIN() - 3) == dBX[iBX] ) {
246  if (St_hits[0] == 0 ) Track_.push_Hit( res_hit->at(iHit) );
247  St_hits[0] += 1; }
248  }
249  if (St_hits[0] > 0) break; // If you found a hit in a BX close to the track, not need to look in other BX
250  }
252  mu_.setTrackSubAddress( RegionalMuonCand::kME1Ch, calc_uGMT_chamber(conv_vals_SP.at(0), conv_vals_SP.at(2), conv_vals_SP.at(3), 1) );
253 
254  conv_vals_SP = convert_SP_location( SP_.ME2_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), -99, 2 );
255  if ( conv_vals_SP.at(3) == 1 and not Track_.Has_neighbor() ) Track_.set_has_neighbor(true);
256  if ( conv_vals_SP.at(3) == 0 and Track_.All_neighbor() ) Track_.set_all_neighbor(false);
257  for (uint iBX = 0; iBX < 5; iBX++) {
258  for (uint iHit = 0; iHit < res_hit->size(); iHit++) {
259  if ( (res_hit->at(iHit)).CSC_ID() == conv_vals_SP.at(0) && (res_hit->at(iHit)).Sector() == conv_vals_SP.at(1) &&
260  // if ( ( (res_hit->at(iHit)).CSC_ID() == conv_vals_SP.at(0) || (res_hit->at(iHit)).CSC_ID() == conv_vals_SP.at(0) + 3 ) &&
261  // (res_hit->at(iHit)).Sector() == conv_vals_SP.at(1) &&
262  (res_hit->at(iHit)).Neighbor() == conv_vals_SP.at(3) && (res_hit->at(iHit)).Station() == 2 &&
263  (res_hit->at(iHit)).Stub_num() == SP_.ME2_stub_num() && (res_hit->at(iHit)).Endcap() == Track_.Endcap() &&
264  (res_hit->at(iHit)).BX() - (SP_.TBIN() - 3) == dBX[iBX] ) {
265  if (St_hits[1] == 0 ) Track_.push_Hit( res_hit->at(iHit) );
266  St_hits[1] += 1; }
267  }
268  if (St_hits[1] > 0) break;
269  }
271  mu_.setTrackSubAddress( RegionalMuonCand::kME2Ch, calc_uGMT_chamber(conv_vals_SP.at(0), conv_vals_SP.at(2), conv_vals_SP.at(3), 2) );
272 
273  conv_vals_SP = convert_SP_location( SP_.ME3_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), -99, 3 );
274  if ( conv_vals_SP.at(3) == 1 and not Track_.Has_neighbor() ) Track_.set_has_neighbor(true);
275  if ( conv_vals_SP.at(3) == 0 and Track_.All_neighbor() ) Track_.set_all_neighbor(false);
276  for (uint iBX = 0; iBX < 5; iBX++) {
277  for (uint iHit = 0; iHit < res_hit->size(); iHit++) {
278  if ( (res_hit->at(iHit)).CSC_ID() == conv_vals_SP.at(0) && (res_hit->at(iHit)).Sector() == conv_vals_SP.at(1) &&
279  // if ( ( (res_hit->at(iHit)).CSC_ID() == conv_vals_SP.at(0) || (res_hit->at(iHit)).CSC_ID() == conv_vals_SP.at(0) + 3 ) &&
280  // (res_hit->at(iHit)).Sector() == conv_vals_SP.at(1) &&
281  (res_hit->at(iHit)).Neighbor() == conv_vals_SP.at(3) && (res_hit->at(iHit)).Station() == 3 &&
282  (res_hit->at(iHit)).Stub_num() == SP_.ME3_stub_num() && (res_hit->at(iHit)).Endcap() == Track_.Endcap() &&
283  (res_hit->at(iHit)).BX() - (SP_.TBIN() - 3) == dBX[iBX] ) {
284  if (St_hits[2] == 0 ) Track_.push_Hit( res_hit->at(iHit) );
285  St_hits[2] += 1; }
286  }
287  if (St_hits[2] > 0) break;
288  }
290  mu_.setTrackSubAddress( RegionalMuonCand::kME3Ch, calc_uGMT_chamber(conv_vals_SP.at(0), conv_vals_SP.at(2), conv_vals_SP.at(3), 3) );
291 
292  conv_vals_SP = convert_SP_location( SP_.ME4_CSC_ID(), (res->at(iOut)).PtrEventHeader()->Sector(), -99, 4 );
293  if ( conv_vals_SP.at(3) == 1 and not Track_.Has_neighbor() ) Track_.set_has_neighbor(true);
294  if ( conv_vals_SP.at(3) == 0 and Track_.All_neighbor() ) Track_.set_all_neighbor(false);
295  for (uint iBX = 0; iBX < 5; iBX++) {
296  for (uint iHit = 0; iHit < res_hit->size(); iHit++) {
297  if ( (res_hit->at(iHit)).CSC_ID() == conv_vals_SP.at(0) && (res_hit->at(iHit)).Sector() == conv_vals_SP.at(1) &&
298  // if ( ( (res_hit->at(iHit)).CSC_ID() == conv_vals_SP.at(0) || (res_hit->at(iHit)).CSC_ID() == conv_vals_SP.at(0) + 3 ) &&
299  // (res_hit->at(iHit)).Sector() == conv_vals_SP.at(1) &&
300  (res_hit->at(iHit)).Neighbor() == conv_vals_SP.at(3) && (res_hit->at(iHit)).Station() == 4 &&
301  (res_hit->at(iHit)).Stub_num() == SP_.ME4_stub_num() && (res_hit->at(iHit)).Endcap() == Track_.Endcap() &&
302  (res_hit->at(iHit)).BX() - (SP_.TBIN() - 3) == dBX[iBX] ) {
303  if (St_hits[3] == 0 ) Track_.push_Hit( res_hit->at(iHit) );
304  St_hits[3] += 1; }
305  }
306  if (St_hits[3] > 0) break;
307  }
309  mu_.setTrackSubAddress( RegionalMuonCand::kME4Ch, calc_uGMT_chamber(conv_vals_SP.at(0), conv_vals_SP.at(2), conv_vals_SP.at(3), 4) );
310 
311 
312  // if ( Track_.Mode() != St_hits[0]*8 + St_hits[1]*4 + St_hits[2]*2 + St_hits[3] && abs(Track_.BX()) < 2) {
313  // std::cout << "" << std::endl;
314  // std::cout << "***********************************************************" << std::endl;
315  // std::cout << "Bug in EMTF event! Mode " << Track_.Mode() << " track in sector " << Track_.Sector()*Track_.Endcap()
316  // << ", BX " << Track_.BX() << " with (" << St_hits[0] << ", " << St_hits[1]
317  // << ", " << St_hits[2] << ", " << St_hits[3] << ") hits in stations (1, 2, 3, 4)" << std::endl;
318  // std::cout << "Sector = " << (res->at(iOut)).PtrEventHeader()->Sector() << ", ME1_stub_num = " << SP_.ME1_stub_num()
319  // << ", ME1_delay = " << SP_.ME1_delay() << ", ME1_CSC_ID = " << SP_.ME1_CSC_ID() << ", ME1_subsector = " << SP_.ME1_subsector() << std::endl;
320  // std::cout << "Sector = " << (res->at(iOut)).PtrEventHeader()->Sector() << ", ME2_stub_num = " << SP_.ME2_stub_num()
321  // << ", ME2_delay = " << SP_.ME2_delay() << ", ME2_CSC_ID = " << SP_.ME2_CSC_ID() << std::endl;
322  // std::cout << "Sector = " << (res->at(iOut)).PtrEventHeader()->Sector() << ", ME3_stub_num = " << SP_.ME3_stub_num()
323  // << ", ME3_delay = " << SP_.ME3_delay() << ", ME3_CSC_ID = " << SP_.ME3_CSC_ID() << std::endl;
324  // std::cout << "Sector = " << (res->at(iOut)).PtrEventHeader()->Sector() << ", ME4_stub_num = " << SP_.ME4_stub_num()
325  // << ", ME4_delay = " << SP_.ME4_delay() << ", ME4_CSC_ID = " << SP_.ME4_CSC_ID() << std::endl;
326 
327  // for (uint iHit = 0; iHit < res_hit->size(); iHit++)
328  // std::cout << "ID = " << (res_hit->at(iHit)).CSC_ID() << ", sector = " << (res_hit->at(iHit)).Sector()
329  // << ", sub = " << (res_hit->at(iHit)).Subsector() << ", neighbor = " << (res_hit->at(iHit)).Neighbor()
330  // << ", station = " << (res_hit->at(iHit)).Station() << ", stub = " << (res_hit->at(iHit)).Stub_num()
331  // << ", BX = " << (res_hit->at(iHit)).BX() << ", ring = " << (res_hit->at(iHit)).Ring()
332  // << ", chamber = " << (res_hit->at(iHit)).Chamber() << std::endl;
333 
334  // for (uint iHit = 0; iHit < res_hit->size(); iHit++) {
335  // if (iHit == 0) (res_hit->at(iHit)).PrintSimulatorHeader();
336  // (res_hit->at(iHit)).PrintForSimulator();
337  // }
338  // std::cout << "***********************************************************" << std::endl;
339  // std::cout << "" << std::endl;
340  // }
341 
342  // write: // Temporarily disable for DQM operation - AWB 09.04.16
343 
344  (res->at(iOut)).push_SP(SP_);
345 
346  res_track->push_back( Track_ );
347 
348  // TBIN_num can range from 0 through 7, i.e. BX = -3 through +4. - AWB 04.04.16
349  res_cand->setBXRange(-3, 4);
350  res_cand->push_back(SP_.TBIN() - 3, mu_);
351 
352  // Finished with unpacking one SP Output Data Record
353  return true;
354 
355  } // End bool SPBlockUnpacker::unpack
356 
357  // bool SPBlockPacker::pack(const Block& block, UnpackerCollections *coll) {
358  // std::cout << "Inside SPBlockPacker::pack" << std::endl;
359  // return true;
360  // } // End bool SPBlockPacker::pack
361 
362  } // End namespace emtf
363  } // End namespace stage2
364 } // End namespace l1t
365 
367 // 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 Endcap() const
Definition: EMTFTrack.h:96
void set_me3_CSC_ID(int bits)
Definition: SP.h:44
virtual int checkFormat(const Block &block)
Definition: EMTFBlockSP.cc:33
int Sector() const
Definition: EMTFTrack.h:97
int calc_uGMT_chamber(int _csc_ID, int _subsector, int _neighbor, int _station)
void set_bx(int bits)
Definition: SP.h:35
int TBIN() const
Definition: SP.h:79
void push_Hit(EMTFHit bits)
Definition: EMTFTrack.h:38
int All_neighbor() const
Definition: EMTFTrack.h:141
void ImportSP(const emtf::SP _SP, int _sector)
std::vector< uint32_t > payload() const
Definition: Block.h:57
int ME3_CSC_ID() const
Definition: SP.h:75
#define DEFINE_L1T_UNPACKER(type)
Definition: Unpacker.h:31
void set_se(int bits)
Definition: SP.h:31
void set_me2_CSC_ID(int bits)
Definition: SP.h:42
void set_me1_stub_num(int bits)
Definition: SP.h:41
void set_pt_GMT(int bits)
Definition: SP.h:38
int Sector_GMT() const
Definition: EMTFTrack.h:98
void set_me4_delay(int bits)
Definition: SP.h:52
void set_phi_GMT(int bits)
Definition: SP.h:34
int TwosCompl(int nBits, int bits)
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 ImportPtLUT(int _mode, unsigned long _address)
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:158
int ME1_CSC_ID() const
Definition: SP.h:71
void set_sector_index(int bits)
Definition: EMTFTrack.h:51
void set_all_neighbor(int bits)
Definition: EMTFTrack.h:93
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:91
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:139
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)
void set_has_neighbor(int bits)
Definition: EMTFTrack.h:92
JetCorrectorParametersCollection coll
Definition: classes.h:10
unsigned long Pt_LUT_addr() const
Definition: EMTFTrack.h:106
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:102
void set_me3_delay(int bits)
Definition: SP.h:51
int ME4_stub_num() const
Definition: SP.h:78
void setBXRange(int bxFirst, int bxLast)
void set_endcap(int bits)
Definition: EMTFTrack.h:48
int Eta_GMT() const
Definition: SP.h:68
void set_pt_LUT_addr(unsigned long bits)
Definition: SP.h:53
int Has_neighbor() const
Definition: EMTFTrack.h:140
int C() const
Definition: SP.h:58
void set_me1_CSC_ID(int bits)
Definition: SP.h:40
int Mode() const
Definition: EMTFTrack.h:100
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:76
std::vector< EMTFTrack > EMTFTrackCollection
Definition: EMTFTrack.h:201
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