From add4339ba68de7136f07cb7c6289e9d83855b407 Mon Sep 17 00:00:00 2001
From: Alexandru Bercuci <abercuci@niham.nipne.ro>
Date: Tue, 3 May 2022 15:34:35 +0200
Subject: [PATCH] improve verbosity, save more cluster data for further
 processing

---
 core/data/trd/CbmTrdCluster.cxx |  4 ++--
 core/data/trd/CbmTrdCluster.h   |  8 ++++----
 core/data/trd/CbmTrdHit.cxx     |  6 ++----
 core/data/trd/CbmTrdPoint.cxx   | 14 ++++++++++++++
 core/data/trd/CbmTrdPoint.h     |  5 ++++-
 5 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/core/data/trd/CbmTrdCluster.cxx b/core/data/trd/CbmTrdCluster.cxx
index ef978d75e5..702c915246 100644
--- a/core/data/trd/CbmTrdCluster.cxx
+++ b/core/data/trd/CbmTrdCluster.cxx
@@ -198,8 +198,8 @@ string CbmTrdCluster::ToString() const
 {
   stringstream ss;
   ss << CbmCluster::ToString();
-  ss << "CbmTrdCluster: mod=" << GetAddress() << " t0=" << fStartTime << " row=" << (int32_t) GetRow() << " "
-     << (HasFaspDigis() ? "Fasp " : "Spadic ") << "Chs=";
+  ss << "CbmTrdCluster: mod=" << GetAddress() << " row=" << (int32_t) GetRow() << " "
+     << (HasFaspDigis() ? "Fasp_" : "Spadic_") << "Chs=";
   ss << (HasOpenStart() ? "/" : "|");
   for (int32_t i(0); i < fNCols; i++)
     ss << fStartCh + i << " ";
diff --git a/core/data/trd/CbmTrdCluster.h b/core/data/trd/CbmTrdCluster.h
index 127bd67a1b..a597001142 100644
--- a/core/data/trd/CbmTrdCluster.h
+++ b/core/data/trd/CbmTrdCluster.h
@@ -107,11 +107,11 @@ public:
   virtual std::string ToString() const;
 
 protected:
-  uint8_t fNCols      = 0;       //! number of columns with charge above threshold
-  uint8_t fNRows      = 0x1f;    //! cluster row info plus extra meta data. Use dedicated getters for the correct value
-  uint16_t fStartCh   = 0xffff;  //! channel address of first channel
+  uint8_t fNCols      = 0;       //< number of columns with charge above threshold
+  uint8_t fNRows      = 0x1f;    //< cluster row info plus extra meta data. Use dedicated getters for the correct value
+  uint16_t fStartCh   = 0xffff;  //< channel address of first channel
   uint32_t fStartTime = 0xffffffff;  //! start time of cluster in clk units wrt buffer start
 
-  ClassDef(CbmTrdCluster, 5)  // cluster of digi for the TRD detector
+  ClassDef(CbmTrdCluster, 6)  // cluster of digi for the TRD detector
 };
 #endif
diff --git a/core/data/trd/CbmTrdHit.cxx b/core/data/trd/CbmTrdHit.cxx
index 8dd24d972a..e07956e3b2 100644
--- a/core/data/trd/CbmTrdHit.cxx
+++ b/core/data/trd/CbmTrdHit.cxx
@@ -43,10 +43,8 @@ std::string CbmTrdHit::ToString() const
 {
   stringstream ss;
   ss << CbmPixelHit::ToString();
-  ss << "CbmTrdHit: time[ns]=" << GetTime() << "+-" << GetTimeError() << " eloss=" << GetELoss();
-  if (GetClassType()) ss << " typ[T]" << (GetMaxType() ? "Max{T}" : "Max{R}");
-  else
-    ss << " typ[R]";
+  ss << "CbmTrdHit" << (GetClassType() ? "2" : "1")<< "D: time[ns]=" << GetTime() << "+-" << GetTimeError() << " eloss=" << GetELoss();
+  if (GetClassType()) ss << " Max=" << (GetMaxType() ? "T" : "R");
   ss << " RC=" << (IsRowCross() ? 'y' : 'n') << " Ovf=" << (HasOverFlow() ? 'y' : 'n') << endl;
   return ss.str();
 }
diff --git a/core/data/trd/CbmTrdPoint.cxx b/core/data/trd/CbmTrdPoint.cxx
index 04e5095838..523cd523f8 100644
--- a/core/data/trd/CbmTrdPoint.cxx
+++ b/core/data/trd/CbmTrdPoint.cxx
@@ -51,5 +51,19 @@ void CbmTrdPoint::Print(const Option_t* /*opt*/) const
 }
 // -------------------------------------------------------------------------
 
+// -----   Public method Print   -------------------------------------------
+std::string CbmTrdPoint::ToString() const
+{
+  std::stringstream ss;
+  ss << "CbmTrdPoint: Track " << fTrackID << " Detector " << fDetectorID << "\n";
+  ss << "    Position In (" << fX << ", " << fY << ", " << fZ << ") cm" << "\n";
+  ss << "    Momentum In (" << fPx << ", " << fPy << ", " << fPz << ") GeV" << "\n";
+  ss << "    Position Out (" << fX_out << ", " << fY_out << ", " << fZ_out << ") cm" << "\n";
+  ss << "    Momentum Out (" << fPx_out << ", " << fPy_out << ", " << fPz_out << ") GeV" << "\n";
+  ss << "    Time " << fTime << " ns,  Length " << fLength << " cm,  Energy loss " << fELoss * 1.0e06 << " keV" << "\n";
+  return ss.str();
+}
+// -------------------------------------------------------------------------
+
 
 ClassImp(CbmTrdPoint)
diff --git a/core/data/trd/CbmTrdPoint.h b/core/data/trd/CbmTrdPoint.h
index 5ff3453d6a..adaee41f76 100644
--- a/core/data/trd/CbmTrdPoint.h
+++ b/core/data/trd/CbmTrdPoint.h
@@ -25,6 +25,7 @@
 #include <TVector3.h>    // for TVector3
 
 #include <cstdint>
+#include <string>
 
 class CbmTrdPoint : public FairMCPoint {
 
@@ -55,8 +56,10 @@ public:
   /** Destructor **/
   virtual ~CbmTrdPoint();
 
-  /** Output to screen **/
+  /** \brief Output to screen **/
   virtual void Print(const Option_t* opt) const;
+  /** \brief Output to string.**/
+  virtual std::string ToString() const;
 
   /** Accessors **/
   double GetXIn() const { return fX; }
-- 
GitLab