From 2608ae8b5c2e63640ddf63aa618a472b8d1f57a9 Mon Sep 17 00:00:00 2001
From: Dominik Smith <smith@th.physik.uni-frankfurt.de>
Date: Tue, 7 Nov 2023 17:44:45 +0100
Subject: [PATCH] Switched to RAII scheme in cbm::algo::tof::Clusterizer.

---
 algo/detectors/tof/Clusterizer.h | 14 +++++++-------
 algo/detectors/tof/Hitfind.cxx   |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/algo/detectors/tof/Clusterizer.h b/algo/detectors/tof/Clusterizer.h
index 4ef616a6ad..28ad1dbe6a 100644
--- a/algo/detectors/tof/Clusterizer.h
+++ b/algo/detectors/tof/Clusterizer.h
@@ -30,23 +30,23 @@ namespace cbm::algo::tof
     /**
        ** @brief Constructor.
        **/
-    Clusterizer() {};
+    Clusterizer(std::unique_ptr<ClusterizerRpcPar> params) { fParams = *(std::move(params)); }
+
+    /**
+       ** @brief Default constructor.
+       **/
+    Clusterizer() = default;
 
     /**
        ** @brief Destructor.
        **/
-    ~Clusterizer() {};
+    ~Clusterizer() = default;
 
     /**
        ** @brief Build clusters out of ToF Digis and store the resulting info in a TofHit.
        **/
     resultType operator()(const std::vector<std::pair<CbmTofDigi, int32_t>>& digisIn);
 
-    /** @brief Set the parameter container
-     ** @param params Vectorer to parameter container
-     **/
-    void SetParams(std::unique_ptr<ClusterizerRpcPar> params) { fParams = *(std::move(params)); }
-
   private:
     typedef std::vector<std::pair<const CbmTofDigi*, int32_t>> inputType;
 
diff --git a/algo/detectors/tof/Hitfind.cxx b/algo/detectors/tof/Hitfind.cxx
index 251c38b006..bc9863ac06 100644
--- a/algo/detectors/tof/Hitfind.cxx
+++ b/algo/detectors/tof/Hitfind.cxx
@@ -65,7 +65,7 @@ namespace cbm::algo::tof
             par->fChanPar[Ch].cell.sizeX    = rpcPar.cell.sizeX;
             par->fChanPar[Ch].cell.sizeY    = rpcPar.cell.sizeY;
           }
-          fAlgo[SmType][Sm * NbRpc + Rpc].SetParams(std::move(par));
+          fAlgo[SmType].emplace(std::make_pair(Sm * NbRpc + Rpc, tof::Clusterizer(std::move(par))));
         }
       }
     }
-- 
GitLab