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  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 
91  PrimitiveConversion prim_conv;
92  prim_conv.configure(tp_geom_,
93  pc_lut_,
94  verbose_,
95  endcap_,
96  sector_,
97  bx,
98  cfg.bxShiftCSC_,
99  cfg.bxShiftRPC_,
100  cfg.bxShiftGEM_,
101  cfg.bxShiftME0_,
102  cfg.zoneBoundaries_,
103  cfg.zoneOverlap_,
104  cfg.duplicateTheta_,
105  cfg.fixZonePhi_,
106  cfg.useNewZones_,
107  cfg.fixME11Edges_,
108  cfg.bugME11Dupes_);
109 
110  PatternRecognition patt_recog;
111  patt_recog.configure(verbose_,
112  endcap_,
113  sector_,
114  bx,
115  cfg.bxWindow_,
116  cfg.pattDefinitions_,
117  cfg.symPattDefinitions_,
118  cfg.useSymPatterns_,
119  cfg.maxRoadsPerZone_,
120  cfg.useSecondEarliest_);
121 
122  PrimitiveMatching prim_match;
123  prim_match.configure(
124  verbose_, endcap_, sector_, bx, cfg.fixZonePhi_, cfg.useNewZones_, cfg.bugSt2PhDiff_, cfg.bugME11Dupes_);
125 
126  AngleCalculation angle_calc;
127  angle_calc.configure(verbose_,
128  endcap_,
129  sector_,
130  bx,
131  cfg.bxWindow_,
132  cfg.thetaWindow_,
133  cfg.thetaWindowZone0_,
134  cfg.bugME11Dupes_,
135  cfg.bugAmbigThetaWin_,
136  cfg.twoStationSameBX_);
137 
138  BestTrackSelection btrack_sel;
139  btrack_sel.configure(verbose_,
140  endcap_,
141  sector_,
142  bx,
143  cfg.bxWindow_,
144  cfg.maxRoadsPerZone_,
145  cfg.maxTracks_,
146  cfg.useSecondEarliest_,
147  cfg.bugSameSectorPt0_);
148 
149  SingleHitTrack single_hit;
150  single_hit.configure(verbose_, endcap_, sector_, bx, cfg.maxTracks_, cfg.useSingleHits_);
151 
152  PtAssignment pt_assign;
153  pt_assign.configure(pt_assign_engine_,
154  pt_assign_engine_dxy_,
155  verbose_,
156  endcap_,
157  sector_,
158  bx,
159  cfg.readPtLUTFile_,
160  cfg.fixMode15HighPt_,
161  cfg.bug9BitDPhi_,
162  cfg.bugMode7CLCT_,
163  cfg.bugNegPt_,
164  cfg.bugGMTPhi_,
165  cfg.promoteMode7_,
166  cfg.modeQualVer_,
167  cfg.pbFileName_);
168 
169  std::map<int, TriggerPrimitiveCollection> selected_dt_map;
170  std::map<int, TriggerPrimitiveCollection> selected_csc_map;
171  std::map<int, TriggerPrimitiveCollection> selected_rpc_map;
172  std::map<int, TriggerPrimitiveCollection> selected_gem_map;
173  std::map<int, TriggerPrimitiveCollection> selected_me0_map;
174  std::map<int, TriggerPrimitiveCollection> selected_prim_map;
175  std::map<int, TriggerPrimitiveCollection> inclusive_selected_prim_map;
176 
177  EMTFHitCollection conv_hits; // "converted" hits converted by primitive converter
178  EMTFHitCollection inclusive_conv_hits;
179 
180  emtf::zone_array<EMTFRoadCollection> zone_roads; // each zone has its road collection
181 
182  emtf::zone_array<EMTFTrackCollection> zone_tracks; // each zone has its track collection
183 
184  EMTFTrackCollection best_tracks; // "best" tracks selected from all the zones
185 
186  // ___________________________________________________________________________
187  // Process
188 
189  // Select muon primitives that belong to this sector and this BX.
190  // Put them into maps with an index that roughly corresponds to
191  // each input link.
192  // From src/PrimitiveSelection.cc
193  prim_sel.process(emtf::DTTag(), muon_primitives, selected_dt_map);
194  prim_sel.process(emtf::CSCTag(), muon_primitives, selected_csc_map);
195  prim_sel.process(emtf::RPCTag(), muon_primitives, selected_rpc_map);
196  prim_sel.process(emtf::GEMTag(), muon_primitives, selected_gem_map);
197  prim_sel.process(emtf::ME0Tag(), muon_primitives, selected_me0_map);
198  prim_sel.merge(
199  selected_dt_map, selected_csc_map, selected_rpc_map, selected_gem_map, selected_me0_map, selected_prim_map);
200 
201  // Convert trigger primitives into "converted" hits
202  // A converted hit consists of integer representations of phi, theta, and zones
203  // From src/PrimitiveConversion.cc
204  prim_conv.process(selected_prim_map, conv_hits);
205  extended_conv_hits.push_back(conv_hits);
206 
207  {
208  // Keep all the converted hits for the use of data-emulator comparisons.
209  // They include the extra ones that are not used in track building and the subsequent steps.
210  prim_sel.merge_no_truncate(selected_dt_map,
211  selected_csc_map,
212  selected_rpc_map,
213  selected_gem_map,
214  selected_me0_map,
215  inclusive_selected_prim_map);
216  prim_conv.process(inclusive_selected_prim_map, inclusive_conv_hits);
217 
218  // Clear the input maps to save memory
219  selected_dt_map.clear();
220  selected_csc_map.clear();
221  selected_rpc_map.clear();
222  selected_gem_map.clear();
223  selected_me0_map.clear();
224  }
225 
226  // Detect patterns in all zones, find 3 best roads in each zone
227  // From src/PatternRecognition.cc
228  patt_recog.process(extended_conv_hits, patt_lifetime_map, zone_roads);
229 
230  // Match the trigger primitives to the roads, create tracks
231  // From src/PrimitiveMatching.cc
232  prim_match.process(extended_conv_hits, zone_roads, zone_tracks);
233 
234  // Calculate deflection angles for each track and fill track variables
235  // From src/AngleCalculation.cc
236  angle_calc.process(zone_tracks);
237  extended_best_track_cands.insert(
238  extended_best_track_cands.begin(), zone_tracks.begin(), zone_tracks.end()); // push_front
239 
240  // Select 3 "best" tracks from all the zones
241  // From src/BestTrackSelection.cc
242  btrack_sel.process(extended_best_track_cands, best_tracks);
243 
244  // Insert single LCTs from station 1 as tracks
245  // From src/SingleHitTracks.cc
246  single_hit.process(conv_hits, best_tracks);
247 
248  // Construct pT address, assign pT, calculate other GMT quantities
249  // From src/PtAssignment.cc
250  pt_assign.process(best_tracks);
251 
252  // ___________________________________________________________________________
253  // Output
254 
255  out_hits.insert(out_hits.end(), inclusive_conv_hits.begin(), inclusive_conv_hits.end());
256  out_tracks.insert(out_tracks.end(), best_tracks.begin(), best_tracks.end());
257 
258  return;
259 }
SingleHitTrack
Definition: SingleHitTrack.h:6
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:12
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:33
EMTFSetup::getSectorProcessorLUT
const SectorProcessorLUT & getSectorProcessorLUT() const
Definition: EMTFSetup.h:35
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:20
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
PtAssignment::configure
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
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:29
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
EMTFSetup::getPtAssignmentEngineDxy
PtAssignmentEngineDxy * getPtAssignmentEngineDxy() const
Definition: EMTFSetup.h:39
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:37
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:12
PtAssignment
Definition: PtAssignment.h:10
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:562
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:483
emtf_assert
#define emtf_assert(expr)
Definition: DebugTools.h:18
PtAssignment::process
void process(EMTFTrackCollection &best_tracks)
Definition: PtAssignment.cc:42
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:18
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:31
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:181