From ddd746ff0b0f5e25dabbd22912e6eb26d4ec582b Mon Sep 17 00:00:00 2001
From: Alexandru Bercuci <abercuci@niham.nipne.ro>
Date: Fri, 12 May 2023 09:39:52 +0300
Subject: [PATCH] modify histo naming, explicit variable naming

---
 core/detectors/trd/CbmTrdParFasp.h                    |  2 +-
 reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.cxx | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/core/detectors/trd/CbmTrdParFasp.h b/core/detectors/trd/CbmTrdParFasp.h
index 982f429950..5c5fd9dff8 100644
--- a/core/detectors/trd/CbmTrdParFasp.h
+++ b/core/detectors/trd/CbmTrdParFasp.h
@@ -93,7 +93,7 @@ public:
   }
   virtual uint32_t GetChannelMask() const;
   virtual bool IsChannelMasked(int ch) const;
-  Int_t GetPadAddress(Int_t ich) const { return 0.5 * GetChannelAddress(ich); }
+  int GetPadAddress(Int_t ich) const { return int(0.5 * GetChannelAddress(ich)); }
   Double_t GetSizeX() const { return fgSizeX; }
   Double_t GetSizeY() const { return fgSizeY; }
   Double_t GetSizeZ() const { return fgSizeZ; }
diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.cxx b/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.cxx
index b272233fd2..07b3445f47 100644
--- a/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.cxx
+++ b/reco/detectors/trd/unpack/CbmTrdUnpackFaspMonitor.cxx
@@ -136,7 +136,7 @@ void CbmTrdUnpackFaspMonitor::MapMaskedChannels(const CbmTrdParSetAsic* par)
     }
     for (int ich(0); ich < NFASPCH; ich++) {
       const CbmTrdParFaspChannel* faspCh = fasp->GetChannel(ich);
-      int pad = fasp->GetChannelAddress(ich) / 2, row = pad / ncol, col = pad % ncol;
+      int pad = fasp->GetPadAddress(ich), row = pad / ncol, col = pad % ncol;
       if (faspCh->IsMasked()) histo->Fill(col + (faspCh->HasPairingR() ? 1 : -1) * 0.25, row);
     }
   }
@@ -151,7 +151,7 @@ void CbmTrdUnpackFaspMonitor::addParam(uint32_t madd, const CbmTrdParSetAsic* as
     return;
   }
 
-  std::vector<int32_t> padToFaspMapping(NFASPMOD * NFASPCH, -1);
+  std::vector<int32_t> chToFaspMapping(NFASPMOD * NFASPCH, -1);
   std::vector<Int_t> add;
   asics->GetAsicAddresses(&add);
   for (auto afasp : add) {
@@ -159,11 +159,11 @@ void CbmTrdUnpackFaspMonitor::addParam(uint32_t madd, const CbmTrdParSetAsic* as
 
     int faspid(afasp % 1000), ich(faspid * 100);
     for (auto ach : fasp->GetChannelAddresses()) {
-      padToFaspMapping[ach] = ich;
+      chToFaspMapping[ach] = ich;
       ich++;
     }
   }
-  std::get<0>((*moduleDef).second) = padToFaspMapping;
+  std::get<0>((*moduleDef).second) = chToFaspMapping;
 }
 
 //_________________________________________________________________________
@@ -192,7 +192,7 @@ void CbmTrdUnpackFaspMonitor::createHisto(eDigiHistos kHisto)
     auto nrows = std::get<2>(moduleDef.second);
     auto nchs  = nrows * ncols;
 
-    histoname = "Fasp_" + getTypeName(kHisto) + "_" + getHistoName(kHisto);
+    histoname = getTypeName(kHisto) + getHistoName(kHisto) + "Fasp";
     switch (kHisto) {
       case eDigiHistos::kMap:
         newhisto = std::make_shared<TH2I>(histoname.data(), Form("%s %d", histoname.data(), modId), 2 * ncols, -0.5,
@@ -203,6 +203,7 @@ void CbmTrdUnpackFaspMonitor::createHisto(eDigiHistos kHisto)
         break;
 
       case eDigiHistos::kMap_St:
+        histoname = getTypeName(kHisto) + "MaskFasp";
         newhisto = std::make_shared<TH2I>(histoname.data(), Form("%s %d", histoname.data(), modId), 2 * ncols, -0.5,
                                           (ncols - 0.5), nrows, -0.5, (nrows - 0.5));
         newhisto->SetXTitle("COL (pad)");
-- 
GitLab