From 1680d0750209ad1a5f571fae36b9c116e896446a Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Thu, 10 Nov 2022 17:07:08 +0100
Subject: [PATCH] Use the TZD unpacker instead of BMon one in Reco steering
 class

---
 reco/steer/CMakeLists.txt    |  1 +
 reco/steer/CbmRecoUnpack.cxx | 38 ++++++++++++++++--------------------
 reco/steer/CbmRecoUnpack.h   | 12 ++++++------
 3 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/reco/steer/CMakeLists.txt b/reco/steer/CMakeLists.txt
index 92492b83d5..17308d68ba 100644
--- a/reco/steer/CMakeLists.txt
+++ b/reco/steer/CMakeLists.txt
@@ -29,6 +29,7 @@ set(PRIVATE_DEPENDENCIES
   CbmRichReco
   CbmRecoSts
   CbmTrdReco
+  CbmTzdReco
   )
 
 set(INTERFACE_DEPENDENCIES
diff --git a/reco/steer/CbmRecoUnpack.cxx b/reco/steer/CbmRecoUnpack.cxx
index 93c399e8dd..d913b4652e 100644
--- a/reco/steer/CbmRecoUnpack.cxx
+++ b/reco/steer/CbmRecoUnpack.cxx
@@ -49,7 +49,7 @@ void CbmRecoUnpack::Finish()
   if (fTofConfig) fTofConfig->GetUnpacker()->Finish();
   if (fTrd1DConfig) fTrd1DConfig->GetUnpacker()->Finish();
   if (fTrd2DConfig) fTrd2DConfig->GetUnpacker()->Finish();
-  if (fBmonConfig) fBmonConfig->GetUnpacker()->Finish();
+  if (fTzdConfig) fTzdConfig->GetUnpacker()->Finish();
 
   // Create some default performance profiling histograms and write them to a file
   if (fDoPerfProf) performanceProfiling();
@@ -152,14 +152,14 @@ Bool_t CbmRecoUnpack::Init()
   // for fasp created CbmTrdDigis PR 072021
 
   // --- Bmon
-  if (fBmonConfig) {
-    fBmonConfig->InitOutput();
-    RegisterOutputs(ioman, fBmonConfig);  /// Framework bound work = kept in this Task
-    fBmonConfig->SetAlgo();
-    fBmonConfig->LoadParFileName();  /// Needed to change the Parameter file name before it is used!!!
-    initParContainers(fBmonConfig->GetParContainerRequest());  /// Framework bound work = kept in this Task
-    fBmonConfig->InitAlgo();
-    initPerformanceMaps(fkFlesBmon, "Bmon");
+  if (fTzdConfig) {
+    fTzdConfig->InitOutput();
+    RegisterOutputs(ioman, fTzdConfig);  /// Framework bound work = kept in this Task
+    fTzdConfig->SetAlgo();
+    fTzdConfig->LoadParFileName();  /// Needed to change the Parameter file name before it is used!!!
+    initParContainers(fTzdConfig->GetParContainerRequest());  /// Framework bound work = kept in this Task
+    fTzdConfig->InitAlgo();
+    initPerformanceMaps(fkFlesTzd, "Tzd");
   }
 
   if (fDoPerfProfPerTs) {
@@ -379,8 +379,8 @@ void CbmRecoUnpack::Reset()
   if (fTrd1DConfig) fTrd1DConfig->Reset();
   // ---- Trd2D ----
   if (fTrd2DConfig) fTrd2DConfig->Reset();
-  // ---- Bmon ----
-  if (fBmonConfig) fBmonConfig->Reset();
+  // ---- Tzd ----
+  if (fTzdConfig) fTzdConfig->Reset();
 }
 
 // ----------------------------------------------------------------------------
@@ -458,14 +458,10 @@ void CbmRecoUnpack::Unpack(unique_ptr<Timeslice> ts)
         }
         break;
       }
