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