13 #if (defined(DUMPHITWINDOW) || defined(DEBUG_BACKWARD_FIT)) && defined(MKFIT_STANDALONE) 25 const std::vector<bool> *ihm,
59 const int iI = inputProp ?
iP :
iC;
61 for (
int i = beg, imp = 0;
i < end; ++
i, ++imp) {
67 const std::vector<Track> &
tracks,
const std::vector<int> &idxs,
int beg,
int end,
bool inputProp,
int mp_offset) {
73 const int iI = inputProp ?
iP :
iC;
75 for (
int i = beg, imp = mp_offset;
i < end; ++
i, ++imp) {
90 const int iI = inputProp ?
iP :
iC;
92 for (
int i = beg, imp = 0;
i < end; ++
i, ++imp) {
98 m_SeedAlgo(imp, 0, 0) =
tracks[idxs[
i].first].seed_algo();
99 m_SeedLabel(imp, 0, 0) =
tracks[idxs[
i].first].seed_label();
109 const std::vector<UpdateIndices> &idxs,
118 const int iI = inputProp ?
iP :
iC;
120 for (
int i = beg, imp = 0;
i < end; ++
i, ++imp) {
126 m_SeedAlgo(imp, 0, 0) =
tracks[idxs[
i].seed_idx].seed_algo();
127 m_SeedLabel(imp, 0, 0) =
tracks[idxs[
i].seed_idx.seed_label();
140 const std::vector<std::pair<int, IdxChi2List>> &idxs,
149 const int iI = inputProp ?
iP :
iC;
151 for (
int i = beg, imp = 0;
i < end; ++
i, ++imp) {
157 m_SeedAlgo(imp, 0, 0) =
tracks[idxs[
i].first].seed_algo();
158 m_SeedLabel(imp, 0, 0) =
tracks[idxs[
i].first].seed_label();
170 const int iO = outputProp ?
iP :
iC;
172 for (
int i = beg, imp = 0;
i < end; ++
i, ++imp) {
178 std::vector<Track> &
tracks,
const std::vector<int> &idxs,
int beg,
int end,
bool outputProp)
const {
182 const int iO = outputProp ?
iP :
iC;
184 for (
int i = beg, imp = 0;
i < end; ++
i, ++imp) {
195 const float invpt,
const float theta,
float &min_dq,
float &max_dq,
float &min_dphi,
float &max_dphi) {
196 float max_invpt =
std::min(invpt, 10.0
f);
198 enum SelWinParameters_e { dp_sf = 0, dp_0, dp_1, dp_2, dq_sf, dq_0, dq_1, dq_2 };
203 float this_dq =
v[dq_sf] * (
v[dq_0] * max_invpt +
v[dq_1] *
theta +
v[dq_2]);
207 max_dq = 2.0f * min_dq;
211 float this_dphi =
v[dp_sf] * (
v[dp_0] * max_invpt +
v[dp_1] *
theta +
v[dp_2]);
213 if (this_dphi > min_dphi) {
214 min_dphi = this_dphi;
215 max_dphi = 2.0f * min_dphi;
227 const float invpt =
m_Par[ipar].
At(itrk, 3, 0);
230 float max_invpt =
std::min(invpt, 10.0
f);
232 enum SelWinParameters_e { c2_sf = 8, c2_0, c2_1, c2_2 };
236 float this_c2 =
v[c2_sf] * (
v[c2_0] * max_invpt +
v[c2_1] *
theta +
v[c2_2]);
238 if (this_c2 > minChi2Cut)
258 const float nSigmaR = 3;
260 dprintf(
"LayerOfHits::SelectHitIndices %s layer=%d N_proc=%d\n",
261 L.is_barrel() ?
"barrel" :
"endcap",
265 float dqv[
NN], dphiv[
NN], qv[
NN], phiv[
NN];
266 bidx_t qb1v[
NN], qb2v[
NN], qbv[
NN], pb1v[
NN], pb2v[
NN];
268 const auto assignbins = [&](
int itrack,
277 dphi = std::clamp(
std::abs(dphi), min_dphi, max_dphi);
278 dq = std::clamp(dq, min_dq, max_dq);
282 dphiv[itrack] = dphi;
285 qbv[itrack] =
L.qBinChecked(
q);
286 qb1v[itrack] =
L.qBinChecked(
q - dq);
287 qb2v[itrack] =
L.qBinChecked(
q + dq) + 1;
288 pb1v[itrack] =
L.phiBinChecked(phi - dphi);
289 pb2v[itrack] =
L.phiMaskApply(
L.phiBin(phi + dphi) + 1);
292 const auto calcdphi2 = [&](
int itrack,
float dphidx,
float dphidy) {
297 const auto calcdphi = [&](
float dphi2,
float min_dphi) {
304 for (
int itrack = 0; itrack <
NN; ++itrack) {
307 float min_dq = ILC.
min_dq();
308 float max_dq = ILC.
max_dq();
312 const float invpt =
m_Par[iI].
At(itrack, 3, 0);
318 const float r2 =
x *
x + y * y;
319 const float dphidx = -y /
r2, dphidy =
x /
r2;
320 const float dphi2 = calcdphi2(itrack, dphidx, dphidy);
325 const float phi =
getPhi(
x, y);
326 float dphi = calcdphi(dphi2, min_dphi);
330 const float edgeCorr =
std::abs(0.5
f * (
L.layer_info()->rout() -
L.layer_info()->rin()) /
335 assignbins(itrack, z,
dz, phi, dphi, min_dq, max_dq, min_dphi, max_dphi);
340 const float layerD =
std::abs(
L.layer_info()->zmax() -
L.layer_info()->zmin()) * 0.5
f *
344 for (
int itrack = 0; itrack <
NN; ++itrack) {
347 float min_dq = ILC.
min_dq();
348 float max_dq = ILC.
max_dq();
352 const float invpt =
m_Par[iI].
At(itrack, 3, 0);
358 const float r2 =
x *
x + y * y;
359 const float r2Inv = 1.f /
r2;
360 const float dphidx = -y * r2Inv, dphidy =
x * r2Inv;
361 const float phi =
getPhi(
x, y);
363 calcdphi2(itrack, dphidx, dphidy)
371 float dphi = calcdphi(dphi2, min_dphi);
375 y * y *
m_Err[iI].constAt(itrack, 1, 1) +
376 2 *
x * y *
m_Err[iI].constAt(itrack, 0, 1)) /
378 const float edgeCorr =
std::abs(0.5
f * (
L.layer_info()->zmax() -
L.layer_info()->zmin()) *
382 assignbins(itrack, r, dr, phi, dphi, min_dq, max_dq, min_dphi, max_dphi);
388 for (
int itrack = 0; itrack < N_proc; ++itrack) {
402 const bidx_t qb = qbv[itrack];
403 const bidx_t qb1 = qb1v[itrack];
404 const bidx_t qb2 = qb2v[itrack];
405 const bidx_t pb1 = pb1v[itrack];
406 const bidx_t pb2 = pb2v[itrack];
409 const float q = qv[itrack];
410 const float phi = phiv[itrack];
411 const float dphi = dphiv[itrack];
412 const float dq = dqv[itrack];
414 dprintf(
" %2d/%2d: %6.3f %6.3f %6.6f %7.5f %3u %3u %4u %4u\n",
415 L.layer_id(), itrack,
q, phi, dq, dphi,
423 #if defined(DUMPHITWINDOW) && defined(MKFIT_STANDALONE) 424 int thisseedmcid = -999999;
426 int seedlabel = m_SeedLabel(itrack, 0, 0);
427 TrackVec &seedtracks = m_event->seedTracks_;
428 int thisidx = -999999;
429 for (
int i = 0;
i <
int(seedtracks.size()); ++
i) {
430 auto &thisseed = seedtracks[
i];
431 if (thisseed.label() == seedlabel) {
436 if (thisidx > -999999) {
437 auto &seedtrack = m_event->seedTracks_[thisidx];
438 std::vector<int> thismcHitIDs;
439 seedtrack.mcHitIDsVec(m_event->layerHits_, m_event->simHitsInfo_, thismcHitIDs);
440 if (std::adjacent_find(thismcHitIDs.begin(), thismcHitIDs.end(), std::not_equal_to<>()) ==
441 thismcHitIDs.end()) {
442 thisseedmcid = thismcHitIDs.at(0);
448 for (bidx_t qi = qb1; qi != qb2; ++qi) {
449 for (bidx_t
pi = pb1;
pi != pb2;
pi =
L.phiMaskApply(
pi + 1)) {
451 if (qi == qb &&
L.isBinDead(
pi, qi) ==
true) {
452 dprint(
"dead module for track in layer=" <<
L.layer_id() <<
" qb=" << qi <<
" pi=" <<
pi <<
" q=" <<
q 465 auto pbi =
L.phiQBinContent(
pi, qi);
466 for (bcnt_t
hi = pbi.begin();
hi < pbi.end(); ++
hi) {
469 unsigned int hi_orig =
L.getOriginalHitIndex(
hi);
473 "Yay, denying masked hit on layer %u, hi %u, orig idx %u\n",
L.layer_info()->layer_id(),
hi, hi_orig);
484 #if defined(DUMPHITWINDOW) && defined(MKFIT_STANDALONE) 486 const MCHitInfo &mchinfo = m_event->simHitsInfo_[
L.refHit(
hi).mcHitID()];
488 int st_isfindable = 0;
489 int st_label = -999999;
496 float st_eta = -999.;
497 float st_phi = -999.;
499 Track simtrack = m_event->simTracks_[mchid];
501 st_label = simtrack.
label();
503 st_pt = simtrack.
pT();
504 st_eta = simtrack.
momEta();
505 st_phi = simtrack.
momPhi();
507 st_charge = simtrack.
charge();
508 st_r = simtrack.
posR();
512 const Hit &thishit =
L.refHit(
hi);
530 float hx = thishit.
x();
531 float hy = thishit.
y();
532 float hz = thishit.
z();
533 float hr = std::hypot(hx, hy);
534 float hphi = std::atan2(hy, hx);
545 (hx * hx * thishit.
exx() + hy * hy * thishit.
eyy() + 2.0f * hx * hy *
m_msErr.
At(itrack, 0, 1)) /
552 float hchi2 = thisOutChi2[itrack];
555 float tx =
m_Par[iI].
At(itrack, 0, 0);
556 float ty =
m_Par[iI].
At(itrack, 1, 0);
557 float tz =
m_Par[iI].
At(itrack, 2, 0);
558 float tr = std::hypot(tx, ty);
559 float tphi = std::atan2(ty, tx);
560 float tchi2 =
m_Chi2(itrack, 0, 0);
573 (tx * tx *
tex *
tex + ty * ty * tey * tey + 2.0
f * tx * ty *
m_Err[iI].At(itrack, 0, 1)) /
578 (ty * ty *
tex *
tex + tx * tx * tey * tey - 2.0
f * tx * ty *
m_Err[iI].At(itrack, 0, 1)) /
579 (tr * tr * tr * tr));
582 float ht_dxy = std::hypot(hx - tx, hy - ty);
583 float ht_dz = hz - tz;
586 static bool first =
true;
591 "lyr_id/I:lyr_isbrl/I:hit_idx/I:" 592 "trk_cnt/I:trk_idx/I:trk_label/I:" 593 "trk_pt/F:trk_eta/F:trk_mphi/F:trk_chi2/F:" 595 "seed_idx/I:seed_label/I:seed_algo/I:seed_mcid/I:" 597 "st_isfindable/I:st_prodtype/I:st_label/I:" 598 "st_pt/F:st_eta/F:st_phi/F:" 599 "st_nhits/I:st_charge/I:st_r/F:st_z/F:" 600 "trk_q/F:hit_q/F:dq_trkhit/F:dq_cut/F:trk_phi/F:hit_phi/F:dphi_trkhit/F:dphi_cut/F:" 601 "t_x/F:t_y/F:t_r/F:t_phi/F:t_z/F:" 602 "t_ex/F:t_ey/F:t_er/F:t_ephi/F:t_ez/F:" 603 "h_x/F:h_y/F:h_r/F:h_phi/F:h_z/F:" 604 "h_ex/F:h_ey/F:h_er/F:h_ephi/F:h_ez/F:" 605 "ht_dxy/F:ht_dz/F:ht_dphi/F:" 614 printf(
"HITWINDOWSEL " 618 "%6.3f %6.3f %6.3f %6.3f " 625 "%6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f " 626 "%6.3f %6.3f %6.3f %6.3f %6.3f " 627 "%6.6f %6.6f %6.6f %6.6f %6.6f " 628 "%6.3f %6.3f %6.3f %6.3f %6.3f " 629 "%6.6f %6.6f %6.6f %6.6f %6.6f " 634 L.layer_id(),
L.is_barrel(),
L.getOriginalHitIndex(
hi),
636 1.0f /
m_Par[iI].
At(itrack, 3, 0),
getEta(
m_Par[iI].At(itrack, 5, 0)),
m_Par[iI].
At(itrack, 4, 0),
m_Chi2(itrack, 0, 0),
638 m_SeedIdx(itrack, 0, 0), m_SeedLabel(itrack, 0, 0), m_SeedAlgo(itrack, 0, 0), thisseedmcid,
640 st_isfindable, st_prodtype, st_label,
641 st_pt, st_eta, st_phi,
642 st_nhits, st_charge, st_r, st_z,
643 q,
L.hit_q(
hi), ddq, dq, phi,
L.hit_phi(
hi), ddphi, dphi,
644 tx, ty, tr, tphi, tz,
645 tex, tey, ter, tephi, tez,
646 hx, hy, hr, hphi, hz,
647 hex, hey, her, hephi, hez,
648 ht_dxy, ht_dz, ht_dphi,
660 dprintf(
" SHI %3u %4u %5u %6.3f %6.3f %6.4f %7.5f %s\n",
662 ddq, ddphi, (ddq < dq && ddphi < dphi) ?
"PASS" :
"FAIL");
677 assert(
false &&
"this code has not been used in a while -- see comments in code");
703 for (
int it = 0; it <
NN; ++it) {
714 for (
int hit_cnt = 0; hit_cnt <
maxSize; ++hit_cnt) {
720 for (
int itrack = 0; itrack < N_proc; ++itrack) {
746 for (
int itrack = 0; itrack < N_proc; ++itrack) {
752 bestHit[itrack] =
m_XHitArr.
At(itrack, hit_cnt, 0);
759 for (
int itrack = 0; itrack < N_proc; ++itrack) {
777 if (bestHit[itrack] >= 0) {
781 dprint(
"ADD BEST HIT FOR TRACK #" 782 << itrack << std::endl
783 <<
"prop x=" <<
m_Par[
iP].constAt(itrack, 0, 0) <<
" y=" <<
m_Par[
iP].constAt(itrack, 1, 0) << std::endl
784 <<
"copy in hit #" << bestHit[itrack] <<
" x=" <<
hit.position()[0] <<
" y=" <<
hit.position()[1]);
802 <<
" r=" << std::hypot(
m_Par[
iP](itrack, 0, 0),
m_Par[
iP](itrack, 1, 0)));
817 dprint(
"update parameters");
831 dprint(
"m_Par[iP](0,0,0)=" <<
m_Par[
iP](0, 0, 0) <<
" m_Par[iC](0,0,0)=" <<
m_Par[
iC](0, 0, 0));
842 const float hitHL =
sqrt(msErr.
constAt(itrack, 2, 2) * 3.f);
843 const float qErr =
sqrt(pErr.
constAt(itrack, 2, 2));
844 dprint(
"qCompat " << hitHL <<
" + " << 3.
f * qErr <<
" vs " <<
res);
849 const float hitT2 = msErr.
constAt(itrack, 0, 0) + msErr.
constAt(itrack, 1, 1);
850 const float hitT2inv = 1.f / hitT2;
851 const float proj[3] = {msErr.
constAt(itrack, 0, 0) * hitT2inv,
852 msErr.
constAt(itrack, 0, 1) * hitT2inv,
853 msErr.
constAt(itrack, 1, 1) * hitT2inv};
857 const float resProj =
859 dprint(
"qCompat " <<
sqrt(hitT2 * 3.
f) <<
" + " << 3.
f * qErr <<
" vs " << resProj);
870 int itrack,
bool isBarrel,
unsigned int pcm,
unsigned int pcmMin,
const MPlexLV &pPar,
const MPlexHS &msErr) {
877 const float hitT2 = msErr.
constAt(itrack, 0, 0) + msErr.
constAt(itrack, 1, 1);
878 const float hitT2inv = 1.f / hitT2;
879 const float proj[3] = {msErr.
constAt(itrack, 0, 0) * hitT2inv,
880 msErr.
constAt(itrack, 0, 1) * hitT2inv,
881 msErr.
constAt(itrack, 1, 1) * hitT2inv};
882 const bool detXY_OK =
884 const float cosP =
cos(pPar.
constAt(itrack, 4, 0));
885 const float sinP =
sin(pPar.
constAt(itrack, 4, 0));
889 2.
f * cosP * sinP *
proj[1]))
896 const float qCorr = pcm * qSF;
897 dprint(
"pcm " << pcm <<
" * " << qSF <<
" = " << qCorr <<
" vs " << pcmMin);
898 return qCorr > pcmMin;
906 std::vector<std::vector<TrackCand>> &tmp_candidates,
917 for (
int it = 0; it <
NN; ++it) {
927 int nHitsAdded[
NN]{};
928 bool isTooLargeCluster[
NN]{
false};
930 for (
int hit_cnt = 0; hit_cnt <
maxSize; ++hit_cnt) {
936 for (
int itrack = 0; itrack < N_proc; ++itrack) {
939 mhp.addInputAt(itrack,
hit);
940 charge_pcm[itrack] =
hit.chargePerCM();
968 bool oneCandPassCut =
false;
969 for (
int itrack = 0; itrack < N_proc; ++itrack) {
976 bool isCompatible =
true;
990 isTooLargeCluster[itrack] =
true;
991 isCompatible =
false;
996 oneCandPassCut =
true;
1003 if (oneCandPassCut) {
1018 dprint(
"update parameters" << std::endl
1019 <<
"propagated track parameters x=" <<
m_Par[
iP].constAt(0, 0, 0)
1020 <<
" y=" <<
m_Par[
iP].constAt(0, 1, 0) << std::endl
1028 for (
int itrack = 0; itrack < N_proc; ++itrack) {
1034 if (
chi2 < max_c2) {
1035 bool isCompatible =
true;
1049 isCompatible =
false;
1053 bool hitExists =
false;
1068 nHitsAdded[itrack]++;
1069 dprint(
"chi2 cut passed, creating new candidate");
1073 const int hit_idx =
m_XHitArr.
At(itrack, hit_cnt, 0);
1077 newcand.
setCharge(tmpChg(itrack, 0, 0));
1086 if (
chi2 < max_c2) {
1088 ccand[
m_CandIdx(itrack, 0, 0)].considerHitForOverlap(
1096 tmp_candidates[
m_SeedIdx(itrack, 0, 0) -
offset].emplace_back(newcand);
1107 for (
int itrack = 0; itrack < N_proc; ++itrack) {
1124 else if (
m_XWsrResult[itrack].m_in_gap ==
true && nHitsAdded[itrack] == 0) {
1128 else if (isTooLargeCluster[itrack] ==
true && nHitsAdded[itrack] == 0) {
1133 <<
" r=" << std::hypot(
m_Par[
iP](itrack, 0, 0),
m_Par[
iP](itrack, 1, 0)));
1143 tmp_candidates[
m_SeedIdx(itrack, 0, 0) -
offset].emplace_back(newcand);
1164 for (
int it = 0; it <
NN; ++it) {
1172 dprintf(
"FindCandidatesCloneEngine max hits to process=%d\n",
maxSize);
1174 int nHitsAdded[
NN]{};
1175 bool isTooLargeCluster[
NN]{
false};
1177 for (
int hit_cnt = 0; hit_cnt <
maxSize; ++hit_cnt) {
1183 for (
int itrack = 0; itrack < N_proc; ++itrack) {
1186 mhp.addInputAt(itrack,
hit);
1187 charge_pcm[itrack] =
hit.chargePerCM();
1209 #pragma omp simd // DOES NOT VECTORIZE AS IT IS NOW 1210 for (
int itrack = 0; itrack < N_proc; ++itrack) {
1222 dprint(
"chi2=" <<
chi2 <<
" for trkIdx=" << itrack <<
" hitIdx=" <<
m_XHitArr.
At(itrack, hit_cnt, 0));
1223 if (
chi2 < max_c2) {
1224 bool isCompatible =
true;
1239 isTooLargeCluster[itrack] =
true;
1240 isCompatible =
false;
1246 bool hitExists =
false;
1261 nHitsAdded[itrack]++;
1262 const int hit_idx =
m_XHitArr.
At(itrack, hit_cnt, 0);
1266 if (
chi2 < max_c2) {
1267 ccand[
m_CandIdx(itrack, 0, 0)].considerHitForOverlap(
1273 tmpList.
hitIdx = hit_idx;
1285 dprint(
" adding hit with hit_cnt=" << hit_cnt <<
" for trkIdx=" << tmpList.
trkIdx 1286 <<
" orig Seed=" <<
m_Label(itrack, 0, 0));
1295 for (
int itrack = 0; itrack < N_proc; ++itrack) {
1314 else if (
m_XWsrResult[itrack].m_in_gap ==
true && nHitsAdded[itrack] == 0) {
1318 else if (isTooLargeCluster[itrack] ==
true && nHitsAdded[itrack] == 0) {
1331 tmpList.
hitIdx = fake_hit_idx;
1343 dprint(
"adding invalid hit " << fake_hit_idx);
1383 const int iO = outputProp ?
iP :
iC;
1385 for (
int i = 0;
i < N_proc; ++
i) {
1393 dprint((outputProp ?
"propagated" :
"updated")
1394 <<
" track parameters x=" <<
cand.parameters()[0] <<
" y=" <<
cand.parameters()[1]
1395 <<
" z=" <<
cand.parameters()[2] <<
" pt=" << 1. /
cand.parameters()[3] <<
" posEta=" <<
cand.posEta());
1410 for (
int i = beg;
i < end; ++
i, ++itrack) {
1437 for (
int i = beg;
i < end; ++
i, ++itrack) {
1463 const int iO = outputProp ?
iP :
iC;
1466 for (
int i = beg;
i < end; ++
i, ++itrack) {
1484 const int iO = outputProp ?
iP :
iC;
1487 for (
int i = beg;
i < end; ++
i, ++itrack) {
1502 #if defined(DEBUG_BACKWARD_FIT) || defined(DEBUG_BACKWARD_FIT_BH) 1519 float tmp_err[6] = {666, 0, 666, 0, 0, 666};
1523 const int layer = lp_iter->m_layer;
1529 for (
int i = 0;
i < N_proc; ++
i) {
1587 for (
int n = 0;
n < N_proc; ++
n) {
1594 #ifdef DEBUG_BACKWARD_FIT_BH 1596 for (
int i = 0;
i < N_proc; ++
i) {
1605 "CHIHIT %3d %10g %10g %10g %10g %10g %11.5g %11.5g %11.5g %10g %10g %10g %10g %11.5g %11.5g %11.5g %10g " 1606 "%10g %10g %10g %10g %11.5g %11.5g\n",
1620 e2s(
m_Err[ti].At(
i, 0, 0)),
1621 e2s(
m_Err[ti].At(
i, 1, 1)),
1622 e2s(
m_Err[ti].At(
i, 2, 2)),
1647 printf(
"Parameters:\n");
1648 for (
int i = 0;
i < 6; ++
i) {
1649 printf(
" %12.4g",
m_Par[corp].constAt(mslot,
i, 0));
1651 printf(
"\nError matrix\n");
1652 for (
int i = 0;
i < 6; ++
i) {
1653 for (
int j = 0;
j < 6; ++
j) {
1654 printf(
" %12.4g",
m_Err[corp].constAt(mslot,
i,
j));
1675 float tmp_err[6] = {666, 0, 666, 0, 0, 666};
1678 #if defined(DEBUG_PROP_UPDATE) 1679 const int DSLOT = 0;
1680 printf(
"bkfit entry, track in slot %d\n", DSLOT);
1685 const int layer = lp_iter.layer();
1690 #if defined(DEBUG_BACKWARD_FIT) 1691 const Hit *last_hit_ptr[
NN];
1697 for (
int i = 0;
i < N_proc; ++
i) {
1717 #ifdef DEBUG_BACKWARD_FIT 1718 last_hit_ptr[
i] = &
hit;
1726 #ifdef DEBUG_BACKWARD_FIT 1727 last_hit_ptr[
i] =
nullptr;
1738 if (done_count == N_proc)
1740 if (here_count == 0)
1775 #if defined(DEBUG_PROP_UPDATE) 1776 printf(
"\nbkfit at layer %d, track in slot %d -- fail=%d, had hit=%d (%g, %g, %g)\n",
1780 1 - no_mat_effs[DSLOT],
1784 printf(
"Propagated:\n");
1786 printf(
"Updated:\n");
1791 for (
int i = 0;
i < N_proc; ++
i) {
1833 #if defined(DEBUG_BACKWARD_FIT) 1836 const char beg_cur_sep =
'/';
1837 for (
int i = 0;
i < N_proc; ++
i) {
1838 if (chiDebug && last_hit_ptr[
i]) {
1841 float chi = tmp_chi2.
At(
i, 0, 0);
1842 float chi_prnt = std::isfinite(chi) ? chi : -9;
1844 #if defined(MKFIT_STANDALONE) 1847 dprintf(
"BKF_OVERLAP %d %d %d %d %d %d %d " 1848 "%f%c%f %f %f%c%f %f %f %f %d %d %d %d " 1852 dprintf(
"BKF_OVERLAP %d %d %d %d %d %d " 1853 "%f%c%f %f %f%c%f %f %f %f %d %d %d " 1857 layer,
L.is_stereo(),
L.is_barrel(),
1858 bb.
pT(), beg_cur_sep, 1.0f /
m_Par[ti].
At(
i, 3, 0),
1861 std::hypot(
m_Par[ti].At(
i, 0, 0),
m_Par[ti].At(
i, 1, 0)),
1864 std::isnan(chi), std::isfinite(chi), chi > 0,
1865 #if defined(MKFIT_STANDALONE)
void setOriginIndex(int oi)
float getScoreCand(const track_score_func &score_func, const Track &cand1, bool penalizeTailMissHits=false, bool inFindCandidates=false)
void addHitIdx(int hitIdx, int hitLyr, float chi2)
unsigned int maxClusterSize
void copy_in(const Track &trk, const int mslot, const int tslot)
static constexpr int MPlexHitIdxMax
const SVector6 & parameters() const
const IterationLayerConfig * m_iteration_layer_config
void setDiagonal3x3(idx_t n, T d)
const HitOnTrack * m_HoTArr[NN]
void kalmanOperationEndcap(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
void copy_out(Track &trk, const int mslot, const int tslot) const
void copyIn(idx_t n, const T *arr)
void outputTracksAndHitIdx(std::vector< Track > &tracks, int beg, int end, bool outputProp) const
HitOnTrack m_HoTArrs[NN][Config::nMaxTrkHits]
const Hit * hitArray() const
void inputTracksAndHitIdx(const std::vector< Track > &tracks, int beg, int end, bool inputProp)
void bkFitInputTracks(TrackVec &cands, int beg, int end)
void setup_bkfit(const PropagationConfig &pc, const SteeringParams &sp)
const T & constAt(idx_t n, idx_t i, idx_t j) const
Sin< T >::type sin(const T &t)
PropagationFlags backward_fit_pflags
void addInput(const T &item)
ProdType prodType() const
T & At(idx_t n, idx_t i, idx_t j)
void selectHitIndices(const LayerOfHits &layer_of_hits, const int N_proc)
void bkFitPropTracksToPCA(const int N_proc)
SMatrixSym66 & errors_nc()
void inputTracksAndHits(const std::vector< CombCandidate > &tracks, const LayerOfHits &layer_of_hits, const std::vector< UpdateIndices > &idxs, int beg, int end, bool inputProp)
void add_hit(const int mslot, int index, int layer)
float getEta(float r, float z)
void(* m_compute_chi2_foo)(const MPlexLS &, const MPlexLV &, const MPlexQI &, const MPlexHS &, const MPlexHV &, MPlexQF &, MPlexLV &, MPlexQI &, const int, const PropagationFlags, const bool)
const float * posArray() const
static unsigned int maxChargePerCM()
static constexpr int kHitStopIdx
const IterationParams * m_iteration_params
void kalmanOperation(const int kfOp, const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, MPlexQF &outChi2, const int N_proc)
void findCandidates(const LayerOfHits &layer_of_hits, std::vector< std::vector< TrackCand >> &tmp_candidates, const int offset, const int N_proc, const FindingFoos &fnd_foos)
static constexpr int kHitInGapIdx
track_score_func m_track_scorer
constexpr bool usePhiQArrays
const HoTNode * hotsData() const
PropagationFlags finding_inter_layer_pflags
bool isStripQCompatible(int itrack, bool isBarrel, const MPlexLS &pErr, const MPlexLV &pPar, const MPlexHS &msErr, const MPlexHV &msPar)
void add(const Matriplex &v)
float getScoreStruct(const track_score_func &score_func, const IdxChi2List &cand1)
const PropagationConfig * m_prop_config
iterator make_iterator(IterationType_e type) const
const T & constAt(idx_t n, idx_t i, idx_t j) const
int num_all_minus_one_hits(const int mslot) const
unsigned int detIDinLayer() const
const float * errArray() const
constexpr Matriplex::idx_t NN
unsigned int bin_content_t
Cos< T >::type cos(const T &t)
void(* m_update_param_foo)(const MPlexLS &, const MPlexLV &, MPlexQI &, const MPlexHS &, const MPlexHV &, MPlexLS &, MPlexLV &, MPlexQI &, const int, const PropagationFlags, const bool)
CombCandidate * combCandidate() const
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
void propagateTracksToHitR(const MPlexHV &par, const int N_proc, const PropagationFlags pf, const MPlexQI *noMatEffPtr=nullptr)
MPlexQI m_NTailMinusOneHits
void copyOut(idx_t n, T *arr) const
const HitOnTrack * getHitsOnTrackArray() const
PropagationFlags pca_prop_pflags
bool finding_requires_propagation_to_hit_pos
constexpr float nSigmaPhi
TrackCand * m_TrkCand[NN]
std::vector< Track > TrackVec
void pack(TMerr &err, TMpar &par)
void bkFitFitTracks(const EventOfHits &eventofhits, const SteeringParams &st_par, const int N_proc, bool chiDebug=false)
const SteeringParams * m_steering_params
static const FindingFoos & get_finding_foos(bool is_barrel)
void updateWithLoadedHit(int N_proc, const FindingFoos &fnd_foos)
std::vector< LayerControl > m_layer_plan
bool passStripChargePCMfromTrack(int itrack, bool isBarrel, unsigned int pcm, unsigned int pcmMin, const MPlexLV &pPar, const MPlexHS &msErr)
float getPhi(float x, float y)
static constexpr int kHitMaxClusterIdx
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)
void copyIn(idx_t n, const T *arr)
const std::vector< float > & get_window_params(bool forward, bool fallback_to_other) const
HitOnTrack hot(int i) const
void copyOutParErr(std::vector< CombCandidate > &seed_cand_vec, int N_proc, bool outputProp) const
int num_inside_minus_one_hits(const int mslot) const
void findCandidatesCloneEngine(const LayerOfHits &layer_of_hits, CandCloner &cloner, const int offset, const int N_proc, const FindingFoos &fnd_foos)
void copyOut(idx_t n, T *arr) const
const std::vector< bool > * m_iteration_hit_mask
PropagationFlags finding_intra_layer_pflags
void add_cand(int idx, const IdxChi2List &cand_info)
float getHitSelDynamicChi2Cut(const int itrk, const int ipar)
static constexpr int kHitMissIdx
const HoTNode * m_HoTNodeArr[NN]
unsigned short bin_index_t
WSR_Result m_XWsrResult[NN]
void getHitSelDynamicWindows(const float invpt, const float theta, float &min_dq, float &max_dq, float &min_dphi, float &max_dphi)
Geom::Theta< T > theta() const
static constexpr int kHitEdgeIdx
T & At(idx_t n, idx_t i, idx_t j)
CombCandidate & combCandWithOriginalIndex(int idx)
static unsigned int minChargePerCM()
SVector6 & parameters_nc()
Power< A, B >::type pow(const A &a, const B &b)
void propagateTracksToHitZ(const MPlexHV &par, const int N_proc, const PropagationFlags pf, const MPlexQI *noMatEffPtr=nullptr)
void setup(const PropagationConfig &pc, const IterationParams &ip, const IterationLayerConfig &ilc, const SteeringParams &sp, const std::vector< bool > *ihm, bool infwd)
void propagateTracksToPCAZ(const int N_proc, const PropagationFlags pf)
const Hit & refHit(int i) const
void print_par_err(int corp, int mslot) const
void addBestHit(const LayerOfHits &layer_of_hits, const int N_proc, const FindingFoos &fnd_foos)
constexpr bool isFinite(float x)