From 3671314b2ca81785b7f9d1ee0647a14be83da5c7 Mon Sep 17 00:00:00 2001
From: "se.gorbunov" <se.gorbunov@gsi.de>
Date: Tue, 19 Dec 2023 23:48:11 +0000
Subject: [PATCH] Warning fixes in the Tof clusterizer

---
 algo/detectors/rich/Unpack.cxx               |  2 +-
 algo/detectors/tof/Clusterizer.cxx           |  8 +++----
 reco/tasks/CbmTaskTofClusterizer.cxx         | 12 +++++-----
 reco/tasks/CbmTaskTofClusterizer.h           | 24 ++++++++++----------
 reco/tasks/CbmTaskTofClusterizerParWrite.cxx |  2 +-
 reco/tasks/CbmTaskTofClusterizerParWrite.h   |  2 +-
 6 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/algo/detectors/rich/Unpack.cxx b/algo/detectors/rich/Unpack.cxx
index 684edd3704..c2b60505fb 100644
--- a/algo/detectors/rich/Unpack.cxx
+++ b/algo/detectors/rich/Unpack.cxx
@@ -88,7 +88,7 @@ namespace cbm::algo::rich
     size_t totalSize       = 0;
     ctx.currentSubSubEvent = 0;
 
-    uint32_t subSubEventId, subSubEventSize;
+    uint32_t subSubEventId = 0, subSubEventSize = 0;
 
     //loop over events in hub block
     while (totalSize < hubSize) {
diff --git a/algo/detectors/tof/Clusterizer.cxx b/algo/detectors/tof/Clusterizer.cxx
index c244d4ff1e..caf6d34f75 100644
--- a/algo/detectors/tof/Clusterizer.cxx
+++ b/algo/detectors/tof/Clusterizer.cxx
@@ -68,11 +68,11 @@ namespace cbm::algo::tof
 
     //Store last position in input channels to avoid unnecessary checks in AddNextChan().
     std::vector<inputType::iterator> lastChanPos;
-    for (int32_t chan = 0; chan < numChan; chan++) {
+    for (size_t chan = 0; chan < numChan; chan++) {
       lastChanPos.push_back(input[chan].begin());
     }
 
-    for (int32_t chan = 0; chan < numChan; chan++) {
+    for (int32_t chan = 0; (size_t) chan < numChan; chan++) {
 
       // Set partition vectors
       chanSizes.push_back(clustersOut.size());
@@ -204,11 +204,11 @@ namespace cbm::algo::tof
 
     while (fParams.fDeadStrips & (1 << chan)) {
       chan++;
-      if (chan >= numChan) {
+      if ((size_t) chan >= numChan) {
         return false;
       }
     }
-    if (chan == numChan) {
+    if ((size_t) chan == numChan) {
       return false;
     }
 
diff --git a/reco/tasks/CbmTaskTofClusterizer.cxx b/reco/tasks/CbmTaskTofClusterizer.cxx
index 4f0523bebf..a494de4629 100644
--- a/reco/tasks/CbmTaskTofClusterizer.cxx
+++ b/reco/tasks/CbmTaskTofClusterizer.cxx
@@ -93,7 +93,7 @@ void CbmTaskTofClusterizer::Exec(Option_t* option)
       LOG(debug) << "TS event " << iEvent << " with " << tEvent->GetNofData(ECbmDataType::kBmonDigi) << " Bmon and "
                  << tEvent->GetNofData(ECbmDataType::kTofDigi) << " Tof digis ";
 
-      for (int32_t iDigi = 0; iDigi < tEvent->GetNofData(ECbmDataType::kBmonDigi); iDigi++) {
+      for (size_t iDigi = 0; iDigi < tEvent->GetNofData(ECbmDataType::kBmonDigi); iDigi++) {
         int32_t iDigiIndex = static_cast<int32_t>(tEvent->GetIndex(ECbmDataType::kBmonDigi, iDigi));
         CbmTofDigi tDigi(fDigiMan->Get<CbmBmonDigi>(iDigiIndex));
         if (tDigi.GetType() != 5) {
@@ -104,13 +104,13 @@ void CbmTaskTofClusterizer::Exec(Option_t* option)
         }
         fTofDigiVec.push_back(tDigi);
       }
-      for (int32_t iDigi = 0; iDigi < tEvent->GetNofData(ECbmDataType::kTofDigi); iDigi++) {
+      for (size_t iDigi = 0; iDigi < tEvent->GetNofData(ECbmDataType::kTofDigi); iDigi++) {
         int32_t iDigiIndex      = static_cast<int32_t>(tEvent->GetIndex(ECbmDataType::kTofDigi, iDigi));
         const CbmTofDigi* tDigi = fDigiMan->Get<CbmTofDigi>(iDigiIndex);
         fTofDigiVec.push_back(CbmTofDigi(*tDigi));
       }
 
-      ExecEvent(option, tEvent);
+      ExecEvent(option);
 
       // --- In event-by-event mode: copy caldigis, hits and matches to output array and register them to event
       uint uDigi0 = fTofCalDigiVecOut->size();  //starting index of current event
@@ -197,7 +197,7 @@ void CbmTaskTofClusterizer::Exec(Option_t* option)
   }
 }
 
-void CbmTaskTofClusterizer::ExecEvent(Option_t* /*option*/, CbmEvent* tEvent)
+void CbmTaskTofClusterizer::ExecEvent(Option_t* /*option*/)
 {
   // Clear output arrays
   fTofCalDigiVec->clear();
@@ -337,7 +337,7 @@ bool CbmTaskTofClusterizer::BuildClusters()
 
   if (bAddBeamCounterSideDigi) {
     // Duplicate type "5" - digis
-    for (int32_t iDigInd = 0; iDigInd < fTofDigiVec.size(); iDigInd++) {
+    for (size_t iDigInd = 0; iDigInd < fTofDigiVec.size(); iDigInd++) {
       CbmTofDigi* pDigi = &(fTofDigiVec.at(iDigInd));
       if (pDigi->GetType() == 5) {  // || pDigi->GetType() == 8) {
         if (pDigi->GetSide() == 1) {
@@ -378,7 +378,7 @@ bool CbmTaskTofClusterizer::BuildClusters()
     //if (event) event->AddData(ECbmDataType::kTofHit, hitIndex);
 
     CbmMatch* digiMatch = new ((*fTofDigiMatchColl)[hitIndex]) CbmMatch();
-    for (uint32_t i = 0; i < cluster.numChan() * 2; i++) {
+    for (int32_t i = 0; i < cluster.numChan() * 2; i++) {
       size_t digiInd = indices.at(indexOffset + i);
       double tot     = fTofCalDigiVec->at(digiInd).GetTot();
       digiMatch->AddLink(CbmLink(tot, digiInd, fiOutputTreeEntry, fiFileIndex));
diff --git a/reco/tasks/CbmTaskTofClusterizer.h b/reco/tasks/CbmTaskTofClusterizer.h
index a9adfaea0a..9283cc5008 100644
--- a/reco/tasks/CbmTaskTofClusterizer.h
+++ b/reco/tasks/CbmTaskTofClusterizer.h
@@ -61,7 +61,7 @@ class CbmTaskTofClusterizer : public FairTask {
        ** @brief Inherited from FairTask.
        **/
   virtual void Exec(Option_t* option);
-  virtual void ExecEvent(Option_t* option, CbmEvent* tEvent = NULL);
+  virtual void ExecEvent(Option_t* option);
 
   /**
        ** @brief Inherited from FairTask.
@@ -70,18 +70,18 @@ class CbmTaskTofClusterizer : public FairTask {
   virtual void Finish(double calMode);
 
   ///////////// Empty functions for interface compatibility
-  inline void SetCalMode(int32_t iMode) {}
-  inline void SetDutId(int32_t Id) {}
-  inline void PosYMaxScal(double val) {}
-  inline void SetTotMax(double val) {}
-  inline void SetTotMin(double val) {}
-  inline void SetTotMean(double val) {}
-  inline void SetMaxTimeDist(double val) {}
-  inline void SetChannelDeadtime(double val) {}
-  inline void SetCalParFileName(TString CalParFileName) {}
-  inline double GetTotMean() { return 0.0; }
+  void SetCalMode(int32_t /*iMode*/) {}
+  void SetDutId(int32_t /*Id*/) {}
+  void PosYMaxScal(double /*val*/) {}
+  void SetTotMax(double /*val*/) {}
+  void SetTotMin(double /*val*/) {}
+  void SetTotMean(double /*val*/) {}
+  void SetMaxTimeDist(double /*val*/) {}
+  void SetChannelDeadtime(double /*val*/) {}
+  void SetCalParFileName(TString /*CalParFileName*/) {}
+  double GetTotMean() { return 0.0; }
   ////////////
-  inline int GetNbHits() { return fiNbHits; }
+  int GetNbHits() { return fiNbHits; }
 
   void SwapChannelSides(bool bSwap) { fbSwapChannelSides = bSwap; }
   void SetFileIndex(int32_t iIndex) { fiFileIndex = iIndex; }
diff --git a/reco/tasks/CbmTaskTofClusterizerParWrite.cxx b/reco/tasks/CbmTaskTofClusterizerParWrite.cxx
index 086fab63f8..8c604fd248 100644
--- a/reco/tasks/CbmTaskTofClusterizerParWrite.cxx
+++ b/reco/tasks/CbmTaskTofClusterizerParWrite.cxx
@@ -47,7 +47,7 @@ CbmTaskTofClusterizerParWrite::CbmTaskTofClusterizerParWrite()
 {
 }
 
-CbmTaskTofClusterizerParWrite::CbmTaskTofClusterizerParWrite(const char* name, int32_t verbose, bool writeDataInOut)
+CbmTaskTofClusterizerParWrite::CbmTaskTofClusterizerParWrite(const char* name, int32_t verbose, bool /*writeDataInOut*/)
   : FairTask(TString(name), verbose)
   , fTofId(NULL)
   , fDigiPar(NULL)
diff --git a/reco/tasks/CbmTaskTofClusterizerParWrite.h b/reco/tasks/CbmTaskTofClusterizerParWrite.h
index 1dc21f5c55..80fe8bf0d7 100644
--- a/reco/tasks/CbmTaskTofClusterizerParWrite.h
+++ b/reco/tasks/CbmTaskTofClusterizerParWrite.h
@@ -57,7 +57,7 @@ class CbmTaskTofClusterizerParWrite : public FairTask {
   /**
        ** @brief Inherited from FairTask.
        **/
-  virtual void Exec(Option_t* option){};
+  virtual void Exec(Option_t* /*option*/){};
 
   /**
        ** @brief Inherited from FairTask.
-- 
GitLab