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);
118 for (
auto const &
s :
ev.seedTracks_) {
123 ev.seedTracks_.swap(seeds1);
124 ev.relabel_bad_seedtracks();
138 bool seeds_sorted =
false;
144 #ifdef USE_VTUNE_PAUSE 155 #ifdef USE_VTUNE_PAUSE 171 job.switch_to_backward();
207 for (
auto const &
s :
ev.seedTracks_) {
212 ev.seedTracks_.swap(seeds1);
213 ev.relabel_bad_seedtracks();
227 bool seeds_sorted =
false;
232 #ifdef USE_VTUNE_PAUSE 243 #ifdef USE_VTUNE_PAUSE 248 check_nan_n_silly_candidates(
ev);
253 job.switch_to_backward();
263 check_nan_n_silly_bkfit(
ev);
296 for (
auto const &
s :
ev.seedTracks_) {
301 ev.seedTracks_.swap(seeds1);
302 ev.relabel_bad_seedtracks();
316 bool seeds_sorted =
false;
321 #ifdef USE_VTUNE_PAUSE 332 #ifdef USE_VTUNE_PAUSE 337 check_nan_n_silly_candidates(
ev);
342 job.switch_to_backward();
355 check_nan_n_silly_bkfit(
ev);
396 constexpr
unsigned int algorithms[] = {4, 22, 23, 5, 24, 7, 8, 9, 10, 6};
400 std::vector<double> timevec;
403 timevec.resize(
n + 1, 0.0);
411 for (
auto const &
s :
ev.seedTracks_) {
416 ev.seedTracks_.swap(seeds1);
417 ev.relabel_bad_seedtracks();
424 for (
int it = 0; it <=
n - 1; ++it) {
439 for (
auto &
s :
ev.seedTracks_) {
459 if (
seeds.size() <= 0)
469 timevec[
n] += timevec[it];
475 seeds_used.insert(seeds_used.end(),
seeds.begin(),
seeds.end());
483 return itconf.
m_pre_bkfit_filter(tc, jb) && StdSeq::qfilter_nan_n_silly<TrackCand>(tc, jb);
486 pre_filter = StdSeq::qfilter_nan_n_silly<TrackCand>;
496 ev.candidateTracks_.reserve(
ev.candidateTracks_.size() + tmp_tvec.size());
497 for (
auto &&
t : tmp_tvec)
502 job.switch_to_backward();
516 if (do_backward_search)
521 if (do_backward_search) {
532 return itconf.
m_post_bkfit_filter(tc, jb) && StdSeq::qfilter_nan_n_silly<TrackCand>(tc, jb);
535 post_filter = StdSeq::qfilter_nan_n_silly<TrackCand>;
539 if (do_backward_search)
560 ev.seedTracks_.swap(seeds_used);
563 check_nan_n_silly_candidates(
ev);
566 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)