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) {
307 #if !defined(__clang__) 310 for (
int itrack = 0; itrack <
NN; ++itrack) {
313 float min_dq = ILC.
min_dq();
314 float max_dq = ILC.
max_dq();
318 const float invpt =
m_Par[iI].
At(itrack, 3, 0);
324 const float r2 =
x *
x + y * y;
325 const float dphidx = -y /
r2, dphidy =
x /
r2;
326 const float dphi2 = calcdphi2(itrack, dphidx, dphidy);
331 const float phi =
getPhi(
x, y);
332 float dphi = calcdphi(dphi2, min_dphi);
336 const float edgeCorr =
std::abs(0.5
f * (
L.layer_info()->rout() -
L.layer_info()->rin()) /
341 assignbins(itrack, z,
dz, phi, dphi, min_dq, max_dq, min_dphi, max_dphi);
346 const float layerD =
std::abs(
L.layer_info()->zmax() -
L.layer_info()->zmin()) * 0.5
f *
349 #if !defined(__clang__) 352 for (
int itrack = 0; itrack <
NN; ++itrack) {
355 float min_dq = ILC.
min_dq();
356 float max_dq = ILC.
max_dq();
360 const float invpt =
m_Par[iI].
At(itrack, 3, 0);
366 const float r2 =
x *
x + y * y;
367 const float r2Inv = 1.f /
r2;
368 const float dphidx = -y * r2Inv, dphidy =
x * r2Inv;
369 const float phi =
getPhi(
x, y);
371 calcdphi2(itrack, dphidx, dphidy)
379 float dphi = calcdphi(dphi2, min_dphi);
383 y * y *
m_Err[iI].constAt(itrack, 1, 1) +
384 2 *
x * y *
m_Err[iI].constAt(itrack, 0, 1)) /
386 const float edgeCorr =
std::abs(0.5
f * (
L.layer_info()->zmax() -
L.layer_info()->zmin()) *
390 assignbins(itrack, r, dr, phi, dphi, min_dq, max_dq, min_dphi, max_dphi);
396 for (
int itrack = 0; itrack < N_proc; ++itrack) {
410 const bidx_t qb = qbv[itrack];
411 const bidx_t qb1 = qb1v[itrack];
412 const bidx_t qb2 = qb2v[itrack];
413 const bidx_t pb1 = pb1v[itrack];
414 const bidx_t pb2 = pb2v[itrack];
417 const float q = qv[itrack];
418 const float phi = phiv[itrack];
419 const float dphi = dphiv[itrack];
420 const float dq = dqv[itrack];
422 dprintf(
" %2d/%2d: %6.3f %6.3f %6.6f %7.5f %3u %3u %4u %4u\n",
423 L.layer_id(), itrack,
q, phi, dq, dphi,
431 #if defined(DUMPHITWINDOW) && defined(MKFIT_STANDALONE) 432 int thisseedmcid = -999999;
434 int seedlabel = m_SeedLabel(itrack, 0, 0);
435 TrackVec &seedtracks = m_event->seedTracks_;
436 int thisidx = -999999;
437 for (
int i = 0;
i <
int(seedtracks.size()); ++
i) {
438 auto &thisseed = seedtracks[
i];
439 if (thisseed.label() == seedlabel) {
444 if (thisidx > -999999) {
445 auto &seedtrack = m_event->seedTracks_[thisidx];
446 std::vector<int> thismcHitIDs;
447 seedtrack.mcHitIDsVec(m_event->layerHits_, m_event->simHitsInfo_, thismcHitIDs);
448 if (std::adjacent_find(thismcHitIDs.begin(), thismcHitIDs.end(), std::not_equal_to<>()) ==
449 thismcHitIDs.end()) {
450 thisseedmcid = thismcHitIDs.at(0);
456 for (bidx_t qi = qb1; qi != qb2; ++qi) {
457 for (bidx_t
pi = pb1;
pi != pb2;
pi =
L.phiMaskApply(
pi + 1)) {
459 if (qi == qb &&
L.isBinDead(
pi, qi) ==
true) {
460 dprint(
"dead module for track in layer=" <<
L.layer_id() <<
" qb=" << qi <<
" pi=" <<
pi <<
" q=" <<
q 473 auto pbi =
L.phiQBinContent(
pi, qi);
474 for (bcnt_t
hi = pbi.begin();
hi < pbi.end(); ++
hi) {
477 unsigned int hi_orig =
L.getOriginalHitIndex(
hi);
481 "Yay, denying masked hit on layer %u, hi %u, orig idx %u\n",
L.layer_info()->layer_id(),
hi, hi_orig);
492 #if defined(DUMPHITWINDOW) && defined(MKFIT_STANDALONE) 494 const MCHitInfo &mchinfo = m_event->simHitsInfo_[
L.refHit(
hi).mcHitID()];
496 int st_isfindable = 0;
497 int st_label = -999999;
504 float st_eta = -999.;
505 float st_phi = -999.;
507 Track simtrack = m_event->simTracks_[mchid];
509 st_label = simtrack.
label();
511 st_pt = simtrack.
pT();
512 st_eta = simtrack.
momEta();
513 st_phi = simtrack.
momPhi();
515 st_charge = simtrack.
charge();
516 st_r = simtrack.
posR();
520 const Hit &thishit =
L.refHit(
hi);
538 float hx = thishit.
x();
539 float hy = thishit.
y();
540 float hz = thishit.
z();
541 float hr = std::hypot(hx, hy);
542 float hphi = std::atan2(hy, hx);
553 (hx * hx * thishit.
exx() + hy * hy * thishit.
eyy() + 2.0f * hx * hy *
m_msErr.
At(itrack, 0, 1)) /
560 float hchi2 = thisOutChi2[itrack];
563 float tx =
m_Par[iI].
At(itrack, 0, 0);
564 float ty =
m_Par[iI].
At(itrack, 1, 0);
565 float tz =
m_Par[iI].
At(itrack, 2, 0);
566 float tr = std::hypot(tx, ty);
567 float tphi = std::atan2(ty, tx);
568 float tchi2 =
m_Chi2(itrack, 0, 0);
581 (tx * tx *
tex *
tex + ty * ty * tey * tey + 2.0
f * tx * ty *
m_Err[iI].At(itrack, 0, 1)) /
586 (ty * ty *
tex *
tex + tx * tx * tey * tey - 2.0
f * tx * ty *
m_Err[iI].At(itrack, 0, 1)) /
587 (tr * tr * tr * tr));
590 float ht_dxy = std::hypot(hx - tx, hy - ty);
591 float ht_dz = hz - tz;
594 static bool first =
true;
599 "lyr_id/I:lyr_isbrl/I:hit_idx/I:" 600 "trk_cnt/I:trk_idx/I:trk_label/I:" 601 "trk_pt/F:trk_eta/F:trk_mphi/F:trk_chi2/F:" 603 "seed_idx/I:seed_label/I:seed_algo/I:seed_mcid/I:" 605 "st_isfindable/I:st_prodtype/I:st_label/I:" 606 "st_pt/F:st_eta/F:st_phi/F:" 607 "st_nhits/I:st_charge/I:st_r/F:st_z/F:" 608 "trk_q/F:hit_q/F:dq_trkhit/F:dq_cut/F:trk_phi/F:hit_phi/F:dphi_trkhit/F:dphi_cut/F:" 609 "t_x/F:t_y/F:t_r/F:t_phi/F:t_z/F:" 610 "t_ex/F:t_ey/F:t_er/F:t_ephi/F:t_ez/F:" 611 "h_x/F:h_y/F:h_r/F:h_phi/F:h_z/F:" 612 "h_ex/F:h_ey/F:h_er/F:h_ephi/F:h_ez/F:" 613 "ht_dxy/F:ht_dz/F:ht_dphi/F:" 622 printf(
"HITWINDOWSEL " 626 "%6.3f %6.3f %6.3f %6.3f " 633 "%6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f " 634 "%6.3f %6.3f %6.3f %6.3f %6.3f " 635 "%6.6f %6.6f %6.6f %6.6f %6.6f " 636 "%6.3f %6.3f %6.3f %6.3f %6.3f " 637 "%6.6f %6.6f %6.6f %6.6f %6.6f " 642 L.layer_id(),
L.is_barrel(),
L.getOriginalHitIndex(
hi),
644 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),
646 m_SeedIdx(itrack, 0, 0), m_SeedLabel(itrack, 0, 0), m_SeedAlgo(itrack, 0, 0), thisseedmcid,
648 st_isfindable, st_prodtype, st_label,
649 st_pt, st_eta, st_phi,
650 st_nhits, st_charge, st_r, st_z,
651 q,
L.hit_q(
hi), ddq, dq, phi,
L.hit_phi(
hi), ddphi, dphi,
652 tx, ty, tr, tphi, tz,
653 tex, tey, ter, tephi, tez,
654 hx, hy, hr, hphi, hz,
655 hex, hey, her, hephi, hez,
656 ht_dxy, ht_dz, ht_dphi,
668 dprintf(
" SHI %3u %4u %5u %6.3f %6.3f %6.4f %7.5f %s\n",
670 ddq, ddphi, (ddq < dq && ddphi < dphi) ?
"PASS" :
"FAIL");
685 assert(
false &&
"this code has not been used in a while -- see comments in code");
711 for (
int it = 0; it <
NN; ++it) {
722 for (
int hit_cnt = 0; hit_cnt <
maxSize; ++hit_cnt) {
728 for (
int itrack = 0; itrack < N_proc; ++itrack) {
754 for (
int itrack = 0; itrack < N_proc; ++itrack) {
760 bestHit[itrack] =
m_XHitArr.
At(itrack, hit_cnt, 0);
767 for (
int itrack = 0; itrack < N_proc; ++itrack) {
785 if (bestHit[itrack] >= 0) {
789 dprint(
"ADD BEST HIT FOR TRACK #" 790 << itrack << std::endl
791 <<
"prop x=" <<
m_Par[
iP].constAt(itrack, 0, 0) <<
" y=" <<
m_Par[
iP].constAt(itrack, 1, 0) << std::endl
792 <<
"copy in hit #" << bestHit[itrack] <<
" x=" <<
hit.position()[0] <<
" y=" <<
hit.position()[1]);
810 <<
" r=" << std::hypot(
m_Par[
iP](itrack, 0, 0),
m_Par[
iP](itrack, 1, 0)));
825 dprint(
"update parameters");
839 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));
850 const float hitHL =
sqrt(msErr.
constAt(itrack, 2, 2) * 3.f);
851 const float qErr =
sqrt(pErr.
constAt(itrack, 2, 2));
852 dprint(
"qCompat " << hitHL <<
" + " << 3.
f * qErr <<
" vs " <<
res);
857 const float hitT2 = msErr.
constAt(itrack, 0, 0) + msErr.
constAt(itrack, 1, 1);
858 const float hitT2inv = 1.f / hitT2;
859 const float proj[3] = {msErr.
constAt(itrack, 0, 0) * hitT2inv,
860 msErr.
constAt(itrack, 0, 1) * hitT2inv,
861 msErr.
constAt(itrack, 1, 1) * hitT2inv};
865 const float resProj =
867 dprint(
"qCompat " <<
sqrt(hitT2 * 3.
f) <<
" + " << 3.
f * qErr <<
" vs " << resProj);
878 int itrack,
bool isBarrel,
unsigned int pcm,
unsigned int pcmMin,
const MPlexLV &pPar,
const MPlexHS &msErr) {
885 const float hitT2 = msErr.
constAt(itrack, 0, 0) + msErr.
constAt(itrack, 1, 1);
886 const float hitT2inv = 1.f / hitT2;
887 const float proj[3] = {msErr.
constAt(itrack, 0, 0) * hitT2inv,
888 msErr.
constAt(itrack, 0, 1) * hitT2inv,
889 msErr.
constAt(itrack, 1, 1) * hitT2inv};
890 const bool detXY_OK =
892 const float cosP =
cos(pPar.
constAt(itrack, 4, 0));
893 const float sinP =
sin(pPar.
constAt(itrack, 4, 0));
897 2.
f * cosP * sinP *
proj[1]))
904 const float qCorr = pcm * qSF;
905 dprint(
"pcm " << pcm <<
" * " << qSF <<
" = " << qCorr <<
" vs " << pcmMin);
906 return qCorr > pcmMin;
914 std::vector<std::vector<TrackCand>> &tmp_candidates,
925 for (
int it = 0; it <
NN; ++it) {
935 int nHitsAdded[
NN]{};
936 bool isTooLargeCluster[
NN]{
false};
938 for (
int hit_cnt = 0; hit_cnt <
maxSize; ++hit_cnt) {
944 for (
int itrack = 0; itrack < N_proc; ++itrack) {
947 mhp.addInputAt(itrack,
hit);
948 charge_pcm[itrack] =
hit.chargePerCM();
976 bool oneCandPassCut =
false;
977 for (
int itrack = 0; itrack < N_proc; ++itrack) {
984 bool isCompatible =
true;
998 isTooLargeCluster[itrack] =
true;
999 isCompatible =
false;
1004 oneCandPassCut =
true;
1011 if (oneCandPassCut) {
1026 dprint(
"update parameters" << std::endl
1027 <<
"propagated track parameters x=" <<
m_Par[
iP].constAt(0, 0, 0)
1028 <<
" y=" <<
m_Par[
iP].constAt(0, 1, 0) << std::endl
1036 for (
int itrack = 0; itrack < N_proc; ++itrack) {
1042 if (
chi2 < max_c2) {
1043 bool isCompatible =
true;
1057 isCompatible =
false;
1061 bool hitExists =
false;
1076 nHitsAdded[itrack]++;
1077 dprint(
"chi2 cut passed, creating new candidate");
1081 const int hit_idx =
m_XHitArr.
At(itrack, hit_cnt, 0);
1085 newcand.
setCharge(tmpChg(itrack, 0, 0));
1094 if (
chi2 < max_c2) {
1096 ccand[
m_CandIdx(itrack, 0, 0)].considerHitForOverlap(
1104 tmp_candidates[
m_SeedIdx(itrack, 0, 0) -
offset].emplace_back(newcand);
1115 for (
int itrack = 0; itrack < N_proc; ++itrack) {
1132 else if (
m_XWsrResult[itrack].m_in_gap ==
true && nHitsAdded[itrack] == 0) {
1136 else if (isTooLargeCluster[itrack] ==
true && nHitsAdded[itrack] == 0) {
1141 <<
" r=" << std::hypot(
m_Par[
iP](itrack, 0, 0),
m_Par[
iP](itrack, 1, 0)));
1151 tmp_candidates[
m_SeedIdx(itrack, 0, 0) -
offset].emplace_back(newcand);
1172 for (
int it = 0; it <
NN; ++it) {
1180 dprintf(
"FindCandidatesCloneEngine max hits to process=%d\n",
maxSize);
1182 int nHitsAdded[
NN]{};
1183 bool isTooLargeCluster[
NN]{
false};
1185 for (
int hit_cnt = 0; hit_cnt <
maxSize; ++hit_cnt) {
1191 for (
int itrack = 0; itrack < N_proc; ++itrack) {
1194 mhp.addInputAt(itrack,
hit);
1195 charge_pcm[itrack] =
hit.chargePerCM();
1218 for (
int itrack = 0; itrack < N_proc; ++itrack) {
1230 dprint(
"chi2=" <<
chi2 <<
" for trkIdx=" << itrack <<
" hitIdx=" <<
m_XHitArr.
At(itrack, hit_cnt, 0));
1231 if (
chi2 < max_c2) {
1232 bool isCompatible =
true;
1247 isTooLargeCluster[itrack] =
true;
1248 isCompatible =
false;
1254 bool hitExists =
false;
1269 nHitsAdded[itrack]++;
1270 const int hit_idx =
m_XHitArr.
At(itrack, hit_cnt, 0);
1274 if (
chi2 < max_c2) {
1275 ccand[
m_CandIdx(itrack, 0, 0)].considerHitForOverlap(
1281 tmpList.
hitIdx = hit_idx;
1293 dprint(
" adding hit with hit_cnt=" << hit_cnt <<
" for trkIdx=" << tmpList.
trkIdx 1294 <<
" orig Seed=" <<
m_Label(itrack, 0, 0));
1303 for (
int itrack = 0; itrack < N_proc; ++itrack) {
1322 else if (
m_XWsrResult[itrack].m_in_gap ==
true && nHitsAdded[itrack] == 0) {
1326 else if (isTooLargeCluster[itrack] ==
true && nHitsAdded[itrack] == 0) {
1339 tmpList.
hitIdx = fake_hit_idx;
1351 dprint(
"adding invalid hit " << fake_hit_idx);
1391 const int iO = outputProp ?
iP :
iC;
1393 for (
int i = 0;
i < N_proc; ++
i) {
1401 dprint((outputProp ?
"propagated" :
"updated")
1402 <<
" track parameters x=" <<
cand.parameters()[0] <<
" y=" <<
cand.parameters()[1]
1403 <<
" z=" <<
cand.parameters()[2] <<
" pt=" << 1. /
cand.parameters()[3] <<
" posEta=" <<
cand.posEta());
1418 for (
int i = beg;
i < end; ++
i, ++itrack) {
1445 for (
int i = beg;
i < end; ++
i, ++itrack) {
1471 const int iO = outputProp ?
iP :
iC;
1474 for (
int i = beg;
i < end; ++
i, ++itrack) {
1492 const int iO = outputProp ?
iP :
iC;
1495 for (
int i = beg;
i < end; ++
i, ++itrack) {
1510 #if defined(DEBUG_BACKWARD_FIT) || defined(DEBUG_BACKWARD_FIT_BH) 1527 float tmp_err[6] = {666, 0, 666, 0, 0, 666};
1531 const int layer = lp_iter->m_layer;
1537 for (
int i = 0;
i < N_proc; ++
i) {
1595 for (
int n = 0;
n < N_proc; ++
n) {
1602 #ifdef DEBUG_BACKWARD_FIT_BH 1604 for (
int i = 0;
i < N_proc; ++
i) {
1613 "CHIHIT %3d %10g %10g %10g %10g %10g %11.5g %11.5g %11.5g %10g %10g %10g %10g %11.5g %11.5g %11.5g %10g " 1614 "%10g %10g %10g %10g %11.5g %11.5g\n",
1628 e2s(
m_Err[ti].At(
i, 0, 0)),
1629 e2s(
m_Err[ti].At(
i, 1, 1)),
1630 e2s(
m_Err[ti].At(
i, 2, 2)),
1655 printf(
"Parameters:\n");
1656 for (
int i = 0;
i < 6; ++
i) {
1657 printf(
" %12.4g",
m_Par[corp].constAt(mslot,
i, 0));
1659 printf(
"\nError matrix\n");
1660 for (
int i = 0;
i < 6; ++
i) {
1661 for (
int j = 0;
j < 6; ++
j) {
1662 printf(
" %12.4g",
m_Err[corp].constAt(mslot,
i,
j));
1683 float tmp_err[6] = {666, 0, 666, 0, 0, 666};
1686 #if defined(DEBUG_PROP_UPDATE) 1687 const int DSLOT = 0;
1688 printf(
"bkfit entry, track in slot %d\n", DSLOT);
1693 const int layer = lp_iter.layer();
1698 #if defined(DEBUG_BACKWARD_FIT) 1699 const Hit *last_hit_ptr[
NN];
1705 for (
int i = 0;
i < N_proc; ++
i) {
1725 #ifdef DEBUG_BACKWARD_FIT 1726 last_hit_ptr[
i] = &
hit;
1734 #ifdef DEBUG_BACKWARD_FIT 1735 last_hit_ptr[
i] =
nullptr;
1746 if (done_count == N_proc)
1748 if (here_count == 0)
1783 #if defined(DEBUG_PROP_UPDATE) 1784 printf(
"\nbkfit at layer %d, track in slot %d -- fail=%d, had hit=%d (%g, %g, %g)\n",
1788 1 - no_mat_effs[DSLOT],
1792 printf(
"Propagated:\n");
1794 printf(
"Updated:\n");
1799 for (
int i = 0;
i < N_proc; ++
i) {
1841 #if defined(DEBUG_BACKWARD_FIT) 1844 const char beg_cur_sep =
'/';
1845 for (
int i = 0;
i < N_proc; ++
i) {
1846 if (chiDebug && last_hit_ptr[
i]) {
1849 float chi = tmp_chi2.
At(
i, 0, 0);
1850 float chi_prnt = std::isfinite(chi) ? chi : -9;
1852 #if defined(MKFIT_STANDALONE) 1855 dprintf(
"BKF_OVERLAP %d %d %d %d %d %d %d " 1856 "%f%c%f %f %f%c%f %f %f %f %d %d %d %d " 1860 dprintf(
"BKF_OVERLAP %d %d %d %d %d %d " 1861 "%f%c%f %f %f%c%f %f %f %f %d %d %d " 1865 layer,
L.is_stereo(),
L.is_barrel(),
1866 bb.
pT(), beg_cur_sep, 1.0f /
m_Par[ti].
At(
i, 3, 0),
1869 std::hypot(
m_Par[ti].At(
i, 0, 0),
m_Par[ti].At(
i, 1, 0)),
1872 std::isnan(chi), std::isfinite(chi), chi > 0,
1873 #if defined(MKFIT_STANDALONE)
void(* m_compute_chi2_foo)(const MPlexLS &, const MPlexLV &, const MPlexQI &, const MPlexHS &, const MPlexHV &, MPlexQF &, MPlexLV &, MPlexQI &, const int, const PropagationFlags &, const bool)
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
void propagateTracksToHitZ(const MPlexHV &par, const int N_proc, const PropagationFlags &pf, const MPlexQI *noMatEffPtr=nullptr)
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)
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
void(* m_update_param_foo)(const MPlexLS &, const MPlexLV &, MPlexQI &, const MPlexHS &, const MPlexHV &, MPlexLS &, MPlexLV &, MPlexQI &, const int, const PropagationFlags &, const bool)
const float * errArray() const
constexpr Matriplex::idx_t NN
unsigned int bin_content_t
Cos< T >::type cos(const T &t)
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
void propagateTracksToPCAZ(const int N_proc, const PropagationFlags &pf)
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()
void setup(const PropagationConfig &pc, const IterationParams &ip, const IterationLayerConfig &ilc, const SteeringParams &sp, const std::vector< bool > *ihm, bool infwd)
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)