diff --git a/reco/L1/L1Algo/L1ClonesMerger.cxx b/reco/L1/L1Algo/L1ClonesMerger.cxx index 76299dc9ca00e8ea1298e748b5d771cc85bd8362..a64a91b3c3a4e0f947377ac34837f01048ceafd0 100644 --- a/reco/L1/L1Algo/L1ClonesMerger.cxx +++ b/reco/L1/L1Algo/L1ClonesMerger.cxx @@ -298,7 +298,7 @@ void L1ClonesMerger::InvertCholesky(fvec a[15]) uud = a[i * (i + 3) / 2] - uud; fvec smallval(1.e-12); - uud = if3(uud >= smallval, uud, smallval); + uud = iif(uud >= smallval, uud, smallval); d[i] = uud / fabs(uud); u[i][i] = sqrt(fabs(uud)); diff --git a/reco/L1/L1Algo/L1Extrapolation.cxx b/reco/L1/L1Algo/L1Extrapolation.cxx index c6008523fb778f9932e3323117be967dad71054b..4ca1c944d55b606760545bfb194941ed3ed0c701 100644 --- a/reco/L1/L1Algo/L1Extrapolation.cxx +++ b/reco/L1/L1Algo/L1Extrapolation.cxx @@ -332,7 +332,7 @@ void L1ExtrapolateRungeKutta // extrapolates track parameters and returns jacob //---------------------------------------------------------------- - if (w) { z_out = if3(fvec::Zero() < *w, z_out, T.z); } + if (w) { z_out = iif(fvec::Zero() < *w, z_out, T.z); } fvec qp_in = T.qp; const fvec z_in = T.z; diff --git a/reco/L1/L1Algo/L1FitMaterial.cxx b/reco/L1/L1Algo/L1FitMaterial.cxx index 09eeefaa48e7da6e56411282cd237abaec232943..5299792d3f7d7bbec54cb3d1380ba1f86b8b5316 100644 --- a/reco/L1/L1Algo/L1FitMaterial.cxx +++ b/reco/L1/L1Algo/L1FitMaterial.cxx @@ -152,7 +152,7 @@ fvec L1Fit::ApproximateBetheBloch(const fvec& bg2) d2 = masked(lhwI + x - 0.5f, init); const fvec r = (x1 - x) / (x1 - x0); init = (x > x0) & (x1 > x); - d2 = if3(init, lhwI + x - 0.5f + (0.5f - lhwI - x0) * r * r * r, d2); + d2 = iif(init, lhwI + x - 0.5f + (0.5f - lhwI - x0) * r * r * r, d2); return mK * mZA * (fvec(1.f) + bg2) / bg2 * (0.5f * log(_2me * bg2 * maxT / (mI * mI)) - bg2 / (fvec(1.f) + bg2) - d2); @@ -199,7 +199,7 @@ fvec L1Fit::ApproximateBetheBloch(const fvec& bg2, const fvec& kp0, const fvec& d2 = masked(lhwI + x - 0.5f, init); const fvec r = (x1 - x) / (x1 - x0); init = (x > x0) & (x1 > x); - d2 = if3(init, lhwI + x - 0.5f + (0.5f - lhwI - x0) * r * r * r, d2); + d2 = iif(init, lhwI + x - 0.5f + (0.5f - lhwI - x0) * r * r * r, d2); return mK * mZA * (fvec(1.f) + bg2) / bg2 * (0.5f * log(_2me * bg2 * maxT / (mI * mI)) - bg2 / (fvec(1.f) + bg2) - d2); @@ -229,7 +229,7 @@ void L1Fit::EnergyLossCorrection(L1TrackPar& T, const fvec& radThick, fvec& qp0, const fvec E2Corrected = (sqrt(E2) + direction * dE) * (sqrt(E2) + direction * dE); fvec corr = sqrt(p2 / (E2Corrected - fMass2)); fmask ok = (corr == corr) & (fvec::Zero() < w); - corr = if3(ok, corr, fvec::One()); + corr = iif(ok, corr, fvec::One()); qp0 *= corr; // fvec dqp = CalcQpAfterEloss(qp[0], (direction*dE)[0], fMass2[0]); @@ -271,7 +271,7 @@ void L1Fit::EnergyLossCorrection(float atomicA, float rho, float radLen, L1Track const fvec E2Corrected = (sqrt(E2) + direction * dE) * (sqrt(E2) + direction * dE); fvec corr = sqrt(p2 / (E2Corrected - fMass2)); fmask ok = (corr == corr) & (fvec::Zero() < w); - corr = if3(ok, corr, fvec::One()); + corr = iif(ok, corr, fvec::One()); qp0 *= corr; // fvec dqp = CalcQpAfterEloss(qp[0], (direction*dE)[0], fMass2[0]); diff --git a/reco/L1/L1Algo/L1TrackFitter.cxx b/reco/L1/L1Algo/L1TrackFitter.cxx index 4bb81544777656e05e50d741074c4eda5c887d40..3711195bdb886ec71c150b16fe87d99737e6c7bf 100644 --- a/reco/L1/L1Algo/L1TrackFitter.cxx +++ b/reco/L1/L1Algo/L1TrackFitter.cxx @@ -1081,7 +1081,7 @@ void L1Algo::L1KFTrackFitterMuch() fvec nofSteps1 = fvec::Zero(); - fvec stepSize = if3(nofSteps < fvec::One(), d_z, st) * w1; + fvec stepSize = iif(nofSteps < fvec::One(), d_z, st) * w1; fvec z_cur = T1.fz; fvec w2 = w1; @@ -1089,7 +1089,7 @@ void L1Algo::L1KFTrackFitterMuch() for (int iStep = 0; iStep < max_steps + 1; iStep++) { const fmask maskLastStep = (nofSteps == nofSteps1); - z_cur = if3(maskLastStep, z_last, T1.fz + stepSize); + z_cur = iif(maskLastStep, z_last, T1.fz + stepSize); // fvec v_mc = fabs(1/qp01)/sqrt(mass2+fabs(1/qp01)*fabs(1/qp01)); // T1.ExtrapolateLine1( z, &w2, v_mc); @@ -1222,14 +1222,14 @@ void L1Algo::L1KFTrackFitterMuch() } fvec nofSteps1 = fvec(0); - fvec stepSize = wIn * if3((nofSteps < fvec::One()), d_z, st); + fvec stepSize = wIn * iif((nofSteps < fvec::One()), d_z, st); fvec z_cur = T1.fz; fvec w2 = wIn; for (int iStep = 0; iStep < max_steps + 1; iStep++) { const fmask maskLastStep = (nofSteps == nofSteps1); - z_cur = if3(maskLastStep, z_last, T1.fz - stepSize); + z_cur = iif(maskLastStep, z_last, T1.fz - stepSize); // fvec v_mc = fabs(1/qp01)/sqrt(mass2+fabs(1/qp01)*fabs(1/qp01)); // T1.ExtrapolateLine1( z_cur, &w2, v_mc); diff --git a/reco/L1/L1Algo/L1TrackParFit.cxx b/reco/L1/L1Algo/L1TrackParFit.cxx index 0c80a507619634cfd7d89a0121e4901c869b7362..04080dff478eed16a238c55019962c2b0ff2f13f 100644 --- a/reco/L1/L1Algo/L1TrackParFit.cxx +++ b/reco/L1/L1Algo/L1TrackParFit.cxx @@ -349,7 +349,7 @@ void L1TrackParFit::Extrapolate // extrapolates track parameters and returns ja //---------------------------------------------------------------- - if (w) { z_out = if3((fvec(0.f) < *w), z_out, fz); } + if (w) { z_out = iif((fvec(0.f) < *w), z_out, fz); } fvec qp_in = fqp; const fvec z_in = fz; @@ -807,7 +807,7 @@ void L1TrackParFit::EnergyLossCorrection(const fvec& radThick, fvec& qp0, fvec d const fvec E2Corrected = (sqrt(E2) + direction * dE) * (sqrt(E2) + direction * dE); fvec corr = sqrt(p2 / (E2Corrected - fMass2)); fmask ok = (corr == corr) & (fvec::Zero() < w); - corr = if3(ok, corr, fvec::One()); + corr = iif(ok, corr, fvec::One()); qp0 *= corr; fqp *= corr; @@ -840,7 +840,7 @@ void L1TrackParFit::EnergyLossCorrection(float atomicA, float rho, float radLen, const fvec E2Corrected = (sqrt(E2) + direction * dE) * (sqrt(E2) + direction * dE); fvec corr = sqrt(p2 / (E2Corrected - fMass2)); fmask ok = (corr == corr) & (fvec::Zero() < w); - corr = if3(ok, corr, fvec::One()); + corr = iif(ok, corr, fvec::One()); qp0 *= corr; fqp *= corr; diff --git a/reco/L1/OffLineInterface/CbmL1RichENNRingFinderParallel.cxx b/reco/L1/OffLineInterface/CbmL1RichENNRingFinderParallel.cxx index a6909fb11f90939c27317fc49f19ee8dbfc4ca7c..b531965401a974ca26a37b860ed32b1600d983ff 100644 --- a/reco/L1/OffLineInterface/CbmL1RichENNRingFinderParallel.cxx +++ b/reco/L1/OffLineInterface/CbmL1RichENNRingFinderParallel.cxx @@ -374,30 +374,30 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, nsL1vector<E GetTimer("Ring finding: Init of param").Start(0); #endif for (int isa = 0; isa < MaxSearchAreaSize; isa++) { // TODO don't work w\o this because of nan in wights - ENNSearchHitV& sHit = SearchArea[isa]; + ENNSearchHitV& sHit = SearchArea[isa]; const fmask validHit = (fvec(isa) < SearchAreaSize) & validRing; - sHit.lx = if3(validHit, sHit.lx, 0); - sHit.ly = if3(validHit, sHit.ly, 0); - sHit.lr2 = if3(validHit, sHit.lr2, 0); + sHit.lx = iif(validHit, sHit.lx, fvec::Zero()); + sHit.ly = iif(validHit, sHit.ly, fvec::Zero()); + sHit.lr2 = iif(validHit, sHit.lr2, fvec::Zero()); } // initialize hits in the search area fvec Dmax = 0.; S0 = S1 = S2 = S3 = S4 = 0.; for (int ih = 0; ih < MaxSearchAreaSize; ih++) { - ENNSearchHitV& sHit = SearchArea[ih]; + ENNSearchHitV& sHit = SearchArea[ih]; const fmask validHit = (fvec(ih) < SearchAreaSize) & validRing; fvec& lr2 = sHit.lr2; fvec lr = sqrt(lr2); - Dmax = if3((lr > Dmax) & validHit, lr, Dmax); + Dmax = iif((lr > Dmax) & validHit, lr, Dmax); sHit.S2 = sHit.lx * sHit.ly; sHit.S3 = sHit.lx * lr2; sHit.S4 = sHit.ly * lr2; sHit.C = -lr * .5; - const fvec w = if3(validHit, if3(lr > fvec(1.E-4), 1. / lr, 1), 0); + const fvec w = iif(validHit, iif(lr > fvec(1.E-4), 1. / lr, fvec::One()), fvec::Zero()); const fvec w2 = w * w; sHit.Cx = w * sHit.lx; sHit.Cy = w * sHit.ly; @@ -443,11 +443,11 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, nsL1vector<E const fvec d = fabs(sqrt(dx * dx + dy * dy) - R); const fvec dSq = d * d; sHit.on_ring = (d <= HitSize) & validHit; - const fvec dp = if3(sHit.on_ring, -1, fabs(sHit.C + sHit.Cx * X + sHit.Cy * Y)); - Dmax = if3(((dp <= Dcut) & (dp > Dmax)), dp, Dmax); + const fvec dp = iif(sHit.on_ring, fvec(-1.), fabs(sHit.C + sHit.Cx * X + sHit.Cy * Y)); + Dmax = iif(((dp <= Dcut) & (dp > Dmax)), dp, Dmax); - fvec w = if3((sHit.on_ring), 1. / (HitSizeSq_v + fabs(dSq)), 1. / (1.e-5 + fabs(dSq))); - w = if3((dp <= Dcut) & validHit, w, 0); + fvec w = iif((sHit.on_ring), 1. / (HitSizeSq_v + fabs(dSq)), 1. / (1.e-5 + fabs(dSq))); + w = iif((dp <= Dcut) & validHit, w, fvec::Zero()); S0 += w * sHit.S0; S1 += w * sHit.S1; S2 += w * sHit.S2; @@ -531,11 +531,11 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, nsL1vector<E const fvec d = fabs( sqrt(dx*dx+dy*dy) - ringV.r ); validHit = validHit & ( d <= HitSize ); ringV.chi2 += d*d; - ringV.localIHits.push_back( if3( validHit, sHit.localIndex, -1 ) ); + ringV.localIHits.push_back( iif( validHit, sHit.localIndex, fvec(-1.) ) ); ringV.NHits += mask2int(validHit); validHit = validHit & ( d <= ShadowSize ); // TODO check *4 if ( Empty (validHit) ) continue; // CHECKME - Shadow.push_back( if3( validHit, sHit.localIndex, -1 ) ); + Shadow.push_back( iif( validHit, sHit.localIndex, fvec(-1.) ) ); } for( int ipu = 0; ipu < MaxPickUpAreaSize; ipu++ ) { fvec validHit = ipu < PickUpAreaSize; @@ -547,11 +547,11 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, nsL1vector<E validHit = validHit & ( d <= HitSize ); if ( Empty (validHit) ) continue; ringV.chi2 += d*d; - ringV.localIHits.push_back( if3( validHit, puHit.localIndex, -1 ) ); + ringV.localIHits.push_back( iif( validHit, puHit.localIndex, fvec(-1.) ) ); ringV.NHits += mask2int(validHit); validHit = validHit & ( d <= ShadowSize ); // TODO check *4 if ( Empty (validHit) ) continue; // CHECKME - Shadow.push_back( if3( validHit, puHit.localIndex, -1 ) ); + Shadow.push_back( iif( validHit, puHit.localIndex, fvec(-1.) ) ); } ringV.chi2 = ringV.chi2 / (( ringV.NHits - 3)*HitSizeSq); @@ -577,7 +577,7 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, nsL1vector<E ENNHitV & hitV = HitsV[ih/fvecLen]; // hitV.quality[ih_4] = ( hitV.quality[ih_4] < quality[i_4] ) ? quality[i_4] : hitV.quality[ih_4]; - // shHit->quality = if3( shHit->quality < quality, quality, shHit->quality ); + // shHit->quality = iif( shHit->quality < quality, quality, shHit->quality ); } } // i_4 } @@ -645,7 +645,7 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, nsL1vector<E ENNHitV& hitV = HitsV[ih / fvecLen]; hitV.quality[ih_4] = (hitV.quality[ih_4] < quality) ? quality : hitV.quality[ih_4]; - // shHit->quality = if3( shHit->quality < quality, quality, shHit->quality ); + // shHit->quality = iif( shHit->quality < quality, quality, shHit->quality ); } } // i_4 diff --git a/reco/L1/vectors/L1vecPseudo.h b/reco/L1/vectors/L1vecPseudo.h index f9d21411f99dbffce9163bda29e394d0a7069328..2d30cea3f020a085a421430ebf7cdcf6d59af54e 100644 --- a/reco/L1/vectors/L1vecPseudo.h +++ b/reco/L1/vectors/L1vecPseudo.h @@ -172,7 +172,7 @@ public: friend fmask operator>=(const fvec& a, const fvec& b) { _opComp(a, b, >=) } friend fmask operator==(const fvec& a, const fvec& b) { _opComp(a, b, ==) } - friend fvec if3(fmask a, fvec b, fvec c) + friend fvec iif(fmask a, fvec b, fvec c) { fvec z; for (int i = 0; i < Size; i++) { @@ -252,11 +252,11 @@ inline fmask MaskZero() { return fmask::One(); } inline fvec fabs(const fvec& a) { return abs(a); } -inline fvec masked(const fvec& a, const fmask& mask) { return if3(mask, a, fvec::Zero()); } +inline fvec masked(const fvec& a, const fmask& mask) { return iif(mask, a, fvec::Zero()); } inline fvec mask2int(const fmask& mask) { // mask returned - return if3(mask, fvec::One(), fvec::Zero()); + return iif(mask, fvec::One(), fvec::Zero()); } /// Checks, if all bands are equal diff --git a/reco/L1/vectors/L1vecVc.h b/reco/L1/vectors/L1vecVc.h index cf27cb1c3699d5add1e56ee971dc556a067be4de..910d0bb7148c641048e9ffcf5bf2d0668ab8c4e7 100644 --- a/reco/L1/vectors/L1vecVc.h +++ b/reco/L1/vectors/L1vecVc.h @@ -26,24 +26,16 @@ inline fvec operator+(const fvec& a, fscal b) { return a + fvec(b); } inline fvec operator-(fscal a, const fvec& b) { return fvec(a) - b; } inline fvec operator-(const fvec& a, fscal b) { return a - fvec(b); } -inline fvec if3(const fmask& a, const fvec& b, const fvec& c) -{ - // return (a ?b :c); - fvec ret = c; - ret(a) = b; - return ret; -} - inline fmask MaskOne() { return fmask::One(); } inline fmask MaskZero() { return fmask::One(); } inline fvec fabs(const fvec& a) { return abs(a); } -inline fvec masked(const fvec& a, const fmask& mask) { return if3(mask, a, fvec::Zero()); } +inline fvec masked(const fvec& a, const fmask& mask) { return iif(mask, a, fvec::Zero()); } inline fvec mask2int(const fmask& mask) { // mask returned - return if3(mask, fvec::One(), fvec::Zero()); + return iif(mask, fvec::One(), fvec::Zero()); } /// Checks, if all bands are equal