From 2bdc54c99b39a6b1fc06f1a86ac088910720e6e8 Mon Sep 17 00:00:00 2001
From: "P.-A. Loizeau" <p.-a.loizeau@gsi.de>
Date: Thu, 21 Jul 2022 16:54:25 +0200
Subject: [PATCH] In StsParAsic/Module, rem move methods + avoid storing TF1 in
 ROOT global list of fctns

---
 core/detectors/sts/CbmStsParAsic.cxx   | 27 +-------------------------
 core/detectors/sts/CbmStsParAsic.h     | 10 +---------
 core/detectors/sts/CbmStsParModule.cxx | 21 ++++++++++++++++++++
 core/detectors/sts/CbmStsParModule.h   |  8 ++++++++
 4 files changed, 31 insertions(+), 35 deletions(-)

diff --git a/core/detectors/sts/CbmStsParAsic.cxx b/core/detectors/sts/CbmStsParAsic.cxx
index b41bd64ffa..a69d9434fe 100644
--- a/core/detectors/sts/CbmStsParAsic.cxx
+++ b/core/detectors/sts/CbmStsParAsic.cxx
@@ -36,18 +36,6 @@ CbmStsParAsic::CbmStsParAsic(const CbmStsParAsic& other)
 }
 // -------------------------------------------------------------------------
 
-
-// -----   Move constructor   ----------------------------------------------
-CbmStsParAsic::CbmStsParAsic(CbmStsParAsic&& other)
-{
-  Set(other.fNofChannels, other.fNofAdc, other.fDynRange, other.fThreshold, other.fTimeResolution, other.fDeadTime,
-      other.fNoise, other.fZeroNoiseRate);
-  SetTimeOffset(other.fTimeOffset);
-  SetWalkCoef(other.fWalkCoef);
-}
-// -------------------------------------------------------------------------
-
-
 // -----   Copy assignment operator   --------------------------------------
 CbmStsParAsic& CbmStsParAsic::operator=(const CbmStsParAsic& other)
 {
@@ -59,19 +47,6 @@ CbmStsParAsic& CbmStsParAsic::operator=(const CbmStsParAsic& other)
 }
 // -------------------------------------------------------------------------
 
-
-// -----   Move assignment operator   --------------------------------------
-CbmStsParAsic& CbmStsParAsic::operator=(CbmStsParAsic&& other)
-{
-  Set(other.fNofChannels, other.fNofAdc, other.fDynRange, other.fThreshold, other.fTimeResolution, other.fDeadTime,
-      other.fNoise, other.fZeroNoiseRate);
-  SetTimeOffset(other.fTimeOffset);
-  SetWalkCoef(other.fWalkCoef);
-  return *this;
-}
-// -------------------------------------------------------------------------
-
-
 // -----   Destructor   ----------------------------------------------------
 CbmStsParAsic::~CbmStsParAsic()
 {
@@ -142,7 +117,7 @@ double CbmStsParAsic::GetRandomNoiseCharge() const
 void CbmStsParAsic::Init()
 {
   if (fNoiseCharge) delete fNoiseCharge;
-  fNoiseCharge = new TF1("Noise Charge", "TMath::Gaus(x, [0], [1])", fThreshold, 10. * fNoise);
+  fNoiseCharge = new TF1("Noise_Charge", "TMath::Gaus(x, [0], [1])", fThreshold, 10. * fNoise, "NL");
   fNoiseCharge->SetParameters(0., fNoise);
   fIsInit = kTRUE;
 }
diff --git a/core/detectors/sts/CbmStsParAsic.h b/core/detectors/sts/CbmStsParAsic.h
index 2dcfc56862..5388154cd1 100644
--- a/core/detectors/sts/CbmStsParAsic.h
+++ b/core/detectors/sts/CbmStsParAsic.h
@@ -41,22 +41,14 @@ public:
                 double noise, double znr);
 
 
-  /** @brief Copy constructor **/
+  /** @brief Copy constructor (implicitely disable move constructor and assignment)**/
   CbmStsParAsic(const CbmStsParAsic&);
 
 
-  /** @brief Move constructor (disabled) **/
-  CbmStsParAsic(CbmStsParAsic&&);
-
-
   /** @brief Copy assignment operator **/
   CbmStsParAsic& operator=(const CbmStsParAsic& other);
 
 
-  /** @brief Move assignment operator (disabled) **/
-  CbmStsParAsic& operator=(CbmStsParAsic&&);
-
-
   /** @brief Destructor **/
   ~CbmStsParAsic();
 
diff --git a/core/detectors/sts/CbmStsParModule.cxx b/core/detectors/sts/CbmStsParModule.cxx
index 7221c976bc..52b68aad91 100644
--- a/core/detectors/sts/CbmStsParModule.cxx
+++ b/core/detectors/sts/CbmStsParModule.cxx
@@ -25,6 +25,27 @@ CbmStsParModule::CbmStsParModule(uint32_t nChannels, uint32_t nAsicChannels)
 // -------------------------------------------------------------------------
 
 
+// -----   Copy constructor   ----------------------------------------------
+CbmStsParModule::CbmStsParModule(const CbmStsParModule& other)
+{
+  fNofChannels     = other.GetNofChannels();
+  fNofAsicChannels = other.GetNofAsicChannels();
+  fAsicPars        = other.GetAsicParams();
+}
+// -------------------------------------------------------------------------
+
+
+// -----   Copy assignment operator   --------------------------------------
+CbmStsParModule& CbmStsParModule::operator=(const CbmStsParModule& other)
+{
+  fNofChannels     = other.GetNofChannels();
+  fNofAsicChannels = other.GetNofAsicChannels();
+  fAsicPars        = other.GetAsicParams();
+  return *this;
+}
+// -------------------------------------------------------------------------
+
+
 // -----   Randomly deactivate channels   ----------------------------------
 uint32_t CbmStsParModule::DeactivateRandomChannels(Double_t fraction)
 {
diff --git a/core/detectors/sts/CbmStsParModule.h b/core/detectors/sts/CbmStsParModule.h
index c50da9fd29..3e2044f16e 100644
--- a/core/detectors/sts/CbmStsParModule.h
+++ b/core/detectors/sts/CbmStsParModule.h
@@ -38,6 +38,14 @@ public:
   CbmStsParModule(uint32_t nChannels, uint32_t nAsicChannels);
 
 
+  /** @brief Copy constructor (implicitely disable move constructor and assignment)**/
+  CbmStsParModule(const CbmStsParModule&);
+
+
+  /** @brief Copy assignment operator **/
+  CbmStsParModule& operator=(const CbmStsParModule& other);
+
+
   /** @brief Destructor **/
   ~CbmStsParModule() {};
 
-- 
GitLab