-      case fkFlesBmon: {
-        if (fBmonConfig) {
-          fCbmTsEventHeader->AddNDigisBmon(unpack(systemId, &timeslice, component, fBmonConfig,
-                                                  fBmonConfig->GetOptOutAVec(), fBmonConfig->GetOptOutBVec()));
-        }
-        else if (fTofConfig) {
-          fCbmTsEventHeader->AddNDigisTof(unpack(fkFlesTof, &timeslice, component, fTofConfig,
-                                                 fTofConfig->GetOptOutAVec(), fTofConfig->GetOptOutBVec()));
+      case fkFlesTzd: {
+        if (fTzdConfig) {
+          fCbmTsEventHeader->AddNDigisBmon(unpack(systemId, &timeslice, component, fTzdConfig,
+                                                  fTzdConfig->GetOptOutAVec(), fTzdConfig->GetOptOutBVec()));
         }
         break;
       }
@@ -485,7 +481,7 @@ void CbmRecoUnpack::Unpack(unique_ptr<Timeslice> ts)
     if (fTofConfig && fTofConfig->GetOutputVec()) { timesort(fTofConfig->GetOutputVec()); }
     if (fTrd1DConfig && fTrd1DConfig->GetOutputVec()) { timesort(fTrd1DConfig->GetOutputVec()); }
     if (fTrd2DConfig && fTrd2DConfig->GetOutputVec()) { timesort(fTrd2DConfig->GetOutputVec()); }
-    if (fBmonConfig && fBmonConfig->GetOutputVec()) { timesort(fBmonConfig->GetOutputVec()); }
+    if (fTzdConfig && fTzdConfig->GetOutputVec()) { timesort(fTzdConfig->GetOutputVec()); }
 
     /// Time sort the output vectors of all unpackers present
     if (fMuchConfig && fMuchConfig->GetOptOutAVec()) { timesort(fMuchConfig->GetOptOutAVec()); }
@@ -495,7 +491,7 @@ void CbmRecoUnpack::Unpack(unique_ptr<Timeslice> ts)
     if (fTofConfig && fTofConfig->GetOptOutAVec()) { timesort(fTofConfig->GetOptOutAVec()); }
     if (fTrd1DConfig && fTrd1DConfig->GetOptOutAVec()) { timesort(fTrd1DConfig->GetOptOutAVec()); }
     if (fTrd2DConfig && fTrd2DConfig->GetOptOutAVec()) { timesort(fTrd2DConfig->GetOptOutAVec()); }
-    if (fBmonConfig && fBmonConfig->GetOptOutAVec()) { timesort(fBmonConfig->GetOptOutAVec()); }
+    if (fTzdConfig && fTzdConfig->GetOptOutAVec()) { timesort(fTzdConfig->GetOptOutAVec()); }
   }
 
   if (fDoPerfProfPerTs) {
diff --git a/reco/steer/CbmRecoUnpack.h b/reco/steer/CbmRecoUnpack.h
index 4d7c3dfb0e..a49798972e 100644
--- a/reco/steer/CbmRecoUnpack.h
+++ b/reco/steer/CbmRecoUnpack.h
@@ -12,7 +12,6 @@
 #ifndef CBMRECOUNPACK_H
 #define CBMRECOUNPACK_H 1
 
-#include "CbmBmonUnpackConfig.h"
 #include "CbmMuchUnpackConfig.h"
 #include "CbmPsdUnpackConfig.h"
 #include "CbmRichUnpackConfig.h"
@@ -21,6 +20,7 @@
 #include "CbmTrdUnpackConfig.h"
 #include "CbmTrdUnpackFaspConfig.h"
 #include "CbmTsEventHeader.h"
+#include "CbmTzdUnpackConfig.h"
 
 #include <MicrosliceDescriptor.hpp>
 #include <Timeslice.hpp>
@@ -31,13 +31,13 @@
 #include <RtypesCore.h>
 #include <THnSparse.h>
 #include <TObject.h>
-#include <type_traits>  // this is std::lib used for template is_member_function_pointer
 
 #include <chrono>
 #include <cstddef>
 #include <cstdint>
 #include <ctime>
 #include <memory>
+#include <type_traits>  // this is std::lib used for template is_member_function_pointer
 #include <utility>
 #include <vector>
 
@@ -149,7 +149,7 @@ public:
   void SetUnpackConfig(std::shared_ptr<CbmTrdUnpackFaspConfig> config) { fTrd2DConfig = config; }
 
   /** @brief Set the Bmon Unpack Config @param config */
-  void SetUnpackConfig(std::shared_ptr<CbmBmonUnpackConfig> config) { fBmonConfig = config; }
+  void SetUnpackConfig(std::shared_ptr<CbmTzdUnpackConfig> config) { fTzdConfig = config; }
 
   /** @brief Trigger the unpacking procedure **/
   void Unpack(std::unique_ptr<fles::Timeslice> ts);
@@ -163,7 +163,7 @@ private:
   static constexpr std::uint16_t fkFlesTrd   = static_cast<std::uint16_t>(fles::SubsystemIdentifier::TRD);
   static constexpr std::uint16_t fkFlesTrd2D = static_cast<std::uint16_t>(fles::SubsystemIdentifier::TRD2D);
   static constexpr std::uint16_t fkFlesTof   = static_cast<std::uint16_t>(fles::SubsystemIdentifier::RPC);
-  static constexpr std::uint16_t fkFlesBmon  = static_cast<std::uint16_t>(fles::SubsystemIdentifier::T0);
+  static constexpr std::uint16_t fkFlesTzd   = static_cast<std::uint16_t>(fles::SubsystemIdentifier::T0);
 
   /** @brief Flag if extended debug output is to be printed or not*/
   bool fDoDebugPrints = false;  //!
@@ -424,8 +424,8 @@ private:
   /** @brief Configuration of the Trd unpacker. Provides the configured algorithm */
   std::shared_ptr<CbmTrdUnpackFaspConfig> fTrd2DConfig = nullptr;  //!
 
-  /** @brief Configuration of the Bmon unpacker. Provides the configured algorithm */
-  std::shared_ptr<CbmBmonUnpackConfig> fBmonConfig = nullptr;  //!
+  /** @brief Configuration of the Tzd unpacker. Provides the configured algorithm */
+  std::shared_ptr<CbmTzdUnpackConfig> fTzdConfig = nullptr;  //!
 
   /** @brief Pointer to the Timeslice start time used to write it to the output tree @remark since we hand this to the FairRootManager it also wants to delete it and we do not have to take care of deletion */
   CbmTsEventHeader* fCbmTsEventHeader = nullptr;
-- 
GitLab