From e5f0a293c78bb48270207b8ffbeec057395abccd Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Tue, 3 Aug 2021 17:11:22 +0200
Subject: [PATCH] Add current TS index to the CbmTsEvenHeader

---
 core/data/CbmTsEventHeader.h | 8 +++++++-
 reco/steer/CbmRecoUnpack.cxx | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/core/data/CbmTsEventHeader.h b/core/data/CbmTsEventHeader.h
index beea415c68..71f43e1a66 100644
--- a/core/data/CbmTsEventHeader.h
+++ b/core/data/CbmTsEventHeader.h
@@ -21,6 +21,8 @@ public:
   /** Default destructor */
   virtual ~CbmTsEventHeader() {};
 
+  /** Get the Start time of the this Timeslice linked to this event header*/
+  uint64_t GetTsIndex() { return fTsIndex; }
   /** Get the Start time of the this Timeslice linked to this event header*/
   uint64_t GetTsStartTime() { return fTsStartTime; }
 
@@ -50,10 +52,14 @@ public:
   /** @brief Set the number of digis in this Ts */
   void SetNDigisTrd2D(ULong64_t value) { fNDigisTrd2D = value; }
 
+  /** @brief Set the Ts Start Time @param value Start time of the TS */
+  void SetTsIndex(uint32_t value) { fTsIndex = value; }
   /** @brief Set the Ts Start Time @param value Start time of the TS */
   void SetTsStartTime(uint64_t value) { fTsStartTime = value; }
 
 protected:
+  /** Timeslice index */
+  uint64_t fTsIndex = 0;
   /** Timeslice start time */
   uint64_t fTsStartTime = 0;
 
@@ -70,6 +76,6 @@ protected:
   /** @brief nDigis in "this" timeslice measured by the TOF */
   ULong64_t fNDigisTof = 0;
 
-  ClassDef(CbmTsEventHeader, 3)
+  ClassDef(CbmTsEventHeader, 4)
 };
 #endif
diff --git a/reco/steer/CbmRecoUnpack.cxx b/reco/steer/CbmRecoUnpack.cxx
index aa4b4a562f..15eb072e9a 100644
--- a/reco/steer/CbmRecoUnpack.cxx
+++ b/reco/steer/CbmRecoUnpack.cxx
@@ -238,6 +238,7 @@ void CbmRecoUnpack::Unpack(unique_ptr<Timeslice> ts)
   // Prepare timeslice
   const fles::Timeslice& timeslice = *ts;
 
+  fCbmTsEventHeader->SetTsIndex(ts->index());
   fCbmTsEventHeader->SetTsStartTime(ts->start_time());
 
   uint64_t nComponents = ts->num_components();
-- 
GitLab