17 #ifdef MKFIT_STANDALONE 25 #include "oneapi/tbb/parallel_for.h" 26 #include "oneapi/tbb/parallel_for_each.h" 62 using namespace mkfit;
65 struct RangeOfSeedIndices {
66 int m_rng_beg, m_rng_end;
69 RangeOfSeedIndices(
int rb,
int re) : m_rng_beg(rb), m_rng_end(re) {
reset(); }
76 bool valid()
const {
return m_beg < m_rng_end; }
78 int n_proc()
const {
return m_end - m_beg; }
92 struct RegionOfSeedIndices {
93 int m_reg_beg, m_reg_end, m_vec_cnt;
95 RegionOfSeedIndices(
const std::vector<int> &seedEtaSeparators,
int region) {
96 m_reg_beg = (
region == 0) ? 0 : seedEtaSeparators[
region - 1];
97 m_reg_end = seedEtaSeparators[
region];
98 m_vec_cnt = (m_reg_end - m_reg_beg +
NN - 1) /
NN;
101 int count()
const {
return m_reg_end - m_reg_beg; }
103 tbb::blocked_range<int> tbb_blk_rng_std(
int thr_hint = -1)
const {
106 return tbb::blocked_range<int>(m_reg_beg, m_reg_end, thr_hint);
109 tbb::blocked_range<int> tbb_blk_rng_vec()
const {
113 RangeOfSeedIndices seed_rng(
const tbb::blocked_range<int> &
i)
const {
114 return RangeOfSeedIndices(m_reg_beg +
NN *
i.begin(),
std::min(m_reg_beg +
NN *
i.end(), m_reg_end));
119 void pre_prop_print(
int ilay,
MkBase *fir) {
120 const float pt = 1.f / fir->
getPar(0, 0, 3);
121 std::cout <<
"propagate to lay=" << ilay <<
" start from x=" << fir->
getPar(0, 0, 0)
122 <<
" y=" << fir->
getPar(0, 0, 1) <<
" z=" << fir->
getPar(0, 0, 2)
128 void post_prop_print(
int ilay,
MkBase *fir) {
129 std::cout <<
"propagate to lay=" << ilay <<
" arrive at x=" << fir->
getPar(0, 1, 0) <<
" y=" << fir->
getPar(0, 1, 1)
135 std::cout <<
"MX - found seed with label=" <<
seed.label() <<
" nHits=" <<
seed.nFoundHits()
136 <<
" chi2=" <<
seed.chi2() <<
" posEta=" <<
seed.posEta() <<
" posPhi=" <<
seed.posPhi()
137 <<
" posR=" <<
seed.posR() <<
" posZ=" <<
seed.z() <<
" pT=" <<
seed.pT() << std::endl;
141 std::cout <<
"MX - found seed with nFoundHits=" <<
seed.nFoundHits() <<
" chi2=" <<
seed.chi2() <<
" x=" <<
seed.x()
142 <<
" y=" <<
seed.y() <<
" z=" <<
seed.z() <<
" px=" <<
seed.px() <<
" py=" <<
seed.py()
143 <<
" pz=" <<
seed.pz() <<
" pT=" <<
seed.pT() << std::endl;
155 print_seed2(event_of_comb_cands[
iseed].front());
164 #ifdef RNT_DUMP_MkF_SelHitIdcs 165 constexpr bool alwaysUseHitSelectionV2 =
true;
167 constexpr bool alwaysUseHitSelectionV2 =
false;
186 int lsize = eoh[
l].nHits();
189 maxL = eoh[
l].layer_id();
223 std::cout <<
"MkBuilder building tracks with '" << build_type <<
"'" 241 const bool seeds_sorted,
242 std::function<insert_seed_foo> insert_seed) {
245 const int size = in_seeds.size();
248 std::vector<unsigned> ranks;
259 ranks.swap(phi_eta_binnor.
m_ranks);
264 for (
int i = 0;
i < size; ++
i) {
265 int j = seeds_sorted ?
i : ranks[
i];
266 int reg =
part.m_region[
j];
279 for (
int i = 0;
i < size; ++
i) {
280 int j = seeds_sorted ?
i : ranks[
i];
281 int reg =
part.m_region[
j];
283 insert_seed(
seed,
j, reg, seed_cursors[reg]++);
299 dprintf(
"MkBuilder::import_seeds finished import of %d seeds (last seeding layer min, max):\n" 300 " ec- = %d(%d,%d), t- = %d(%d,%d), brl = %d(%d,%d), t+ = %d(%d,%d), ec+ = %d(%d,%d).\n",
315 int i = 0, place_pos = 0;
317 dprintf(
"MkBuilder::filter_comb_cands Entering filter size eoccs.size=%d\n", eoccs.
size());
320 while (
i < eoccs.
size()) {
322 eoccs[
i].repackCandPostBkwSearch(0);
325 if (!
passed && attempt_all_cands) {
326 for (
int j = 1;
j < (
int)eoccs[
i].size(); ++
j) {
328 eoccs[
i].repackCandPostBkwSearch(
j);
330 eoccs[
i][0] = eoccs[
i][
j];
342 ++removed_cnts[eoccs[
i].front().getEtaRegion()];
349 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",
353 n_removed + removed_cnts[reg],
357 n_removed += removed_cnts[reg];
363 dprintf(
"MkBuilder::filter_comb_cands n_removed = %d, eoccs.size=%d\n", n_removed, eoccs.
size());
370 int min[5],
max[5], gmin = 0, gmax = 0;
372 for (
int reg = 0; reg < 5; ++reg) {
383 printf(
"MkBuilder::find_min_max_hots_size MIN %3d -- [ %3d | %3d | %3d | %3d | %3d ] " 384 "MAX %3d -- [ %3d | %3d | %3d | %3d | %3d ]\n",
398 out_vec.reserve(out_vec.size() + eoccs.
size());
399 for (
int i = 0;
i < eoccs.
size();
i++) {
403 out_vec.emplace_back(bcand.
exportTrack(remove_missing_hits));
409 out_vec.reserve(out_vec.size() +
m_tracks.size());
411 out_vec.emplace_back(
t);
423 for (
int i = 0;
i < (
int)tv.size(); ++
i) {
426 "Post-cleaning seed silly value check and fix");
432 tv.erase(tv.begin() +
i);
439 printf(
"Nan'n'Silly detected %d silly seeds (fix=%d, remove=%d).\n",
453 assert(!in_seeds.empty());
473 printf(
"No backward search plan for region %d\n",
region);
488 tbb::parallel_for(rosi.tbb_blk_rng_vec(), [&](
const tbb::blocked_range<int> &blk_rng) {
491 RangeOfSeedIndices rng = rosi.seed_rng(blk_rng);
493 std::vector<int> trk_idcs(
NN);
494 std::vector<int> trk_llay(
NN);
496 while (rng.valid()) {
497 dprint(std::endl <<
"processing track=" << rng.m_beg <<
", label=" <<
cands[rng.m_beg].label());
499 int prev_layer = 9999;
501 for (
int i = rng.m_beg,
ii = 0;
i < rng.m_end; ++
i, ++
ii) {
502 int llay =
cands[
i].getLastHitLyr();
504 prev_layer =
std::min(prev_layer, llay);
512 dprintf(
"Made iterator for %d, first layer=%d ... end layer=%d\n",
514 layer_plan_it.layer(),
515 layer_plan_it.last_layer());
517 assert(layer_plan_it.is_pickup_only());
519 int curr_layer = layer_plan_it.layer();
521 mkfndr->m_Stopped.setVal(0);
526 while (++layer_plan_it) {
527 prev_layer = curr_layer;
528 curr_layer = layer_plan_it.layer();
529 mkfndr->setup(prop_config,
542 dprint(
"at layer " << curr_layer <<
", nHits in layer " << layer_of_hits.
nHits());
545 if (curr_tridx < rng.n_proc()) {
546 int prev_tridx = curr_tridx;
548 for (
int i = rng.m_beg,
ii = 0;
i < rng.m_end; ++
i, ++
ii) {
549 if (trk_llay[
ii] == prev_layer)
550 trk_idcs[curr_tridx++] =
i;
552 if (curr_tridx > prev_tridx) {
553 dprintf(
"added %d seeds, started with %d\n", curr_tridx - prev_tridx, prev_tridx);
555 mkfndr->inputTracksAndHitIdx(
cands, trk_idcs, prev_tridx, curr_tridx,
false, prev_tridx);
559 if (layer_plan_it.is_pickup_only())
562 dcall(pre_prop_print(curr_layer, mkfndr.get()));
564 mkfndr->clearFailFlag();
568 dcall(post_prop_print(curr_layer, mkfndr.get()));
570 mkfndr->selectHitIndices(layer_of_hits, curr_tridx);
574 const float r_min_sqr = layer_info.
rin() * layer_info.
rin();
575 for (
int i = 0;
i < curr_tridx; ++
i) {
576 if (!mkfndr->m_Stopped[
i]) {
577 if (mkfndr->radiusSqr(
i,
MkBase::iP) < r_min_sqr) {
579 mkfndr->m_Stopped[
i] = 1;
580 mkfndr->outputTrackAndHitIdx(
cands[rng.m_beg +
i],
i,
false);
583 mkfndr->m_XHitSize[
i] = 0;
587 mkfndr->m_XHitSize[
i] = 0;
593 dprint(
"make new candidates");
595 mkfndr->addBestHit(layer_of_hits, curr_tridx, fnd_foos);
598 for (
int i = 0;
i < curr_tridx; ++
i) {
599 if (!mkfndr->m_Stopped[
i] && mkfndr->bestHitLastHoT(
i).index == -2) {
600 mkfndr->m_Stopped[
i] = 1;
601 mkfndr->outputTrackAndHitIdx(
cands[rng.m_beg +
i],
i,
false);
607 mkfndr->outputNonStoppedTracksAndHitIdx(
cands, trk_idcs, 0, curr_tridx,
false);
623 assert(!in_seeds.empty());
642 seed_cand_vec.clear();
655 for (
int ic = 0; ic < (
int)ccand.
size(); ++ic) {
656 if (ccand[ic].getLastHitIdx() != -2) {
658 if (ccand[ic].
pT() < iter_params.minPtCut) {
659 ccand[ic].addHitIdx(-2, layer, 0.0
f);
664 const float dphi =
std::abs(ccand[ic].posPhi() - ccand[ic].momPhi());
665 if (ccand[ic].posRsq() > 625.
f && dphi > 1.371
f && dphi < 4.512
f) {
668 ccand[ic].addHitIdx(-2, layer, 0.0
f);
674 seed_cand_vec.push_back(std::pair<int, int>(
iseed, ic));
675 ccand[ic].resetOverlaps();
680 "Per layer silly check"))
695 return seed_cand_vec.size();
701 const std::vector<std::pair<int, int>> &seed_cand_idx,
703 const int start_seed,
713 for (
int ti = itrack; ti < end; ++ti) {
718 dprintf(
"WSR Check label %d, seed %d, cand %d score %f -> wsr %d, in_gap %d\n",
720 seed_cand_idx[ti].first,
721 seed_cand_idx[ti].second,
732 dprintf(
"Barrel cand propagation failed, got to r=%f ... layer is %f - %f\n",
738 tmp_cands[seed_cand_idx[ti].first - start_seed].push_back(
cand);
740 dprintf(
" creating extra stopped held back candidate\n");
741 tmp_cands[seed_cand_idx[ti].first - start_seed].back().addHitIdx(-2, layer_info.
layer_id(), 0);
746 dprintf(
" creating extra held back candidate\n");
747 tmp_cands[seed_cand_idx[ti].first - start_seed].push_back(
cand);
765 printf(
"No backward search plan for region %d\n",
region);
777 const int adaptiveSPT = std::clamp(
779 dprint(
"adaptiveSPT " << adaptiveSPT <<
" fill " << rosi.count() <<
"/" << eoccs.
size() <<
" region " <<
region);
782 tbb::parallel_for(rosi.tbb_blk_rng_std(adaptiveSPT), [&](
const tbb::blocked_range<int> &
seeds) {
785 const int start_seed =
seeds.begin();
786 const int end_seed =
seeds.end();
787 const int n_seeds = end_seed - start_seed;
789 std::vector<std::vector<TrackCand>> tmp_cands(n_seeds);
791 tmp_cands[
iseed].reserve(2 *
params.maxCandsPerSeed);
794 std::vector<std::pair<int, int>> seed_cand_idx;
795 seed_cand_idx.reserve(n_seeds *
params.maxCandsPerSeed);
799 dprintf(
"Made iterator for %d, first layer=%d ... end layer=%d\n",
801 layer_plan_it.layer(),
802 layer_plan_it.last_layer());
804 assert(layer_plan_it.is_pickup_only());
806 int curr_layer = layer_plan_it.layer(), prev_layer;
808 dprintf(
"\nMkBuilder::FindTracksStandard region=%d, seed_pickup_layer=%d, first_layer=%d\n",
811 layer_plan_it.next_layer());
817 while (++layer_plan_it) {
818 prev_layer = curr_layer;
819 curr_layer = layer_plan_it.layer();
820 mkfndr->setup(prop_config,
834 dprintf(
"\n* Processing layer %d\n", curr_layer);
835 mkfndr->begin_layer(layer_of_hits);
842 layer_plan_it.is_pickup_only(),
845 dprintf(
" Number of candidates to process: %d, nHits in layer: %d\n", theEndCand, layer_of_hits.
nHits());
847 if (layer_plan_it.is_pickup_only() || theEndCand == 0)
851 for (
int itrack = 0; itrack < theEndCand; itrack +=
NN) {
854 dprint(
"processing track=" << itrack <<
", label=" 855 << eoccs[seed_cand_idx[itrack].
first][seed_cand_idx[itrack].
second].
label());
858 mkfndr->inputTracksAndHitIdx(eoccs.
refCandidates(), seed_cand_idx, itrack, end,
false);
861 dcall(pre_prop_print(curr_layer, mkfndr.get()));
863 mkfndr->clearFailFlag();
867 dcall(post_prop_print(curr_layer, mkfndr.get()));
869 dprint(
"now get hit range");
871 if (alwaysUseHitSelectionV2 || iter_params.useHitSelectionV2)
872 mkfndr->selectHitIndicesV2(layer_of_hits, end - itrack);
874 mkfndr->selectHitIndices(layer_of_hits, end - itrack);
877 mkfndr.get(), layer_info, tmp_cands, seed_cand_idx,
region, start_seed, itrack, end);
879 dprint(
"make new candidates");
880 mkfndr->findCandidates(layer_of_hits, tmp_cands, start_seed, end - itrack, fnd_foos);
885 for (
int is = 0; is < n_seeds; ++is) {
886 dprint(
"dump seed n " << is <<
" with N_input_candidates=" << tmp_cands[is].size());
888 std::sort(tmp_cands[is].begin(), tmp_cands[is].end(), sortCandByScore);
892 for (
int is = 0; is < n_seeds; ++is) {
893 if (!tmp_cands[is].
empty()) {
894 eoccs[start_seed + is].clear();
898 bool first_short =
true;
899 for (
int ii = 0;
ii < (
int)tmp_cands[is].size() && n_placed <
params.maxCandsPerSeed; ++
ii) {
917 eoccs[start_seed + is].emplace_back(tc);
919 }
else if (first_short) {
921 if (tc.
score() > eoccs[start_seed + is].refBestShortCand().score()) {
922 eoccs[start_seed + is].setBestShortCand(tc);
927 tmp_cands[is].clear();
955 printf(
"No backward search plan for region %d\n",
region);
962 const int adaptiveSPT = std::clamp(
964 dprint(
"adaptiveSPT " << adaptiveSPT <<
" fill " << rosi.count() <<
"/" << eoccs.
size() <<
" region " <<
region);
966 tbb::parallel_for(rosi.tbb_blk_rng_std(adaptiveSPT), [&](
const tbb::blocked_range<int> &
seeds) {
986 const int start_seed,
995 const int n_seeds = end_seed - start_seed;
997 std::vector<std::pair<int, int>> seed_cand_idx;
998 std::vector<UpdateIndices> seed_cand_update_idx, seed_cand_overlap_idx;
999 seed_cand_idx.reserve(n_seeds *
params.maxCandsPerSeed);
1000 seed_cand_update_idx.reserve(n_seeds *
params.maxCandsPerSeed);
1001 seed_cand_overlap_idx.reserve(n_seeds *
params.maxCandsPerSeed);
1003 std::vector<std::vector<TrackCand>> extra_cands(n_seeds);
1004 for (
int ii = 0;
ii < n_seeds; ++
ii)
1005 extra_cands[
ii].reserve(
params.maxCandsPerSeed);
1007 cloner.
begin_eta_bin(&eoccs, &seed_cand_update_idx, &seed_cand_overlap_idx, &extra_cands, start_seed, n_seeds);
1013 dprintf(
"Made iterator for %d, first layer=%d ... end layer=%d\n",
1015 layer_plan_it.layer(),
1016 layer_plan_it.last_layer());
1018 assert(layer_plan_it.is_pickup_only());
1020 int curr_layer = layer_plan_it.layer(), prev_layer;
1023 "\nMkBuilder::find_tracks_in_layers region=%d, seed_pickup_layer=%d, first_layer=%d; start_seed=%d, " 1027 layer_plan_it.next_layer(),
1035 while (++layer_plan_it) {
1036 prev_layer = curr_layer;
1037 curr_layer = layer_plan_it.layer();
1038 mkfndr->
setup(prop_config,
1048 const bool pickup_only = layer_plan_it.is_pickup_only();
1054 dprintf(
"\n\n* Processing layer %d, %s\n\n", curr_layer, pickup_only ?
"pickup only" :
"full finding");
1058 seed_cand_idx, start_seed, end_seed, curr_layer, prev_layer, pickup_only, iteration_dir);
1060 dprintf(
" Number of candidates to process: %d, nHits in layer: %d\n", theEndCand, layer_of_hits.
nHits());
1069 if (pickup_only || theEndCand == 0)
1075 for (
int itrack = 0; itrack < theEndCand; itrack +=
NN) {
1076 const int end =
std::min(itrack +
NN, theEndCand);
1079 dprintf(
"\nProcessing track=%d, start_seed=%d, n_seeds=%d, theEndCand=%d, end=%d, nn=%d, end_eq_tec=%d\n",
1088 for (
int i = itrack;
i < end; ++
i)
1096 for (
int i = itrack;
i < end; ++
i)
1097 dprintf(
" track %d, idx %d is from seed %d\n",
i,
i - itrack, mkfndr->
m_Label(
i - itrack, 0, 0));
1105 dprint(
"now get hit range");
1107 if (alwaysUseHitSelectionV2 || iter_params.useHitSelectionV2)
1113 mkfndr, layer_info, extra_cands, seed_cand_idx,
region, start_seed, itrack, end);
1126 dprint(
"make new candidates");
1142 const int theEndUpdater = seed_cand_update_idx.size();
1144 for (
int itrack = 0; itrack < theEndUpdater; itrack +=
NN) {
1145 const int end =
std::min(itrack +
NN, theEndUpdater);
1155 const int theEndOverlapper = seed_cand_overlap_idx.size();
1157 for (
int itrack = 0; itrack < theEndOverlapper; itrack +=
NN) {
1158 const int end =
std::min(itrack +
NN, theEndOverlapper);
1166 mkfndr->
inputOverlapHits(layer_of_hits, seed_cand_overlap_idx, itrack, end);
1173 for (
int ii = itrack;
ii < end; ++
ii) {
1174 const int fi =
ii - itrack;
1175 TrackCand &tc = eoccs[seed_cand_overlap_idx[
ii].seed_idx][seed_cand_overlap_idx[
ii].cand_idx];
1179 auto chi2Ovlp = mkfndr->
m_Chi2[fi];
1180 if (mkfndr->
m_FailFlag[fi] == 0 && chi2Ovlp >= 0.0f && chi2Ovlp <= 60.0f) {
1183 tc.
addHitIdx(seed_cand_overlap_idx[
ii].ovlp_idx, curr_layer, chi2Ovlp);
1186 if (scoreCand > scoreCandOvlp)
1197 for (
int i = 0;
i < ((
int)
cc.size()) - 1; ++
i) {
1199 printf(
"CloneEngine - NOT SORTED: layer=%d, iseed=%d (size=%lu)-- %d : %f smaller than %d : %f\n",
1226 #ifdef DEBUG_FINAL_FIT 1230 dprintf(
" %4d with q=%+d chi2=%7.3f pT=%7.3f eta=% 7.3f x=%.3f y=%.3f z=%.3f" 1231 " nHits=%2d label=%4d findable=%d\n",
1232 i,
t.charge(),
t.chi2(),
t.pT(),
t.momEta(),
t.x(),
t.y(),
t.z(),
1233 t.nFoundHits(),
t.label(),
t.isFindable());
1243 tbb::parallel_for(rosi.tbb_blk_rng_vec(), [&](
const tbb::blocked_range<int> &blk_rng) {
1246 RangeOfSeedIndices rng = rosi.seed_rng(blk_rng);
1248 while (rng.valid()) {
1262 #ifdef DEBUG_FINAL_FIT 1267 for (
int icand = start_cand; icand < end_cand; icand +=
NN) {
1268 const int end =
std::min(icand +
NN, end_cand);
1270 #ifdef DEBUG_FINAL_FIT 1271 dprintf(
"Pre Final fit for %d - %d\n", icand, end);
1272 for (
int i = icand;
i < end; ++
i) {
1273 dprint_tcand(eoccs[
i][0],
i);
1277 bool chi_debug =
false;
1278 #ifdef DEBUG_BACKWARD_FIT_BH 1293 #ifdef DEBUG_BACKWARD_FIT_BH 1296 mkfndr->
m_Chi2(0, 0, 0) / (eoccs[icand][0].nFoundHits() * 3 - 6) > 20.0
f) {
1298 #ifdef MKFIT_STANDALONE 1299 printf(
"CHIHDR Event %d, Cand %3d, pT %f, chipdof %f ### NOTE x,y,z in cm, sigmas, deltas in mum ### !!!\n",
1302 printf(
"CHIHDR Cand %3d, pT %f, chipdof %f ### NOTE x,y,z in cm, sigmas, deltas in mum ### !!!\n",
1306 mkfndr->
m_Chi2(0, 0, 0) / (eoccs[icand][0].nFoundHits() * 3 - 6));
1308 printf(
"CHIHDR %3s %10s" 1309 " %10s %10s %10s %10s %11s %11s %11s" 1310 " %10s %10s %10s %10s %11s %11s %11s" 1311 " %10s %10s %10s %10s %10s %11s %11s\n",
1313 "x_h",
"y_h",
"z_h",
"r_h",
"sx_h",
"sy_h",
"sz_h",
1314 "x_t",
"y_t",
"z_t",
"r_t",
"sx_t",
"sy_t",
"sz_t",
1315 "pt",
"phi",
"theta",
"phi_h",
"phi_t",
"d_xy",
"d_z");
1324 #ifdef DEBUG_FINAL_FIT 1325 dprintf(
"Post Final fit for %d - %d\n", icand, end);
1326 for (
int i = icand;
i < end; ++
i) {
1327 dprint_tcand(eoccs[
i][0],
i);
1342 const int adaptiveSPT = std::clamp(
1344 dprint(
"adaptiveSPT " << adaptiveSPT <<
" fill " << rosi.count() <<
"/" << eoccs.
size() <<
" region " <<
region);
1346 tbb::parallel_for(rosi.tbb_blk_rng_std(adaptiveSPT), [&](
const tbb::blocked_range<int> &
cands) {
1361 for (
int icand = start_cand; icand < end_cand; icand +=
step) {
1364 bool chi_debug =
false;
1366 #ifdef DEBUG_FINAL_FIT 1368 dprintf(
"Pre Final fit for %d - %d\n", icand, end);
1369 for (
int i = icand;
i < end; ++
i) {
1370 dprint_tcand(eoccs[
i][0],
i);
1373 static bool first =
true;
1377 "BKF_OVERLAP event/I:label/I:prod_type/I:is_findable/I:layer/I:is_stereo/I:is_barrel/I:" 1378 "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:" 1379 "sx_t/F:sy_t/F:sz_t/F:d_xy/F:d_z/F\n");
1397 #ifdef DEBUG_FINAL_FIT 1398 dprintf(
"Post Final fit for %d - %d\n", icand, end);
1399 for (
int i = icand;
i < end; ++
i) {
1400 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