CMS 3D CMS Logo

SectorProcessor.cc
Go to the documentation of this file.
2 
3 
5 
6 }
7 
9 
10 }
11 
13  const GeometryTranslator* tp_geom,
14  const ConditionHelper* cond,
15  const SectorProcessorLUT* lut,
16  PtAssignmentEngine* pt_assign_engine,
17  int verbose, int endcap, int sector,
18  int minBX, int maxBX, int bxWindow, int bxShiftCSC, int bxShiftRPC, int bxShiftGEM,
19  std::string era,
20  const std::vector<int>& zoneBoundaries, int zoneOverlap,
21  bool includeNeighbor, bool duplicateTheta, bool fixZonePhi, bool useNewZones, bool fixME11Edges,
22  const std::vector<std::string>& pattDefinitions, const std::vector<std::string>& symPattDefinitions, bool useSymPatterns,
23  int thetaWindow, int thetaWindowZone0, bool useRPC, bool useSingleHits, bool bugSt2PhDiff, bool bugME11Dupes, bool bugAmbigThetaWin, bool twoStationSameBX,
24  int maxRoadsPerZone, int maxTracks, bool useSecondEarliest, bool bugSameSectorPt0,
25  bool readPtLUTFile, bool fixMode15HighPt, bool bug9BitDPhi, bool bugMode7CLCT, bool bugNegPt, bool bugGMTPhi, bool promoteMode7, int modeQualVer
26 ) {
27  if (not(emtf::MIN_ENDCAP <= endcap && endcap <= emtf::MAX_ENDCAP))
28  { edm::LogError("L1T") << "emtf::MIN_ENDCAP = " << emtf::MIN_ENDCAP
29  << ", emtf::MAX_ENDCAP = " << emtf::MAX_ENDCAP
30  << ", endcap = " << endcap; return; }
31  if (not(emtf::MIN_TRIGSECTOR <= sector && sector <= emtf::MAX_TRIGSECTOR))
32  { edm::LogError("L1T") << "emtf::MIN_TRIGSECTOR = " << emtf::MIN_TRIGSECTOR
33  << ", emtf::MAX_TRIGSECTOR = " << emtf::MAX_TRIGSECTOR
34  << ", endcap = " << sector; return; }
35  if (not(tp_geom != nullptr))
36  { edm::LogError("L1T") << "tp_geom = nullptr"; return; }
37  if (not(cond != nullptr))
38  { edm::LogError("L1T") << "cond = nullptr"; return; }
39  if (not(lut != nullptr))
40  { edm::LogError("L1T") << "lut = nullptr"; return; }
41  if (not(pt_assign_engine != nullptr))
42  { edm::LogError("L1T") << "pt_assign_engine = nullptr"; return; }
43 
44  tp_geom_ = tp_geom;
45  cond_ = cond;
46  lut_ = lut;
47  pt_assign_engine_ = pt_assign_engine;
48 
49  verbose_ = verbose;
50  endcap_ = endcap;
51  sector_ = sector;
52 
53  minBX_ = minBX;
54  maxBX_ = maxBX;
55  bxWindow_ = bxWindow;
56  bxShiftCSC_ = bxShiftCSC;
57  bxShiftRPC_ = bxShiftRPC;
58  bxShiftGEM_ = bxShiftGEM;
59 
60  era_ = era;
61 
62  zoneBoundaries_ = zoneBoundaries;
63  zoneOverlap_ = zoneOverlap;
64  includeNeighbor_ = includeNeighbor;
65  duplicateTheta_ = duplicateTheta;
66  fixZonePhi_ = fixZonePhi;
67  useNewZones_ = useNewZones;
68  fixME11Edges_ = fixME11Edges;
69 
70  pattDefinitions_ = pattDefinitions;
71  symPattDefinitions_ = symPattDefinitions;
72  useSymPatterns_ = useSymPatterns;
73 
74  thetaWindow_ = thetaWindow;
75  thetaWindowZone0_ = thetaWindowZone0;
76  useRPC_ = useRPC;
77  useSingleHits_ = useSingleHits;
78  bugSt2PhDiff_ = bugSt2PhDiff;
79  bugME11Dupes_ = bugME11Dupes;
80  bugAmbigThetaWin_ = bugAmbigThetaWin;
81  twoStationSameBX_ = twoStationSameBX;
82 
83  maxRoadsPerZone_ = maxRoadsPerZone;
85  useSecondEarliest_ = useSecondEarliest;
86  bugSameSectorPt0_ = bugSameSectorPt0;
87 
88  readPtLUTFile_ = readPtLUTFile;
89  fixMode15HighPt_ = fixMode15HighPt;
90  bug9BitDPhi_ = bug9BitDPhi;
91  bugMode7CLCT_ = bugMode7CLCT;
92  bugNegPt_ = bugNegPt;
93  bugGMTPhi_ = bugGMTPhi;
94  promoteMode7_ = promoteMode7;
95  modeQualVer_ = modeQualVer;
96 }
97 
98 // Refer to docs/EMTF_FW_LUT_versions_2016_draft2.xlsx
99 void SectorProcessor::configure_by_fw_version(unsigned fw_version) {
100  if (verbose_ > 0) {
101  std::cout << "Configure SectorProcessor with fw_version: " << fw_version << std::endl;
102  }
103 
104  if (fw_version == 0 || fw_version == 123456) // fw_version '123456' is from the fake conditions
105  return;
106 
107  // For now, no switches later than FW version 47864 (end-of-year 2016)
108  // Beggining in late 2016, "fw_version" in O2O populated with timestamp, rather than FW version
109  // tm fw_time = gmtime(fw_version); (See https://linux.die.net/man/3/gmtime, https://www.epochconverter.com)
110 
114  if (fw_version >= 1514764800) { // January 1, 2018
115 
116  // Settings for all of 2018 (following order in simEmtfDigis_cfi.py)
117  // BXWindow(2) and BugAmbigThetaWin(F) deployed sometime before stable beams on March 20, not quite sure when - AWB 26.04.18
118  // TwoStationSameBX(T), ThetaWindowZone0(4), and ModeQualVer(2) to be deployed sometime between May 17 and May 31 - AWB 14.05.18
119 
120  // Global parameters
121  // Defaults : CSCEnable(T), RPCEnable(T), GEMEnable(F), Era("Run2_2018"), MinBX(-3), MaxBX(+3), BXWindow(2)
122  // --------------------------------------------------------------------------------------------------------
123 
124  // spTBParams16 : Sector processor track-building parameters
125  // Defaults : PrimConvLUT(1), ZoneBoundaries(0,41,49,87,127), ZoneOverlap(2), IncludeNeighbor(T),
126  // DuplicateThteta(T), FixZonePhi(T), UseNewZones(F), FixME11Edges(T)
127  // ------------------------------------------------------------------------------
128 
129  // spPRParams16 : Sector processor pattern-recognition parameters
130  // Defaults : PatternDefinitions(...), SymPatternDefinitions(...), UseSymmetricalPatterns(T)
131  // -----------------------------------------------------------------------------------------
132 
133  // spTBParams16 : Sector processor track-building parameters
134  // Defaults : ThetaWindow(8), ThetaWindowZone0(4), UseSingleHits(F), BugSt2PhDiff(F),
135  // BugME11Dupes(F), BugAmbigThetaWin(F), TwoStationSameBX(T)
136  // ----------------------------------------------------------------------------------
137 
138  // spGCParams16 : Sector processor ghost-cancellation parameters
139  // Defaults : MaxRoadsPerZone(3), MaxTracks(3), UseSecondEarliest(T), BugSameSectorPt0(F)
140  // --------------------------------------------------------------------------------------
141 
142  // spPAParams16 : Sector processor pt-assignment parameters
143  // Defaults : ReadPtLUTFile(F), FixMode15HighPt(T), Bug9BitDPhi(F), BugMode7CLCT(F),
144  // BugNegPt(F), BugGMTPhi(F), PromoteMode7(F), ModeQualVer(2)
145  // ---------------------------------------------------------------------------------
146 
147 
148  // ___________________________________________________________________________
149  // Versions in 2018 - no documentation
150  // As of the beginning of 2018 EMTF O2O is broken, not updating the database with online conditions
151  // Firmware version reported for runs as late as April 30 is 1504018578 (Aug. 29, 2017) even though
152  // updates occured in February and March of 2018. Hopefully will fix soon, may need to re-write
153  // history in the database. - AWB 30.04.18
154 
155  return;
156  }
157 
161  else if (fw_version >= 50000) {
162 
163  // Settings for all of 2017 (following order in simEmtfDigis_cfi.py)
164 
165  // Global parameters
166  // Defaults : CSCEnable(T), RPCEnable(T), GEMEnable(F), Era("Run2_2018"), MinBX(-3), MaxBX(+3), BXWindow(2)
167  // --------------------------------------------------------------------------------------------------------
168  era_ = "Run2_2017"; // Era for CMSSW customization
169  bxWindow_ = 3; // Number of BX whose primitives can be included in the same track
170 
171  // spTBParams16 : Sector processor track-building parameters
172  // Defaults : PrimConvLUT(1), ZoneBoundaries(0,41,49,87,127), ZoneOverlap(2), IncludeNeighbor(T),
173  // DuplicateThteta(T), FixZonePhi(T), UseNewZones(F), FixME11Edges(T)
174  // ------------------------------------------------------------------------------
175 
176  // spPRParams16 : Sector processor pattern-recognition parameters
177  // Defaults : PatternDefinitions(...), SymPatternDefinitions(...), UseSymmetricalPatterns(T)
178  // -----------------------------------------------------------------------------------------
179 
180  // spTBParams16 : Sector processor track-building parameters
181  // Defaults : ThetaWindow(8), ThetaWindowZone0(4), UseSingleHits(F), BugSt2PhDiff(F),
182  // BugME11Dupes(F), BugAmbigThetaWin(F), TwoStationSameBX(T)
183  // ----------------------------------------------------------------------------------
184  thetaWindow_ = 8; // Maximum dTheta between primitives in the same track
185  thetaWindowZone0_ = 8; // Maximum dTheta between primitives in the same track in Zone 0 (ring 1)
186  bugAmbigThetaWin_ = true; // Can allow dThetas outside window when there are 2 LCTs in the same chamber
187  twoStationSameBX_ = false; // Requires the hits in two-station tracks to have the same BX
188 
189  // spGCParams16 : Sector processor ghost-cancellation parameters
190  // Defaults : MaxRoadsPerZone(3), MaxTracks(3), UseSecondEarliest(T), BugSameSectorPt0(F)
191  // --------------------------------------------------------------------------------------
192 
193  // spPAParams16 : Sector processor pt-assignment parameters
194  // Defaults : ReadPtLUTFile(F), FixMode15HighPt(T), Bug9BitDPhi(F), BugMode7CLCT(F),
195  // BugNegPt(F), BugGMTPhi(F), PromoteMode7(F)
196  // ---------------------------------------------------------------------------------
197  modeQualVer_ = 1; // Version 2 contains modified mode-quality mapping for 2018
198 
199  // ___________________________________________________________________________
200  // Versions in 2017 - no full documentation, can refer to https://twiki.cern.ch/twiki/bin/viewauth/CMS/L1KnownIssues
201 
202  // Before July 9th (runs < 298653), all mode 7 tracks (station 2-3-4) assigned quality 11
203  // July 9th - 29th (runs 298653 - 300087), mode 7 tracks with |eta| > 1.6 in sector -6 assigned quality 12
204  // After July 29th (runs >= 300088), mode 7 track promotion applied in all sectors
205  // For some reason, the FW version in the database is 1496792995, at least for runs >= 298034 (July 4),
206  // which is towards the end of run 2017B (could not check earlier runs). This corresponds to the date "June 6th",
207  // which is a month earlier than the first firmware update to apply this promotion. So something's screwey.
208  // Since July 18 is in the middle of the single-sector-fix period, would like to use a firmware version with
209  // roughly that date. But this may require an intervention in the database. - AWB 04.08.17
210  // Last firmware version in 2017 was 1504018578 (Aug. 29, 2017).
211  if (fw_version >= 1496792995)
212  promoteMode7_ = true; // Assign station 2-3-4 tracks with |eta| > 1.6 SingleMu quality
213 
214  return;
215  }
216 
220  else {
221 
222  // Global parameters
223  // Defaults : CSCEnable(T), RPCEnable(T), GEMEnable(F), Era("Run2_2018"), MinBX(-3), MaxBX(+3), BXWindow(2)
224  // --------------------------------------------------------------------------------------------------------
225  useRPC_ = false; // Use clustered RPC hits from CPPF in track-building
226  era_ = "Run2_2016"; // Era for CMSSW customization
227  // maxBX_ // Depends on FW version, see below
228  bxWindow_ = 3; // Number of BX whose primitives can be included in the same track
229 
230  // spTBParams16 : Sector processor track-building parameters
231  // Defaults : PrimConvLUT(1), ZoneBoundaries(0,41,49,87,127), ZoneOverlap(2), IncludeNeighbor(T),
232  // DuplicateThteta(T), FixZonePhi(T), UseNewZones(F), FixME11Edges(T)
233  // ------------------------------------------------------------------------------
234  // primConvLUT_ // Should be 0 for 2016, set using get_pc_lut_version() from ConditionsHelper.cc
235  // fixZonePhi_ // Depends on FW version, see below
236  fixME11Edges_ = false; // Improved small fraction of buggy LCT coordinate transformations
237 
238  // spPRParams16 : Sector processor pattern-recognition parameters
239  // Defaults : PatternDefinitions(...), SymPatternDefinitions(...), UseSymmetricalPatterns(T)
240  // -----------------------------------------------------------------------------------------
241  // useSymPatterns_ // Depends on FW version, see below
242 
243  // spTBParams16 : Sector processor track-building parameters
244  // Defaults : ThetaWindow(8), ThetaWindowZone0(4), UseSingleHits(F), BugSt2PhDiff(F),
245  // BugME11Dupes(F), BugAmbigThetaWin(F), TwoStationSameBX(T)
246  // ----------------------------------------------------------------------------------
247  thetaWindow_ = 4; // Maximum dTheta between primitives in the same track
248  thetaWindowZone0_ = 4; // Maximum dTheta between primitives in the same track in Zone 0 (ring 1)
249  // bugSt2PhDiff_ // Depends on FW version, see below
250  // bugME11Dupes_ // Depends on FW version, see below
251  bugAmbigThetaWin_ = true; // Can allow dThetas outside window when there are 2 LCTs in the same chamber
252  twoStationSameBX_ = false; // Requires the hits in two-station tracks to have the same BX
253 
254  // spGCParams16 : Sector processor ghost-cancellation parameters
255  // Defaults : MaxRoadsPerZone(3), MaxTracks(3), UseSecondEarliest(T), BugSameSectorPt0(F)
256  // --------------------------------------------------------------------------------------
257  // useSecondEarliest_ // Depends on FW version, see below
258  // bugSameSectorPt0_ // Depends on FW version, see below
259 
260  // spPAParams16 : Sector processor pt-assignment parameters
261  // Defaults : ReadPtLUTFile(F), FixMode15HighPt(T), Bug9BitDPhi(F), BugMode7CLCT(F),
262  // BugNegPt(F), BugGMTPhi(F), PromoteMode7(F)
263  // ---------------------------------------------------------------------------------
264  // fixMode15HighPt_ // Depends on FW version, see below
265  // bug9BitDPhi_ // Depends on FW version, see below
266  // bugMode7CLCT_ // Depends on FW version, see below
267  // bugNegPt_ // Depends on FW version, see below
268  bugGMTPhi_ = true; // Some drift in uGMT phi conversion, off by up to a few degrees
269  modeQualVer_ = 1; // Version 2 contains modified mode-quality mapping for 2018
270 
271  } // End default settings for 2016
272 
273 
274  // ___________________________________________________________________________
275  // Versions in 2016 - refer to docs/EMTF_FW_LUT_versions_2016_draft2.xlsx
276 
277  // 1st_LCT_BX / 2nd_LCT_BX (should also make unpacker configurable - AWB 21.07.17)
278  // FW: Before: Earliest LCT used to assign BX, tracks only cancel within same BX
279  // After: Second-earliest LCT used to assign BX, tracks cancel over 3 BX, improved LCT recovery
280  useSecondEarliest_ = (fw_version < 46773) ? false : true; // Changed Sept. 5
281 
282  // 8_BX_readout / 7_BX_readout
283  // SW: DAQ readout changed from to [-3, +4] BX to [-3, +3] BX
284  maxBX_ = (fw_version < 47109) ? +4 : +3; // Changed Sept. 28
285 
286  // Asymm_patterns / Symm_patterns
287  // FW: Changed from 9 asymmetric patterns to 5 symmetric patterns for track building
288  useSymPatterns_ = (fw_version < 47214) ? false : true; // Changed Oct. 6
289 
290  // HiPt_outlier
291  // LUT: High-pT fix puts outlier LCTs in mode 15 tracks back in a straight line
292  fixMode15HighPt_ = (fw_version < 46650) ? false : true; // Changed July 25
293 
294  // Link_monitor (unpacker only)
295  // FW: Added MPC link monitoring
296 
297  // ___________________________________________________________________________
298  // Bugs
299 
300  // DAQ_ID (unpacker only; should make configurable - AWB 21.07.17)
301  // FW: DAQ ME with output CSC ID range 0 - 8 instead of 1 - 9
302  // SP output ME2_ID, 3_ID, and 4_ID filled with 4, 5, or 6 when they should have been 7, 8, or 9.
303 
304  // ME_ID_FR
305  // FW: Incorrect ME_ID fields in DAQ, wrong FR bits and some dPhi wrap-around in pT LUT address
306  // - Unpacker only, or not worth emulating
307 
308  // DAQ_miss_LCT (unpacker only)
309  // FW: LCTs only output if there was a track in the sector
310 
311  // Sector_pT_0
312  // FW: Only highest-quality track in a sector assigned pT; others assigned pT = 0
313  bugSameSectorPt0_ = (fw_version < 46650) ? true : false; // Fixed July 22
314 
315  // Sector_bad_pT
316  // FW: Tracks sometimes assigned pT of track in previous BX
317  // - This is an ongoing (very rare) bug which occurs when 2 tracks try to access the same "bank" in the pT LUT
318  // It would be very difficult to emulate exactly, but the logic from Alex Madorsky is below
319  // ## macro for detecting same bank address
320  // ## bank and chip must match, and valid flags must be set
321  // ## a and b are indexes 0,1,2
322  // ## [X:Y] are bit portions from ptlut address words
323  // `define sb(a,b) (ptlut_addr[a][29:26] == ptlut_addr[b][29:26] && ptlut_addr[a][5:2] == ptlut_addr[b][5:2] && ptlut_addr_val[a] && ptlut_addr_val[b])
324  // ## This macro is used like this:
325  // if (`sb(0,2) || `sb(1,2)) {disable PT readout for track 2}
326 
327 
328  // DAQ_BX_3_LCT (unpacker only)
329  // SW: LCTs in BX -3 only reported if there was a track in the sector
330  // - not applicable
331 
332  // DAQ_BX_23_LCT (unpacker only)
333  // SW: LCTs in BX -2 and -3 only reported if there was a track in the sector
334  // - not applicable
335 
336  // pT_dPhi_bits
337  // FW: dPhi wrap-around in modes 3, 5, 6, 9, 10, 12
338  bug9BitDPhi_ = (fw_version < 47214) ? true : false; // Fixed Oct. 6
339 
340  // Pattern_phi / ME1_neigh_phi
341  // FW: Pattern phi slightly offset from true LCT phi; also ME3/4 pattern width off
342  // Pattern phi of neighbor hits in ME1 miscalculated
343  fixZonePhi_ = (fw_version < 47214) ? false : true; // Fixed Oct. 6
344 
345  // LCT_station_2
346  // FW: Reduced LCT matching window in station 2, resulting in demoted tracks and inefficiency
347  bugSt2PhDiff_ = (47109 <= fw_version && fw_version < 47249) ? true : false; // Bug introduced Oct. 6, fixed Oct. 19
348 
349  // LCT_theta_dup
350  // FW: LCTs matched to track may take theta value from other LCT in the same chamber
351  bugME11Dupes_ = (fw_version < 47423) ? true : false; // Fixed Nov. 1
352 
353  // LCT_7_10_neg_pT (E)
354  // LUT: Written with incorrect values for mode 7 CLCT, mode 10 random offset, all modes negative (1/pT) set to 3 instead of 511
355  bugMode7CLCT_ = (fw_version < 47864) ? true : false; // Fixed sometime after Nov. 1
356  bugNegPt_ = (fw_version < 47864) ? true : false; // Fixed sometime after Nov. 1
357 
358 
359 }
360 
362  EventNumber_t ievent,
363  const TriggerPrimitiveCollection& muon_primitives,
364  EMTFHitCollection& out_hits,
365  EMTFTrackCollection& out_tracks
366 ) const {
367 
368  // if (endcap_ == 1 && sector_ == 1) {
369  // std::cout << "\nConfigured with era " << era_ << ", thetaWindowZone0 = " << thetaWindowZone0_ << ", bugAmbigThetaWin = "
370  // << bugAmbigThetaWin_ << ", twoStationSameBX = " << twoStationSameBX_ << ", promoteMode7_ = " << promoteMode7_ << std::endl;
371  // }
372 
373  // List of converted hits, extended from previous BXs
374  // deque (double-ended queue) is similar to a vector, but allows insertion or deletion of elements at both beginning and end
375  std::deque<EMTFHitCollection> extended_conv_hits;
376 
377  // List of best track candidates, extended from previous BXs
378  std::deque<EMTFTrackCollection> extended_best_track_cands;
379 
380  // Map of pattern detector --> lifetime, tracked across BXs
381  std::map<pattern_ref_t, int> patt_lifetime_map;
382 
383  // ___________________________________________________________________________
384  // Run each sector processor for every BX, taking into account the BX window
385 
386  int delayBX = bxWindow_ - 1;
387 
388  for (int bx = minBX_; bx <= maxBX_ + delayBX; ++bx) {
389  if (verbose_ > 0) { // debug
390  std::cout << "Endcap: " << endcap_ << " Sector: " << sector_ << " Event: " << ievent << " BX: " << bx << std::endl;
391  }
392 
394  bx,
395  muon_primitives,
396  out_hits,
397  out_tracks,
398  extended_conv_hits,
399  extended_best_track_cands,
400  patt_lifetime_map
401  );
402 
403  // Drop earliest BX outside of BX window
404  if (bx >= minBX_ + delayBX) {
405  extended_conv_hits.pop_front();
406 
407  int n = emtf::zone_array<int>().size();
408  extended_best_track_cands.erase(extended_best_track_cands.end()-n, extended_best_track_cands.end()); // pop_back
409  }
410  } // end loop over bx
411 
412  return;
413 }
414 
416  int bx,
417  const TriggerPrimitiveCollection& muon_primitives,
418  EMTFHitCollection& out_hits,
419  EMTFTrackCollection& out_tracks,
420  std::deque<EMTFHitCollection>& extended_conv_hits,
421  std::deque<EMTFTrackCollection>& extended_best_track_cands,
422  std::map<pattern_ref_t, int>& patt_lifetime_map
423 ) const {
424 
425  // ___________________________________________________________________________
426  // Configure
427 
428  PrimitiveSelection prim_sel;
429  prim_sel.configure(
430  verbose_, endcap_, sector_, bx,
434  );
435 
436  PrimitiveConversion prim_conv;
437  prim_conv.configure(
438  tp_geom_, lut_,
439  verbose_, endcap_, sector_, bx,
444  );
445 
446  PatternRecognition patt_recog;
447  patt_recog.configure(
448  verbose_, endcap_, sector_, bx,
449  bxWindow_,
452  );
453 
454  PrimitiveMatching prim_match;
455  prim_match.configure(
456  verbose_, endcap_, sector_, bx,
459  );
460 
461  AngleCalculation angle_calc;
462  angle_calc.configure(
463  verbose_, endcap_, sector_, bx,
464  bxWindow_,
467  );
468 
469  BestTrackSelection btrack_sel;
470  btrack_sel.configure(
471  verbose_, endcap_, sector_, bx,
472  bxWindow_,
475  );
476 
477  SingleHitTrack single_hit;
478  single_hit.configure(
479  verbose_, endcap_, sector_, bx,
480  maxTracks_,
482  );
483 
484  PtAssignment pt_assign;
485  pt_assign.configure(
487  verbose_, endcap_, sector_, bx,
491  );
492 
493  std::map<int, TriggerPrimitiveCollection> selected_csc_map;
494  std::map<int, TriggerPrimitiveCollection> selected_rpc_map;
495  std::map<int, TriggerPrimitiveCollection> selected_gem_map;
496  std::map<int, TriggerPrimitiveCollection> selected_prim_map;
497  std::map<int, TriggerPrimitiveCollection> inclusive_selected_prim_map;
498 
499  EMTFHitCollection conv_hits; // "converted" hits converted by primitive converter
500  EMTFHitCollection inclusive_conv_hits;
501 
502  emtf::zone_array<EMTFRoadCollection> zone_roads; // each zone has its road collection
503 
504  emtf::zone_array<EMTFTrackCollection> zone_tracks; // each zone has its track collection
505 
506  EMTFTrackCollection best_tracks; // "best" tracks selected from all the zones
507 
508  // ___________________________________________________________________________
509  // Process
510 
511  // Select muon primitives that belong to this sector and this BX.
512  // Put them into maps with an index that roughly corresponds to
513  // each input link.
514  // From src/PrimitiveSelection.cc
515  prim_sel.process(CSCTag(), muon_primitives, selected_csc_map);
516  if (useRPC_) {
517  prim_sel.process(RPCTag(), muon_primitives, selected_rpc_map);
518  }
519  prim_sel.process(GEMTag(), muon_primitives, selected_gem_map);
520  prim_sel.merge(selected_csc_map, selected_rpc_map, selected_gem_map, selected_prim_map);
521 
522  // Convert trigger primitives into "converted" hits
523  // A converted hit consists of integer representations of phi, theta, and zones
524  // From src/PrimitiveConversion.cc
525  prim_conv.process(selected_prim_map, conv_hits);
526  extended_conv_hits.push_back(conv_hits);
527 
528  {
529  // Keep all the converted hits for the use of data-emulator comparisons.
530  // They include the extra ones that are not used in track building and the subsequent steps.
531  prim_sel.merge_no_truncate(selected_csc_map, selected_rpc_map, selected_gem_map, inclusive_selected_prim_map);
532  prim_conv.process(inclusive_selected_prim_map, inclusive_conv_hits);
533 
534  // Clear the input maps to save memory
535  selected_csc_map.clear();
536  selected_rpc_map.clear();
537  selected_gem_map.clear();
538  }
539 
540  // Detect patterns in all zones, find 3 best roads in each zone
541  // From src/PatternRecognition.cc
542  patt_recog.process(extended_conv_hits, patt_lifetime_map, zone_roads);
543 
544  // Match the trigger primitives to the roads, create tracks
545  // From src/PrimitiveMatching.cc
546  prim_match.process(extended_conv_hits, zone_roads, zone_tracks);
547 
548  // Calculate deflection angles for each track and fill track variables
549  // From src/AngleCalculation.cc
550  angle_calc.process(zone_tracks);
551  extended_best_track_cands.insert(extended_best_track_cands.begin(), zone_tracks.begin(), zone_tracks.end()); // push_front
552 
553  // Select 3 "best" tracks from all the zones
554  // From src/BestTrackSelection.cc
555  btrack_sel.process(extended_best_track_cands, best_tracks);
556 
557  // Insert single LCTs from station 1 as tracks
558  // From src/SingleHitTracks.cc
559  single_hit.process(conv_hits, best_tracks);
560 
561  // Construct pT address, assign pT, calculate other GMT quantities
562  // From src/PtAssignment.cc
563  pt_assign.process(best_tracks);
564 
565  // ___________________________________________________________________________
566  // Output
567 
568  out_hits.insert(out_hits.end(), inclusive_conv_hits.begin(), inclusive_conv_hits.end());
569  out_tracks.insert(out_tracks.end(), best_tracks.begin(), best_tracks.end());
570 
571  return;
572 }
size
Write out results.
void configure_by_fw_version(unsigned fw_version)
std::vector< std::string > pattDefinitions_
int MAX_TRIGSECTOR
Definition: Common.h:61
void process_single_bx(int bx, const TriggerPrimitiveCollection &muon_primitives, EMTFHitCollection &out_hits, EMTFTrackCollection &out_tracks, std::deque< EMTFHitCollection > &extended_conv_hits, std::deque< EMTFTrackCollection > &extended_best_track_cands, std::map< pattern_ref_t, int > &patt_lifetime_map) const
void process(const std::deque< EMTFTrackCollection > &extended_best_track_cands, EMTFTrackCollection &best_tracks) const
std::vector< int > zoneBoundaries_
const ConditionHelper * cond_
bool verbose
void configure(const GeometryTranslator *tp_geom, const SectorProcessorLUT *lut, int verbose, int endcap, int sector, int bx, int bxShiftCSC, int bxShiftRPC, int bxShiftGEM, const std::vector< int > &zoneBoundaries, int zoneOverlap, bool duplicateTheta, bool fixZonePhi, bool useNewZones, bool fixME11Edges, bool bugME11Dupes)
void process(emtf::zone_array< EMTFTrackCollection > &zone_tracks) const
emtf::CSCTag CSCTag
Definition: Common.h:44
int MIN_ENDCAP
Definition: Common.h:56
unsigned long long EventNumber_t
std::string era_
void process(const EMTFHitCollection &conv_hits, EMTFTrackCollection &best_tracks) const
std::vector< std::string > symPattDefinitions_
void configure(const GeometryTranslator *tp_geom, const ConditionHelper *cond, const SectorProcessorLUT *lut, PtAssignmentEngine *pt_assign_engine, int verbose, int endcap, int sector, int minBX, int maxBX, int bxWindow, int bxShiftCSC, int bxShiftRPC, int bxShiftGEM, std::string era, const std::vector< int > &zoneBoundaries, int zoneOverlap, bool includeNeighbor, bool duplicateTheta, bool fixZonePhi, bool useNewZones, bool fixME11Edges, const std::vector< std::string > &pattDefinitions, const std::vector< std::string > &symPattDefinitions, bool useSymPatterns, int thetaWindow, int thetaWindowZone0, bool useRPC, bool useSingleHits, bool bugSt2PhDiff, bool bugME11Dupes, bool bugAmbigThetaWin, bool twoStationSameBX, int maxRoadsPerZone, int maxTracks, bool useSecondEarliest, bool bugSameSectorPt0, bool readPtLUTFile, bool fixMode15HighPt, bool bug9BitDPhi, bool bugMode7CLCT, bool bugNegPt, bool bugGMTPhi, bool promoteMode7, int modeQualVer)
void merge_no_truncate(const std::map< int, TriggerPrimitiveCollection > &selected_csc_map, const std::map< int, TriggerPrimitiveCollection > &selected_rpc_map, const std::map< int, TriggerPrimitiveCollection > &selected_gem_map, std::map< int, TriggerPrimitiveCollection > &selected_prim_map) const
void configure(int verbose, int endcap, int sector, int bx, int bxShiftCSC, int bxShiftRPC, int bxShiftGEM, bool includeNeighbor, bool duplicateTheta, bool bugME11Dupes)
const GeometryTranslator * tp_geom_
l1t::EMTFTrackCollection EMTFTrackCollection
Definition: Common.h:28
emtf::RPCTag RPCTag
Definition: Common.h:45
void process(const std::deque< EMTFHitCollection > &extended_conv_hits, std::map< pattern_ref_t, int > &patt_lifetime_map, emtf::zone_array< EMTFRoadCollection > &zone_roads) const
void configure(int verbose, int endcap, int sector, int bx, int bxWindow, int thetaWindow, int thetaWindowZone0, bool bugME11Dupes, bool bugAmbigThetaWin, bool twoStationSameBX)
int MIN_TRIGSECTOR
Definition: Common.h:60
const SectorProcessorLUT * lut_
std::array< T, NUM_ZONES > zone_array
Definition: Common.h:76
void process(T tag, const TriggerPrimitiveCollection &muon_primitives, std::map< int, TriggerPrimitiveCollection > &selected_prim_map) const
l1t::EMTFHitCollection EMTFHitCollection
Definition: Common.h:24
emtf::GEMTag GEMTag
Definition: Common.h:46
void process(EventNumber_t ievent, const TriggerPrimitiveCollection &muon_primitives, EMTFHitCollection &out_hits, EMTFTrackCollection &out_tracks) const
void configure(PtAssignmentEngine *pt_assign_engine, int verbose, int endcap, int sector, int bx, bool readPtLUTFile, bool fixMode15HighPt, bool bug9BitDPhi, bool bugMode7CLCT, bool bugNegPt, bool bugGMTPhi, bool promoteMode7, int modeQualVer)
Definition: PtAssignment.cc:6
void configure(int verbose, int endcap, int sector, int bx, int bxWindow, const std::vector< std::string > &pattDefinitions, const std::vector< std::string > &symPattDefinitions, bool useSymPatterns, int maxRoadsPerZone, bool useSecondEarliest)
PtAssignmentEngine * pt_assign_engine_
void configure(int verbose, int endcap, int sector, int bx, int bxWindow, int maxRoadsPerZone, int maxTracks, bool useSecondEarliest, bool bugSameSectorPt0)
void merge(const std::map< int, TriggerPrimitiveCollection > &selected_csc_map, const std::map< int, TriggerPrimitiveCollection > &selected_rpc_map, const std::map< int, TriggerPrimitiveCollection > &selected_gem_map, std::map< int, TriggerPrimitiveCollection > &selected_prim_map) const
void process(const std::map< int, TriggerPrimitiveCollection > &selected_prim_map, EMTFHitCollection &conv_hits) const
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
Definition: Common.h:33
void process(EMTFTrackCollection &best_tracks)
Definition: PtAssignment.cc:34
int MAX_ENDCAP
Definition: Common.h:57
Definition: plugin.cc:24
void configure(int verbose, int endcap, int sector, int bx, int maxTracks, bool useSingleHits)
void process(const std::deque< EMTFHitCollection > &extended_conv_hits, const emtf::zone_array< EMTFRoadCollection > &zone_roads, emtf::zone_array< EMTFTrackCollection > &zone_tracks) const
void configure(int verbose, int endcap, int sector, int bx, bool fixZonePhi, bool useNewZones, bool bugSt2PhDiff, bool bugME11Dupes)