From 881a6b8cbc4ba7b1b8efe8192b5ab8a55a8bd3f8 Mon Sep 17 00:00:00 2001
From: "P.-A. Loizeau" <p.-a.loizeau@gsi.de>
Date: Thu, 2 Dec 2021 10:44:21 +0100
Subject: [PATCH] Remove the usage of Logger in header of CbmMuchAddress

- Move implementation of CbmMuchAddress::SetElementId to cpp file
- Move Logger include from header to cpp
- Add missing Logger include to CbmMuchSignal cxx file
- Add missing Logger include to CbmAnaDimuonAnalysis cxx file (needed only for FS/FR jun19-v18.2)

Induced by inclusion in DigiData of the other detectors on top of STS (needed only for FS/FR higher than FS/FR jun19-v18.2)
---
 analysis/PWGDIL/dimuon/CbmAnaDimuonAnalysis.cxx |  1 +
 core/data/much/CbmMuchAddress.cxx               | 15 +++++++++++++++
 core/data/much/CbmMuchAddress.h                 | 13 +------------
 sim/detectors/much/CbmMuchSignal.cxx            | 10 ++++++----
 4 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/analysis/PWGDIL/dimuon/CbmAnaDimuonAnalysis.cxx b/analysis/PWGDIL/dimuon/CbmAnaDimuonAnalysis.cxx
index 79433fd380..e0f6f529ff 100644
--- a/analysis/PWGDIL/dimuon/CbmAnaDimuonAnalysis.cxx
+++ b/analysis/PWGDIL/dimuon/CbmAnaDimuonAnalysis.cxx
@@ -38,6 +38,7 @@
 
 #include "FairRootManager.h"
 #include "FairTrackParam.h"
+#include <Logger.h>
 
 #include "TClonesArray.h"
 #include "TDirectory.h"
diff --git a/core/data/much/CbmMuchAddress.cxx b/core/data/much/CbmMuchAddress.cxx
index 2f569cc010..9e654bf6db 100644
--- a/core/data/much/CbmMuchAddress.cxx
+++ b/core/data/much/CbmMuchAddress.cxx
@@ -6,6 +6,8 @@
 
 #include "CbmDefs.h"  // for kMuch
 
+#include <Logger.h>  // for Logger, LOG
+
 #include <iomanip>  // for setw, __iom_t6
 #include <ios>      // for right
 
@@ -106,4 +108,17 @@ void CbmMuchAddress::Print()
 // -------------------------------------------------------------------------
 
 
+// -------------------------------------------------------------------------
+uint32_t CbmMuchAddress::SetElementId(uint32_t address, int32_t level, int32_t newId)
+{
+  if (level < 0 || level >= kMuchNofLevels) return address;
+  if (newId >= (1 << fgkBits[level])) {
+    LOG(error) << "Id " << newId << " for MUCH level " << level << " exceeds maximum (" << (1 << fgkBits[level]) - 1
+               << ")";
+    return 0;
+  }
+  return (address & (~(fgkMask[level] << fgkShift[level]))) | (newId << fgkShift[level]);
+}
+// -------------------------------------------------------------------------
+
 ClassImp(CbmMuchAddress)
diff --git a/core/data/much/CbmMuchAddress.h b/core/data/much/CbmMuchAddress.h
index b5fd0b0e26..a370dd47f8 100644
--- a/core/data/much/CbmMuchAddress.h
+++ b/core/data/much/CbmMuchAddress.h
@@ -7,8 +7,6 @@
 
 #include "CbmAddress.h"  // for CbmAddress
 
-#include <Logger.h>  // for Logger, LOG
-
 #include <Rtypes.h>  // for ClassDef
 
 #include <cstdint>
@@ -126,16 +124,7 @@ public:
      ** @param newId   New element index
      ** @return New address
      **/
-  static uint32_t SetElementId(uint32_t address, int32_t level, int32_t newId)
-  {
-    if (level < 0 || level >= kMuchNofLevels) return address;
-    if (newId >= (1 << fgkBits[level])) {
-      LOG(error) << "Id " << newId << " for MUCH level " << level << " exceeds maximum (" << (1 << fgkBits[level]) - 1
-                 << ")";
-      return 0;
-    }
-    return (address & (~(fgkMask[level] << fgkShift[level]))) | (newId << fgkShift[level]);
-  }
+  static uint32_t SetElementId(uint32_t address, int32_t level, int32_t newId);
 
 private:
   /** Number of bits for the different levels **/
diff --git a/sim/detectors/much/CbmMuchSignal.cxx b/sim/detectors/much/CbmMuchSignal.cxx
index b884b32d15..5c8806791e 100644
--- a/sim/detectors/much/CbmMuchSignal.cxx
+++ b/sim/detectors/much/CbmMuchSignal.cxx
@@ -11,7 +11,7 @@
  **@since 10/04/18
  **@version 2.0
  ** Removing fSignalShape, which is mainly useful for PileUp Cases,
- ** but taking too much memory. Will implement similar behaviour 
+ ** but taking too much memory. Will implement similar behaviour
  ** via computing PileUp effect on the fly.
  **@since 17/05/16
  **@version 1.0
@@ -31,6 +31,8 @@
 #include "CbmMuchDigi.h"
 #include "CbmMuchDigiMatch.h"
 
+#include <Logger.h>  // for Logger, LOG
+
 #include "TMath.h"
 #include "TRandom.h"
 
@@ -128,7 +130,7 @@ void CbmMuchSignal::MergeSignal(CbmMuchSignal* signal)
 	fSignalShape.Set(fSignalShape.GetSize()+StopDiff);
 	//std::cout<<"MergeSignal called and size of fSignalShape "<<fSignalShape.GetSize()<<endl;
 	for (Int_t j=0;j<fSignalShape.GetSize()&&j<SecondSignalShape.GetSize();j++)
-		  
+
 		fSignalShape[j+StartDiff]=fSignalShape[j+StartDiff]+SecondSignalShape[j];
 		//SignalShape will be added in the first signal at location from where second signal start.
 */
@@ -179,8 +181,8 @@ void CbmMuchSignal::AddAdc(Int_t adc) {
 // -----   Set new charge   ------------------------------------------------
 void CbmMuchSignal::SetAdc(Int_t adc) {
 	//Charge value should not be more than saturation
-	
-	UShort_t saturation = 4095; //2 ^ 12 - 1;	
+
+	UShort_t saturation = 4095; //2 ^ 12 - 1;
 	if(adc>saturation){
 		fCharge=saturation;
 		fSaturationFlag=1;
-- 
GitLab