CMS 3D CMS Logo

SectorProcessor.cc
Go to the documentation of this file.
2 
4 
6 
7 void SectorProcessor::configure(const EMTFSetup* setup, int verbose, int endcap, int sector) {
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 
74  // ___________________________________________________________________________
75  // Configure
76 
77  PrimitiveSelection prim_sel;
78  prim_sel.configure(verbose_,
79  endcap_,
80  sector_,
81  bx,
82  cfg.bxShiftCSC_,
83  cfg.bxShiftRPC_,
84  cfg.bxShiftGEM_,
85  cfg.bxShiftME0_,
86  cfg.includeNeighbor_,
87  cfg.duplicateTheta_,
88  cfg.bugME11Dupes_);
89 
90  PrimitiveConversion prim_conv;
91  prim_conv.configure(tp_geom_,
92  pc_lut_,
93  verbose_,
94  endcap_,
95  sector_,
96  bx,
97  cfg.bxShiftCSC_,
98  cfg.bxShiftRPC_,
99  cfg.bxShiftGEM_,
100  cfg.bxShiftME0_,
101  cfg.zoneBoundaries_,
102  cfg.zoneOverlap_,
103  cfg.duplicateTheta_,
104  cfg.fixZonePhi_,
105  cfg.useNewZones_,
106  cfg.fixME11Edges_,
107  cfg.bugME11Dupes_);
108 
109  PatternRecognition patt_recog;
110  patt_recog.configure(verbose_,
111  endcap_,
112  sector_,
113  bx,
114  cfg.bxWindow_,
115  cfg.pattDefinitions_,
116  cfg.symPattDefinitions_,
117  cfg.useSymPatterns_,
118  cfg.maxRoadsPerZone_,
119  cfg.useSecondEarliest_);
120 
121  PrimitiveMatching prim_match;
122  prim_match.configure(
123  verbose_, endcap_, sector_, bx, cfg.fixZonePhi_, cfg.useNewZones_, cfg.bugSt2PhDiff_, cfg.bugME11Dupes_);
124 
125  AngleCalculation angle_calc;
126  angle_calc.configure(verbose_,
127  endcap_,
128  sector_,
129  bx,
130  cfg.bxWindow_,
131  cfg.thetaWindow_,
132  cfg.thetaWindowZone0_,
133  cfg.bugME11Dupes_,
134  cfg.bugAmbigThetaWin_,
135  cfg.twoStationSameBX_);
136 
137  BestTrackSelection btrack_sel;
138  btrack_sel.configure(verbose_,
139  endcap_,
140  sector_,
141  bx,
142  cfg.bxWindow_,
143  cfg.maxRoadsPerZone_,
144  cfg.maxTracks_,
145  cfg.useSecondEarliest_,
146  cfg.bugSameSectorPt0_);
147 
148  SingleHitTrack single_hit;
149  single_hit.configure(verbose_, endcap_, sector_, bx, cfg.maxTracks_, cfg.useSingleHits_);
150 
151  PtAssignment pt_assign;
152  pt_assign.configure(pt_assign_engine_,
153  verbose_,
154  endcap_,
155  sector_,
156  bx,
157  cfg.readPtLUTFile_,
158  cfg.fixMode15HighPt_,
159  cfg.bug9BitDPhi_,
160  cfg.bugMode7CLCT_,
161  cfg.bugNegPt_,
162  cfg.bugGMTPhi_,
163  cfg.promoteMode7_,
164  cfg.modeQualVer_);
165 
166  std::map<int, TriggerPrimitiveCollection> selected_dt_map;
167  std::map<int, TriggerPrimitiveCollection> selected_csc_map;
168  std::map<int, TriggerPrimitiveCollection> selected_rpc_map;
169  std::map<int, TriggerPrimitiveCollection> selected_gem_map;
170  std::map<int, TriggerPrimitiveCollection> selected_me0_map;
171  std::map<int, TriggerPrimitiveCollection> selected_prim_map;
172  std::map<int, TriggerPrimitiveCollection> inclusive_selected_prim_map;
173 
174  EMTFHitCollection conv_hits; // "converted" hits converted by primitive converter
175  EMTFHitCollection inclusive_conv_hits;
176 
177  emtf::zone_array<EMTFRoadCollection> zone_roads; // each zone has its road collection
178 
179  emtf::zone_array<EMTFTrackCollection> zone_tracks; // each zone has its track collection
180 
181  EMTFTrackCollection best_tracks; // "best" tracks selected from all the zones
182 
183  // ___________________________________________________________________________
184  // Process
185 
186  // Select muon primitives that belong to this sector and this BX.
187  // Put them into maps with an index that roughly corresponds to
188  // each input link.
189  // From src/PrimitiveSelection.cc
190  prim_sel.process(emtf::DTTag(), muon_primitives, selected_dt_map);
191  prim_sel.process(emtf::CSCTag(), muon_primitives, selected_csc_map);
192  prim_sel.process(emtf::RPCTag(), muon_primitives, selected_rpc_map);
193  prim_sel.process(emtf::GEMTag(), muon_primitives, selected_gem_map);
194  prim_sel.process(emtf::ME0Tag(), muon_primitives, selected_me0_map);
195  prim_sel.merge(
196  selected_dt_map, selected_csc_map, selected_rpc_map, selected_gem_map, selected_me0_map, selected_prim_map);
197 
198  // Convert trigger primitives into "converted" hits
199  // A converted hit consists of integer representations of phi, theta, and zones
200  // From src/PrimitiveConversion.cc
201  prim_conv.process(selected_prim_map, conv_hits);
202  extended_conv_hits.push_back(conv_hits);
203 
204  {
205  // Keep all the converted hits for the use of data-emulator comparisons.
206  // They include the extra ones that are not used in track building and the subsequent steps.
207  prim_sel.merge_no_truncate(selected_dt_map,
208  selected_csc_map,
209  selected_rpc_map,
210  selected_gem_map,
211  selected_me0_map,
212  inclusive_selected_prim_map);
213  prim_conv.process(inclusive_selected_prim_map, inclusive_conv_hits);
214 
215  // Clear the input maps to save memory
216  selected_dt_map.clear();
217  selected_csc_map.clear();
218  selected_rpc_map.clear();
219  selected_gem_map.clear();
220  selected_me0_map.clear();
221  }
222 
223  // Detect patterns in all zones, find 3 best roads in each zone
224  // From src/PatternRecognition.cc
225  patt_recog.process(extended_conv_hits, patt_lifetime_map, zone_roads);
226 
227  // Match the trigger primitives to the roads, create tracks
228  // From src/PrimitiveMatching.cc
229  prim_match.process(extended_conv_hits, zone_roads, zone_tracks);
230 
231  // Calculate deflection angles for each track and fill track variables
232  // From src/AngleCalculation.cc
233  angle_calc.process(zone_tracks);
234  extended_best_track_cands.insert(
235  extended_best_track_cands.begin(), zone_tracks.begin(), zone_tracks.end()); // push_front
236 
237  // Select 3 "best" tracks from all the zones
238  // From src/BestTrackSelection.cc
239  btrack_sel.process(extended_best_track_cands, best_tracks);
240 
241  // Insert single LCTs from station 1 as tracks
242  // From src/SingleHitTracks.cc
243  single_hit.process(conv_hits, best_tracks);
244 
245  // Construct pT address, assign pT, calculate other GMT quantities
246  // From src/PtAssignment.cc
247  pt_assign.process(best_tracks);
248 
249  // ___________________________________________________________________________
250  // Output
251 
252  out_hits.insert(out_hits.end(), inclusive_conv_hits.begin(), inclusive_conv_hits.end());
253  out_tracks.insert(out_tracks.end(), best_tracks.begin(), best_tracks.end());
254 
255  return;
256 }
SingleHitTrack
Definition: SingleHitTrack.h:6
PtAssignment::configure
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:5
PrimitiveMatching
Definition: PrimitiveMatching.h:6
emtf::CSCTag
Definition: EMTFSubsystemTag.h:31
PatternRecognition::configure
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)
Definition: PatternRecognition.cc:11
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
SectorProcessor::sector_
int sector_
Definition: SectorProcessor.h:55
emtf::MIN_TRIGSECTOR
constexpr int MIN_TRIGSECTOR
Definition: Common.h:49
EMTFSetup::getVersionControl
const VersionControl & getVersionControl() const
Definition: EMTFSetup.h:32
EMTFSetup::getSectorProcessorLUT
const SectorProcessorLUT & getSectorProcessorLUT() const
Definition: EMTFSetup.h:34
emtf::GEMTag
Definition: EMTFSubsystemTag.h:57
AngleCalculation
Definition: AngleCalculation.h:6
PatternRecognition
Definition: PatternRecognition.h:7
AngleCalculation::process
void process(emtf::zone_array< EMTFTrackCollection > &zone_tracks) const
Definition: AngleCalculation.cc:35
SectorProcessor.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EMTFSetup
Definition: EMTFSetup.h:19
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
emtf::MAX_ENDCAP
constexpr int MAX_ENDCAP
Definition: Common.h:46
SingleHitTrack::process
void process(const EMTFHitCollection &conv_hits, EMTFTrackCollection &best_tracks) const
Definition: SingleHitTrack.cc:14
SectorProcessor::SectorProcessor
SectorProcessor()
Definition: SectorProcessor.cc:3
PrimitiveConversion::process
void process(const std::map< int, TriggerPrimitiveCollection > &selected_prim_map, EMTFHitCollection &conv_hits) const
Definition: PrimitiveConversion.cc:49
PrimitiveConversion
Definition: PrimitiveConversion.h:8
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
PrimitiveSelection::process
void process(T tag, const TriggerPrimitiveCollection &muon_primitives, std::map< int, TriggerPrimitiveCollection > &selected_prim_map) const
SectorProcessor::process
void process(const edm::EventID &event_id, const TriggerPrimitiveCollection &muon_primitives, EMTFHitCollection &out_hits, EMTFTrackCollection &out_tracks) const
Definition: SectorProcessor.cc:18
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
emtf::MAX_TRIGSECTOR
constexpr int MAX_TRIGSECTOR
Definition: Common.h:50
EMTFTrackCollection
l1t::EMTFTrackCollection EMTFTrackCollection
Definition: Common.h:27
EMTFSetup::getGeometryTranslator
const GeometryTranslator & getGeometryTranslator() const
Definition: EMTFSetup.h:28
BestTrackSelection::configure
void configure(int verbose, int endcap, int sector, int bx, int bxWindow, int maxRoadsPerZone, int maxTracks, bool useSecondEarliest, bool bugSameSectorPt0)
Definition: BestTrackSelection.cc:5
BestTrackSelection
Definition: BestTrackSelection.h:6
emtf::MIN_ENDCAP
constexpr int MIN_ENDCAP
Definition: Common.h:45
SectorProcessor::~SectorProcessor
~SectorProcessor()
Definition: SectorProcessor.cc:5
EMTFHitCollection
l1t::EMTFHitCollection EMTFHitCollection
Definition: Common.h:23
verbose
static constexpr int verbose
Definition: HLTExoticaSubAnalysis.cc:25
emtf::ME0Tag
Definition: EMTFSubsystemTag.h:62
SectorProcessor::setup_
const EMTFSetup * setup_
Definition: SectorProcessor.h:53
emtf::RPCTag
Definition: EMTFSubsystemTag.h:38
SectorProcessor::process_single_bx
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
Definition: SectorProcessor.cc:61
SectorProcessor::verbose_
int verbose_
Definition: SectorProcessor.h:55
SingleHitTrack::configure
void configure(int verbose, int endcap, int sector, int bx, int maxTracks, bool useSingleHits)
Definition: SingleHitTrack.cc:3
TriggerPrimitiveCollection
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
Definition: Common.h:32
PrimitiveSelection
Definition: PrimitiveSelection.h:6
SectorProcessor::configure
void configure(const EMTFSetup *setup, int verbose, int endcap, int sector)
Definition: SectorProcessor.cc:7
EMTFSetup::getPtAssignmentEngine
PtAssignmentEngine * getPtAssignmentEngine() const
Definition: EMTFSetup.h:36
emtf::DTTag
Definition: EMTFSubsystemTag.h:24
AngleCalculation::configure
void configure(int verbose, int endcap, int sector, int bx, int bxWindow, int thetaWindow, int thetaWindowZone0, bool bugME11Dupes, bool bugAmbigThetaWin, bool twoStationSameBX)
Definition: AngleCalculation.cc:12
looper.cfg
cfg
Definition: looper.py:297
PrimitiveMatching::configure
void configure(int verbose, int endcap, int sector, int bx, bool fixZonePhi, bool useNewZones, bool bugSt2PhDiff, bool bugME11Dupes)
Definition: PrimitiveMatching.cc:11
PtAssignment
Definition: PtAssignment.h:9
PrimitiveSelection::merge_no_truncate
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
Definition: PrimitiveSelection.cc:561
PrimitiveSelection::merge
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
Definition: PrimitiveSelection.cc:482
emtf_assert
#define emtf_assert(expr)
Definition: DebugTools.h:18
PtAssignment::process
void process(EMTFTrackCollection &best_tracks)
Definition: PtAssignment.cc:34
PrimitiveSelection::configure
void configure(int verbose, int endcap, int sector, int bx, int bxShiftCSC, int bxShiftRPC, int bxShiftGEM, int bxShiftME0, bool includeNeighbor, bool duplicateTheta, bool bugME11Dupes)
Definition: PrimitiveSelection.cc:17
emtf::zone_array
std::array< T, NUM_ZONES > zone_array
Definition: Common.h:65
edm::EventID
Definition: EventID.h:31
BestTrackSelection::process
void process(const std::deque< EMTFTrackCollection > &extended_best_track_cands, EMTFTrackCollection &best_tracks) const
Definition: BestTrackSelection.cc:26
PrimitiveConversion::configure
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)
Definition: PrimitiveConversion.cc:7
PrimitiveMatching::process
void process(const std::deque< EMTFHitCollection > &extended_conv_hits, const emtf::zone_array< EMTFRoadCollection > &zone_roads, emtf::zone_array< EMTFTrackCollection > &zone_tracks) const
Definition: PrimitiveMatching.cc:30
SectorProcessor::endcap_
int endcap_
Definition: SectorProcessor.h:55
PatternRecognition::process
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
Definition: PatternRecognition.cc:180