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