diff --git a/reco/L1/L1Algo/L1Extrapolation.cxx b/reco/L1/L1Algo/L1Extrapolation.cxx index e22ef374bcc0f49577f16c0772e4ca94dc9ea4c2..cb2bb78fdf04e4b6071fd2d2640300e07816e816 100644 --- a/reco/L1/L1Algo/L1Extrapolation.cxx +++ b/reco/L1/L1Algo/L1Extrapolation.cxx @@ -687,7 +687,7 @@ void L1ExtrapolateTime(L1TrackPar& T, // input track parameters (x,y,tx,ty,Q/p) fvec timeInfo) { cnst c_light = 29.9792458; - dz.setZero(timeInfo < 0); //TODO: SG: bug: must be <=0 + dz.setZero(timeInfo <= fvec::Zero()); T.t += dz * sqrt((T.tx * T.tx) + (T.ty * T.ty) + 1) / c_light; diff --git a/reco/L1/L1Algo/L1Filtration.h b/reco/L1/L1Algo/L1Filtration.h index e6b336bfb8851a9ddc69b0e0d29f70d29ab04f72..1e28b13418e7f4ad5a8e898b3b7badc60e3102fd 100644 --- a/reco/L1/L1Algo/L1Filtration.h +++ b/reco/L1/L1Algo/L1Filtration.h @@ -28,7 +28,7 @@ inline void FilterTime(L1TrackPar& T, fvec t, fvec dt, fvec timeInfo = fvec::One fvec HCH = T.C55; - w = masked(w, timeInfo > fvec::Zero()); + w.setZero(timeInfo <= fvec::Zero()); fvec dt2 = dt * dt; @@ -42,7 +42,7 @@ inline void FilterTime(L1TrackPar& T, fvec t, fvec dt, fvec timeInfo = fvec::One fvec wi = w / (dt2 + 1.0000001f * HCH); fvec zeta = T.t - t; - fvec zetawi = w * zeta / (masked(dt2, maskDoFilter) + HCH); + fvec zetawi = w * zeta / (iif(maskDoFilter, dt2, fvec::Zero()) + HCH); //T.chi2 += maskDoFilter & (zeta * zetawi); T.chi2 += zeta * zeta * wi; @@ -113,9 +113,9 @@ inline void L1Filter(L1TrackPar& T, const L1UMeasurementInfo& info, fvec u, fvec // with respect to HCH that it disappears due to the roundoff error // fvec wi = w / (info.sigma2 + 1.0000001f * HCH); - fvec zetawi = w * zeta / (masked(info.sigma2, maskDoFilter) + HCH); + fvec zetawi = w * zeta / (iif(maskDoFilter, info.sigma2, fvec::Zero()) + HCH); - // T.chi2 += masked( zeta * zetawi, maskDoFilter); + // T.chi2 += iif( maskDoFilter, zeta * zetawi, fvec::Zero() ); T.chi2 += zeta * zeta * wi; T.NDF += w; @@ -182,7 +182,7 @@ inline void L1FilterNoField(L1TrackPar& T, const L1UMeasurementInfo& info, fvec //fvec wi = w / (info.sigma2 + 1.0000001f * HCH); fvec wi = w / (info.sigma2 + HCH); - fvec zetawi = w * zeta / (masked(info.sigma2, maskDoFilter) + HCH); + fvec zetawi = w * zeta / (iif(maskDoFilter, info.sigma2, fvec::Zero()) + HCH); T.chi2 += zeta * zeta * wi; T.NDF += w; diff --git a/reco/L1/L1Algo/L1FitMaterial.cxx b/reco/L1/L1Algo/L1FitMaterial.cxx index 5299792d3f7d7bbec54cb3d1380ba1f86b8b5316..91445450bbe39c6d9be4cc236c879388dda38694 100644 --- a/reco/L1/L1Algo/L1FitMaterial.cxx +++ b/reco/L1/L1Algo/L1FitMaterial.cxx @@ -149,7 +149,7 @@ fvec L1Fit::ApproximateBetheBloch(const fvec& bg2) const fvec lhwI = log(28.816f * 1e-9f * sqrt(rho * mZA) / mI); fmask init = x > x1; - d2 = masked(lhwI + x - 0.5f, init); + d2 = iif(init, lhwI + x - 0.5f, fvec::Zero()); const fvec r = (x1 - x) / (x1 - x0); init = (x > x0) & (x1 > x); d2 = iif(init, lhwI + x - 0.5f + (0.5f - lhwI - x0) * r * r * r, d2); @@ -196,7 +196,7 @@ fvec L1Fit::ApproximateBetheBloch(const fvec& bg2, const fvec& kp0, const fvec& const fvec lhwI = log(28.816f * 1e-9f * sqrt(rho * mZA) / mI); fmask init = x > x1; - d2 = masked(lhwI + x - 0.5f, init); + d2 = iif(init, lhwI + x - 0.5f, fvec::Zero()); const fvec r = (x1 - x) / (x1 - x0); init = (x > x0) & (x1 > x); d2 = iif(init, lhwI + x - 0.5f + (0.5f - lhwI - x0) * r * r * r, d2); diff --git a/reco/L1/L1Algo/L1TrackParFit.cxx b/reco/L1/L1Algo/L1TrackParFit.cxx index 04080dff478eed16a238c55019962c2b0ff2f13f..60e163ea4e15398a8be92d4b6bf8e3f91ef77e96 100644 --- a/reco/L1/L1Algo/L1TrackParFit.cxx +++ b/reco/L1/L1Algo/L1TrackParFit.cxx @@ -167,9 +167,9 @@ void L1TrackParFit::Filter(fvec t0, fvec dt0, fvec w, fvec timeInfo) #if 1 // use mask const fmask mask = (timeInfo > 0.f); - wi = masked(w / (dt0 * dt0 + HCH), mask); + wi = iif(mask, w / (dt0 * dt0 + HCH), fvec::Zero()); zetawi = zeta * wi; - chi2 += masked(zeta * zetawi, mask); + chi2 += iif(mask, zeta * zetawi, fvec::Zero()); #else wi = w / (dt0 * dt0 + HCH); zetawi = zeta * wi; @@ -220,7 +220,7 @@ void L1TrackParFit::ExtrapolateLine(fvec z_out, fvec* w) cnst c_light = 29.9792458; fvec dz = (z_out - fz); - if (w) { dz = masked(dz, (fvec(0.f) < *w)); } + if (w) { dz.setZero(*w <= fvec::Zero()); } fx += dz * ftx; fy += dz * fty; @@ -266,7 +266,7 @@ void L1TrackParFit::ExtrapolateLine1(fvec z_out, fvec* w, fvec v) cnst c_light = 29.9792458; fvec dz = (z_out - fz); - if (w) { dz = masked(dz, (fvec(0.f) < *w)); } + if (w) { dz.setZero(*w <= fvec::Zero()); } fx += dz * ftx; fy += dz * fty; diff --git a/reco/L1/ParticleFinder/CbmL1PFFitter.cxx b/reco/L1/ParticleFinder/CbmL1PFFitter.cxx index 5865d7fd5860cbf2fddcc554679d965a4df3b577..270268c0964436cf1e8c3f82c840b0082b8d9d16 100644 --- a/reco/L1/ParticleFinder/CbmL1PFFitter.cxx +++ b/reco/L1/ParticleFinder/CbmL1PFFitter.cxx @@ -253,8 +253,8 @@ void CbmL1PFFitter::Fit(vector<CbmStsTrack>& Tracks, vector<int>& pidHypo) fld.Set(b0, z0, b1, z1, b2, z2); fmask initialised = (z[i] <= z_end) & (z_start < z[i]); - fvec w1 = masked(w[i], initialised); - fvec wIn = mask2int(initialised); + fvec w1 = iif(initialised, w[i], fvec::Zero()); + fvec wIn = iif(initialised, fvec::One(), fvec::Zero()); L1Extrapolate(T, z[i], qp0, fld, &w1); if (i == NMvdStations) { // TODO: How a hit can be also a station? (S.Zharko) @@ -330,8 +330,8 @@ void CbmL1PFFitter::Fit(vector<CbmStsTrack>& Tracks, vector<int>& pidHypo) fld.Set(b0, z0, b1, z1, b2, z2); fmask initialised = (z[i] < z_end) & (z_start <= z[i]); - fvec w1 = masked(w[i], initialised); - fvec wIn = mask2int(initialised); + fvec w1 = iif(initialised, w[i], fvec::Zero()); + fvec wIn = iif(initialised, fvec::One(), fvec::Zero()); L1Extrapolate(T, z[i], qp0, fld, &w1); if (i == NMvdStations - 1) { @@ -526,7 +526,7 @@ void CbmL1PFFitter::GetChiToVertex(vector<CbmStsTrack>& Tracks, vector<L1FieldRe c[2] += fvec(Cv[2]); fvec d = c[0] * c[2] - c[1] * c[1]; fvec chi = sqrt(fabs(0.5 * (dx * dx * c[0] - 2 * dx * dy * c[1] + dy * dy * c[2]) / d)); - chi = masked(chi, fabs(d) >= fvec(1.e-20)); + chi.setZero(fabs(d) < fvec(1.e-20)); for (int iVec = 0; iVec < nTracks_SIMD; iVec++) { chiToVtx.push_back(chi[iVec]); diff --git a/reco/L1/vectors/L1vecPseudo.h b/reco/L1/vectors/L1vecPseudo.h index f107f5b5e41d85f4a543bfc4f6e3b0d290f8179f..4ae66719092336612a4abaa573f3118d56f3a123 100644 --- a/reco/L1/vectors/L1vecPseudo.h +++ b/reco/L1/vectors/L1vecPseudo.h @@ -268,8 +268,6 @@ public: inline fvec fabs(const fvec& a) { return abs(a); } -inline fvec masked(const fvec& a, const fmask& mask) { return iif(mask, a, fvec::Zero()); } - inline fvec mask2int(const fmask& mask) { // mask returned return iif(mask, fvec::One(), fvec::Zero()); diff --git a/reco/L1/vectors/L1vecVc.h b/reco/L1/vectors/L1vecVc.h index f20939f5deb03137c17e76df8f04d5b6a09344c0..48e074ecfc7642f60f43c5204c29990596b8f656 100644 --- a/reco/L1/vectors/L1vecVc.h +++ b/reco/L1/vectors/L1vecVc.h @@ -29,8 +29,6 @@ inline fvec operator-(const fvec& a, fscal b) { return a - fvec(b); } inline fvec fabs(const fvec& a) { return abs(a); } -inline fvec masked(const fvec& a, const fmask& mask) { return iif(mask, a, fvec::Zero()); } - inline fvec mask2int(const fmask& mask) { // mask returned return iif(mask, fvec::One(), fvec::Zero());