CMS 3D CMS Logo

runFunctions.cc
Go to the documentation of this file.
4 
5 #include "oneapi/tbb/parallel_for.h"
6 
7 #include <memory>
8 
9 namespace mkfit {
10 
11  //==============================================================================
12  // run_OneIteration
13  //
14  // One-stop function for running track building from CMSSW.
15  //==============================================================================
16 
19  const std::vector<const std::vector<bool> *> &m_mask_vector;
20 
21  IterationMaskIfcCmssw(const TrackerInfo &ti, const std::vector<const std::vector<bool> *> &maskvec)
22  : m_trk_info(ti), m_mask_vector(maskvec) {}
23 
24  const std::vector<bool> *get_mask_for_layer(int layer) const override {
26  }
27  };
28 
29  void run_OneIteration(const TrackerInfo &trackerInfo,
30  const IterationConfig &itconf,
31  const EventOfHits &eoh,
32  const std::vector<const std::vector<bool> *> &hit_masks,
33  MkBuilder &builder,
34  TrackVec &seeds,
35  TrackVec &out_tracks,
36  bool do_seed_clean,
37  bool do_backward_fit,
38  bool do_remove_duplicates) {
39  IterationMaskIfcCmssw it_mask_ifc(trackerInfo, hit_masks);
40 
41  MkJob job({trackerInfo, itconf, eoh, &it_mask_ifc});
42 
43  builder.begin_event(&job, nullptr, __func__);
44 
45  if (do_seed_clean) {
46  // Seed cleaning not done on pixelLess / tobTec iters
47  if (itconf.m_requires_dupclean_tight)
49  }
50 
51  // Check nans in seeds -- this should not be needed when Slava fixes
52  // the track parameter coordinate transformation.
53  builder.seed_post_cleaning(seeds);
54 
55  if (itconf.m_requires_seed_hit_sorting) {
56  for (auto &s : seeds)
57  s.sortHitsByLayer(); // sort seed hits for the matched hits (I hope it works here)
58  }
59 
60  builder.find_tracks_load_seeds(seeds, do_seed_clean);
61 
62  builder.findTracksCloneEngine();
63 
67  builder.filter_comb_cands([&](const TrackCand &t) { return StdSeq::qfilter_n_hits_pixseed(t, 3); });
68  } else if (Algo(itconf.m_track_algorithm) == Algo::pixelLessStep) {
69  builder.filter_comb_cands(
70  [&](const TrackCand &t) { return StdSeq::qfilter_pixelLessFwd(t, eoh.refBeamSpot(), trackerInfo); });
71  } else {
72  builder.filter_comb_cands(
73  [&](const TrackCand &t) { return StdSeq::qfilter_n_hits(t, itconf.m_params.minHitsQF); });
74  }
75  }
76 
77  if (do_backward_fit) {
78  if (itconf.m_backward_search) {
80  }
81 
82  builder.backwardFit();
83 
84  if (itconf.m_backward_search) {
85  builder.beginBkwSearch();
87  builder.endBkwSearch();
88  }
89 
93  builder.filter_comb_cands(
94  [&](const TrackCand &t) { return StdSeq::qfilter_n_layers(t, eoh.refBeamSpot(), trackerInfo); });
95  } else if (Algo(itconf.m_track_algorithm) == Algo::pixelLessStep) {
96  builder.filter_comb_cands(
97  [&](const TrackCand &t) { return StdSeq::qfilter_pixelLessBkwd(t, eoh.refBeamSpot(), trackerInfo); });
98  }
99  }
100  }
101 
102  builder.filter_comb_cands([&](const TrackCand &t) { return StdSeq::qfilter_nan_n_silly(t); });
103 
104  builder.export_best_comb_cands(out_tracks, true);
105 
106  if (do_remove_duplicates) {
107  StdSeq::find_and_remove_duplicates(out_tracks, itconf);
108  }
109 
110  builder.end_event();
111  builder.release_memory();
112  }
113 
114 } // end namespace mkfit
void find_and_remove_duplicates(TrackVec &tracks, const IterationConfig &itconf)
Definition: MkStdSeqs.cc:591
bool qfilter_n_hits_pixseed(const TRACK &t, int nMinHits)
Definition: MkStdSeqs.h:50
bool qfilter_pixelLessFwd(const TRACK &t, const BeamSpot &bspot, const TrackerInfo &tk_info)
quality filter tuned for pixelLess iteration during forward search
Definition: MkStdSeqs.h:78
IterationParams m_params
const BeamSpot & refBeamSpot() const
bool qfilter_n_hits(const TRACK &t, int nMinHits)
Definition: MkStdSeqs.h:42
bool qfilter_n_layers(const TRACK &t, const BeamSpot &bspot, const TrackerInfo &trk_inf)
Definition: MkStdSeqs.h:56
int filter_comb_cands(std::function< filter_track_cand_foo > filter)
Definition: MkBuilder.cc:303
void compactifyHitStorageForBestCand(bool remove_seed_hits, int backward_fit_min_hits)
Definition: MkBuilder.h:91
void findTracksCloneEngine(SteeringParams::IterationType_e iteration_dir=SteeringParams::IT_FwdSearch)
Definition: MkBuilder.cc:926
void begin_event(MkJob *job, Event *ev, const char *build_type)
Definition: MkBuilder.cc:196
bool is_pixel() const
Definition: TrackerInfo.h:69
constexpr std::array< uint8_t, layerIndexSize > layer
void run_OneIteration(const TrackerInfo &trackerInfo, const IterationConfig &itconf, const EventOfHits &eoh, const std::vector< const std::vector< bool > *> &hit_masks, MkBuilder &builder, TrackVec &seeds, TrackVec &out_tracks, bool do_seed_clean, bool do_backward_fit, bool do_remove_duplicates)
Definition: runFunctions.cc:29
void find_tracks_load_seeds(const TrackVec &in_seeds, const bool seeds_sorted)
Definition: MkBuilder.cc:612
void release_memory()
Definition: MkBuilder.cc:224
bool qfilter_pixelLessBkwd(const TRACK &t, const BeamSpot &bspot, const TrackerInfo &tk_info)
quality filter tuned for pixelLess iteration during backward search
Definition: MkStdSeqs.h:104
void seed_post_cleaning(TrackVec &tv)
Definition: MkBuilder.cc:397
const LayerInfo & layer(int l) const
Definition: TrackerInfo.h:162
const std::vector< bool > * get_mask_for_layer(int layer) const override
Definition: runFunctions.cc:24
std::vector< Track > TrackVec
const std::vector< const std::vector< bool > * > & m_mask_vector
Definition: runFunctions.cc:19
void beginBkwSearch()
Definition: MkBuilder.h:95
bool qfilter_nan_n_silly(const TRACK &t)
Definition: MkStdSeqs.h:128
void export_best_comb_cands(TrackVec &out_vec, bool remove_missing_hits=false)
Definition: MkBuilder.cc:371
void endBkwSearch()
Definition: MkBuilder.h:96
TrackAlgorithm
track algorithm; copy from TrackBase.h to keep in standalone builds
Definition: Track.h:275
const TrackerInfo & m_trk_info
Definition: runFunctions.cc:18
IterationMaskIfcCmssw(const TrackerInfo &ti, const std::vector< const std::vector< bool > *> &maskvec)
Definition: runFunctions.cc:21
Definition: fakeMenu.h:6
int clean_cms_seedtracks_iter(TrackVec *seed_ptr, const IterationConfig &itrcfg, const BeamSpot &bspot)
Definition: MkStdSeqs.cc:84