CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Attributes
SectorProcessor Class Reference

#include <SectorProcessor.h>

Public Types

typedef
PatternRecognition::pattern_ref_t 
pattern_ref_t
 

Public Member Functions

void configure (const EMTFSetup *setup, int verbose, int endcap, int sector)
 
void process (const edm::EventID &event_id, const TriggerPrimitiveCollection &muon_primitives, EMTFHitCollection &out_hits, EMTFTrackCollection &out_tracks) const
 
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
 
 SectorProcessor ()
 
 ~SectorProcessor ()
 

Private Attributes

int endcap_
 
int sector_
 
const EMTFSetupsetup_
 
int verbose_
 

Detailed Description

Definition at line 23 of file SectorProcessor.h.

Member Typedef Documentation

Definition at line 28 of file SectorProcessor.h.

Constructor & Destructor Documentation

SectorProcessor::SectorProcessor ( )
explicit

Definition at line 3 of file SectorProcessor.cc.

3 {}
SectorProcessor::~SectorProcessor ( )

Definition at line 5 of file SectorProcessor.cc.

5 {}

Member Function Documentation

void SectorProcessor::configure ( const EMTFSetup setup,
int  verbose,
int  endcap,
int  sector 
)

Definition at line 7 of file SectorProcessor.cc.

References emtf_assert, Reference_intrackfit_cff::endcap, endcap_, emtf::MAX_ENDCAP, emtf::MAX_TRIGSECTOR, emtf::MIN_ENDCAP, emtf::MIN_TRIGSECTOR, sector_, GeneralSetup::setup(), setup_, verbose, and verbose_.

7  {
8  emtf_assert(setup != nullptr);
11 
12  setup_ = setup;
13  verbose_ = verbose;
14  endcap_ = endcap;
15  sector_ = sector;
16 }
constexpr int MIN_ENDCAP
Definition: Common.h:45
const EMTFSetup * setup_
constexpr int MIN_TRIGSECTOR
Definition: Common.h:49
static constexpr int verbose
#define emtf_assert(expr)
Definition: DebugTools.h:18
constexpr int MAX_ENDCAP
Definition: Common.h:46
constexpr int MAX_TRIGSECTOR
Definition: Common.h:50
void SectorProcessor::process ( const edm::EventID event_id,
const TriggerPrimitiveCollection muon_primitives,
EMTFHitCollection out_hits,
EMTFTrackCollection out_tracks 
) const

Definition at line 18 of file SectorProcessor.cc.

References makePileupJSON::bx, looper::cfg, gather_cfg::cout, endcap_, EMTFSetup::getVersionControl(), dqmiodumpmetadata::n, process_single_bx(), sector_, setup_, findQualityFiles::size, and verbose_.

21  {
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 }
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
tuple cfg
Definition: looper.py:296
const EMTFSetup * setup_
const VersionControl & getVersionControl() const
Definition: EMTFSetup.h:33
std::array< T, NUM_ZONES > zone_array
Definition: Common.h:65
tuple cout
Definition: gather_cfg.py:144
tuple size
Write out results.
void SectorProcessor::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 at line 61 of file SectorProcessor.cc.

References looper::cfg, PrimitiveSelection::configure(), BestTrackSelection::configure(), SingleHitTrack::configure(), AngleCalculation::configure(), PrimitiveConversion::configure(), PrimitiveMatching::configure(), PtAssignment::configure(), PatternRecognition::configure(), endcap_, EMTFSetup::getGeometryTranslator(), EMTFSetup::getPtAssignmentEngine(), EMTFSetup::getPtAssignmentEngineDxy(), EMTFSetup::getSectorProcessorLUT(), EMTFSetup::getVersionControl(), PrimitiveSelection::merge(), PrimitiveSelection::merge_no_truncate(), SingleHitTrack::process(), BestTrackSelection::process(), AngleCalculation::process(), PrimitiveMatching::process(), PrimitiveSelection::process(), PatternRecognition::process(), PtAssignment::process(), PrimitiveConversion::process(), sector_, setup_, and verbose_.

Referenced by process().

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

Member Data Documentation

int SectorProcessor::endcap_
private

Definition at line 55 of file SectorProcessor.h.

Referenced by configure(), process(), and process_single_bx().

int SectorProcessor::sector_
private

Definition at line 55 of file SectorProcessor.h.

Referenced by configure(), process(), and process_single_bx().

const EMTFSetup* SectorProcessor::setup_
private
int SectorProcessor::verbose_
private

Definition at line 55 of file SectorProcessor.h.

Referenced by configure(), process(), and process_single_bx().