From b9870024b9ffa211faead0cc88c34c1c1a186923 Mon Sep 17 00:00:00 2001
From: "se.gorbunov" <se.gorbunov@gsi.de>
Date: Mon, 5 Sep 2022 23:16:11 +0000
Subject: [PATCH] L1: SIMD vectors: remove mask2int()

---
 .../OffLineInterface/CbmL1RichENNRingFinderParallel.cxx   | 6 +++---
 reco/L1/ParticleFinder/CbmL1PFFitter.cxx                  | 2 +-
 reco/L1/vectors/L1vecPseudo.h                             | 5 -----
 reco/L1/vectors/L1vecVc.h                                 | 8 ++++----
 4 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/reco/L1/OffLineInterface/CbmL1RichENNRingFinderParallel.cxx b/reco/L1/OffLineInterface/CbmL1RichENNRingFinderParallel.cxx
index cdc1f7e82c..0fbc0228ad 100644
--- a/reco/L1/OffLineInterface/CbmL1RichENNRingFinderParallel.cxx
+++ b/reco/L1/OffLineInterface/CbmL1RichENNRingFinderParallel.cxx
@@ -470,7 +470,7 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, nsL1vector<E
       S0 = S1 = S2 = S3 = S4 = S5 = S6 = S7 = 0.0;
       for (THitIndex ih = 0; ih < MaxSearchAreaSize; ih++) {
         ENNSearchHitV& sHit = SearchArea[ih];
-        const fvec w        = mask2int(SearchArea[ih].on_ring);
+        const fvec w        = iif(SearchArea[ih].on_ring, fvec::One(), fvec::Zero());
         S0 += w * sHit.S0;
         S1 += w * sHit.S1;
         S2 += w * sHit.S2;
@@ -532,7 +532,7 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, nsL1vector<E
         validHit = validHit & ( d <= HitSize );
         ringV.chi2 += d*d;
         ringV.localIHits.push_back( iif( validHit, sHit.localIndex, fvec(-1.) ) );
-        ringV.NHits += mask2int(validHit);
+        ringV.NHits += iif(validHit, fvec::One(), fvec::Zero());
         validHit = validHit & ( d <= ShadowSize ); // TODO check *4
         if ( validHit.isEmpty() ) continue; // CHECKME
         Shadow.push_back( iif( validHit, sHit.localIndex, fvec(-1.) ) );
@@ -548,7 +548,7 @@ void CbmL1RichENNRingFinderParallel::ENNRingFinder(const int NHits, nsL1vector<E
         if ( validHit.isEmpty() ) continue;
         ringV.chi2 += d*d;
         ringV.localIHits.push_back( iif( validHit, puHit.localIndex, fvec(-1.) ) );
-        ringV.NHits += mask2int(validHit);
+        ringV.NHits += iif(validHit, fvec::One(), fvec::Zero());
         validHit = validHit & ( d <= ShadowSize ); // TODO check *4
         if ( validHit.isEmpty() ) continue; // CHECKME
         Shadow.push_back( iif( validHit, puHit.localIndex, fvec(-1.) ) );
diff --git a/reco/L1/ParticleFinder/CbmL1PFFitter.cxx b/reco/L1/ParticleFinder/CbmL1PFFitter.cxx
index 270268c096..d3c53cb8bd 100644
--- a/reco/L1/ParticleFinder/CbmL1PFFitter.cxx
+++ b/reco/L1/ParticleFinder/CbmL1PFFitter.cxx
@@ -498,7 +498,7 @@ void CbmL1PFFitter::GetChiToVertex(vector<CbmStsTrack>& Tracks, vector<L1FieldRe
 
     for (int iSt = nStations - 4; iSt >= 0; iSt--) {
 
-      fvec w = mask2int(T.z > (zSta[iSt] + 2.5));
+      fvec w = iif(T.z > (zSta[iSt] + 2.5), fvec::One(), fvec::Zero());
 
       L1Extrapolate(T, zSta[iSt], T.qp, fld, &w);
       if (iSt == NMvdStations - 1) {
diff --git a/reco/L1/vectors/L1vecPseudo.h b/reco/L1/vectors/L1vecPseudo.h
index 4ae6671909..e4130b84a7 100644
--- a/reco/L1/vectors/L1vecPseudo.h
+++ b/reco/L1/vectors/L1vecPseudo.h
@@ -268,11 +268,6 @@ public:
 
 inline fvec fabs(const fvec& a) { return abs(a); }
 
-inline fvec mask2int(const fmask& mask)
-{  // mask returned
-  return iif(mask, fvec::One(), fvec::Zero());
-}
-
 /// Checks, if all bands are equal
 /// NOTE: two values defined as signaling_NaN() are not equal, thus if there are all or one
 /// of the words are kNaN, the function returns false
diff --git a/reco/L1/vectors/L1vecVc.h b/reco/L1/vectors/L1vecVc.h
index 48e074ecfc..1ff387d535 100644
--- a/reco/L1/vectors/L1vecVc.h
+++ b/reco/L1/vectors/L1vecVc.h
@@ -29,10 +29,10 @@ inline fvec operator-(const fvec& a, fscal b) { return a - fvec(b); }
 
 inline fvec fabs(const fvec& a) { return abs(a); }
 
-inline fvec mask2int(const fmask& mask)
-{  // mask returned
-  return iif(mask, fvec::One(), fvec::Zero());
-}
+//inline fvec mask2int(const fmask& mask)
+//{  // mask returned
+//return iif(mask, fvec::One(), fvec::Zero());
+//}
 
 /// Checks, if all bands are equal
 /// NOTE: two values defined as signaling_NaN() are not equal, thus if there are all or one
-- 
GitLab