CMS 3D CMS Logo

SectorProcessor.cc
Go to the documentation of this file.
2 
4 
6 
8  emtf_assert(setup != nullptr);
11 
12  setup_ = setup;
13  verbose_ = verbose;
14  endcap_ = endcap;
15  sector_ = sector;
16 }
17 
19  const TriggerPrimitiveCollection& muon_primitives,
20  EMTFHitCollection& out_hits,
21  EMTFTrackCollection& out_tracks) const {
22  auto cfg = setup_->getVersionControl();
23 
24  // List of converted hits, extended from previous BXs
25  // deque (double-ended queue) is similar to a vector, but allows insertion or deletion of elements at both beginning and end
26  std::deque<EMTFHitCollection> extended_conv_hits;
27 
28  // List of best track candidates, extended from previous BXs
29  std::deque<EMTFTrackCollection> extended_best_track_cands;
30 
31  // Map of pattern detector --> lifetime, tracked across BXs
32  std::map<pattern_ref_t, int> patt_lifetime_map;
33 
34  // ___________________________________________________________________________
35  // Run each sector processor for every BX, taking into account the BX window
36 
37  int delayBX = cfg.bxWindow_ - 1;
38 
39  for (int bx = cfg.minBX_; bx <= cfg.maxBX_ + delayBX; ++bx) {
40  if (verbose_ > 0) { // debug
41  std::cout << "Event: " << event_id << " Endcap: " << endcap_ << " Sector: " << sector_ << " BX: " << bx
42  << std::endl;
43  }
44 
46  bx, muon_primitives, out_hits, out_tracks, extended_conv_hits, extended_best_track_cands, patt_lifetime_map);
47 
48  // Drop earliest BX outside of BX window
49  if (bx >= cfg.minBX_ + delayBX) {
50  extended_conv_hits.pop_front();
51 
52  int n = emtf::zone_array<int>().size();
53  extended_best_track_cands.erase(extended_best_track_cands.end() - n,
54  extended_best_track_cands.end()); // pop_back
55  }
56  } // end loop over bx
57 
58  return;
59 }
60 
62  const TriggerPrimitiveCollection& muon_primitives,
63  EMTFHitCollection& out_hits,
64  EMTFTrackCollection& out_tracks,
65  std::deque<EMTFHitCollection>& extended_conv_hits,
66  std::deque<EMTFTrackCollection>& extended_best_track_cands,
67  std::map<pattern_ref_t, int>& patt_lifetime_map) const {
68  auto cfg = setup_->getVersionControl();
69 
70  auto tp_geom_ = &(setup_->getGeometryTranslator());
71  auto pc_lut_ = &(setup_->getSectorProcessorLUT());
72  auto pt_assign_engine_ = setup_->getPtAssignmentEngine();
73  auto pt_assign_engine_dxy_ = setup_->getPtAssignmentEngineDxy();
74 
75  // ___________________________________________________________________________
76  // Configure
77 
78  PrimitiveSelection prim_sel;
79  prim_sel.configure(verbose_,
80  endcap_,
81  sector_,
82  bx,
83  cfg.bxShiftCSC_,
84  cfg.bxShiftRPC_,
85  cfg.bxShiftGEM_,
86  cfg.bxShiftME0_,
87  cfg.includeNeighbor_,
88  cfg.duplicateTheta_,
89  cfg.bugME11Dupes_,
90  cfg.useRun3CCLUT_OTMB_,
91  cfg.useRun3CCLUT_TMB_);
92 
93  PrimitiveConversion prim_conv;
94  prim_conv.configure(tp_geom_,
95  pc_lut_,
96  verbose_,
97  endcap_,
98  sector_,
99  bx,
100  cfg.bxShiftCSC_,
101  cfg.bxShiftRPC_,
102  cfg.bxShiftGEM_,
103  cfg.bxShiftME0_,
104  cfg.zoneBoundaries_,
105  cfg.zoneOverlap_,
106  cfg.duplicateTheta_,
107  cfg.fixZonePhi_,
108  cfg.useNewZones_,
109  cfg.fixME11Edges_,
110  cfg.bugME11Dupes_,
111  cfg.useRun3CCLUT_OTMB_,
112  cfg.useRun3CCLUT_TMB_);
113 
114  PatternRecognition patt_recog;
115  patt_recog.configure(verbose_,
116  endcap_,
117  sector_,
118  bx,
119  cfg.bxWindow_,
120  cfg.pattDefinitions_,
121  cfg.symPattDefinitions_,
122  cfg.useSymPatterns_,
123  cfg.maxRoadsPerZone_,
124  cfg.useSecondEarliest_);
125 
126  PrimitiveMatching prim_match;
127  prim_match.configure(
128  verbose_, endcap_, sector_, bx, cfg.fixZonePhi_, cfg.useNewZones_, cfg.bugSt2PhDiff_, cfg.bugME11Dupes_);
129 
130  AngleCalculation angle_calc;
131  angle_calc.configure(verbose_,
132  endcap_,
133  sector_,
134  bx,
135  cfg.bxWindow_,
136  cfg.thetaWindow_,
137  cfg.thetaWindowZone0_,
138  cfg.bugME11Dupes_,
139  cfg.bugAmbigThetaWin_,
140  cfg.twoStationSameBX_);
141 
142  BestTrackSelection btrack_sel;
143  btrack_sel.configure(verbose_,
144  endcap_,
145  sector_,
146  bx,
147  cfg.bxWindow_,
148  cfg.maxRoadsPerZone_,
149  cfg.maxTracks_,
150  cfg.useSecondEarliest_,
151  cfg.bugSameSectorPt0_);
152 
153  SingleHitTrack single_hit;
154  single_hit.configure(verbose_, endcap_, sector_, bx, cfg.maxTracks_, cfg.useSingleHits_);
155 
156  PtAssignment pt_assign;
157  pt_assign.configure(pt_assign_engine_,
158  pt_assign_engine_dxy_,
159  verbose_,
160  endcap_,
161  sector_,
162  bx,
163  cfg.readPtLUTFile_,
164  cfg.fixMode15HighPt_,
165  cfg.bug9BitDPhi_,
166  cfg.bugMode7CLCT_,
167  cfg.bugNegPt_,
168  cfg.bugGMTPhi_,
169  cfg.promoteMode7_,
170  cfg.modeQualVer_,
171  cfg.pbFileName_);
172 
173  std::map<int, TriggerPrimitiveCollection> selected_dt_map;
174  std::map<int, TriggerPrimitiveCollection> selected_csc_map;
175  std::map<int, TriggerPrimitiveCollection> selected_rpc_map;
176  std::map<int, TriggerPrimitiveCollection> selected_gem_map;
177  std::map<int, TriggerPrimitiveCollection> selected_me0_map;
178  std::map<int, TriggerPrimitiveCollection> selected_prim_map;
179  std::map<int, TriggerPrimitiveCollection> inclusive_selected_prim_map;
180 
181  EMTFHitCollection conv_hits; // "converted" hits converted by primitive converter
182  EMTFHitCollection inclusive_conv_hits;
183 
184  emtf::zone_array<EMTFRoadCollection> zone_roads; // each zone has its road collection
185 
186  emtf::zone_array<EMTFTrackCollection> zone_tracks; // each zone has its track collection
187 
188  EMTFTrackCollection best_tracks; // "best" tracks selected from all the zones
189 
190  // ___________________________________________________________________________
191  // Process
192 
193  // Select muon primitives that belong to this sector and this BX.
194  // Put them into maps with an index that roughly corresponds to
195  // each input link.
196  // From src/PrimitiveSelection.cc
197  prim_sel.process(emtf::DTTag(), muon_primitives, selected_dt_map);
198  prim_sel.process(emtf::CSCTag(), muon_primitives, selected_csc_map);
199  prim_sel.process(emtf::RPCTag(), muon_primitives, selected_rpc_map);
200  prim_sel.process(emtf::GEMTag(), muon_primitives, selected_gem_map);
201  prim_sel.process(emtf::ME0Tag(), muon_primitives, selected_me0_map);
202  prim_sel.merge(
203  selected_dt_map, selected_csc_map, selected_rpc_map, selected_gem_map, selected_me0_map, selected_prim_map);
204 
205  // Convert trigger primitives into "converted" hits
206  // A converted hit consists of integer representations of phi, theta, and zones
207  // From src/PrimitiveConversion.cc
208  prim_conv.process(selected_prim_map, conv_hits);
209  extended_conv_hits.push_back(conv_hits);
210 
211  {
212  // Keep all the converted hits for the use of data-emulator comparisons.
213  // They include the extra ones that are not used in track building and the subsequent steps.
214  prim_sel.merge_no_truncate(selected_dt_map,
215  selected_csc_map,
216  selected_rpc_map,
217  selected_gem_map,
218  selected_me0_map,
219  inclusive_selected_prim_map);
220  prim_conv.process(inclusive_selected_prim_map, inclusive_conv_hits);
221 
222  // Clear the input maps to save memory
223  selected_dt_map.clear();
224  selected_csc_map.clear();
225  selected_rpc_map.clear();
226  selected_gem_map.clear();
227  selected_me0_map.clear();
228  }
229 
230  // Detect patterns in all zones, find 3 best roads in each zone
231  // From src/PatternRecognition.cc
232  patt_recog.process(extended_conv_hits, patt_lifetime_map, zone_roads);
233 
234  // Match the trigger primitives to the roads, create tracks
235  // From src/PrimitiveMatching.cc
236  prim_match.process(extended_conv_hits, zone_roads, zone_tracks);
237 
238  // Calculate deflection angles for each track and fill track variables
239  // From src/AngleCalculation.cc
240  angle_calc.process(zone_tracks);
241  extended_best_track_cands.insert(
242  extended_best_track_cands.begin(), zone_tracks.begin(), zone_tracks.end()); // push_front
243 
244  // Select 3 "best" tracks from all the zones
245  // From src/BestTrackSelection.cc
246  btrack_sel.process(extended_best_track_cands, best_tracks);
247 
248  // Insert single LCTs from station 1 as tracks
249  // From src/SingleHitTracks.cc
250  single_hit.process(conv_hits, best_tracks);
251 
252  // Construct pT address, assign pT, calculate other GMT quantities
253  // From src/PtAssignment.cc
254  pt_assign.process(best_tracks);
255 
256  // ___________________________________________________________________________
257  // Output
258 
259  out_hits.insert(out_hits.end(), inclusive_conv_hits.begin(), inclusive_conv_hits.end());
260  out_tracks.insert(out_tracks.end(), best_tracks.begin(), best_tracks.end());
261 
262  return;
263 }
size
Write out results.
void merge(const std::map< int, TriggerPrimitiveCollection > &selected_dt_map, const std::map< int, TriggerPrimitiveCollection > &selected_csc_map, const std::map< int, TriggerPrimitiveCollection > &selected_rpc_map, const std::map< int, TriggerPrimitiveCollection > &selected_gem_map, const std::map< int, TriggerPrimitiveCollection > &selected_me0_map, std::map< int, TriggerPrimitiveCollection > &selected_prim_map) const
void process(const std::deque< EMTFHitCollection > &extended_conv_hits, const emtf::zone_array< EMTFRoadCollection > &zone_roads, emtf::zone_array< EMTFTrackCollection > &zone_tracks) const
constexpr int MIN_ENDCAP
Definition: Common.h:45
void process(const std::deque< EMTFTrackCollection > &extended_best_track_cands, EMTFTrackCollection &best_tracks) const
l1t::EMTFTrackCollection EMTFTrackCollection
Definition: Common.h:27
void process(const EMTFHitCollection &conv_hits, EMTFTrackCollection &best_tracks) const
const EMTFSetup * setup_
void process(emtf::zone_array< EMTFTrackCollection > &zone_tracks) const
bool verbose
l1t::EMTFHitCollection EMTFHitCollection
Definition: Common.h:23
void configure(const EMTFSetup *setup, int verbose, int endcap, int sector)
const GeometryTranslator & getGeometryTranslator() const
Definition: EMTFSetup.h:29
void merge_no_truncate(const std::map< int, TriggerPrimitiveCollection > &selected_dt_map, const std::map< int, TriggerPrimitiveCollection > &selected_csc_map, const std::map< int, TriggerPrimitiveCollection > &selected_rpc_map, const std::map< int, TriggerPrimitiveCollection > &selected_gem_map, const std::map< int, TriggerPrimitiveCollection > &selected_me0_map, std::map< int, TriggerPrimitiveCollection > &selected_prim_map) const
constexpr int MIN_TRIGSECTOR
Definition: Common.h:49
void configure(int verbose, int endcap, int sector, int bx, int bxWindow, int thetaWindow, int thetaWindowZone0, bool bugME11Dupes, bool bugAmbigThetaWin, bool twoStationSameBX)
void process(const std::map< int, TriggerPrimitiveCollection > &selected_prim_map, EMTFHitCollection &conv_hits) const
std::array< T, NUM_ZONES > zone_array
Definition: Common.h:65
void process(const edm::EventID &event_id, const TriggerPrimitiveCollection &muon_primitives, EMTFHitCollection &out_hits, EMTFTrackCollection &out_tracks) const
void configure(int verbose, int endcap, int sector, int bx, int bxShiftCSC, int bxShiftRPC, int bxShiftGEM, int bxShiftME0, bool includeNeighbor, bool duplicateTheta, bool bugME11Dupes, bool useRun3CCLUT_OTMB, bool useRun3CCLUT_TMB)
const SectorProcessorLUT & getSectorProcessorLUT() const
Definition: EMTFSetup.h:35
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
const VersionControl & getVersionControl() const
Definition: EMTFSetup.h:33
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)
void configure(int verbose, int endcap, int sector, int bx, int bxWindow, int maxRoadsPerZone, int maxTracks, bool useSecondEarliest, bool bugSameSectorPt0)
PtAssignmentEngine * getPtAssignmentEngine() const
Definition: EMTFSetup.h:37
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
#define emtf_assert(expr)
Definition: DebugTools.h:18
void process(EMTFTrackCollection &best_tracks)
Definition: PtAssignment.cc:42
constexpr int MAX_ENDCAP
Definition: Common.h:46
void configure(PtAssignmentEngine *pt_assign_engine, PtAssignmentEngineDxy *pt_assign_engine_dxy, int verbose, int endcap, int sector, int bx, bool readPtLUTFile, bool fixMode15HighPt, bool bug9BitDPhi, bool bugMode7CLCT, bool bugNegPt, bool bugGMTPhi, bool promoteMode7, int modeQualVer, std::string pbFileName)
Definition: PtAssignment.cc:6
void process(T tag, const TriggerPrimitiveCollection &muon_primitives, std::map< int, TriggerPrimitiveCollection > &selected_prim_map) const
void configure(int verbose, int endcap, int sector, int bx, int maxTracks, bool useSingleHits)
void configure(const GeometryTranslator *tp_geom, const SectorProcessorLUT *pc_lut, int verbose, int endcap, int sector, int bx, int bxShiftCSC, int bxShiftRPC, int bxShiftGEM, int bxShiftME0, const std::vector< int > &zoneBoundaries, int zoneOverlap, bool duplicateTheta, bool fixZonePhi, bool useNewZones, bool fixME11Edges, bool bugME11Dupes, bool useRun3CCLUT_OTMB, bool useRun3CCLUT_TMB)
constexpr int MAX_TRIGSECTOR
Definition: Common.h:50
void configure(int verbose, int endcap, int sector, int bx, bool fixZonePhi, bool useNewZones, bool bugSt2PhDiff, bool bugME11Dupes)
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
Definition: Common.h:32
PtAssignmentEngineDxy * getPtAssignmentEngineDxy() const
Definition: EMTFSetup.h:39