17 #ifdef MKFIT_STANDALONE 25 #include "oneapi/tbb/parallel_for.h" 26 #include "oneapi/tbb/parallel_for_each.h" 56 using namespace mkfit;
59 struct RangeOfSeedIndices {
60 int m_rng_beg, m_rng_end;
63 RangeOfSeedIndices(
int rb,
int re) : m_rng_beg(rb), m_rng_end(re) {
reset(); }
70 bool valid()
const {
return m_beg < m_rng_end; }
72 int n_proc()
const {
return m_end - m_beg; }
86 struct RegionOfSeedIndices {
87 int m_reg_beg, m_reg_end, m_vec_cnt;
89 RegionOfSeedIndices(
const std::vector<int> &seedEtaSeparators,
int region) {
90 m_reg_beg = (
region == 0) ? 0 : seedEtaSeparators[
region - 1];
91 m_reg_end = seedEtaSeparators[
region];
92 m_vec_cnt = (m_reg_end - m_reg_beg +
NN - 1) /
NN;
95 int count()
const {
return m_reg_end - m_reg_beg; }
97 tbb::blocked_range<int> tbb_blk_rng_std(
int thr_hint = -1)
const {
100 return tbb::blocked_range<int>(m_reg_beg, m_reg_end, thr_hint);
103 tbb::blocked_range<int> tbb_blk_rng_vec()
const {
107 RangeOfSeedIndices seed_rng(
const tbb::blocked_range<int> &
i)
const {
108 return RangeOfSeedIndices(m_reg_beg +
NN *
i.begin(),
std::min(m_reg_beg +
NN *
i.end(), m_reg_end));
113 void pre_prop_print(
int ilay,
MkBase *fir) {
114 const float pt = 1.f / fir->
getPar(0, 0, 3);
115 std::cout <<
"propagate to lay=" << ilay <<
" start from x=" << fir->
getPar(0, 0, 0)
116 <<
" y=" << fir->
getPar(0, 0, 1) <<
" z=" << fir->
getPar(0, 0, 2)
122 void post_prop_print(
int ilay,
MkBase *fir) {
123 std::cout <<
"propagate to lay=" << ilay <<
" arrive at x=" << fir->
getPar(0, 1, 0) <<
" y=" << fir->
getPar(0, 1, 1)
129 std::cout <<
"MX - found seed with label=" <<
seed.label() <<
" nHits=" <<
seed.nFoundHits()
130 <<
" chi2=" <<
seed.chi2() <<
" posEta=" <<
seed.posEta() <<
" posPhi=" <<
seed.posPhi()
131 <<
" posR=" <<
seed.posR() <<
" posZ=" <<
seed.z() <<
" pT=" <<
seed.pT() << std::endl;
135 std::cout <<
"MX - found seed with nFoundHits=" <<
seed.nFoundHits() <<
" chi2=" <<
seed.chi2() <<
" x=" <<
seed.x()
136 <<
" y=" <<
seed.y() <<
" z=" <<
seed.z() <<
" px=" <<
seed.px() <<
" py=" <<
seed.py()
137 <<
" pz=" <<
seed.pz() <<
" pT=" <<
seed.pT() << std::endl;
149 print_seed2(event_of_comb_cands[
iseed].front());
174 int lsize = eoh[
l].nHits();
177 maxL = eoh[
l].layer_id();
211 std::cout <<
"MkBuilder building tracks with '" << build_type <<
"'" 229 const bool seeds_sorted,
230 std::function<insert_seed_foo> insert_seed) {
233 const int size = in_seeds.size();
236 std::vector<unsigned> ranks;
247 ranks.swap(phi_eta_binnor.
m_ranks);
252 for (
int i = 0;
i < size; ++
i) {
253 int j = seeds_sorted ?
i : ranks[
i];
254 int reg =
part.m_region[
j];
267 for (
int i = 0;
i < size; ++
i) {
268 int j = seeds_sorted ?
i : ranks[
i];
269 int reg =
part.m_region[
j];
271 insert_seed(
seed,
j, reg, seed_cursors[reg]++);
287 dprintf(
"MkBuilder::import_seeds finished import of %d seeds (last seeding layer min, max):\n" 288 " ec- = %d(%d,%d), t- = %d(%d,%d), brl = %d(%d,%d), t+ = %d(%d,%d), ec+ = %d(%d,%d).\n",
303 int i = 0, place_pos = 0;
305 dprintf(
"MkBuilder::filter_comb_cands Entering filter size eoccs.size=%d\n", eoccs.
size());
308 while (
i < eoccs.
size()) {
310 eoccs[
i].repackCandPostBkwSearch(0);
313 if (!
passed && attempt_all_cands) {
314 for (
int j = 1;
j < (
int)eoccs[
i].size(); ++
j) {
316 eoccs[
i].repackCandPostBkwSearch(
j);
318 eoccs[
i][0] = eoccs[
i][
j];
330 ++removed_cnts[eoccs[
i].front().getEtaRegion()];
337 dprintf(
"MkBuilder::filter_comb_cands reg=%d: n_rem_was=%d removed_in_r=%d n_rem=%d, es_was=%d es_new=%d\n",
341 n_removed + removed_cnts[reg],
345 n_removed += removed_cnts[reg];
351 dprintf(
"MkBuilder::filter_comb_cands n_removed = %d, eoccs.size=%d\n", n_removed, eoccs.
size());
358 int min[5],
max[5], gmin = 0, gmax = 0;
360 for (
int reg = 0; reg < 5; ++reg) {
371 printf(
"MkBuilder::find_min_max_hots_size MIN %3d -- [ %3d | %3d | %3d | %3d | %3d ] " 372 "MAX %3d -- [ %3d | %3d | %3d | %3d | %3d ]\n",
386 out_vec.reserve(out_vec.size() + eoccs.
size());
387 for (
int i = 0;
i < eoccs.
size();
i++) {
391 out_vec.emplace_back(bcand.
exportTrack(remove_missing_hits));
397 out_vec.reserve(out_vec.size() +
m_tracks.size());
399 out_vec.emplace_back(
t);
411 for (
int i = 0;
i < (
int)tv.size(); ++
i) {
414 "Post-cleaning seed silly value check and fix");
420 tv.erase(tv.begin() +
i);
427 printf(
"Nan'n'Silly detected %d silly seeds (fix=%d, remove=%d).\n",
441 assert(!in_seeds.empty());
461 printf(
"No backward search plan for region %d\n",
region);
476 tbb::parallel_for(rosi.tbb_blk_rng_vec(), [&](
const tbb::blocked_range<int> &blk_rng) {
479 RangeOfSeedIndices rng = rosi.seed_rng(blk_rng);
481 std::vector<int> trk_idcs(
NN);
482 std::vector<int> trk_llay(
NN);
484 while (rng.valid()) {
485 dprint(std::endl <<
"processing track=" << rng.m_beg <<
", label=" <<
cands[rng.m_beg].label());
487 int prev_layer = 9999;
489 for (
int i = rng.m_beg,
ii = 0;
i < rng.m_end; ++
i, ++
ii) {
490 int llay =
cands[
i].getLastHitLyr();
492 prev_layer =
std::min(prev_layer, llay);
500 dprintf(
"Made iterator for %d, first layer=%d ... end layer=%d\n",
502 layer_plan_it.layer(),
503 layer_plan_it.last_layer());
505 assert(layer_plan_it.is_pickup_only());
507 int curr_layer = layer_plan_it.layer();
509 mkfndr->m_Stopped.setVal(0);
514 while (++layer_plan_it) {
515 prev_layer = curr_layer;
516 curr_layer = layer_plan_it.layer();
517 mkfndr->setup(prop_config,
530 dprint(
"at layer " << curr_layer <<
", nHits in layer " << layer_of_hits.
nHits());
533 if (curr_tridx < rng.n_proc()) {
534 int prev_tridx = curr_tridx;
536 for (
int i = rng.m_beg,
ii = 0;
i < rng.m_end; ++
i, ++
ii) {
537 if (trk_llay[
ii] == prev_layer)
538 trk_idcs[curr_tridx++] =
i;
540 if (curr_tridx > prev_tridx) {
541 dprintf(
"added %d seeds, started with %d\n", curr_tridx - prev_tridx, prev_tridx);
543 mkfndr->inputTracksAndHitIdx(
cands, trk_idcs, prev_tridx, curr_tridx,
false, prev_tridx);
547 if (layer_plan_it.is_pickup_only())
550 dcall(pre_prop_print(curr_layer, mkfndr.get()));
552 mkfndr->clearFailFlag();
556 dcall(post_prop_print(curr_layer, mkfndr.get()));
558 mkfndr->selectHitIndices(layer_of_hits, curr_tridx);
562 const float r_min_sqr = layer_info.
rin() * layer_info.
rin();
563 for (
int i = 0;
i < curr_tridx; ++
i) {
564 if (!mkfndr->m_Stopped[
i]) {
565 if (mkfndr->radiusSqr(
i,
MkBase::iP) < r_min_sqr) {
567 mkfndr->m_Stopped[
i] = 1;
568 mkfndr->outputTrackAndHitIdx(
cands[rng.m_beg +
i],
i,
false);
571 mkfndr->m_XHitSize[
i] = 0;
575 mkfndr->m_XHitSize[
i] = 0;
581 dprint(
"make new candidates");
583 mkfndr->addBestHit(layer_of_hits, curr_tridx, fnd_foos);
586 for (
int i = 0;
i < curr_tridx; ++
i) {
587 if (!mkfndr->m_Stopped[
i] && mkfndr->bestHitLastHoT(
i).index == -2) {
588 mkfndr->m_Stopped[
i] = 1;
589 mkfndr->outputTrackAndHitIdx(
cands[rng.m_beg +
i],
i,
false);
595 mkfndr->outputNonStoppedTracksAndHitIdx(
cands, trk_idcs, 0, curr_tridx,
false);
611 assert(!in_seeds.empty());
630 seed_cand_vec.clear();
643 for (
int ic = 0; ic < (
int)ccand.
size(); ++ic) {
644 if (ccand[ic].getLastHitIdx() != -2) {
646 if (ccand[ic].
pT() < iter_params.minPtCut) {
647 ccand[ic].addHitIdx(-2, layer, 0.0
f);
652 const float dphi =
std::abs(ccand[ic].posPhi() - ccand[ic].momPhi());
653 if (ccand[ic].posRsq() > 625.
f && dphi > 1.371
f && dphi < 4.512
f) {
656 ccand[ic].addHitIdx(-2, layer, 0.0
f);
662 seed_cand_vec.push_back(std::pair<int, int>(
iseed, ic));
663 ccand[ic].resetOverlaps();
668 "Per layer silly check"))
683 return seed_cand_vec.size();
689 const std::vector<std::pair<int, int>> &seed_cand_idx,
691 const int start_seed,
701 for (
int ti = itrack; ti < end; ++ti) {
706 dprintf(
"WSR Check label %d, seed %d, cand %d score %f -> wsr %d, in_gap %d\n",
708 seed_cand_idx[ti].first,
709 seed_cand_idx[ti].second,
720 dprintf(
"Barrel cand propagation failed, got to r=%f ... layer is %f - %f\n",
726 tmp_cands[seed_cand_idx[ti].first - start_seed].push_back(
cand);
728 dprintf(
" creating extra stopped held back candidate\n");
729 tmp_cands[seed_cand_idx[ti].first - start_seed].back().addHitIdx(-2, layer_info.
layer_id(), 0);
734 dprintf(
" creating extra held back candidate\n");
735 tmp_cands[seed_cand_idx[ti].first - start_seed].push_back(
cand);
753 printf(
"No backward search plan for region %d\n",
region);
765 const int adaptiveSPT = std::clamp(
767 dprint(
"adaptiveSPT " << adaptiveSPT <<
" fill " << rosi.count() <<
"/" << eoccs.
size() <<
" region " <<
region);
770 tbb::parallel_for(rosi.tbb_blk_rng_std(adaptiveSPT), [&](
const tbb::blocked_range<int> &
seeds) {
773 const int start_seed =
seeds.begin();
774 const int end_seed =
seeds.end();
775 const int n_seeds = end_seed - start_seed;
777 std::vector<std::vector<TrackCand>> tmp_cands(n_seeds);
779 tmp_cands[
iseed].reserve(2 *
params.maxCandsPerSeed);
782 std::vector<std::pair<int, int>> seed_cand_idx;
783 seed_cand_idx.reserve(n_seeds *
params.maxCandsPerSeed);
787 dprintf(
"Made iterator for %d, first layer=%d ... end layer=%d\n",
789 layer_plan_it.layer(),
790 layer_plan_it.last_layer());
792 assert(layer_plan_it.is_pickup_only());
794 int curr_layer = layer_plan_it.layer(), prev_layer;
796 dprintf(
"\nMkBuilder::FindTracksStandard region=%d, seed_pickup_layer=%d, first_layer=%d\n",
799 layer_plan_it.next_layer());
805 while (++layer_plan_it) {
806 prev_layer = curr_layer;
807 curr_layer = layer_plan_it.layer();
808 mkfndr->setup(prop_config,
822 dprintf(
"\n* Processing layer %d\n", curr_layer);
823 mkfndr->begin_layer(layer_of_hits);
830 layer_plan_it.is_pickup_only(),
833 dprintf(
" Number of candidates to process: %d, nHits in layer: %d\n", theEndCand, layer_of_hits.
nHits());
835 if (layer_plan_it.is_pickup_only() || theEndCand == 0)
839 for (
int itrack = 0; itrack < theEndCand; itrack +=
NN) {
842 dprint(
"processing track=" << itrack <<
", label=" 843 << eoccs[seed_cand_idx[itrack].
first][seed_cand_idx[itrack].
second].
label());
846 mkfndr->inputTracksAndHitIdx(eoccs.
refCandidates(), seed_cand_idx, itrack, end,
false);
849 dcall(pre_prop_print(curr_layer, mkfndr.get()));
851 mkfndr->clearFailFlag();
855 dcall(post_prop_print(curr_layer, mkfndr.get()));
857 dprint(
"now get hit range");
858 mkfndr->selectHitIndices(layer_of_hits, end - itrack);
861 mkfndr.get(), layer_info, tmp_cands, seed_cand_idx,
region, start_seed, itrack, end);
863 dprint(
"make new candidates");
864 mkfndr->findCandidates(layer_of_hits, tmp_cands, start_seed, end - itrack, fnd_foos);
869 for (
int is = 0; is < n_seeds; ++is) {
870 dprint(
"dump seed n " << is <<
" with N_input_candidates=" << tmp_cands[is].size());
872 std::sort(tmp_cands[is].begin(), tmp_cands[is].end(), sortCandByScore);
876 for (
int is = 0; is < n_seeds; ++is) {
877 if (!tmp_cands[is].
empty()) {
878 eoccs[start_seed + is].clear();
882 bool first_short =
true;
883 for (
int ii = 0;
ii < (
int)tmp_cands[is].size() && n_placed <
params.maxCandsPerSeed; ++
ii) {
901 eoccs[start_seed + is].emplace_back(tc);
903 }
else if (first_short) {
905 if (tc.
score() > eoccs[start_seed + is].refBestShortCand().score()) {
906 eoccs[start_seed + is].setBestShortCand(tc);
911 tmp_cands[is].clear();
939 printf(
"No backward search plan for region %d\n",
region);
946 const int adaptiveSPT = std::clamp(
948 dprint(
"adaptiveSPT " << adaptiveSPT <<
" fill " << rosi.count() <<
"/" << eoccs.
size() <<
" region " <<
region);
950 tbb::parallel_for(rosi.tbb_blk_rng_std(adaptiveSPT), [&](
const tbb::blocked_range<int> &
seeds) {
970 const int start_seed,
979 const int n_seeds = end_seed - start_seed;
981 std::vector<std::pair<int, int>> seed_cand_idx;
982 std::vector<UpdateIndices> seed_cand_update_idx, seed_cand_overlap_idx;
983 seed_cand_idx.reserve(n_seeds *
params.maxCandsPerSeed);
984 seed_cand_update_idx.reserve(n_seeds *
params.maxCandsPerSeed);
985 seed_cand_overlap_idx.reserve(n_seeds *
params.maxCandsPerSeed);
987 std::vector<std::vector<TrackCand>> extra_cands(n_seeds);
988 for (
int ii = 0;
ii < n_seeds; ++
ii)
989 extra_cands[
ii].reserve(
params.maxCandsPerSeed);
991 cloner.
begin_eta_bin(&eoccs, &seed_cand_update_idx, &seed_cand_overlap_idx, &extra_cands, start_seed, n_seeds);
997 dprintf(
"Made iterator for %d, first layer=%d ... end layer=%d\n",
999 layer_plan_it.layer(),
1000 layer_plan_it.last_layer());
1002 assert(layer_plan_it.is_pickup_only());
1004 int curr_layer = layer_plan_it.layer(), prev_layer;
1007 "\nMkBuilder::find_tracks_in_layers region=%d, seed_pickup_layer=%d, first_layer=%d; start_seed=%d, " 1011 layer_plan_it.next_layer(),
1019 while (++layer_plan_it) {
1020 prev_layer = curr_layer;
1021 curr_layer = layer_plan_it.layer();
1022 mkfndr->
setup(prop_config,
1032 const bool pickup_only = layer_plan_it.is_pickup_only();
1038 dprintf(
"\n\n* Processing layer %d, %s\n\n", curr_layer, pickup_only ?
"pickup only" :
"full finding");
1042 seed_cand_idx, start_seed, end_seed, curr_layer, prev_layer, pickup_only, iteration_dir);
1044 dprintf(
" Number of candidates to process: %d, nHits in layer: %d\n", theEndCand, layer_of_hits.
nHits());
1053 if (pickup_only || theEndCand == 0)
1059 for (
int itrack = 0; itrack < theEndCand; itrack +=
NN) {
1060 const int end =
std::min(itrack +
NN, theEndCand);
1063 dprintf(
"\nProcessing track=%d, start_seed=%d, n_seeds=%d, theEndCand=%d, end=%d, nn=%d, end_eq_tec=%d\n",
1072 for (
int i = itrack;
i < end; ++
i)
1080 for (
int i = itrack;
i < end; ++
i)
1081 dprintf(
" track %d, idx %d is from seed %d\n",
i,
i - itrack, mkfndr->
m_Label(
i - itrack, 0, 0));
1089 dprint(
"now get hit range");
1091 if (iter_params.useHitSelectionV2)
1097 mkfndr, layer_info, extra_cands, seed_cand_idx,
region, start_seed, itrack, end);
1110 dprint(
"make new candidates");
1126 const int theEndUpdater = seed_cand_update_idx.size();
1128 for (
int itrack = 0; itrack < theEndUpdater; itrack +=
NN) {
1129 const int end =
std::min(itrack +
NN, theEndUpdater);
1139 const int theEndOverlapper = seed_cand_overlap_idx.size();
1141 for (
int itrack = 0; itrack < theEndOverlapper; itrack +=
NN) {
1142 const int end =
std::min(itrack +
NN, theEndOverlapper);
1150 mkfndr->
inputOverlapHits(layer_of_hits, seed_cand_overlap_idx, itrack, end);
1157 for (
int ii = itrack;
ii < end; ++
ii) {
1158 const int fi =
ii - itrack;
1159 TrackCand &tc = eoccs[seed_cand_overlap_idx[
ii].seed_idx][seed_cand_overlap_idx[
ii].cand_idx];
1163 auto chi2Ovlp = mkfndr->
m_Chi2[fi];
1164 if (mkfndr->
m_FailFlag[fi] == 0 && chi2Ovlp >= 0.0f && chi2Ovlp <= 60.0f) {
1167 tc.
addHitIdx(seed_cand_overlap_idx[
ii].ovlp_idx, curr_layer, chi2Ovlp);
1170 if (scoreCand > scoreCandOvlp)
1181 for (
int i = 0;
i < ((
int)
cc.size()) - 1; ++
i) {
1183 printf(
"CloneEngine - NOT SORTED: layer=%d, iseed=%d (size=%lu)-- %d : %f smaller than %d : %f\n",
1210 #ifdef DEBUG_FINAL_FIT 1214 dprintf(
" %4d with q=%+d chi2=%7.3f pT=%7.3f eta=% 7.3f x=%.3f y=%.3f z=%.3f" 1215 " nHits=%2d label=%4d findable=%d\n",
1216 i,
t.charge(),
t.chi2(),
t.pT(),
t.momEta(),
t.x(),
t.y(),
t.z(),
1217 t.nFoundHits(),
t.label(),
t.isFindable());
1227 tbb::parallel_for(rosi.tbb_blk_rng_vec(), [&](
const tbb::blocked_range<int> &blk_rng) {
1230 RangeOfSeedIndices rng = rosi.seed_rng(blk_rng);
1232 while (rng.valid()) {
1246 #ifdef DEBUG_FINAL_FIT 1251 for (
int icand = start_cand; icand < end_cand; icand +=
NN) {
1252 const int end =
std::min(icand +
NN, end_cand);
1254 #ifdef DEBUG_FINAL_FIT 1255 dprintf(
"Pre Final fit for %d - %d\n", icand, end);
1256 for (
int i = icand;
i < end; ++
i) {
1257 dprint_tcand(eoccs[
i][0],
i);
1261 bool chi_debug =
false;
1262 #ifdef DEBUG_BACKWARD_FIT_BH 1277 #ifdef DEBUG_BACKWARD_FIT_BH 1280 mkfndr->
m_Chi2(0, 0, 0) / (eoccs[icand][0].nFoundHits() * 3 - 6) > 20.0
f) {
1282 #ifdef MKFIT_STANDALONE 1283 printf(
"CHIHDR Event %d, Cand %3d, pT %f, chipdof %f ### NOTE x,y,z in cm, sigmas, deltas in mum ### !!!\n",
1286 printf(
"CHIHDR Cand %3d, pT %f, chipdof %f ### NOTE x,y,z in cm, sigmas, deltas in mum ### !!!\n",
1290 mkfndr->
m_Chi2(0, 0, 0) / (eoccs[icand][0].nFoundHits() * 3 - 6));
1292 printf(
"CHIHDR %3s %10s" 1293 " %10s %10s %10s %10s %11s %11s %11s" 1294 " %10s %10s %10s %10s %11s %11s %11s" 1295 " %10s %10s %10s %10s %10s %11s %11s\n",
1297 "x_h",
"y_h",
"z_h",
"r_h",
"sx_h",
"sy_h",
"sz_h",
1298 "x_t",
"y_t",
"z_t",
"r_t",
"sx_t",
"sy_t",
"sz_t",
1299 "pt",
"phi",
"theta",
"phi_h",
"phi_t",
"d_xy",
"d_z");
1308 #ifdef DEBUG_FINAL_FIT 1309 dprintf(
"Post Final fit for %d - %d\n", icand, end);
1310 for (
int i = icand;
i < end; ++
i) {
1311 dprint_tcand(eoccs[
i][0],
i);
1326 const int adaptiveSPT = std::clamp(
1328 dprint(
"adaptiveSPT " << adaptiveSPT <<
" fill " << rosi.count() <<
"/" << eoccs.
size() <<
" region " <<
region);
1330 tbb::parallel_for(rosi.tbb_blk_rng_std(adaptiveSPT), [&](
const tbb::blocked_range<int> &
cands) {
1345 for (
int icand = start_cand; icand < end_cand; icand +=
step) {
1348 bool chi_debug =
false;
1350 #ifdef DEBUG_FINAL_FIT 1352 dprintf(
"Pre Final fit for %d - %d\n", icand, end);
1353 for (
int i = icand;
i < end; ++
i) {
1354 dprint_tcand(eoccs[
i][0],
i);
1357 static bool first =
true;
1361 "BKF_OVERLAP event/I:label/I:prod_type/I:is_findable/I:layer/I:is_stereo/I:is_barrel/I:" 1362 "pt/F:pt_cur/F:eta/F:phi/F:phi_cur/F:r_cur/F:z_cur/F:chi2/F:isnan/I:isfin/I:gtzero/I:hit_label/I:" 1363 "sx_t/F:sy_t/F:sz_t/F:d_xy/F:d_z/F\n");
1381 #ifdef DEBUG_FINAL_FIT 1382 dprintf(
"Post Final fit for %d - %d\n", icand, end);
1383 for (
int i = icand;
i < end; ++
i) {
1384 dprint_tcand(eoccs[
i][0],
i);
void(MkBase::* m_propagate_foo)(float, const int, const PropagationFlags &)
const IterationConfig & m_iter_config
float getScoreCand(const track_score_func &score_func, const Track &cand1, bool penalizeTailMissHits=false, bool inFindCandidates=false)
void import_seeds(const TrackVec &in_seeds, const bool seeds_sorted, std::function< insert_seed_foo > insert_seed)
void addHitIdx(int hitIdx, int hitLyr, float chi2)
int find_tracks_unroll_candidates(std::vector< std::pair< int, int >> &seed_cand_vec, int start_seed, int end_seed, int layer, int prev_layer, bool pickup_only, SteeringParams::IterationType_e iteration_dir)
std::pair< int, int > max_hits_layer(const EventOfHits &eoh) const
void export_tracks(TrackVec &out_vec)
IterationParams m_backward_params
void findTracksBestHit(SteeringParams::IterationType_e iteration_dir=SteeringParams::IT_FwdSearch)
ExecutionContext()=default
void chi2OfLoadedHit(int N_proc, const FindingFoos &fnd_foos)
Track exportTrack(bool remove_missing_hits=false) const
float radius(int itrack, int i) const
void inputOverlapHits(const LayerOfHits &layer_of_hits, const std::vector< UpdateIndices > &idxs, int beg, int end)
void resizeAfterFiltering(int n_removed)
void insertSeed(const Track &seed, int seed_idx, const track_score_func &score_func, int region, int pos)
void begin_eta_bin(EventOfCombCandidates *e_o_ccs, std::vector< UpdateIndices > *update_list, std::vector< UpdateIndices > *overlap_list, std::vector< std::vector< TrackCand >> *extra_cands, int start_seed, int n_seeds)
void inputTracksAndHitIdx(const std::vector< Track > &tracks, int beg, int end, bool inputProp)
void bkFitInputTracks(TrackVec &cands, int beg, int end)
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
uint32_t cc[maxCellsPerHit]
constexpr bool nan_n_silly_print_bad_seeds
std::atomic< int > m_nan_n_silly_per_layer_count
void find_min_max_hots_size()
Sin< T >::type sin(const T &t)
const auto regions_begin() const
constexpr Process operator++(Process p)
void setState(SeedState_e ss)
void selectHitIndices(const LayerOfHits &layer_of_hits, const int N_proc, bool fill_binsearch_only=false)
void setup(const PropagationConfig &pc, const IterationConfig &ic, const IterationParams &ip, const IterationLayerConfig &ilc, const SteeringParams &sp, const std::vector< bool > *ihm, const Event *ev, int region, bool infwd)
void findTracksCloneEngine(SteeringParams::IterationType_e iteration_dir=SteeringParams::IT_FwdSearch)
void bkFitPropTracksToPCA(const int N_proc)
constexpr bool nan_n_silly_check_seeds
void inputTracksAndHits(const std::vector< CombCandidate > &tracks, const LayerOfHits &layer_of_hits, const std::vector< UpdateIndices > &idxs, int beg, int end, bool inputProp)
float propagate_to() const
void begin_event(MkJob *job, Event *ev, const char *build_type)
const auto & params() const
bool cands_in_backward_rep() const
const EventOfHits & m_event_of_hits
constexpr bool nan_n_silly_fixup_bad_cands_every_layer
void swap(Association< C > &lhs, Association< C > &rhs)
void finalize_registration()
track_score_func m_track_scorer
unsigned int nHits() const
U second(std::pair< T, U > const &p)
PropagationFlags finding_inter_layer_pflags
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
iterator make_iterator(IterationType_e type) const
std::vector< IterationLayerConfig > m_layer_configs
void reset(int new_capacity, int max_cands_per_seed, int expected_num_hots=128)
void find_tracks_load_seeds(const TrackVec &in_seeds, const bool seeds_sorted)
constexpr bool nan_n_silly_remove_bad_seeds
void register_entry_safe(typename A1::real_t r1, typename A2::real_t r2)
constexpr Matriplex::idx_t NN
Cos< T >::type cos(const T &t)
void setup_bkfit(const PropagationConfig &pc, const SteeringParams &sp, const Event *ev)
partition_seeds_func m_seed_partitioner
std::vector< int > m_seedEtaSeparators
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
void seed_post_cleaning(TrackVec &tv)
ExecutionContext g_exe_ctx
Pool< MkFinder > m_finders
float getHypot(float x, float y)
void select_best_comb_cands(bool clear_m_tracks=false, bool remove_missing_hits=false)
constexpr int numThreadsFinder
int filter_comb_cands(filter_candidates_func filter, bool attempt_all_cands)
Pool< CandCloner > m_cloners
void begin_registration(C n_items)
void begin_layer(const LayerOfHits &layer_of_hits)
trk_cand_vec_type::size_type size() const
const LayerInfo & layer(int l) const
const auto & steering_params(int i)
const TrackerInfo & m_trk_info
void updateWithLoadedHit(int N_proc, const LayerOfHits &layer_of_hits, const FindingFoos &fnd_foos)
void selectHitIndicesV2(const LayerOfHits &layer_of_hits, const int N_proc)
std::vector< Track > TrackVec
constexpr bool nan_n_silly_fixup_bad_seeds
void begin_layer(int lay)
Pool< MkFitter > m_fitters
const std::vector< CombCandidate > & refCandidates() const
bool sortByScoreTrackCand(const TrackCand &cand1, const TrackCand &cand2)
void bkFitFitTracks(const EventOfHits &eventofhits, const SteeringParams &st_par, const int N_proc, bool chiDebug=false)
EventOfCombCandidates m_event_of_comb_cands
std::vector< CombCandidate > & refCandidates_nc()
void find_tracks_handle_missed_layers(MkFinder *mkfndr, const LayerInfo &layer_info, std::vector< std::vector< TrackCand >> &tmp_cands, const std::vector< std::pair< int, int >> &seed_cand_idx, const int region, const int start_seed, const int itrack, const int end)
static const FindingFoos & get_finding_foos(bool is_barrel)
std::vector< int > m_seedMaxLastLayer
constexpr bool nan_n_silly_check_cands_every_layer
int getLastHitIdx() const
void export_best_comb_cands(TrackVec &out_vec, bool remove_missing_hits=false)
void bkFitOutputTracks(TrackVec &cands, int beg, int end, bool outputProp)
void bkFitFitTracksBH(const EventOfHits &eventofhits, const SteeringParams &st_par, const int N_proc, bool chiDebug=false)
static std::unique_ptr< MkBuilder > make_builder(bool silent=true)
constexpr int numSeedsPerTask
constexpr int numThreadsEvents
const auto regions_end() const
int getLastHitLyr() const
void copyOutParErr(std::vector< CombCandidate > &seed_cand_vec, int N_proc, bool outputProp) const
void findCandidatesCloneEngine(const LayerOfHits &layer_of_hits, CandCloner &cloner, const int offset, const int N_proc, const FindingFoos &fnd_foos)
void fit_cands(MkFinder *mkfndr, int start_cand, int end_cand, int region)
const std::vector< bool > * get_mask_for_layer(int layer)
while(__syncthreads_or(more))
int max_max_cands() const
constexpr bool usePropToPlane
~ExecutionContext()=default
std::vector< int > m_seedMinLastLayer
WSR_Result m_XWsrResult[NN]
constexpr bool nan_n_silly_print_bad_cands_every_layer
void reset(double vett[256])
SeedState_e state() const
void fit_cands_BH(MkFinder *mkfndr, int start_cand, int end_cand, int region)
void find_tracks_in_layers(CandCloner &cloner, MkFinder *mkfndr, SteeringParams::IterationType_e iteration_dir, const int start_seed, const int end_seed, const int region)
const PropagationConfig & prop_config() const
const Hit & refHit(int i) const
float getPar(int itrack, int i, int par) const