From 5b61621656e6dd99d338623a945d48a7873980e5 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Mon, 22 Feb 2021 16:43:58 +0100
Subject: [PATCH] Add more comments around new feature in CbmMcbm2018Source

---
 fles/mcbm2018/CbmMcbm2018Source.cxx          |  9 ++++++++-
 macro/beamtime/mcbm2020/find_spills_kronos.C | 14 ++++++--------
 macro/beamtime/mcbm2020/unpack_tsa_mcbm.C    |  2 ++
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/fles/mcbm2018/CbmMcbm2018Source.cxx b/fles/mcbm2018/CbmMcbm2018Source.cxx
index 151d39ebb0..3e42ec0d9c 100644
--- a/fles/mcbm2018/CbmMcbm2018Source.cxx
+++ b/fles/mcbm2018/CbmMcbm2018Source.cxx
@@ -117,7 +117,13 @@ Bool_t CbmMcbm2018Source::Init() {
                   fTimeSliceMetaDataArray,
                   fbWriteOutput);
 
-  /// Single spill unpacking
+  /// Single spill or spills range unpacking
+  /// => Obtain the start and stop TS indices for the TS loop from user supplied vectors
+  /// => Three possibilities linked to output of CbmMcbmSpillFindAlgo,
+  ///    choice controlled by fuFlagSpillStart
+  ///    - Beginning of the spill break
+  ///    - Middle of the spill break
+  ///    - End of the spill break
   if (0 <= fiUnpSpillIdxStart) {
     switch (fuFlagSpillStart) {
       case 0: {
@@ -333,6 +339,7 @@ Int_t CbmMcbm2018Source::FillBuffer() {
       }
     }  // if( 1 == fTSCounter )
 
+    /// Single spill or spills range unpacking
     if (0 <= fiUnpSpillIdxStart) {
       if (tsIndex < fuSpillBegTs) {
         /// Jump all TS until reaching the first TS in the spill we want to unpack
diff --git a/macro/beamtime/mcbm2020/find_spills_kronos.C b/macro/beamtime/mcbm2020/find_spills_kronos.C
index 138396fbb9..f4ea5834fd 100644
--- a/macro/beamtime/mcbm2020/find_spills_kronos.C
+++ b/macro/beamtime/mcbm2020/find_spills_kronos.C
@@ -1,11 +1,9 @@
-/** @file MCBM DATA unpacking
- ** @author Florian Uhlig <f.uhlig@gsi.de>
- ** @date 20.06.2016
- ** Modified by P.-A. Loizeau
- ** @date 30.01.2019
- ** ROOT macro to read tsa files which have been produced with the new data transport
- ** Convert data into cbmroot format.
- ** Uses CbmMcbm2018Source as source task.
+/** @file MCBM spill detection with T0, wrapper for lustre runs
+ ** @author Pierre-Alain Loizeau <p.-a.loizeau@gsi.de>
+ ** @date 16.02.2021
+ ** ROOT macro to read tsa files which have been produced in mCBM and use the T0 detector to
+ ** find the spill breaks beginning, middle and end TS index
+ ** This wrapper macro provides all lustre paths + easy [0; n] run index mapping
  */
 #include "find_spills.C"
 
diff --git a/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C b/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C
index 0be424de00..aadd7491ab 100644
--- a/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C
+++ b/macro/beamtime/mcbm2020/unpack_tsa_mcbm.C
@@ -609,6 +609,8 @@ Bool_t unpack_tsa_mcbm(TString inFile       = "",
   source->AddUnpacker(unpacker_rich, 0x30, ECbmModuleId::kRich);   // RICH trb
   source->AddUnpacker(unpacker_psd, 0x80, ECbmModuleId::kPsd);     // PSD
 
+  /// Select a pre-identified spills block through block index + block length (in spills)
+  /// Also select where we split the spills: beginning, middle or end of the spill break
   source->UnpackSelectSpills(iSpillIndex * iSpillnumber, iSpillIndex * iSpillnumber + iSpillnumber - 1, uSpillLimType);
   /// Disable clang formatting around vectors initialization by lists
   /* clang-format off */
-- 
GitLab