From 205a8cf414c4aa2490e3d0683e1272bfd3dbaeb1 Mon Sep 17 00:00:00 2001
From: Pierre-Alain Loizeau <p.-a.loizeau@gsi.de>
Date: Tue, 2 Feb 2021 17:51:09 +0100
Subject: [PATCH] [mCBM 2020] Add test for mcbm_event_ana.C - Fix wrongly
 commented out ParFile line - Add test for mcbm_event_ana with both event
 builders

---
 core/data/tof/CbmTofDetectorId_v21a.cxx  |  6 ++++--
 macro/beamtime/mcbm2020/CMakeLists.txt   | 19 +++++++++++++++++++
 macro/beamtime/mcbm2020/mcbm_event_ana.C | 13 +++++++++----
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/core/data/tof/CbmTofDetectorId_v21a.cxx b/core/data/tof/CbmTofDetectorId_v21a.cxx
index 741dfbe45b..78f9372086 100644
--- a/core/data/tof/CbmTofDetectorId_v21a.cxx
+++ b/core/data/tof/CbmTofDetectorId_v21a.cxx
@@ -26,8 +26,10 @@ CbmTofDetectorId_v21a::CbmTofDetectorId_v21a()
     if (i == 4) continue;  // ignore side bit
     modulemask |= (maskarray[i] << shiftarray[i]);
   }
-  cout << "<I> V21a module mask 0x" << setfill('0') << setw(8) << right << hex
-       << modulemask << endl;
+  char prev = std::cout.fill('x');
+  std::cout << "<I> V21a module mask 0x" << std::setfill('0') << std::setw(8)
+            << std::right << std::hex << modulemask << std::setfill(prev)
+            << std::dec << std::endl;
 }
 
 CbmTofDetectorInfo
diff --git a/macro/beamtime/mcbm2020/CMakeLists.txt b/macro/beamtime/mcbm2020/CMakeLists.txt
index e50bca332b..7813b2ecf7 100644
--- a/macro/beamtime/mcbm2020/CMakeLists.txt
+++ b/macro/beamtime/mcbm2020/CMakeLists.txt
@@ -24,6 +24,7 @@ If(DEFINED ENV{RAW_DATA_PATH} )
   GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2020/mcbm_reco.C )        # Cluster Finding + Hit reconstruction, time based (no events)
   GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2020/mcbm_build_and_reco.C ) # TW event building + Cluster Finding + Hit reconstruction, Event based
   GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2020/mcbm_event_reco.C )  # Digi dt event building + Cluster Finding + Hit reconstruction, Event based
+  GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2020/mcbm_event_ana.C )   # TOF Track extension toward other detectors
   GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2020/MonitorT0.C )        # CbmMcbm2018MonitorTaskT0 + CbmMcbm2018MonitorAlgoT0
   GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2020/MonitorSts.C )       # CbmMcbm2018MonitorSts.h
   GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2020/MonitorMuch.C )      # CbmMcbm2018MonitorMuchLite.h
@@ -122,6 +123,24 @@ If(DEFINED ENV{RAW_DATA_PATH} )
       Set(fixture_mcbm_event_reco_${RUN} fixture_done_${testname})
       set_tests_properties(${testname} PROPERTIES FIXTURES_SETUP ${fixture_mcbm_event_reco_${RUN}})
 
+      Set(testname mcbm_evt_win_ana_2020_${RUN})
+      Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2020/mcbm_event_ana.sh ${RUN} 1000 "kTRUE" )
+      Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "600")
+      Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed;All ok")
+      set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED ${fixture_mcbm_build_reco_${RUN}})
+      set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_build_reco_2020_${RUN})
+      Set(fixture_mcbm_evt_win_ana_${RUN} fixture_done_${testname})
+      set_tests_properties(${testname} PROPERTIES FIXTURES_SETUP ${fixture_mcbm_evt_win_ana_${RUN}})
+
+      Set(testname mcbm_event_ana_2020_${RUN})
+      Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2020/mcbm_event_ana.sh ${RUN} )
+      Set_Tests_Properties(${testname} PROPERTIES TIMEOUT "600")
+      Set_Tests_Properties(${testname} PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed;All ok")
+      set_tests_properties(${testname} PROPERTIES FIXTURES_REQUIRED ${fixture_mcbm_event_reco_${RUN}})
+      set_tests_properties(${testname} PROPERTIES DEPENDS mcbm_event_reco_2020_${RUN})
+      Set(fixture_mcbm_event_ana_${RUN} fixture_done_${testname})
+      set_tests_properties(${testname} PROPERTIES FIXTURES_SETUP ${fixture_mcbm_event_ana_${RUN}})
+
       ### Monitors tests => Should run 1 by 1 after unpacker test to avoid concurrent access to tsa file
       Set(testname mcbm_monit0_2020_${RUN})
       Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2020/MonitorT0.sh \"${RAW_DATA_PATH}/${RUN}_first20Ts.tsa\" )
diff --git a/macro/beamtime/mcbm2020/mcbm_event_ana.C b/macro/beamtime/mcbm2020/mcbm_event_ana.C
index fc635b459b..7399cefef4 100644
--- a/macro/beamtime/mcbm2020/mcbm_event_ana.C
+++ b/macro/beamtime/mcbm2020/mcbm_event_ana.C
@@ -6,7 +6,9 @@
 //
 // --------------------------------------------------------------------------
 
-void mcbm_event_ana(Int_t runId = 831, Int_t nTimeslices = 1000) {
+void mcbm_event_ana(Int_t runId       = 831,
+                    Int_t nTimeslices = 1000,
+                    Bool_t bUseEvtWin = kFALSE) {
 
   // --- Logger settings ----------------------------------------------------
   TString logLevel     = "WARN";
@@ -21,11 +23,14 @@ void mcbm_event_ana(Int_t runId = 831, Int_t nTimeslices = 1000) {
   // ------------------------------------------------------------------------
 
   // -----   In- and output file names   ------------------------------------
-  TString inFile = Form("./data/reco_mcbm_%i.root", runId);
-  TString inFile = Form("./data/reco_mcbm_evt_win_%i.root", runId);
-  //TString parFile = Form("./data/unp_mcbm_params_%i.root", runId);
+  TString inFile = Form("./data/reco_mcbm_%03u.root", runId);
+  if (bUseEvtWin) {
+    inFile = Form("./data/reco_mcbm_evt_win_%03u.root", runId);
+  }  // if (bUseEvtWin)
+  TString parFile = Form("./data/unp_mcbm_params_%i.root", runId);
   TString geoFile = paramDir + "mcbm_beam_2020_03.geo.root";
   TString outFile = Form("./data/ana_mcbm_%i.root", runId);
+
   // ------------------------------------------------------------------------
 
   // -----   Parameter files as input to the runtime database   -------------
-- 
GitLab