From b16550aaf903e78c98d882376469aa8e42dd1bce Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Tue, 20 Jul 2021 13:07:14 +0200
Subject: [PATCH] Add TOF system offset + fix usage in TOF CRI unpacker

---
 macro/run/run_unpack_tsa.C                     | 2 +-
 reco/detectors/tof/unpack/CbmTofUnpackAlgo.cxx | 2 +-
 reco/detectors/tof/unpack/CbmTofUnpackAlgo.h   | 3 ---
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/macro/run/run_unpack_tsa.C b/macro/run/run_unpack_tsa.C
index de0cecd813..9606370845 100644
--- a/macro/run/run_unpack_tsa.C
+++ b/macro/run/run_unpack_tsa.C
@@ -158,7 +158,7 @@ void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const cha
   // tofconfig->SetDoWriteOptOutA("CbmTofErrors");
   std::string parfilesbasepathTof = Form("%s/macro/beamtime/mcbm2021/", srcDir.Data());
   tofconfig->SetParFilesBasePath(parfilesbasepathTof);
-  //tofconfig->SetSystemTimeOffset(-2221);  // [ns] value to be updated
+  tofconfig->SetSystemTimeOffset(-1220);  // [ns] value to be updated
   // -------------
 
 
diff --git a/reco/detectors/tof/unpack/CbmTofUnpackAlgo.cxx b/reco/detectors/tof/unpack/CbmTofUnpackAlgo.cxx
index 5719ae8da4..a1285fa8f8 100644
--- a/reco/detectors/tof/unpack/CbmTofUnpackAlgo.cxx
+++ b/reco/detectors/tof/unpack/CbmTofUnpackAlgo.cxx
@@ -385,7 +385,7 @@ void CbmTofUnpackAlgo::ProcessHit(const critof001::Message& mess)
   /// Apply offset to T0 only to TOF digis
   if (0x90 != fuCurrentMsSysId) {
     /// Tricking clang to avoid one liner
-    dHitTime -= fdTimeOffsetNs;
+    dHitTime -= fSystemTimeOffset;
   }
 
   /// FIXME: seems there is an offset of +4 Epoch between data and header
diff --git a/reco/detectors/tof/unpack/CbmTofUnpackAlgo.h b/reco/detectors/tof/unpack/CbmTofUnpackAlgo.h
index e773bd76a4..d2543049bf 100644
--- a/reco/detectors/tof/unpack/CbmTofUnpackAlgo.h
+++ b/reco/detectors/tof/unpack/CbmTofUnpackAlgo.h
@@ -159,9 +159,6 @@ private:
   std::vector<Int_t> fviModuleId = {};
   std::vector<Int_t> fviRpcChUId = {};
 
-  /// User settings: Data correction parameters
-  Double_t fdTimeOffsetNs;
-
   /// Running indices
   UInt_t fuMapWarnToPrint     = 100;
   ULong64_t fulCurrentTsIdx   = 0;  //! Idx of the current TS
-- 
GitLab