From 1374b69a1190cd71fb1918b3c1ce5e2aa1f40c18 Mon Sep 17 00:00:00 2001 From: "se.gorbunov" <se.gorbunov@gsi.de> Date: Tue, 15 Nov 2022 12:44:33 +0000 Subject: [PATCH] L1: unify extrapolation and filtration for different setups --- reco/L1/L1Algo/L1CATrackFinder.cxx | 68 +++--------------------------- reco/L1/L1Algo/L1Filtration.h | 68 ------------------------------ reco/L1/L1Algo/L1TrackPar.h | 7 +++ 3 files changed, 14 insertions(+), 129 deletions(-) diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx index e77be40a97..08afa4422b 100644 --- a/reco/L1/L1Algo/L1CATrackFinder.cxx +++ b/reco/L1/L1Algo/L1CATrackFinder.cxx @@ -292,7 +292,7 @@ inline void L1Algo::findSingletsStep1( /// input 1st stage of singlet search //assert(T.IsConsistent(true, -1)); // add the target - if (istal < fNfieldStations) { + { fvec eX, eY, J04, J14; fvec dz; dz = fTargZ - zl; @@ -306,29 +306,6 @@ inline void L1Algo::findSingletsStep1( /// input 1st stage of singlet search J[5] = J14; L1FilterVtx(T, fTargX, fTargY, TargetXYInfo, eX, eY, J); } - else { //TODO: SG: take the field into account properly - fvec eX, eY, J04, J14; - fvec dz; - dz = fTargZ - zl; - eX = T.tx * dz; - eY = T.ty * dz; - J04 = 0.f; - J14 = 0.f; - L1ExtrapolateJXY0(T.tx, T.ty, dz, fld0, eX, eY, J04, J14); - fvec J[6]; - J[0] = dz; - J[1] = 0; - J[2] = J04; - J[3] = 0; - J[4] = dz; - J[5] = J14; - L1FilterVtx(T, fTargX, fTargY, TargetXYInfo, eX, eY, J); - // old code - //L1ExtrapolateLine(T, fTargZ); - //assert(T.IsConsistent(true, -1)); - //L1FilterXY(T, fTargX, fTargY, TargetXYInfo); - //assert(T.IsConsistent(true, -1)); - } } //assert(T.IsConsistent(true, -1)); @@ -345,18 +322,11 @@ inline void L1Algo::findSingletsStep1( /// input 1st stage of singlet search //fit.L1AddPipeMaterial(T, fMaxInvMom, fvec::One()); //} - //assert(T.IsConsistent(true, -1)); - fvec dz = stam.fZ - zl; L1ExtrapolateTime(T, dz, stam.timeInfo); // extrapolate to the middle hit - if (istam < fNfieldStations) { L1Extrapolate0(T, stam.fZ, fld0); } - else { - L1ExtrapolateLine(T, stam.fZ); // TODO: fld1 doesn't work! - } - - // assert(T.IsConsistent(true, -1)); + L1Extrapolate0(T, stam.fZ, fld0); } // i1_V } @@ -613,19 +583,8 @@ inline void L1Algo::findTripletsStep0( // input // L1TrackPar tStore1 = T2; - // TODO: SG: L1FilterNoField is wrong. - // TODO: If the field was present before, - // TODO: the momentum is correlated with the position and corresponding - // TODO: matrix elements must be up[dated - - if (istam < fNfieldStations) { - L1Filter(T2, stam.frontInfo, u_front_2, du2_2, fvec::One()); - L1Filter(T2, stam.backInfo, u_back_2, dv2_2, fvec::One()); - } - else { - L1FilterNoField(T2, stam.frontInfo, u_front_2, du2_2, fvec::One()); - L1FilterNoField(T2, stam.backInfo, u_back_2, dv2_2, fvec::One()); - } + L1Filter(T2, stam.frontInfo, u_front_2, du2_2, fvec::One()); + L1Filter(T2, stam.backInfo, u_back_2, dv2_2, fvec::One()); FilterTime(T2, t_2, dt2_2, stam.timeInfo); @@ -647,12 +606,7 @@ inline void L1Algo::findTripletsStep0( // input // extrapolate to the right hit station - if (istar <= fNfieldStations) { - L1Extrapolate(T2, star.fZ, T2.qp, f2); // Full extrapolation in the magnetic field - } - else { - L1ExtrapolateLine(T2, star.fZ); // Extrapolation with line () - } + L1Extrapolate(T2, star.fZ, T2.qp, f2); // assert(T2.IsConsistent(true, n2_4)); @@ -836,16 +790,8 @@ inline void L1Algo::findTripletsStep1( // input L1ExtrapolateLine(T3, z_Pos[i3_V]); - bool noField = (&star - fParameters.GetStations().begin() >= fNfieldStations); - - if (noField) { - L1FilterNoField(T3, star.frontInfo, u_front_[i3_V], du2_3[i3_V], fvec::One()); - L1FilterNoField(T3, star.backInfo, u_back_[i3_V], dv2_3[i3_V], fvec::One()); - } - else { - L1Filter(T3, star.frontInfo, u_front_[i3_V], du2_3[i3_V], fvec::One()); - L1Filter(T3, star.backInfo, u_back_[i3_V], dv2_3[i3_V], fvec::One()); - } + L1Filter(T3, star.frontInfo, u_front_[i3_V], du2_3[i3_V], fvec::One()); + L1Filter(T3, star.backInfo, u_back_[i3_V], dv2_3[i3_V], fvec::One()); if (kMcbm != fTrackingMode) { FilterTime(T3, t_3[i3_V], dt2_3[i3_V], star.timeInfo); } } diff --git a/reco/L1/L1Algo/L1Filtration.h b/reco/L1/L1Algo/L1Filtration.h index cf74fcbff6..f22e7c9e4e 100644 --- a/reco/L1/L1Algo/L1Filtration.h +++ b/reco/L1/L1Algo/L1Filtration.h @@ -154,74 +154,6 @@ inline void L1Filter(L1TrackPar& T, const L1UMeasurementInfo& info, fvec u, fvec } -inline void L1FilterNoField(L1TrackPar& T, const L1UMeasurementInfo& info, fvec u, fvec du2, fvec w) -{ - fvec zeta, HCH; - fvec F0, F1, F2, F3, F4, F5; - fvec K1, K2, K3, K4, K5; - - zeta = info.cos_phi * T.x + info.sin_phi * T.y - u; - - // F = CH' - F0 = info.cos_phi * T.C00 + info.sin_phi * T.C10; - F1 = info.cos_phi * T.C10 + info.sin_phi * T.C11; - - HCH = (F0 * info.cos_phi + F1 * info.sin_phi); - - F2 = info.cos_phi * T.C20 + info.sin_phi * T.C21; - F3 = info.cos_phi * T.C30 + info.sin_phi * T.C31; - F4 = info.cos_phi * T.C40 + info.sin_phi * T.C41; - F5 = info.cos_phi * T.C50 + info.sin_phi * T.C51; - - //const fmask maskDoFilter = (HCH < du2 * 16.f); - const fmask maskDoFilter(fmask::One()); - - //TODO: SG: try this - //fvec wi = w / (du2 + 1.0000001f * HCH); - - fvec wi = w / (du2 + HCH); - fvec zetawi = w * zeta / (iif(maskDoFilter, du2, fvec::Zero()) + HCH); - - T.chi2 += zeta * zeta * wi; - T.NDF += w; - - K1 = F1 * wi; - K2 = F2 * wi; - K3 = F3 * wi; - K4 = F4 * wi; - K5 = F5 * wi; - - T.x -= F0 * zetawi; - T.y -= F1 * zetawi; - T.tx -= F2 * zetawi; - T.ty -= F3 * zetawi; - // T.qp -= F4*zetawi; - T.t -= F5 * zetawi; - - T.C00 -= F0 * F0 * wi; - T.C10 -= K1 * F0; - T.C11 -= K1 * F1; - - T.C20 -= K2 * F0; - T.C21 -= K2 * F1; - T.C22 -= K2 * F2; - T.C30 -= K3 * F0; - T.C31 -= K3 * F1; - T.C32 -= K3 * F2; - T.C33 -= K3 * F3; - // T.C40-= K4*F0; - // T.C41-= K4*F1; - // T.C42-= K4*F2; - // T.C43-= K4*F3; - // T.C44-= K4*F4; - T.C50 -= K5 * F0; - T.C51 -= K5 * F1; - T.C52 -= K5 * F2; - T.C53 -= K5 * F3; - T.C54 -= K5 * F4; - T.C55 -= K5 * F5; -} - inline void L1FilterChi2(const L1UMeasurementInfo& info, const fvec& x, const fvec& y, const fvec& C00, const fvec& C10, const fvec& C11, fvec& chi2, const fvec& u, const fvec& du2) { diff --git a/reco/L1/L1Algo/L1TrackPar.h b/reco/L1/L1Algo/L1TrackPar.h index 7afaa11752..4f129149e1 100644 --- a/reco/L1/L1Algo/L1TrackPar.h +++ b/reco/L1/L1Algo/L1TrackPar.h @@ -89,6 +89,13 @@ public: return c[ind]; } + fvec& C(int i, int j) + { + fvec* c = &C00; + int ind = (j <= i) ? i * (1 + i) / 2 + j : j * (1 + j) / 2 + i; + return c[ind]; + } + void Print(int i = -1) const; void PrintCorrelations(int i = -1) const; -- GitLab