8 #include "oneapi/tbb/parallel_for.h" 14 inline bool sortByHitsChi2(
const std::pair<Track, TrackState> &cand1,
const std::pair<Track, TrackState> &cand2) {
15 if (cand1.first.nFoundHits() == cand2.first.nFoundHits())
16 return cand1.first.chi2() < cand2.first.chi2();
18 return cand1.first.nFoundHits() > cand2.first.nFoundHits();
22 return std::atan2(hit1.
y(), hit1.
x()) < std::atan2(hit2.
y(), hit2.
x());
36 bool operator()(
const std::pair<int, int> &track1,
const std::pair<int, int> &track2) {
43 inline bool sortByZ(
const Hit &hit1,
const Hit &hit2) {
return hit1.
z() < hit2.
z(); }
61 void check_nan_n_silly_candidates(
Event &
ev) {
70 int sc = check_nan_n_silly(
ev.candidateTracks_,
"Pre-bkfit silly check");
72 printf(
"Nan'n'Silly: Number of silly pre-bkfit candidates = %d\n", sc);
76 void check_nan_n_silly_bkfit(
Event &
ev) {
78 int sc = check_nan_n_silly(
ev.fitTracks_,
"Post-bkfit silly check");
80 printf(
"Nan'n'Silly: Number of silly post-bkfit candidates = %d\n", sc);
117 for (
auto const &
s :
ev.seedTracks_) {
122 ev.seedTracks_.swap(seeds1);
123 ev.relabel_bad_seedtracks();
137 bool seeds_sorted =
false;
143 #ifdef USE_VTUNE_PAUSE 154 #ifdef USE_VTUNE_PAUSE 170 job.switch_to_backward();
190 ev.seedTracks_.swap(seeds1);
209 for (
auto const &
s :
ev.seedTracks_) {
214 ev.seedTracks_.swap(seeds1);
215 ev.relabel_bad_seedtracks();
229 bool seeds_sorted =
false;
231 ev.setCurrentSeedTracks(
ev.seedTracks_);
232 ev.simLabelForCurrentSeed(0);
236 #ifdef USE_VTUNE_PAUSE 247 #ifdef USE_VTUNE_PAUSE 252 check_nan_n_silly_candidates(
ev);
255 ev.candidateTracks_.clear();
258 job.switch_to_backward();
268 check_nan_n_silly_bkfit(
ev);
280 ev.resetCurrentSeedTracks();
287 ev.seedTracks_.swap(seeds1);
306 for (
auto const &
s :
ev.seedTracks_) {
311 ev.seedTracks_.swap(seeds1);
312 ev.relabel_bad_seedtracks();
326 bool seeds_sorted =
false;
328 ev.setCurrentSeedTracks(
ev.seedTracks_);
332 #ifdef USE_VTUNE_PAUSE 343 #ifdef USE_VTUNE_PAUSE 348 check_nan_n_silly_candidates(
ev);
351 ev.candidateTracks_.clear();
354 job.switch_to_backward();
367 check_nan_n_silly_bkfit(
ev);
380 ev.resetCurrentSeedTracks();
387 ev.seedTracks_.swap(seeds1);
418 std::vector<double> timevec;
421 timevec.resize(
n + 1, 0.0);
429 for (
auto const &
s :
ev.seedTracks_) {
434 ev.seedTracks_.swap(seeds1);
435 ev.relabel_bad_seedtracks();
442 for (
int it = 0;
it <=
n - 1; ++
it) {
457 for (
auto &
s :
ev.seedTracks_) {
477 if (
seeds.size() <= 0)
479 ev.setCurrentSeedTracks(
seeds);
480 ev.simLabelForCurrentSeed(0);
489 timevec[
n] += timevec[
it];
495 seeds_used.insert(seeds_used.end(),
seeds.begin(),
seeds.end());
503 return itconf.
m_pre_bkfit_filter(tc, jb) && StdSeq::qfilter_nan_n_silly<TrackCand>(tc, jb);
506 pre_filter = StdSeq::qfilter_nan_n_silly<TrackCand>;
516 ev.candidateTracks_.reserve(
ev.candidateTracks_.size() + tmp_tvec.size());
517 for (
auto &&
t : tmp_tvec)
522 job.switch_to_backward();
536 if (do_backward_search)
541 if (do_backward_search) {
552 return itconf.
m_post_bkfit_filter(tc, jb) && StdSeq::qfilter_nan_n_silly<TrackCand>(tc, jb);
555 post_filter = StdSeq::qfilter_nan_n_silly<TrackCand>;
559 if (do_backward_search)
569 ev.resetCurrentSeedTracks();
581 ev.seedTracks_.swap(seeds_used);
584 check_nan_n_silly_candidates(
ev);
587 check_nan_n_silly_bkfit(
ev);
void export_tracks(TrackVec &out_vec)
void findTracksBestHit(SteeringParams::IterationType_e iteration_dir=SteeringParams::IT_FwdSearch)
const BeamSpot & refBeamSpot() const
constexpr bool nan_n_silly_check_cands_post_bkfit
constexpr bool nan_n_silly_print_bad_cands_bkfit
double runBuildingTestPlexStandard(Event &ev, const EventOfHits &eoh, MkBuilder &builder)
constexpr bool nan_n_silly_check_cands_pre_bkfit
void compactifyHitStorageForBestCand(bool remove_seed_hits, int backward_fit_min_hits)
bool sortTracksByPhi(const Track &track1, const Track &track2)
void root_val(Event *event)
void findTracksCloneEngine(SteeringParams::IterationType_e iteration_dir=SteeringParams::IT_FwdSearch)
bool m_backward_drop_seed_hits
void begin_event(MkJob *job, Event *ev, const char *build_type)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool sortByHitsChi2(const std::pair< Track, TrackState > &cand1, const std::pair< Track, TrackState > &cand2)
clean_seeds_func m_seed_cleaner
void prep_simtracks(Event *event)
void find_tracks_load_seeds_BH(const TrackVec &in_seeds, const bool seeds_sorted)
void findTracksStandard(SteeringParams::IterationType_e iteration_dir=SteeringParams::IT_FwdSearch)
std::function< filter_candidates_cf > filter_candidates_func
const std::vector< std::vector< Track > > & m_track_candidates
void find_tracks_load_seeds(const TrackVec &in_seeds, const bool seeds_sorted)
sortTracksByPhiStruct(std::vector< std::vector< Track >> *track_candidates)
TrackVec & ref_tracks_nc()
void seed_post_cleaning(TrackVec &tv)
void select_best_comb_cands(bool clear_m_tracks=false, bool remove_missing_hits=false)
void runBuildingTestPlexDumbCMSSW(Event &ev, const EventOfHits &eoh, MkBuilder &builder)
int filter_comb_cands(filter_candidates_func filter, bool attempt_all_cands)
int m_backward_fit_min_hits
const TrackVec & ref_tracks() const
filter_candidates_func m_post_bkfit_filter
bool sortByZ(const Hit &hit1, const Hit &hit2)
std::vector< Track > TrackVec
double runBuildingTestPlexCloneEngine(Event &ev, const EventOfHits &eoh, MkBuilder &builder)
clean_duplicates_func m_duplicate_cleaner
std::vector< double > runBtpCe_MultiIter(Event &ev, const EventOfHits &eoh, MkBuilder &builder, int n)
void export_best_comb_cands(TrackVec &out_vec, bool remove_missing_hits=false)
bool operator()(const std::pair< int, int > &track1, const std::pair< int, int > &track2)
void root_val_dumb_cmssw(Event *event)
void quality_val(Event *event)
bool sortTracksByEta(const Track &track1, const Track &track2)
std::vector< std::vector< bool > > m_mask_vector
bool sortByPhi(const Hit &hit1, const Hit &hit2)
filter_candidates_func m_pre_bkfit_filter
bool m_requires_seed_hit_sorting
double runBuildingTestPlexBestHit(Event &ev, const EventOfHits &eoh, MkBuilder &builder)
bool sortByEta(const Hit &hit1, const Hit &hit2)