diff --git a/macro/rich/mcbm/beamtime/getToTOffsetDigi.C b/macro/rich/mcbm/beamtime/getToTOffsetDigi.C
new file mode 100644
index 0000000000000000000000000000000000000000..20a8bb2010551ea8d67da5b9ec9ae7c4b65cdd99
--- /dev/null
+++ b/macro/rich/mcbm/beamtime/getToTOffsetDigi.C
@@ -0,0 +1,90 @@
+/* Copyright (C) 2019-2020 Justus-Liebig-Universitaet Giessen, Giessen
+   SPDX-License-Identifier: GPL-3.0-only
+   Authors: Florian Uhlig, Adrian Amatus Weber [committer] */
+
+/** @file MCBM DATA unpacking and ToT Shift calculation
+ ** @author Florian Uhlig <f.uhlig@gsi.de>
+ ** @date 20.06.2016
+ ** Modified by P.-A. Loizeau
+ ** @date 30.01.2019
+ ** Modified by A. Weber
+ ** @date 07.02.2022
+ ** ROOT macro to read digi.root file which have been produced with latest unpacker.
+ ** Calculate the ToT Shifts (relative to current paramters) in all channels of diriches for Parameter File.
+ */
+// In order to call later Finish, we make this global
+
+void getToTOffsetDigi(UInt_t uRunId = 831, UInt_t nrEvents = 10000, TString outDir = "./data/ToTOffset/",
+                      TString inDir = "")  //1Event is 1TS
+{
+  TString srcDir = gSystem->Getenv("VMCWORKDIR");
+
+  TString inputDir = "/data/cbmroot/cbmsource/macro/run/data";
+  TString inFile   = Form("%s/2022038090316_0.digi.root", inputDir.Data());
+  //TString inFile   = Form("%s/%u.digi.root", inputDir.Data(),uRunId);
+
+  // --- Specify number of events to be produced.
+  // --- -1 means run until the end of the input file.
+  Int_t nEvents = -1;
+
+  // --- Set log output levels
+  FairLogger::GetLogger();
+  gLogger->SetLogScreenLevel("INFO");
+  //gLogger->SetLogScreenLevel("DEBUG4");
+  gLogger->SetLogVerbosityLevel("MEDIUM");
+  //gLogger->SetLogVerbosityLevel("LOW");
+
+  // --- Define parameter files
+  TList* parFileList = new TList();
+  TString paramDir   = srcDir + "/macro/beamtime/mcbm2021/";
+
+  TString paramFileRich       = paramDir + "mRichPar_70.par";
+  TObjString* parRichFileName = new TObjString(paramFileRich);
+  parFileList->Add(parRichFileName);
+
+  // --- Set debug level
+  gDebug = 0;
+
+  // ------------------------------------------------------------------------
+
+  FairRunAna* run             = new FairRunAna();
+  FairFileSource* inputSource = new FairFileSource(inFile.Data());
+  run->SetSource(inputSource);
+
+  // Add ToT Correction Finder
+  CbmRichMCbmToTShifter* tot = new CbmRichMCbmToTShifter();
+  //tot->GeneratePDF();
+  tot->ShowTdcId(true);
+  run->AddTask(tot);
+
+  // -----   Runtime database   ---------------------------------------------
+  FairRuntimeDb* rtdb       = run->GetRuntimeDb();
+  Bool_t kParameterMerged   = kTRUE;
+  FairParAsciiFileIo* parIn = new FairParAsciiFileIo();
+  parIn->open(parFileList, "in");
+  rtdb->setFirstInput(parIn);
+
+  run->Init();
+
+  // --- Start run
+  TStopwatch timer;
+  timer.Start();
+  std::cout << ">>> getToTOffsetDigi: Starting run..." << std::endl;
+  if (0 == nrEvents) {
+    run->Run(nEvents, 0);  // run until end of input file
+  }
+  else {
+    run->Run(0, nrEvents);  // process  2000 Events
+  }
+
+  timer.Stop();
+
+  // --- End-of-run info
+  Double_t rtime = timer.RealTime();
+  Double_t ctime = timer.CpuTime();
+  std::cout << std::endl << std::endl;
+  std::cout << ">>> getToTOffsetDigi: Macro finished successfully." << std::endl;
+  //std::cout << ">>> unpack_tsa_mcbm: Output file is " << outFile << std::endl;
+  std::cout << ">>> getToTOffsetDigi: Real time " << rtime << " s, CPU time " << ctime << " s" << std::endl;
+  std::cout << std::endl;
+}
diff --git a/macro/rich/mcbm/beamtime/run_reco_mcbm_real_wToF_jun21.C b/macro/rich/mcbm/beamtime/run_reco_mcbm_real_wToF_jun21.C
new file mode 100644
index 0000000000000000000000000000000000000000..99677f3f189e6243bb04a2658fc2512ec69f7835
--- /dev/null
+++ b/macro/rich/mcbm/beamtime/run_reco_mcbm_real_wToF_jun21.C
@@ -0,0 +1,1161 @@
+/* Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
+   SPDX-License-Identifier: GPL-3.0-only
+   Authors: Florian Uhlig [committer] */
+
+void run_reco_mcbm_real_wToF_jun21(const string srcfolder = "/lustre/cbm/users/ploizeau/"
+                                                            "mcbm2021/July2021",
+                                   const unsigned int runId = 1588,  // used for the output folder
+                                   int nEvents = 10, const int taskId = 5)
+{
+  // -----   File names   --------------------------------------------------
+  //  const string& parFile  = Form("/lustre/cbm/users/adrian/cbmgit/cbmsource/macro/beamtime/mcbm2021/data/unp_mcbm_params_%d.root", runId);
+  const string& digiFile = Form("%s/%4d_node8_2_0001.digi.root", srcfolder.c_str(), runId);
+  //const string& digiFile = Form("/lustre/cbm/users/adrian/cbmgit/cbmsource/macro/run/data/%4d.digi.root", runId);
+
+  const string& recoFile = Form("reco_mcbm_mar21_%d.root", runId);
+  TString setup          = "mcbm_beam_2021_07_surveyed";
+  // -----------------------------------------------------------------------
+
+
+  // -----   EventBuilder Settings-----------------------------------------
+  const Double_t eb_fixedTimeWindow {200.};
+  const Int_t eb_TriggerMinNumberT0 {1};
+  const Int_t eb_TriggerMinNumberSts {0};
+  const Int_t eb_TriggerMinNumberMuch {0};
+  const Int_t eb_TriggerMinNumberTof {10};
+  const Int_t eb_TriggerMinNumberRich {5};
+  // -----------------------------------------------------------------------
+
+
+  // -----   TOF defaults --------------------------------------------------
+  Int_t calMode      = 93;
+  Int_t calSel       = 1;
+  Int_t calSm        = 0;
+  Int_t RefSel       = 0;
+  Double_t dDeadtime = 50.;
+  Int_t iSel2        = 500;
+
+  // Tracking
+  Int_t iSel           = 500;  //910041;
+  Int_t iTrackingSetup = 10;
+  Int_t iGenCor        = 1;
+  Double_t dScalFac    = 1.;
+  Double_t dChi2Lim2   = 500.;
+  Bool_t bUseSigCalib  = kFALSE;
+  Int_t iCalOpt        = 1;
+  Int_t iTrkPar        = 3;
+  // -----------------------------------------------------------------------
+
+
+  // -----   TOF Settings --------------------------------------------------
+  TString cCalId = "490.100.5.0";
+  if (runId >= 759) cCalId = "759.100.4.0";
+  if (runId >= 812) cCalId = "831.100.4.0";
+  if (runId >= 1588) cCalId = "1588.50.6.0";
+  Int_t iCalSet = 30040500;  // calibration settings
+  if (runId >= 759) iCalSet = 10020500;
+  if (runId >= 812) iCalSet = 10020500;
+  if (runId >= 1588) iCalSet = 13003003;
+
+  Double_t Tint           = 100.;  // coincidence time interval
+  Int_t iTrackMode        = 2;     // 2 for TofTracker
+  const Int_t iTofCluMode = 1;
+  // -----------------------------------------------------------------------
+
+
+  // -----   Fair logger ---------------------------------------------------
+  FairLogger::GetLogger()->SetLogScreenLevel("INFO");
+  FairLogger::GetLogger()->SetLogVerbosityLevel("LOW");
+  TTree::SetMaxTreeSize(90000000000);
+  // -----------------------------------------------------------------------
+
+
+  TString myName  = "run_reco_mcbm_real";
+  TString srcDir  = gSystem->Getenv("VMCWORKDIR");  // top source directory
+  TString workDir = gSystem->Getenv("VMCWORKDIR");
+
+  remove(recoFile.c_str());
+
+  // -----   Load the geometry setup   -------------------------------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Loading setup " << setup << std::endl;
+  CbmSetup* pSetup = CbmSetup::Instance();
+  pSetup->LoadSetup(setup);
+  // You can modify the pre-defined setup by using
+  // CbmSetup::Instance()->RemoveModule(ESystemId) or
+  // CbmSetup::Instance()->SetModule(ESystemId, const char*, Bool_t) or
+  //CbmSetup::Instance()->SetActive(ESystemId, Bool_t)
+  pSetup->SetActive(ECbmModuleId::kMvd, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kSts, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kMuch, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kRich, kTRUE);
+  pSetup->SetActive(ECbmModuleId::kTrd, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kPsd, kFALSE);
+  // -----------------------------------------------------------------------
+
+
+  //TString TofFileFolder = Form("/lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2018/%s",cFileId.Data());
+  //    TString TofFileFolder = Form("/lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2019/%s",cFileId.Data());
+  //TString TofFileFolder = Form("/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020/%s", cCalId.Data());
+  TString TofFileFolder = Form("/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/%s", cCalId.Data());
+  //    TString setupFile = srcDir + "/geometry/setup/setup_" + geoSetup + ".C";
+  //    TString setupFunct = "setup_" + geoSetup + "()";
+  //    gROOT->LoadMacro(setupFile);
+  //    gROOT->ProcessLine(setupFunct);
+
+  std::cout << std::endl << "-I- " << myName << ": Defining parameter files " << std::endl;
+  TList* parFileList = new TList();
+
+
+  //-----------------------------------------------//
+  //   TString FId    = cCalId;
+  //   TString TofGeo = "v19b_mcbm"; //v18m_mCbm
+  //   TString TofGeo = "v20a_mcbm"; //v18m_mCbm
+
+
+  // ----- TOF digitisation parameters -------------------------------------
+  TString geoTag;
+  TString geoFile;
+  if (pSetup->IsActive(ECbmModuleId::kTof)) {
+    pSetup->GetGeoTag(ECbmModuleId::kTof, geoTag);
+    TObjString* tofBdfFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par");
+    //TObjString* tofBdfFile = new TObjString("/lustre/cbm/users/adrian/cbmgit/cbmsource/parameters/tof/tof_v21c_mcbm.digibdf.par");
+    parFileList->Add(tofBdfFile);
+    //    parFileList->Add("/lustre/cbm/users/adrian/cbmgit/cbmsource/parameters/tof/tof_v21c_mcbm.digibdf.par");
+    std::cout << "-I- " << myName << ": Using parameter file " << tofBdfFile->GetString() << std::endl;
+
+    //    geoFile = srcDir + "/geometry/tof/geofile_tof_" + geoTag + ".root";
+    //geoFile = "/lustre/cbm/users/nh/CBM/cbmroot/trunk/geometry/tof/geofile_tof_" + geoTag + ".root";
+    //geoFile = "/lustre/cbm/users/nh/CBM/cbmroot/trunk/geometry/tof/tof_" + geoTag + ".geo.root";
+    geoFile             = srcDir + "/macro/mcbm/data/mcbm_beam_2021_07_surveyed.geo.root";
+    TFile* fgeo         = new TFile(geoFile);
+    TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom");
+    if (NULL == geoMan) {
+      cout << "<E> FAIRGeom not found in geoFile " << geoFile.Data() << endl;
+      return;
+    }
+  }
+
+  // ------------------------------------------------------------------------
+
+  //   TObjString *tofDigiFile = new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par"); // TOF digi file
+  //   std::cout << std::endl<< "-I- digi.par file : "<<workDir << "/parameters/tof/tof_" << TofGeo << ".digi.par"<< std::endl;
+  //   parFileList->Add(tofDigiFile);
+  //
+  //   TObjString *tofDigiBdfFile = new TObjString( workDir  + "/parameters/tof/tof_" + TofGeo +".digibdf.par");
+  //   std::cout << std::endl<< "-I- digibdf.par file : "<<workDir << "/parameters/tof/tof_" << TofGeo << ".digibdf.par"<< std::endl;
+  //   parFileList->Add(tofDigiBdfFile);
+
+  //    TString geoDir  = workDir;  // gSystem->Getenv("VMCWORKDIR");
+  //    //TString geoFile = geoDir + "/geometry/tof/geofile_tof_" + TofGeo + ".root";
+  //    //TString geoFile = "/lustre/nyx/cbm/users/adrian/data/sim/rich/mcbm/sis18_mcbm_25deg_long_geofile_full.root"; //18m
+  // //   TString geoFile = srcDir + "/macro/mcbm/data/mcbm_beam_2019_11.geo.root";
+  //    TString geoFile = srcDir + "/macro/mcbm/data/mcbm_beam_2020_03.geo.root";
+  //    TFile* fgeo = new TFile(geoFile);
+  //    TGeoManager *geoMan = (TGeoManager*) fgeo->Get("FAIRGeom");
+  //    if (NULL == geoMan){
+  //      cout << "<E> FAIRGeom not found in geoFile"<<endl;
+  //      return;
+  //    }
+
+
+  // -----   Timer   --------------------------------------------------------
+  TStopwatch timer;
+  timer.Start();
+  // ------------------------------------------------------------------------
+
+
+  // ----    Debug option   -------------------------------------------------
+  gDebug = 0;
+  // ------------------------------------------------------------------------
+
+  gROOT->LoadMacro("save_hst.C");
+
+
+  // -----   Input file   ---------------------------------------------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Using input file " << digiFile << std::endl;
+  // ------------------------------------------------------------------------
+
+  // -----   FairRunAna   ---------------------------------------------------
+  FairRunAna* run             = new FairRunAna();
+  FairFileSource* inputSource = new FairFileSource(digiFile.c_str());
+  run->SetSource(inputSource);
+  run->SetOutputFile(recoFile.c_str());
+  //     run->SetGenerateRunInfo(kFALSE);
+  //if (hasFairMonitor) FairMonitor::GetMonitor()->EnableMonitor(kTRUE);
+
+
+  // -----   Cbm EventBuilder   ---------------------------------------------------
+  CbmMcbm2018EventBuilder* eventBuilder = new CbmMcbm2018EventBuilder();
+  //	eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::MaximumTimeGap);
+  eventBuilder->SetMaximumTimeGap(200.);
+  eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::FixedTimeWindow);
+  eventBuilder->SetFixedTimeWindow(eb_fixedTimeWindow);
+  eventBuilder->SetTriggerMinNumberT0(eb_TriggerMinNumberT0);
+  eventBuilder->SetTriggerMinNumberSts(eb_TriggerMinNumberSts);
+  eventBuilder->SetTriggerMinNumberMuch(eb_TriggerMinNumberMuch);
+  eventBuilder->SetTriggerMinNumberTof(eb_TriggerMinNumberTof);
+  eventBuilder->SetTriggerMinNumberRich(eb_TriggerMinNumberRich);
+  eventBuilder->SetFillHistos(kFALSE);  // to prevent memory leak???
+
+  run->AddTask(eventBuilder);
+
+
+  // -----   Local reconstruction of RICH Hits ---------------
+  CbmRichMCbmHitProducer* hitProd = new CbmRichMCbmHitProducer();
+  hitProd->SetMappingFile("mRICH_Mapping_vert_20190318_elView.geo");
+  hitProd->setToTLimits(23.7, 30.0);
+  hitProd->applyToTCut();
+  run->AddTask(hitProd);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Local reconstruction in RICh -> Finding of Rings ---------------
+  CbmRichReconstruction* richReco = new CbmRichReconstruction();
+  richReco->UseMCbmSetup();
+  run->AddTask(richReco);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Local reconstruction in TOF   ----------------------------------
+  TString cFname;
+  switch (iTofCluMode) {
+    case 1: {
+      CbmTofEventClusterizer* tofCluster = new CbmTofEventClusterizer("TOF Event Clusterizer", 0, 1);
+      //		cFname=Form("/%s_set%09d_%02d_%01dtofClust.hst.root",cCalId.Data(),iCalSet,calMode,calSel);
+      //      cFname = Form("/%s_set%09d_%02d_%01d_noWalk_tofClust.hst.root", cCalId.Data(), iCalSet, calMode, calSel);
+      cFname = Form("/%s_set%09d_%02d_%01dtofClust.hst.root", cCalId.Data(), iCalSet, calMode, calSel);
+      tofCluster->SetCalParFileName(TofFileFolder + cFname);
+      tofCluster->SetCalMode(calMode);
+      tofCluster->SetCalSel(calSel);
+      tofCluster->SetCaldXdYMax(300.);            // geometrical matching window in cm
+      tofCluster->SetCalCluMulMax(3.);            // Max Counter Cluster Multiplicity for filling calib histos
+      tofCluster->SetCalRpc(calSm);               // select detector for calibration update
+      tofCluster->SetTRefId(RefSel);              // reference trigger for offset calculation
+      tofCluster->SetTotMax(20.);                 // Tot upper limit for walk corection
+      tofCluster->SetTotMin(0.);                  // Tot lower limit for walk correction
+      tofCluster->SetTotPreRange(5.);             // effective lower Tot limit  in ns from peak position
+      tofCluster->SetTotMean(5.);                 // Tot calibration target value in ns
+      tofCluster->SetMaxTimeDist(1.0);            // default cluster range in ns
+      tofCluster->SetDelTofMax(50.);              // acceptance range for cluster distance in ns (!)
+      tofCluster->SetSel2MulMax(3);               // limit Multiplicity in 2nd selector
+      tofCluster->SetChannelDeadtime(dDeadtime);  // artificial deadtime in ns
+      tofCluster->SetEnableAvWalk(kFALSE);
+      //tofCluster->SetEnableMatchPosScaling(kFALSE); // turn off projection to nominal target
+      tofCluster->SetYFitMin(1.E4);
+      tofCluster->SetToDAv(0.04);
+      tofCluster->SetIdMode(1);        // calibrate on module level
+      tofCluster->SetTRefDifMax(2.0);  // in ns
+      tofCluster->PosYMaxScal(0.75);   //in % of length
+      Int_t iBRef    = iCalSet % 1000;
+      Int_t iSet     = (iCalSet - iBRef) / 1000;
+      Int_t iRSel    = 0;
+      Int_t iRSelTyp = 0;
+      Int_t iRSelSm  = 0;
+      Int_t iRSelRpc = 0;
+      iRSel          = iBRef;  // use diamond
+      Int_t iRSelin  = iRSel;
+      iRSelRpc       = iRSel % 10;
+      iRSelTyp       = (iRSel - iRSelRpc) / 10;
+      iRSelSm        = iRSelTyp % 10;
+      iRSelTyp       = (iRSelTyp - iRSelSm) / 10;
+      tofCluster->SetBeamRefId(iRSelTyp);  // define Beam reference counter
+      tofCluster->SetBeamRefSm(iRSelSm);
+      tofCluster->SetBeamRefDet(iRSelRpc);
+      tofCluster->SetBeamAddRefMul(-1);
+      tofCluster->SetBeamRefMulMax(3);
+      Int_t iSel2in  = iSel2;
+      Int_t iSel2Rpc = iSel2 % 10;
+      iSel2          = (iSel2 - iSel2Rpc) / 10;
+      Int_t iSel2Sm  = iSel2 % 10;
+      iSel2          = (iSel2 - iSel2Sm) / 10;
+      if (iSel2 > -1) {
+        tofCluster->SetSel2Id(iSel2);
+        tofCluster->SetSel2Sm(iSel2Sm);
+        tofCluster->SetSel2Rpc(iSel2Rpc);
+      }
+      Int_t iRef    = iSet % 1000;
+      Int_t iDut    = (iSet - iRef) / 1000;
+      Int_t iDutRpc = iDut % 10;
+      iDut          = (iDut - iDutRpc) / 10;
+      Int_t iDutSm  = iDut % 10;
+      iDut          = (iDut - iDutSm) / 10;
+      tofCluster->SetDutId(iDut);
+      tofCluster->SetDutSm(iDutSm);
+      tofCluster->SetDutRpc(iDutRpc);
+
+      Int_t iRefRpc = iRef % 10;
+      iRef          = (iRef - iRefRpc) / 10;
+      Int_t iRefSm  = iRef % 10;
+      iRef          = (iRef - iRefSm) / 10;
+
+      tofCluster->SetSelId(iRef);
+      tofCluster->SetSelSm(iRefSm);
+      tofCluster->SetSelRpc(iRefRpc);
+
+      run->AddTask(tofCluster);
+      std::cout << "-I- " << myName << ": Added task " << tofCluster->GetName() << std::endl;
+    } break;
+
+    default: {
+      ;
+    }
+  }
+  // -------------------------------------------------------------------------
+
+  /*
+  // =========================================================================
+  // ===                   Tof Tracking                                    ===
+  // =========================================================================
+  cout << "<I> Initialize Tof tracker by ini_trks" << endl;
+  TString cTrkFile = Form("/%s_tofFindTracks.hst.root", cCalId.Data());
+  // -----   Local selection variables  -------------------------------------------
+
+  Int_t iRef    = iSel % 1000;
+  Int_t iDut    = (iSel - iRef) / 1000;
+  Int_t iDutRpc = iDut % 10;
+  iDut          = (iDut - iDutRpc) / 10;
+  Int_t iDutSm  = iDut % 10;
+  iDut          = (iDut - iDutSm) / 10;
+  //Int_t iRefRpc = iRef % 10;
+  //iRef          = (iRef - iRefRpc) / 10;
+  //  Int_t iRefSm  = iRef % 10;
+  //  iRef          = (iRef - iRefSm) / 10;
+  Int_t iBucRpc = 0;
+
+  CbmTofTrackFinderNN* tofTrackFinder = new CbmTofTrackFinderNN();
+  tofTrackFinder->SetMaxTofTimeDifference(0.2);  // in ns/cm
+
+  CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211);
+  TFitter* MyFit                    = new TFitter(1);  // initialize Minuit
+  tofTrackFinder->SetFitter(tofTrackFitter);
+  CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder");
+  tofFindTracks->UseFinder(tofTrackFinder);
+  tofFindTracks->UseFitter(tofTrackFitter);
+
+  tofFindTracks->SetCalOpt(iCalOpt);   // 1 - update offsets, 2 - update walk, 0 - bypass
+  tofFindTracks->SetCorMode(iGenCor);  // valid options: 0,1,2,3,4,5,6, 10 - 19
+  //tofFindTracks->SetTtTarg(0.047);     // target value for Mar2021 double stack, v21b
+  tofFindTracks->SetTtTarg(0.035);  // target value for Jun2021 double stack, v21c
+  //  0.0605);  // target value for Mar2020 triple stack -> betapeak ~ 0.95
+  //tofFindTracks->SetTtTarg(0.062);           // target value for Mar2020 triple stack -> betapeak ~ 0.95
+  //tofFindTracks->SetTtTarg(0.058);           // target value for Mar2020 double stack
+  //tofFindTracks->SetTtTarg(0.051);           // target value Nov2019
+  //tofFindTracks->SetTtTarg(0.035);           // target value for inverse velocity, > 0.033 ns/cm!
+  tofFindTracks->SetCalParFileName(TofFileFolder + cTrkFile);  // Tracker parameter value file name
+  tofFindTracks->SetR0Lim(5.);
+  tofFindTracks->SetStationMaxHMul(30);  // Max Hit Multiplicity in any used station
+
+  tofFindTracks->SetT0MAX(dScalFac);            // in ns
+  tofFindTracks->SetSIGT(0.08);                 // default in ns
+  tofFindTracks->SetSIGX(0.3);                  // default in cm
+  tofFindTracks->SetSIGY(0.45);                 // default in cm
+  tofFindTracks->SetSIGZ(0.05);                 // default in cm
+  tofFindTracks->SetUseSigCalib(bUseSigCalib);  // ignore resolutions in CalPar file
+  tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.);    // matching window in multiples of chi2
+  tofTrackFinder->SetChiMaxAccept(dChi2Lim2);   // max tracklet chi2
+  tofTrackFinder->SetSIGLIMMOD(5.);             // max deviation for last hit
+  tofTrackFinder->SetAddVertex(kFALSE);         // disable virtual vertex
+
+  cout << "<I> Tracker Parameter Set: " << iTrkPar << endl;
+  switch (iTrkPar) {
+    case 0:                                    // for full mTof setup
+      tofTrackFinder->SetTxMean(0.);           // mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);           // mean slope dy/dz
+      tofTrackFinder->SetTxLIM(0.3);           // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.3);           // max dev from mean slope dy/dz
+      tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
+      break;
+    case 1:                                    // for double stack test counters
+      tofTrackFinder->SetTxMean(0.);           // mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.18);         // mean slope dy/dz
+      tofTrackFinder->SetTxLIM(0.15);          // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.18);          // max dev from mean slope dy/dz
+      tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
+      break;
+    case 2:                             // for double stack cosmics
+      tofTrackFinder->SetTxMean(0.);    // mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);    // mean slope dy/dz
+      tofTrackFinder->SetTxLIM(2.);     // max slope dx/dz
+      tofTrackFinder->SetTyLIM(20.);    // max dev from mean slope dy/dz
+      tofFindTracks->SetTtMin(-100.);   // allow negative velocities with respect to z-axis
+      tofFindTracks->SetTtTarg(0.033);  // target value for mCBM Cosmic2021 triple stack, v21c
+      tofFindTracks->SetSIGT(0.2);      // default in ns
+      break;
+    case 3:                                 // for Jul2021-CRI
+      tofTrackFinder->SetTxMean(-0.2);      // mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);        // mean slope dy/dz
+      tofTrackFinder->SetTxLIM(0.1);        // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.3);        // max dev from mean slope dy/dz
+      tofTrackFinder->SetAddVertex(kTRUE);  // add virtual vertex
+      tofFindTracks->SetTtMin(-100.);       // allow negative velocities with respect to z-axis
+      tofFindTracks->SetR0Lim(30.);         // allow for large extrapolation errors
+      break;
+  }
+
+  Int_t iMinNofHits   = -1;
+  Int_t iNStations    = 0;
+  Int_t iNReqStations = 3;
+
+  switch (iTrackingSetup) {
+    case 0:  // bypass mode
+      iMinNofHits = -1;
+      iNStations  = 1;
+      tofFindTracks->SetStation(0, 5, 0, 0);  // Diamond
+      break;
+
+    case 1:  // for calibration mode of full setup
+    {
+      Double_t dTsig = dScalFac * 0.03;
+      tofFindTracks->SetSIGT(dTsig);  // allow for variable deviations in ns
+    }
+      iMinNofHits   = 3;
+      iNStations    = 30;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 2, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 0, 2);
+      tofFindTracks->SetStation(4, 0, 2, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 0, 1);
+      tofFindTracks->SetStation(7, 0, 2, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 0, 3);
+      tofFindTracks->SetStation(10, 0, 2, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 0, 0);
+      tofFindTracks->SetStation(13, 0, 2, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 0, 4);
+      tofFindTracks->SetStation(16, 0, 4, 0);
+      tofFindTracks->SetStation(17, 0, 3, 0);
+      tofFindTracks->SetStation(18, 0, 4, 1);
+      tofFindTracks->SetStation(19, 0, 3, 1);
+      tofFindTracks->SetStation(20, 0, 4, 2);
+      tofFindTracks->SetStation(21, 0, 3, 2);
+      tofFindTracks->SetStation(22, 0, 4, 3);
+      tofFindTracks->SetStation(23, 0, 3, 3);
+      tofFindTracks->SetStation(24, 0, 4, 4);
+      tofFindTracks->SetStation(25, 0, 3, 4);
+      tofFindTracks->SetStation(26, 9, 0, 0);
+      tofFindTracks->SetStation(27, 9, 1, 0);
+      tofFindTracks->SetStation(28, 9, 0, 1);
+      tofFindTracks->SetStation(29, 9, 1, 1);
+      //tofFindTracks->SetStation(28, 6, 0, 0);
+      //tofFindTracks->SetStation(29, 6, 0, 1);
+      break;
+
+    case 10:  // for calibration mode of full setup
+    {
+      Double_t dTsig = dScalFac * 0.03;
+      tofFindTracks->SetSIGT(dTsig);  // allow for variable deviations in ns
+    }
+      iMinNofHits   = 3;
+      iNStations    = 37;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(36, 5, 0, 0);
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 1, 2);
+      tofFindTracks->SetStation(2, 0, 0, 2);
+      tofFindTracks->SetStation(3, 0, 2, 1);
+      tofFindTracks->SetStation(4, 0, 1, 1);
+      tofFindTracks->SetStation(5, 0, 0, 1);
+      tofFindTracks->SetStation(6, 0, 2, 3);
+      tofFindTracks->SetStation(7, 0, 1, 3);
+      tofFindTracks->SetStation(8, 0, 0, 3);
+      tofFindTracks->SetStation(9, 0, 2, 0);
+      tofFindTracks->SetStation(10, 0, 1, 0);
+      tofFindTracks->SetStation(11, 0, 0, 0);
+      tofFindTracks->SetStation(12, 0, 2, 4);
+      tofFindTracks->SetStation(13, 0, 1, 4);
+      tofFindTracks->SetStation(14, 0, 0, 4);
+      tofFindTracks->SetStation(15, 0, 4, 0);
+      tofFindTracks->SetStation(16, 0, 3, 0);
+      tofFindTracks->SetStation(17, 0, 4, 1);
+      tofFindTracks->SetStation(18, 0, 3, 1);
+      tofFindTracks->SetStation(19, 0, 4, 2);
+      tofFindTracks->SetStation(20, 0, 3, 2);
+      tofFindTracks->SetStation(21, 0, 4, 3);
+      tofFindTracks->SetStation(22, 0, 3, 3);
+      tofFindTracks->SetStation(23, 0, 4, 4);
+      tofFindTracks->SetStation(24, 0, 3, 4);
+      tofFindTracks->SetStation(25, 9, 0, 0);
+      tofFindTracks->SetStation(26, 9, 1, 0);
+      tofFindTracks->SetStation(27, 9, 0, 1);
+      tofFindTracks->SetStation(28, 9, 1, 1);
+      tofFindTracks->SetStation(29, 6, 0, 0);
+      tofFindTracks->SetStation(30, 6, 0, 1);
+      tofFindTracks->SetStation(31, 2, 0, 0);
+      tofFindTracks->SetStation(32, 2, 0, 1);
+      tofFindTracks->SetStation(33, 2, 0, 2);
+      tofFindTracks->SetStation(34, 2, 0, 3);
+      tofFindTracks->SetStation(35, 2, 0, 4);
+      break;
+
+    case 11:  // for calibration mode of 2-stack & test counters
+      iMinNofHits   = 3;
+      iNStations    = 17;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 4, 0);
+      tofFindTracks->SetStation(1, 0, 3, 0);
+      tofFindTracks->SetStation(2, 0, 4, 1);
+      tofFindTracks->SetStation(3, 0, 3, 1);
+      tofFindTracks->SetStation(4, 0, 4, 2);
+      tofFindTracks->SetStation(5, 0, 3, 2);
+      tofFindTracks->SetStation(6, 0, 4, 3);
+      tofFindTracks->SetStation(7, 0, 3, 3);
+      tofFindTracks->SetStation(8, 0, 4, 4);
+      tofFindTracks->SetStation(9, 0, 3, 4);
+      tofFindTracks->SetStation(10, 9, 0, 0);
+      tofFindTracks->SetStation(11, 9, 1, 0);
+      tofFindTracks->SetStation(12, 9, 0, 1);
+      tofFindTracks->SetStation(13, 9, 1, 1);
+      tofFindTracks->SetStation(14, 6, 0, 0);
+      tofFindTracks->SetStation(15, 6, 0, 1);
+      tofFindTracks->SetStation(16, 5, 0, 0);
+      break;
+
+    case 12:  // for calibration mode of 2-stack & test counters
+      iMinNofHits   = 3;
+      iNStations    = 9;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 6, 0, 0);
+      tofFindTracks->SetStation(5, 9, 0, 1);
+      tofFindTracks->SetStation(6, 9, 1, 1);
+      tofFindTracks->SetStation(7, 6, 0, 1);
+      tofFindTracks->SetStation(8, 5, 0, 0);
+      break;
+
+    case 13:  // for calibration mode of triple-stack (july2021-cri)
+      iMinNofHits   = 3;
+      iNStations    = 10;
+      iNReqStations = 3;
+      tofFindTracks->SetStation(0, 0, 1, 2);
+      tofFindTracks->SetStation(1, 0, 0, 2);
+      tofFindTracks->SetStation(2, 0, 1, 1);
+      tofFindTracks->SetStation(3, 0, 0, 1);
+      tofFindTracks->SetStation(4, 0, 1, 3);
+      tofFindTracks->SetStation(5, 0, 0, 3);
+      tofFindTracks->SetStation(6, 0, 1, 0);
+      tofFindTracks->SetStation(7, 0, 0, 0);
+      tofFindTracks->SetStation(8, 0, 1, 4);
+      tofFindTracks->SetStation(9, 0, 0, 4);
+      break;
+
+    case 113:  // for double stack TSHU counter (031)
+      iMinNofHits   = 6;
+      iNStations    = 7;
+      iNReqStations = 7;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 9, 0, 0);
+      tofFindTracks->SetStation(5, 5, 0, 0);
+      tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 114:  // for double stack TSHU counter (041)
+      iMinNofHits   = 6;
+      iNStations    = 7;
+      iNReqStations = 7;
+      tofFindTracks->SetStation(0, 9, 1, 1);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 9, 0, 0);
+      tofFindTracks->SetStation(5, 5, 0, 0);
+      tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 116:  // for evaluation of BUC counter (600, 601)
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 117:  // for evaluation of BUC counter (600, 601)
+      iMinNofHits   = 5;
+      iNStations    = 6;
+      iNReqStations = 6;
+      iBucRpc       = 1 - iDutRpc;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 6, 0, iBucRpc);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 2:
+      iMinNofHits   = 3;
+      iNStations    = 28;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 0, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 2, 1);
+      tofFindTracks->SetStation(4, 0, 0, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 2, 3);
+      tofFindTracks->SetStation(7, 0, 0, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 2, 0);
+      tofFindTracks->SetStation(10, 0, 0, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 2, 4);
+      tofFindTracks->SetStation(13, 0, 0, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 4, 0);
+      tofFindTracks->SetStation(16, 0, 3, 0);
+      tofFindTracks->SetStation(17, 0, 4, 1);
+      tofFindTracks->SetStation(18, 0, 3, 1);
+      tofFindTracks->SetStation(19, 0, 4, 2);
+      tofFindTracks->SetStation(20, 0, 3, 2);
+      tofFindTracks->SetStation(21, 0, 4, 3);
+      tofFindTracks->SetStation(22, 0, 3, 3);
+      tofFindTracks->SetStation(23, 0, 4, 4);
+      tofFindTracks->SetStation(24, 0, 3, 4);
+      tofFindTracks->SetStation(25, 9, 0, 0);
+      tofFindTracks->SetStation(26, 9, 0, 1);
+      tofFindTracks->SetStation(27, 5, 0, 0);
+      break;
+
+    case 3:
+      iMinNofHits   = 3;
+      iNStations    = 16;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 2, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 0, 2);
+
+      tofFindTracks->SetStation(4, 0, 2, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 0, 1);
+
+      tofFindTracks->SetStation(7, 0, 2, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 0, 3);
+
+      tofFindTracks->SetStation(10, 0, 2, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 0, 0);
+
+      tofFindTracks->SetStation(13, 0, 2, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 0, 4);
+
+      /*
+     tofFindTracks->SetStation(16, 0, 3, 2);         
+     tofFindTracks->SetStation(17, 0, 4, 2);  
+     tofFindTracks->SetStation(18, 0, 3, 1);         
+     tofFindTracks->SetStation(19, 0, 4, 1);
+     tofFindTracks->SetStation(20, 0, 3, 3);         
+     tofFindTracks->SetStation(21, 0, 4, 3);
+     tofFindTracks->SetStation(22, 0, 3, 0);         
+     tofFindTracks->SetStation(23, 0, 4, 0);
+     tofFindTracks->SetStation(24, 0, 3, 4);         
+     tofFindTracks->SetStation(25, 0, 4, 4); 
+     */
+  /* break;
+
+    case 31:  // cosmic triple stack, Aug 2021
+      iMinNofHits   = 3;
+      iNStations    = 20;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 0, 2);
+      tofFindTracks->SetStation(1, 0, 2, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 2, 0, 2);
+
+      tofFindTracks->SetStation(4, 0, 0, 1);
+      tofFindTracks->SetStation(5, 0, 2, 1);
+      tofFindTracks->SetStation(6, 0, 1, 1);
+      tofFindTracks->SetStation(7, 2, 0, 1);
+
+      tofFindTracks->SetStation(8, 0, 0, 3);
+      tofFindTracks->SetStation(9, 0, 2, 3);
+      tofFindTracks->SetStation(10, 0, 1, 3);
+      tofFindTracks->SetStation(11, 2, 0, 3);
+
+      tofFindTracks->SetStation(12, 0, 0, 0);
+      tofFindTracks->SetStation(13, 0, 2, 0);
+      tofFindTracks->SetStation(14, 0, 1, 0);
+      tofFindTracks->SetStation(15, 2, 0, 0);
+
+      tofFindTracks->SetStation(16, 0, 0, 4);
+      tofFindTracks->SetStation(17, 0, 2, 4);
+      tofFindTracks->SetStation(18, 0, 1, 4);
+      tofFindTracks->SetStation(19, 2, 0, 4);
+      break;
+
+    case 4:  // for USTC evaluation (dut=910,911)
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      //tofFindTracks->SetStation(2, 9, 0, 1);  // broken in May2021
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 5, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 40:  // for USTC evaluation (dut=910)
+      iMinNofHits   = 4;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      //tofFindTracks->SetStation(2, 9, 0, 1);
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 9, 1, 1);
+      tofFindTracks->SetStation(4, 5, 0, 0);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 41:  // for USTC evaluation (dut=911)
+      iMinNofHits   = 4;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      //tofFindTracks->SetStation(2, 9, 0, 1);
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 5, 0, 0);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 42:  // for USTC evaluation (dut=900, 901)
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 6, 0, 0);
+      tofFindTracks->SetStation(3, 6, 0, 1);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 43:  // for USTC evaluation (dut=900, 901)
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 6, 0, 1);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 14:
+      iMinNofHits   = 3;
+      iNStations    = 15;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 1, 2);
+      tofFindTracks->SetStation(2, 0, 0, 2);
+      tofFindTracks->SetStation(0, 0, 2, 1);
+      tofFindTracks->SetStation(1, 0, 1, 1);
+      tofFindTracks->SetStation(2, 0, 0, 1);
+      tofFindTracks->SetStation(0, 0, 2, 0);
+      tofFindTracks->SetStation(1, 0, 1, 0);
+      tofFindTracks->SetStation(2, 0, 0, 0);
+      tofFindTracks->SetStation(0, 0, 2, 3);
+      tofFindTracks->SetStation(1, 0, 1, 3);
+      tofFindTracks->SetStation(2, 0, 0, 3);
+      tofFindTracks->SetStation(0, 0, 2, 4);
+      tofFindTracks->SetStation(1, 0, 1, 4);
+      tofFindTracks->SetStation(2, 0, 0, 4);
+      break;
+
+    case 5:  // for evaluation of Buc in 2-stack
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 4, 3);
+      tofFindTracks->SetStation(1, 0, 3, 3);
+      tofFindTracks->SetStation(2, 5, 0, 0);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 50:  // for evaluation of Buc in 2-stack
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 3);
+      tofFindTracks->SetStation(1, 0, 3, 3);
+      tofFindTracks->SetStation(2, 6, 0, 1);
+      tofFindTracks->SetStation(3, 5, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 51:  // for evaluation of Buc in 2-stack
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 3);
+      tofFindTracks->SetStation(1, 0, 3, 3);
+      tofFindTracks->SetStation(2, 6, 0, 0);
+      tofFindTracks->SetStation(3, 5, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 6:  // for double stack TSHU counter (900,901) evaluation
+      iMinNofHits   = 5;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 5, 0, 0);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 60:  // for double stack TSHU counter (900) evaluation
+      iMinNofHits   = 5;
+      iNStations    = 7;
+      iNReqStations = 7;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 9, 0, 1);
+      tofFindTracks->SetStation(5, 5, 0, 0);
+      tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 61:  // for double stack TSHU counter (901) evaluation
+      iMinNofHits   = 5;
+      iNStations    = 7;
+      iNReqStations = 7;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 9, 0, 0);
+      tofFindTracks->SetStation(5, 5, 0, 0);
+      tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 7:  // for double stack mTOF counter evaluation
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 9, 1, 1);
+      tofFindTracks->SetStation(1, 9, 0, 0);
+      tofFindTracks->SetStation(2, 9, 1, 0);
+      tofFindTracks->SetStation(3, 5, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 8:  // evaluation of add-on counters (BUC)
+      iMinNofHits = 5;
+      iNStations  = 6;
+
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 0, 4, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 0, 3, 1);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 81:  // evaluation of add-on counters (BUC) in July 2021
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 9, 0, 1);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 9:  // evaluation of M6, Dut=202
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 0, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 5, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 992:  // evaluation of CRI cosmics 2021
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      {
+        Int_t iType[4]   = {0, 0, 0, 2};
+        Int_t iModule[4] = {0, 2, 1, 0};
+        Int_t iSt        = 0;
+        for (Int_t iM = 0; iM < iNStations; iM++) {
+          if (iType[iM] == iDut && iModule[iM] == iDutSm) continue;
+          tofFindTracks->SetStation(iSt, iType[iM], iModule[iM], iDutRpc);
+          iSt++;
+        }
+      }
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    default:
+      cout << "Tracking setup " << iTrackingSetup << " not implemented " << endl;
+      return;
+      ;
+  }
+  tofFindTracks->SetMinNofHits(iMinNofHits);
+  tofFindTracks->SetNStations(iNStations);
+  tofFindTracks->SetNReqStations(iNReqStations);
+  tofFindTracks->PrintSetup();
+  run->AddTask(tofFindTracks);
+
+  
+  // -----   Track reconstruction   ------------------------------------------
+  /*
+  Double_t beamWidthX = 0.1;
+  Double_t beamWidthY = 0.1;
+  switch (iTrackMode) {
+    case 2: {
+      Int_t iGenCor                     = 1;
+      Double_t dScalFac                 = 1.;
+      Double_t dChi2Lim2                = 3.5;
+      TString cTrkFile                  = Form("/%s_tofFindTracks.hst.root", cCalId.Data());
+      Int_t iTrackingSetup              = 1;
+      CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN();
+      tofTrackFinder->SetMaxTofTimeDifference(0.2);  // in ns/cm
+      tofTrackFinder->SetTxLIM(0.3);                 // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.3);                 // max dev from mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);                 // mean slope dy/dz
+      CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211);
+      TFitter* MyFit                    = new TFitter(1);  // initialize Minuit
+      tofTrackFinder->SetFitter(tofTrackFitter);
+      CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder");
+      tofFindTracks->UseFinder(tofTrackFinder);
+      tofFindTracks->UseFitter(tofTrackFitter);
+      tofFindTracks->SetCorMode(iGenCor);  // valid options: 0,1,2,3,4,5,6, 10 - 19
+      tofFindTracks->SetTtTarg(0.041);     // target value for inverse velocity, > 0.033 ns/cm!
+      //tofFindTracks->SetTtTarg(0.035);            // target value for inverse velocity, > 0.033 ns/cm!
+      tofFindTracks->SetCalParFileName(TofFileFolder + cTrkFile);  // Tracker parameter value file name
+      tofFindTracks->SetBeamCounter(5, 0, 0);                      // default beam counter
+      tofFindTracks->SetStationMaxHMul(30);                        // Max Hit Multiplicity in any used station
+
+
+      tofFindTracks->SetT0MAX(dScalFac);           // in ns
+      tofFindTracks->SetSIGT(0.08);                // default in ns
+      tofFindTracks->SetSIGX(0.3);                 // default in cm
+      tofFindTracks->SetSIGY(0.45);                // default in cm
+      tofFindTracks->SetSIGZ(0.05);                // default in cm
+      tofFindTracks->SetUseSigCalib(kFALSE);       // ignore resolutions in CalPar file
+      tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.);   // matching window in multiples of chi2
+      tofTrackFinder->SetChiMaxAccept(dChi2Lim2);  // max tracklet chi2
+
+      Int_t iMinNofHits   = -1;
+      Int_t iNStations    = 0;
+      Int_t iNReqStations = 3;
+
+      switch (iTrackingSetup) {
+        case 0:  // bypass mode
+          iMinNofHits = -1;
+          iNStations  = 1;
+          tofFindTracks->SetStation(0, 5, 0, 0);  // Diamond
+          break;
+
+        case 1:  // for calibration mode of full setup
+          iMinNofHits   = 3;
+          iNStations    = 30;
+          iNReqStations = 4;
+          tofFindTracks->SetStation(0, 5, 0, 0);
+          tofFindTracks->SetStation(1, 0, 2, 2);
+          tofFindTracks->SetStation(2, 0, 1, 2);
+          tofFindTracks->SetStation(3, 0, 0, 2);
+          tofFindTracks->SetStation(4, 0, 2, 1);
+          tofFindTracks->SetStation(5, 0, 1, 1);
+          tofFindTracks->SetStation(6, 0, 0, 1);
+          tofFindTracks->SetStation(7, 0, 2, 3);
+          tofFindTracks->SetStation(8, 0, 1, 3);
+          tofFindTracks->SetStation(9, 0, 0, 3);
+          tofFindTracks->SetStation(10, 0, 2, 0);
+          tofFindTracks->SetStation(11, 0, 1, 0);
+          tofFindTracks->SetStation(12, 0, 0, 0);
+          tofFindTracks->SetStation(13, 0, 2, 4);
+          tofFindTracks->SetStation(14, 0, 1, 4);
+          tofFindTracks->SetStation(15, 0, 0, 4);
+          tofFindTracks->SetStation(16, 0, 4, 0);
+          tofFindTracks->SetStation(17, 0, 3, 0);
+          tofFindTracks->SetStation(18, 0, 4, 1);
+          tofFindTracks->SetStation(19, 0, 3, 1);
+          tofFindTracks->SetStation(20, 0, 4, 2);
+          tofFindTracks->SetStation(21, 0, 3, 2);
+          tofFindTracks->SetStation(22, 0, 4, 3);
+          tofFindTracks->SetStation(23, 0, 3, 3);
+          tofFindTracks->SetStation(24, 0, 4, 4);
+          tofFindTracks->SetStation(25, 0, 3, 4);
+          tofFindTracks->SetStation(26, 9, 0, 0);
+          tofFindTracks->SetStation(27, 9, 0, 1);
+          tofFindTracks->SetStation(28, 6, 0, 0);
+          tofFindTracks->SetStation(29, 6, 0, 1);
+          break;
+      }
+      tofFindTracks->SetMinNofHits(iMinNofHits);
+      tofFindTracks->SetNStations(iNStations);
+      tofFindTracks->SetNReqStations(iNReqStations);
+      tofFindTracks->PrintSetup();
+      run->AddTask(tofFindTracks);
+    } break;
+
+    case 1: {
+    }
+
+    case 0:
+
+    default:;
+  }
+  */
+  // ------------------------------------------------------------------------
+
+
+  // =========================================================================
+  // ===                           RICH QA                                 ===
+  // =========================================================================
+
+  CbmRichMCbmQaReal* qaTask = new CbmRichMCbmQaReal();
+  if (taskId < 0) { qaTask->SetOutputDir(Form("result_run%d", runId)); }
+  else {
+    qaTask->SetOutputDir(Form("result_run%d_%05d", runId, taskId));
+  }
+  // qaTask->DoRestrictToAcc();  // restrict to mRICH MAR2019 in histFilling
+  qaTask->XOffsetHistos(+25.3);
+  qaTask->SetMaxNofDrawnEvents(100);
+  qaTask->SetTotRich(23.7, 30.0);
+  qaTask->SetTriggerRichHits(eb_TriggerMinNumberRich);
+  qaTask->SetTriggerTofHits(0);  // eb_TriggerMinNumberTof);
+  run->AddTask(qaTask);
+  // ------------------------------------------------------------------------
+
+
+  // -----  Parameter database   --------------------------------------------
+  std::cout << std::endl << std::endl << "-I- " << myName << ": Set runtime DB" << std::endl;
+  FairRuntimeDb* rtdb        = run->GetRuntimeDb();
+  Bool_t kParameterMerged    = kTRUE;
+  FairParRootFileIo* parIo1  = new FairParRootFileIo(kParameterMerged);
+  FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
+  parIo2->open(parFileList, "in");
+  parIo2->print();
+  rtdb->setFirstInput(parIo2);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Run initialisation   -------------------------------------------
+  std::cout << std::endl << "-I- " << myName << ": Initialise run" << std::endl;
+  run->Init();
+  // ------------------------------------------------------------------------
+
+
+  // -----   Database update   ----------------------------------------------
+  rtdb->setOutput(parIo1);
+  rtdb->saveOutput();
+  rtdb->print();
+  rtdb->printParamContexts();
+  // ------------------------------------------------------------------------
+
+
+  //--- House Keeping -------------------------------------------------------
+  // print all important infos in a file
+  std::ofstream outfile;
+  if (taskId < 0) { outfile.open(Form("result_run%d/run_info.dat", runId)); }
+  else {
+    outfile.open(Form("result_run%d_%05d/run_info.dat", runId, taskId));
+  }
+  // write inputted data into the file.
+  outfile << "Run: " << runId << std::endl;
+  outfile << "Events: " << nEvents << std::endl;
+  //  outfile << "parFile: " << parFile << std::endl;
+  outfile << "digiFile: " << digiFile << std::endl;
+  outfile << "recoFile: " << recoFile << std::endl;
+  outfile << "Geometry: " << geoFile << std::endl;
+  outfile << "TrackCalParFile: " << TofFileFolder << cCalId << std::endl;
+  outfile << "TofClusterFile :" << TofFileFolder + cFname << std::endl;
+  outfile << "TofOutput :" << cFname << std::endl << std::endl;
+  outfile << "Trigger:" << std::endl;
+  outfile << "  fixedTimeWindow :" << eb_fixedTimeWindow << std::endl;
+  outfile << "  MinNumberT0   :" << eb_TriggerMinNumberT0 << std::endl;
+  outfile << "  MinNumberSts  :" << eb_TriggerMinNumberSts << std::endl;
+  outfile << "  MinNumberMuch :" << eb_TriggerMinNumberMuch << std::endl;
+  outfile << "  MinNumberTof  :" << eb_TriggerMinNumberTof << std::endl;
+  outfile << "  MinNumberRich :" << eb_TriggerMinNumberRich << std::endl;
+  outfile.close();
+  // ------------------------------------------------------------------------
+
+
+  // -----   Start run   ----------------------------------------------------
+  std::cout << std::endl << std::endl;
+  std::cout << "-I- " << myName << ": Starting run" << std::endl;
+  run->Run(0, nEvents);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Finish   -------------------------------------------------------
+  timer.Stop();
+  std::cout << std::endl << std::endl;
+  std::cout << "Macro finished succesfully." << std::endl;
+  std::cout << "Output file is " << recoFile << std::endl;
+  //  std::cout << "Parameter file is " << parFile << std::endl;
+  std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << " s" << std::endl;
+  std::cout << "Test passed" << std::endl << "All ok" << std::endl;
+
+  // -----   Resource monitoring   ------------------------------------------
+  //     if ( hasFairMonitor /*Has_Fair_Monitor()*/ ) {      // FairRoot Version >= 15.11
+  //         // Extract the maximal used memory an add is as Dart measurement
+  //         // This line is filtered by CTest and the value send to CDash
+  //         FairSystemInfo sysInfo;
+  //         Float_t maxMemory=sysInfo.GetMaxMemory();
+  //         std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
+  //         std::cout << maxMemory;
+  //         std::cout << "</DartMeasurement>" << std::endl;
+  //
+  //         Float_t cpuUsage=ctime/rtime;
+  //         std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
+  //         std::cout << cpuUsage;
+  //         std::cout << "</DartMeasurement>" << std::endl;
+  //
+  //         FairMonitor* tempMon = FairMonitor::GetMonitor();
+  //         tempMon->Print();
+  //     }
+}
+
+void save_hst(TString cstr = "status.hst.root", Bool_t bROOT = kFALSE)
+{
+  cout << "save all histograms to file " << cstr.Data() << endl;
+  TList* tList(NULL);
+  if (bROOT) { tList = gROOT->GetList(); }
+  else {
+    tList = gDirectory->GetList();
+  }
+  TIter next(tList);
+  // Write objects to the file
+  TFile* fHist = new TFile(cstr, "RECREATE");
+  {
+    TObject* obj;
+    while ((obj = (TObject*) next())) {
+      if (obj->InheritsFrom(TH1::Class()) || obj->InheritsFrom(TEfficiency::Class())) { obj->Write(); }
+    }
+  }
+  // fHist->ls();
+  fHist->Close();
+}
diff --git a/macro/rich/mcbm/beamtime/run_reco_mcbm_real_wToF_mar22.C b/macro/rich/mcbm/beamtime/run_reco_mcbm_real_wToF_mar22.C
new file mode 100644
index 0000000000000000000000000000000000000000..6163b8593678dc77bb7a738ee1d90b787747656e
--- /dev/null
+++ b/macro/rich/mcbm/beamtime/run_reco_mcbm_real_wToF_mar22.C
@@ -0,0 +1,1147 @@
+/* Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
+   SPDX-License-Identifier: GPL-3.0-only
+   Authors: Florian Uhlig [committer] */
+
+void run_reco_mcbm_real_wToF_mar22(const string srcfolder = "/data/cbmroot/cbmsource/macro/"
+                                                            "run/data/",
+                                   const unsigned int runId = 1981,  // used for the output folder
+                                   int nEvents = 10, const int taskId = 5)
+{
+  // -----   File names   --------------------------------------------------
+  const string& digiFile = Form("%s/%4d.digi.root", srcfolder.c_str(), runId);
+
+  const string& recoFile = Form("reco_mcbm_mar22_%d.root", runId);
+  TString setup          = "mcbm_beam_2021_07_surveyed";
+  // -----------------------------------------------------------------------
+
+
+  // -----   EventBuilder Settings-----------------------------------------
+  const Double_t eb_fixedTimeWindow {200.};
+  const Int_t eb_TriggerMinNumberT0 {1};
+  const Int_t eb_TriggerMinNumberSts {0};
+  const Int_t eb_TriggerMinNumberMuch {0};
+  const Int_t eb_TriggerMinNumberTof {2};
+  const Int_t eb_TriggerMinNumberRich {5};
+  // -----------------------------------------------------------------------
+
+
+  // -----   TOF defaults --------------------------------------------------
+  Int_t calMode      = 93;
+  Int_t calSel       = 1;
+  Int_t calSm        = 0;
+  Int_t RefSel       = 0;
+  Double_t dDeadtime = 50.;
+  Int_t iSel2        = 500;
+
+  // Tracking
+  Int_t iSel           = 500;  // 910041;
+  Int_t iTrackingSetup = 10;
+  Int_t iGenCor        = 1;
+  Double_t dScalFac    = 1.;
+  Double_t dChi2Lim2   = 500.;
+  Bool_t bUseSigCalib  = kFALSE;
+  Int_t iCalOpt        = 1;
+  Int_t iTrkPar        = 3;
+  // -----------------------------------------------------------------------
+
+
+  // -----   TOF Settings --------------------------------------------------
+  TString cCalId = "490.100.5.0";
+  if (runId >= 759) cCalId = "759.100.4.0";
+  if (runId >= 812) cCalId = "831.100.4.0";
+  if (runId >= 1588) cCalId = "1588.50.6.0";
+  Int_t iCalSet = 30040500;  // calibration settings
+  if (runId >= 759) iCalSet = 10020500;
+  if (runId >= 812) iCalSet = 10020500;
+  if (runId >= 1588) iCalSet = 12002002;
+
+  Double_t Tint           = 100.;  // coincidence time interval
+  Int_t iTrackMode        = 2;     // 2 for TofTracker
+  const Int_t iTofCluMode = 1;
+  // -----------------------------------------------------------------------
+
+
+  // -----   Fair logger ---------------------------------------------------
+  FairLogger::GetLogger()->SetLogScreenLevel("INFO");
+  FairLogger::GetLogger()->SetLogVerbosityLevel("LOW");
+  TTree::SetMaxTreeSize(90000000000);
+  // -----------------------------------------------------------------------
+
+
+  TString myName  = "run_reco_mcbm_real";
+  TString srcDir  = gSystem->Getenv("VMCWORKDIR");  // top source directory
+  TString workDir = gSystem->Getenv("VMCWORKDIR");
+
+  remove(recoFile.c_str());
+
+  // -----   Load the geometry setup   -------------------------------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Loading setup " << setup << std::endl;
+  CbmSetup* geoSetup = CbmSetup::Instance();
+  geoSetup->LoadSetup(setup);
+  // You can modify the pre-defined setup by using
+  // CbmSetup::Instance()->RemoveModule(ESystemId) or
+  // CbmSetup::Instance()->SetModule(ESystemId, const char*, Bool_t) or
+  //CbmSetup::Instance()->SetActive(ESystemId, Bool_t)
+  geoSetup->SetActive(ECbmModuleId::kMvd, kFALSE);
+  geoSetup->SetActive(ECbmModuleId::kSts, kFALSE);
+  geoSetup->SetActive(ECbmModuleId::kMuch, kFALSE);
+  geoSetup->SetActive(ECbmModuleId::kRich, kTRUE);
+  geoSetup->SetActive(ECbmModuleId::kTrd, kFALSE);
+  geoSetup->SetActive(ECbmModuleId::kPsd, kFALSE);
+  // -----------------------------------------------------------------------
+
+  //TString TofFileFolder = Form("/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020/%s", cCalId.Data());
+  TString TofFileFolder = Form("/data/cbmroot/files/tofCal/mTofCriPar2/%s", cCalId.Data());
+
+  std::cout << std::endl << "-I- " << myName << ": Defining parameter files " << std::endl;
+  TList* parFileList = new TList();
+
+
+  //-----------------------------------------------//
+  //   TString FId    = cCalId;
+  //   TString TofGeo = "v19b_mcbm"; //v18m_mCbm
+  //   TString TofGeo = "v20a_mcbm"; //v18m_mCbm
+
+
+  // ----- TOF digitisation parameters -------------------------------------
+  TString geoTag;
+  TString geoFile;
+  if (geoSetup->IsActive(ECbmModuleId::kTof)) {
+    geoSetup->GetGeoTag(ECbmModuleId::kTof, geoTag);
+    TObjString* tofBdfFile = new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par");
+    //TObjString* tofBdfFile = new TObjString("/lustre/cbm/users/adrian/cbmgit/cbmsource/parameters/tof/tof_v21c_mcbm.digibdf.par");
+    parFileList->Add(tofBdfFile);
+    //    parFileList->Add("/lustre/cbm/users/adrian/cbmgit/cbmsource/parameters/tof/tof_v21c_mcbm.digibdf.par");
+    std::cout << "-I- " << myName << ": Using parameter file " << tofBdfFile->GetString() << std::endl;
+
+    geoFile             = srcDir + "/macro/mcbm/data/mcbm_beam_2021_07_surveyed.geo.root";
+    TFile* fgeo         = new TFile(geoFile);
+    TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom");
+    if (NULL == geoMan) {
+      cout << "<E> FAIRGeom not found in geoFile " << geoFile.Data() << endl;
+      return;
+    }
+  }
+
+  // -----   Timer   --------------------------------------------------------
+  TStopwatch timer;
+  timer.Start();
+  // ------------------------------------------------------------------------
+
+
+  // ----    Debug option   -------------------------------------------------
+  gDebug = 0;
+  // ------------------------------------------------------------------------
+
+  gROOT->LoadMacro("save_hst.C");
+
+
+  // -----   Input file   ---------------------------------------------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Using input file " << digiFile << std::endl;
+  // ------------------------------------------------------------------------
+
+  // -----   FairRunAna   ---------------------------------------------------
+  FairRunAna* run             = new FairRunAna();
+  FairFileSource* inputSource = new FairFileSource(digiFile.c_str());
+  run->SetSource(inputSource);
+  run->SetOutputFile(recoFile.c_str());
+
+  // --------------------event builder---------------------------------------
+  CbmTaskBuildRawEvents* evBuildRaw = new CbmTaskBuildRawEvents();
+
+  //Choose between NoOverlap, MergeOverlap, AllowOverlap
+  evBuildRaw->SetEventOverlapMode(EOverlapModeRaw::AllowOverlap);
+
+  // Remove detectors where digis not found
+  if (!geoSetup->IsActive(ECbmModuleId::kRich)) evBuildRaw->RemoveDetector(kRawEventBuilderDetRich);
+  if (!geoSetup->IsActive(ECbmModuleId::kMuch)) evBuildRaw->RemoveDetector(kRawEventBuilderDetMuch);
+  if (!geoSetup->IsActive(ECbmModuleId::kPsd)) evBuildRaw->RemoveDetector(kRawEventBuilderDetPsd);
+  if (!geoSetup->IsActive(ECbmModuleId::kTrd)) evBuildRaw->RemoveDetector(kRawEventBuilderDetTrd);
+  if (!geoSetup->IsActive(ECbmModuleId::kSts)) evBuildRaw->RemoveDetector(kRawEventBuilderDetSts);
+  if (!geoSetup->IsActive(ECbmModuleId::kTof)) evBuildRaw->RemoveDetector(kRawEventBuilderDetTof);
+
+  // Set TOF as reference detector
+  evBuildRaw->SetReferenceDetector(kRawEventBuilderDetTof);
+
+  // void SetTsParameters(double TsStartTime, double TsLength, double TsOverLength): TsStartTime=0, TsLength=256ms in 2021, TsOverLength=TS overlap, not used in mCBM2021
+  evBuildRaw->SetTsParameters(0.0, 1.024e9, 0.0);
+
+  if (geoSetup->IsActive(ECbmModuleId::kTof))
+    evBuildRaw->SetTriggerMinNumber(ECbmModuleId::kTof, eb_TriggerMinNumberTof);
+
+  if (geoSetup->IsActive(ECbmModuleId::kTof)) evBuildRaw->SetTriggerMaxNumber(ECbmModuleId::kTof, -1);
+
+  //evBuildRaw->SetTriggerMinNumber(ECbmModuleId::kSts, eb_TriggerMinNumberSts);
+  //evBuildRaw->SetTriggerMaxNumber(ECbmModuleId::kSts, -1);
+
+  evBuildRaw->SetTriggerMinNumber(ECbmModuleId::kRich, eb_TriggerMinNumberRich);
+  evBuildRaw->SetTriggerMaxNumber(ECbmModuleId::kRich, -1);
+
+  if (geoSetup->IsActive(ECbmModuleId::kTof)) evBuildRaw->SetTriggerWindow(ECbmModuleId::kTof, -50, 50);
+  if (geoSetup->IsActive(ECbmModuleId::kSts)) evBuildRaw->SetTriggerWindow(ECbmModuleId::kSts, -50, 50);
+  if (geoSetup->IsActive(ECbmModuleId::kTrd)) evBuildRaw->SetTriggerWindow(ECbmModuleId::kTrd, -200, 200);
+  if (geoSetup->IsActive(ECbmModuleId::kRich)) evBuildRaw->SetTriggerWindow(ECbmModuleId::kRich, -50, 700);
+
+  run->AddTask(evBuildRaw);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Local reconstruction of RICH Hits ---------------
+  CbmRichMCbmHitProducer* hitProd = new CbmRichMCbmHitProducer();
+  hitProd->SetMappingFile("mRICH_Mapping_vert_20190318_elView.geo");
+  hitProd->setToTLimits(23.7, 30.0);
+  hitProd->applyToTCut();
+  run->AddTask(hitProd);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Local reconstruction in RICh -> Finding of Rings ---------------
+  CbmRichReconstruction* richReco = new CbmRichReconstruction();
+  richReco->UseMCbmSetup();
+  run->AddTask(richReco);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Local reconstruction in TOF   ----------------------------------
+  TString cFname;
+  switch (iTofCluMode) {
+    case 1: {
+      CbmTofEventClusterizer* tofCluster = new CbmTofEventClusterizer("TOF Event Clusterizer", 0, 1);
+      //      cFname=Form("/%s_set%09d_%02d_%01dtofClust.hst.root",cCalId.Data(),iCalSet,calMode,calSel);
+      //      cFname = Form("/%s_set%09d_%02d_%01d_noWalk_tofClust.hst.root", cCalId.Data(), iCalSet, calMode, calSel);
+      cFname = Form("/%s_set%09d_%02d_%01dtofClust.hst.root", cCalId.Data(), iCalSet, calMode, calSel);
+      tofCluster->SetCalParFileName(TofFileFolder + cFname);
+      tofCluster->SetCalMode(calMode);
+      tofCluster->SetCalSel(calSel);
+      tofCluster->SetCaldXdYMax(300.);            // geometrical matching window in cm
+      tofCluster->SetCalCluMulMax(3.);            // Max Counter Cluster Multiplicity for filling calib histos
+      tofCluster->SetCalRpc(calSm);               // select detector for calibration update
+      tofCluster->SetTRefId(RefSel);              // reference trigger for offset calculation
+      tofCluster->SetTotMax(20.);                 // Tot upper limit for walk corection
+      tofCluster->SetTotMin(0.);                  // Tot lower limit for walk correction
+      tofCluster->SetTotPreRange(5.);             // effective lower Tot limit  in ns from peak position
+      tofCluster->SetTotMean(5.);                 // Tot calibration target value in ns
+      tofCluster->SetMaxTimeDist(1.0);            // default cluster range in ns
+      tofCluster->SetDelTofMax(50.);              // acceptance range for cluster distance in ns (!)
+      tofCluster->SetSel2MulMax(3);               // limit Multiplicity in 2nd selector
+      tofCluster->SetChannelDeadtime(dDeadtime);  // artificial deadtime in ns
+      tofCluster->SetEnableAvWalk(kFALSE);
+      // tofCluster->SetEnableMatchPosScaling(kFALSE); // turn off projection to nominal target
+      tofCluster->SetYFitMin(1.E4);
+      tofCluster->SetToDAv(0.04);
+      tofCluster->SetIdMode(1);        // calibrate on module level
+      tofCluster->SetTRefDifMax(2.0);  // in ns
+      tofCluster->PosYMaxScal(0.75);   //in % of length
+      Int_t iBRef    = iCalSet % 1000;
+      Int_t iSet     = (iCalSet - iBRef) / 1000;
+      Int_t iRSel    = 0;
+      Int_t iRSelTyp = 0;
+      Int_t iRSelSm  = 0;
+      Int_t iRSelRpc = 0;
+      iRSel          = iBRef;  // use diamond
+      Int_t iRSelin  = iRSel;
+      iRSelRpc       = iRSel % 10;
+      iRSelTyp       = (iRSel - iRSelRpc) / 10;
+      iRSelSm        = iRSelTyp % 10;
+      iRSelTyp       = (iRSelTyp - iRSelSm) / 10;
+      tofCluster->SetBeamRefId(iRSelTyp);  // define Beam reference counter
+      tofCluster->SetBeamRefSm(iRSelSm);
+      tofCluster->SetBeamRefDet(iRSelRpc);
+      tofCluster->SetBeamAddRefMul(-1);
+      tofCluster->SetBeamRefMulMax(3);
+      Int_t iSel2in  = iSel2;
+      Int_t iSel2Rpc = iSel2 % 10;
+      iSel2          = (iSel2 - iSel2Rpc) / 10;
+      Int_t iSel2Sm  = iSel2 % 10;
+      iSel2          = (iSel2 - iSel2Sm) / 10;
+      if (iSel2 > -1) {
+        tofCluster->SetSel2Id(iSel2);
+        tofCluster->SetSel2Sm(iSel2Sm);
+        tofCluster->SetSel2Rpc(iSel2Rpc);
+      }
+      Int_t iRef    = iSet % 1000;
+      Int_t iDut    = (iSet - iRef) / 1000;
+      Int_t iDutRpc = iDut % 10;
+      iDut          = (iDut - iDutRpc) / 10;
+      Int_t iDutSm  = iDut % 10;
+      iDut          = (iDut - iDutSm) / 10;
+      tofCluster->SetDutId(iDut);
+      tofCluster->SetDutSm(iDutSm);
+      tofCluster->SetDutRpc(iDutRpc);
+
+      Int_t iRefRpc = iRef % 10;
+      iRef          = (iRef - iRefRpc) / 10;
+      Int_t iRefSm  = iRef % 10;
+      iRef          = (iRef - iRefSm) / 10;
+
+      tofCluster->SetSelId(iRef);
+      tofCluster->SetSelSm(iRefSm);
+      tofCluster->SetSelRpc(iRefRpc);
+
+      run->AddTask(tofCluster);
+      std::cout << "-I- " << myName << ": Added task " << tofCluster->GetName() << std::endl;
+    } break;
+
+    default: {
+      ;
+    }
+  }
+  // -------------------------------------------------------------------------
+
+  /*
+  // =========================================================================
+  // ===                   Tof Tracking                                    ===
+  // =========================================================================
+  cout << "<I> Initialize Tof tracker by ini_trks" << endl;
+  TString cTrkFile = Form("/%s_tofFindTracks.hst.root", cCalId.Data());
+  // -----   Local selection variables  -------------------------------------------
+
+  Int_t iRef    = iSel % 1000;
+  Int_t iDut    = (iSel - iRef) / 1000;
+  Int_t iDutRpc = iDut % 10;
+  iDut          = (iDut - iDutRpc) / 10;
+  Int_t iDutSm  = iDut % 10;
+  iDut          = (iDut - iDutSm) / 10;
+  //Int_t iRefRpc = iRef % 10;
+  //iRef          = (iRef - iRefRpc) / 10;
+  //  Int_t iRefSm  = iRef % 10;
+  //  iRef          = (iRef - iRefSm) / 10;
+  Int_t iBucRpc = 0;
+
+  CbmTofTrackFinderNN* tofTrackFinder = new CbmTofTrackFinderNN();
+  tofTrackFinder->SetMaxTofTimeDifference(0.2);  // in ns/cm
+
+  CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211);
+  TFitter* MyFit                    = new TFitter(1);  // initialize Minuit
+  tofTrackFinder->SetFitter(tofTrackFitter);
+  CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder");
+  tofFindTracks->UseFinder(tofTrackFinder);
+  tofFindTracks->UseFitter(tofTrackFitter);
+
+  tofFindTracks->SetCalOpt(iCalOpt);   // 1 - update offsets, 2 - update walk, 0 - bypass
+  tofFindTracks->SetCorMode(iGenCor);  // valid options: 0,1,2,3,4,5,6, 10 - 19
+  //tofFindTracks->SetTtTarg(0.047);     // target value for Mar2021 double stack, v21b
+  tofFindTracks->SetTtTarg(0.035);  // target value for Jun2021 double stack, v21c
+  //  0.0605);  // target value for Mar2020 triple stack -> betapeak ~ 0.95
+  //tofFindTracks->SetTtTarg(0.062);           // target value for Mar2020 triple stack -> betapeak ~ 0.95
+  //tofFindTracks->SetTtTarg(0.058);           // target value for Mar2020 double stack
+  //tofFindTracks->SetTtTarg(0.051);           // target value Nov2019
+  //tofFindTracks->SetTtTarg(0.035);           // target value for inverse velocity, > 0.033 ns/cm!
+  tofFindTracks->SetCalParFileName(TofFileFolder + cTrkFile);  // Tracker parameter value file name
+  tofFindTracks->SetR0Lim(5.);
+  tofFindTracks->SetStationMaxHMul(30);  // Max Hit Multiplicity in any used station
+
+  tofFindTracks->SetT0MAX(dScalFac);            // in ns
+  tofFindTracks->SetSIGT(0.08);                 // default in ns
+  tofFindTracks->SetSIGX(0.3);                  // default in cm
+  tofFindTracks->SetSIGY(0.45);                 // default in cm
+  tofFindTracks->SetSIGZ(0.05);                 // default in cm
+  tofFindTracks->SetUseSigCalib(bUseSigCalib);  // ignore resolutions in CalPar file
+  tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.);    // matching window in multiples of chi2
+  tofTrackFinder->SetChiMaxAccept(dChi2Lim2);   // max tracklet chi2
+  tofTrackFinder->SetSIGLIMMOD(5.);             // max deviation for last hit
+  tofTrackFinder->SetAddVertex(kFALSE);         // disable virtual vertex
+
+  cout << "<I> Tracker Parameter Set: " << iTrkPar << endl;
+  switch (iTrkPar) {
+    case 0:                                    // for full mTof setup
+      tofTrackFinder->SetTxMean(0.);           // mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);           // mean slope dy/dz
+      tofTrackFinder->SetTxLIM(0.3);           // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.3);           // max dev from mean slope dy/dz
+      tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
+      break;
+    case 1:                                    // for double stack test counters
+      tofTrackFinder->SetTxMean(0.);           // mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.18);         // mean slope dy/dz
+      tofTrackFinder->SetTxLIM(0.15);          // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.18);          // max dev from mean slope dy/dz
+      tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
+      break;
+    case 2:                             // for double stack cosmics
+      tofTrackFinder->SetTxMean(0.);    // mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);    // mean slope dy/dz
+      tofTrackFinder->SetTxLIM(2.);     // max slope dx/dz
+      tofTrackFinder->SetTyLIM(20.);    // max dev from mean slope dy/dz
+      tofFindTracks->SetTtMin(-100.);   // allow negative velocities with respect to z-axis
+      tofFindTracks->SetTtTarg(0.033);  // target value for mCBM Cosmic2021 triple stack, v21c
+      tofFindTracks->SetSIGT(0.2);      // default in ns
+      break;
+    case 3:                                 // for Jul2021-CRI
+      tofTrackFinder->SetTxMean(-0.2);      // mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);        // mean slope dy/dz
+      tofTrackFinder->SetTxLIM(0.1);        // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.3);        // max dev from mean slope dy/dz
+      tofTrackFinder->SetAddVertex(kTRUE);  // add virtual vertex
+      tofFindTracks->SetTtMin(-100.);       // allow negative velocities with respect to z-axis
+      tofFindTracks->SetR0Lim(30.);         // allow for large extrapolation errors
+      break;
+  }
+
+  Int_t iMinNofHits   = -1;
+  Int_t iNStations    = 0;
+  Int_t iNReqStations = 3;
+
+  switch (iTrackingSetup) {
+    case 0:  // bypass mode
+      iMinNofHits = -1;
+      iNStations  = 1;
+      tofFindTracks->SetStation(0, 5, 0, 0);  // Diamond
+      break;
+
+    case 1:  // for calibration mode of full setup
+    {
+      Double_t dTsig = dScalFac * 0.03;
+      tofFindTracks->SetSIGT(dTsig);  // allow for variable deviations in ns
+    }
+      iMinNofHits   = 3;
+      iNStations    = 30;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 2, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 0, 2);
+      tofFindTracks->SetStation(4, 0, 2, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 0, 1);
+      tofFindTracks->SetStation(7, 0, 2, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 0, 3);
+      tofFindTracks->SetStation(10, 0, 2, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 0, 0);
+      tofFindTracks->SetStation(13, 0, 2, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 0, 4);
+      tofFindTracks->SetStation(16, 0, 4, 0);
+      tofFindTracks->SetStation(17, 0, 3, 0);
+      tofFindTracks->SetStation(18, 0, 4, 1);
+      tofFindTracks->SetStation(19, 0, 3, 1);
+      tofFindTracks->SetStation(20, 0, 4, 2);
+      tofFindTracks->SetStation(21, 0, 3, 2);
+      tofFindTracks->SetStation(22, 0, 4, 3);
+      tofFindTracks->SetStation(23, 0, 3, 3);
+      tofFindTracks->SetStation(24, 0, 4, 4);
+      tofFindTracks->SetStation(25, 0, 3, 4);
+      tofFindTracks->SetStation(26, 9, 0, 0);
+      tofFindTracks->SetStation(27, 9, 1, 0);
+      tofFindTracks->SetStation(28, 9, 0, 1);
+      tofFindTracks->SetStation(29, 9, 1, 1);
+      //tofFindTracks->SetStation(28, 6, 0, 0);
+      //tofFindTracks->SetStation(29, 6, 0, 1);
+      break;
+
+    case 10:  // for calibration mode of full setup
+    {
+      Double_t dTsig = dScalFac * 0.03;
+      tofFindTracks->SetSIGT(dTsig);  // allow for variable deviations in ns
+    }
+      iMinNofHits   = 3;
+      iNStations    = 37;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(36, 5, 0, 0);
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 1, 2);
+      tofFindTracks->SetStation(2, 0, 0, 2);
+      tofFindTracks->SetStation(3, 0, 2, 1);
+      tofFindTracks->SetStation(4, 0, 1, 1);
+      tofFindTracks->SetStation(5, 0, 0, 1);
+      tofFindTracks->SetStation(6, 0, 2, 3);
+      tofFindTracks->SetStation(7, 0, 1, 3);
+      tofFindTracks->SetStation(8, 0, 0, 3);
+      tofFindTracks->SetStation(9, 0, 2, 0);
+      tofFindTracks->SetStation(10, 0, 1, 0);
+      tofFindTracks->SetStation(11, 0, 0, 0);
+      tofFindTracks->SetStation(12, 0, 2, 4);
+      tofFindTracks->SetStation(13, 0, 1, 4);
+      tofFindTracks->SetStation(14, 0, 0, 4);
+      tofFindTracks->SetStation(15, 0, 4, 0);
+      tofFindTracks->SetStation(16, 0, 3, 0);
+      tofFindTracks->SetStation(17, 0, 4, 1);
+      tofFindTracks->SetStation(18, 0, 3, 1);
+      tofFindTracks->SetStation(19, 0, 4, 2);
+      tofFindTracks->SetStation(20, 0, 3, 2);
+      tofFindTracks->SetStation(21, 0, 4, 3);
+      tofFindTracks->SetStation(22, 0, 3, 3);
+      tofFindTracks->SetStation(23, 0, 4, 4);
+      tofFindTracks->SetStation(24, 0, 3, 4);
+      tofFindTracks->SetStation(25, 9, 0, 0);
+      tofFindTracks->SetStation(26, 9, 1, 0);
+      tofFindTracks->SetStation(27, 9, 0, 1);
+      tofFindTracks->SetStation(28, 9, 1, 1);
+      tofFindTracks->SetStation(29, 6, 0, 0);
+      tofFindTracks->SetStation(30, 6, 0, 1);
+      tofFindTracks->SetStation(31, 2, 0, 0);
+      tofFindTracks->SetStation(32, 2, 0, 1);
+      tofFindTracks->SetStation(33, 2, 0, 2);
+      tofFindTracks->SetStation(34, 2, 0, 3);
+      tofFindTracks->SetStation(35, 2, 0, 4);
+      break;
+
+    case 11:  // for calibration mode of 2-stack & test counters
+      iMinNofHits   = 3;
+      iNStations    = 17;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 4, 0);
+      tofFindTracks->SetStation(1, 0, 3, 0);
+      tofFindTracks->SetStation(2, 0, 4, 1);
+      tofFindTracks->SetStation(3, 0, 3, 1);
+      tofFindTracks->SetStation(4, 0, 4, 2);
+      tofFindTracks->SetStation(5, 0, 3, 2);
+      tofFindTracks->SetStation(6, 0, 4, 3);
+      tofFindTracks->SetStation(7, 0, 3, 3);
+      tofFindTracks->SetStation(8, 0, 4, 4);
+      tofFindTracks->SetStation(9, 0, 3, 4);
+      tofFindTracks->SetStation(10, 9, 0, 0);
+      tofFindTracks->SetStation(11, 9, 1, 0);
+      tofFindTracks->SetStation(12, 9, 0, 1);
+      tofFindTracks->SetStation(13, 9, 1, 1);
+      tofFindTracks->SetStation(14, 6, 0, 0);
+      tofFindTracks->SetStation(15, 6, 0, 1);
+      tofFindTracks->SetStation(16, 5, 0, 0);
+      break;
+
+    case 12:  // for calibration mode of 2-stack & test counters
+      iMinNofHits   = 3;
+      iNStations    = 9;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 6, 0, 0);
+      tofFindTracks->SetStation(5, 9, 0, 1);
+      tofFindTracks->SetStation(6, 9, 1, 1);
+      tofFindTracks->SetStation(7, 6, 0, 1);
+      tofFindTracks->SetStation(8, 5, 0, 0);
+      break;
+
+    case 13:  // for calibration mode of triple-stack (july2021-cri)
+      iMinNofHits   = 3;
+      iNStations    = 10;
+      iNReqStations = 3;
+      tofFindTracks->SetStation(0, 0, 1, 2);
+      tofFindTracks->SetStation(1, 0, 0, 2);
+      tofFindTracks->SetStation(2, 0, 1, 1);
+      tofFindTracks->SetStation(3, 0, 0, 1);
+      tofFindTracks->SetStation(4, 0, 1, 3);
+      tofFindTracks->SetStation(5, 0, 0, 3);
+      tofFindTracks->SetStation(6, 0, 1, 0);
+      tofFindTracks->SetStation(7, 0, 0, 0);
+      tofFindTracks->SetStation(8, 0, 1, 4);
+      tofFindTracks->SetStation(9, 0, 0, 4);
+      break;
+
+    case 113:  // for double stack TSHU counter (031)
+      iMinNofHits   = 6;
+      iNStations    = 7;
+      iNReqStations = 7;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 9, 0, 0);
+      tofFindTracks->SetStation(5, 5, 0, 0);
+      tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 114:  // for double stack TSHU counter (041)
+      iMinNofHits   = 6;
+      iNStations    = 7;
+      iNReqStations = 7;
+      tofFindTracks->SetStation(0, 9, 1, 1);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 9, 0, 0);
+      tofFindTracks->SetStation(5, 5, 0, 0);
+      tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 116:  // for evaluation of BUC counter (600, 601)
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 117:  // for evaluation of BUC counter (600, 601)
+      iMinNofHits   = 5;
+      iNStations    = 6;
+      iNReqStations = 6;
+      iBucRpc       = 1 - iDutRpc;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 6, 0, iBucRpc);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 2:
+      iMinNofHits   = 3;
+      iNStations    = 28;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 0, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 2, 1);
+      tofFindTracks->SetStation(4, 0, 0, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 2, 3);
+      tofFindTracks->SetStation(7, 0, 0, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 2, 0);
+      tofFindTracks->SetStation(10, 0, 0, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 2, 4);
+      tofFindTracks->SetStation(13, 0, 0, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 4, 0);
+      tofFindTracks->SetStation(16, 0, 3, 0);
+      tofFindTracks->SetStation(17, 0, 4, 1);
+      tofFindTracks->SetStation(18, 0, 3, 1);
+      tofFindTracks->SetStation(19, 0, 4, 2);
+      tofFindTracks->SetStation(20, 0, 3, 2);
+      tofFindTracks->SetStation(21, 0, 4, 3);
+      tofFindTracks->SetStation(22, 0, 3, 3);
+      tofFindTracks->SetStation(23, 0, 4, 4);
+      tofFindTracks->SetStation(24, 0, 3, 4);
+      tofFindTracks->SetStation(25, 9, 0, 0);
+      tofFindTracks->SetStation(26, 9, 0, 1);
+      tofFindTracks->SetStation(27, 5, 0, 0);
+      break;
+
+    case 3:
+      iMinNofHits   = 3;
+      iNStations    = 16;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 2, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 0, 2);
+
+      tofFindTracks->SetStation(4, 0, 2, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 0, 1);
+
+      tofFindTracks->SetStation(7, 0, 2, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 0, 3);
+
+      tofFindTracks->SetStation(10, 0, 2, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 0, 0);
+
+      tofFindTracks->SetStation(13, 0, 2, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 0, 4);
+
+      /*
+     tofFindTracks->SetStation(16, 0, 3, 2);         
+     tofFindTracks->SetStation(17, 0, 4, 2);  
+     tofFindTracks->SetStation(18, 0, 3, 1);         
+     tofFindTracks->SetStation(19, 0, 4, 1);
+     tofFindTracks->SetStation(20, 0, 3, 3);         
+     tofFindTracks->SetStation(21, 0, 4, 3);
+     tofFindTracks->SetStation(22, 0, 3, 0);         
+     tofFindTracks->SetStation(23, 0, 4, 0);
+     tofFindTracks->SetStation(24, 0, 3, 4);         
+     tofFindTracks->SetStation(25, 0, 4, 4); 
+     */
+  /* break;
+
+    case 31:  // cosmic triple stack, Aug 2021
+      iMinNofHits   = 3;
+      iNStations    = 20;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 0, 2);
+      tofFindTracks->SetStation(1, 0, 2, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 2, 0, 2);
+
+      tofFindTracks->SetStation(4, 0, 0, 1);
+      tofFindTracks->SetStation(5, 0, 2, 1);
+      tofFindTracks->SetStation(6, 0, 1, 1);
+      tofFindTracks->SetStation(7, 2, 0, 1);
+
+      tofFindTracks->SetStation(8, 0, 0, 3);
+      tofFindTracks->SetStation(9, 0, 2, 3);
+      tofFindTracks->SetStation(10, 0, 1, 3);
+      tofFindTracks->SetStation(11, 2, 0, 3);
+
+      tofFindTracks->SetStation(12, 0, 0, 0);
+      tofFindTracks->SetStation(13, 0, 2, 0);
+      tofFindTracks->SetStation(14, 0, 1, 0);
+      tofFindTracks->SetStation(15, 2, 0, 0);
+
+      tofFindTracks->SetStation(16, 0, 0, 4);
+      tofFindTracks->SetStation(17, 0, 2, 4);
+      tofFindTracks->SetStation(18, 0, 1, 4);
+      tofFindTracks->SetStation(19, 2, 0, 4);
+      break;
+
+    case 4:  // for USTC evaluation (dut=910,911)
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      //tofFindTracks->SetStation(2, 9, 0, 1);  // broken in May2021
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 5, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 40:  // for USTC evaluation (dut=910)
+      iMinNofHits   = 4;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      //tofFindTracks->SetStation(2, 9, 0, 1);
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 9, 1, 1);
+      tofFindTracks->SetStation(4, 5, 0, 0);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 41:  // for USTC evaluation (dut=911)
+      iMinNofHits   = 4;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      //tofFindTracks->SetStation(2, 9, 0, 1);
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 5, 0, 0);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 42:  // for USTC evaluation (dut=900, 901)
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 6, 0, 0);
+      tofFindTracks->SetStation(3, 6, 0, 1);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 43:  // for USTC evaluation (dut=900, 901)
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 6, 0, 1);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 14:
+      iMinNofHits   = 3;
+      iNStations    = 15;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 1, 2);
+      tofFindTracks->SetStation(2, 0, 0, 2);
+      tofFindTracks->SetStation(0, 0, 2, 1);
+      tofFindTracks->SetStation(1, 0, 1, 1);
+      tofFindTracks->SetStation(2, 0, 0, 1);
+      tofFindTracks->SetStation(0, 0, 2, 0);
+      tofFindTracks->SetStation(1, 0, 1, 0);
+      tofFindTracks->SetStation(2, 0, 0, 0);
+      tofFindTracks->SetStation(0, 0, 2, 3);
+      tofFindTracks->SetStation(1, 0, 1, 3);
+      tofFindTracks->SetStation(2, 0, 0, 3);
+      tofFindTracks->SetStation(0, 0, 2, 4);
+      tofFindTracks->SetStation(1, 0, 1, 4);
+      tofFindTracks->SetStation(2, 0, 0, 4);
+      break;
+
+    case 5:  // for evaluation of Buc in 2-stack
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 4, 3);
+      tofFindTracks->SetStation(1, 0, 3, 3);
+      tofFindTracks->SetStation(2, 5, 0, 0);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 50:  // for evaluation of Buc in 2-stack
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 3);
+      tofFindTracks->SetStation(1, 0, 3, 3);
+      tofFindTracks->SetStation(2, 6, 0, 1);
+      tofFindTracks->SetStation(3, 5, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 51:  // for evaluation of Buc in 2-stack
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 3);
+      tofFindTracks->SetStation(1, 0, 3, 3);
+      tofFindTracks->SetStation(2, 6, 0, 0);
+      tofFindTracks->SetStation(3, 5, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 6:  // for double stack TSHU counter (900,901) evaluation
+      iMinNofHits   = 5;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 5, 0, 0);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 60:  // for double stack TSHU counter (900) evaluation
+      iMinNofHits   = 5;
+      iNStations    = 7;
+      iNReqStations = 7;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 9, 0, 1);
+      tofFindTracks->SetStation(5, 5, 0, 0);
+      tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 61:  // for double stack TSHU counter (901) evaluation
+      iMinNofHits   = 5;
+      iNStations    = 7;
+      iNReqStations = 7;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 9, 0, 0);
+      tofFindTracks->SetStation(5, 5, 0, 0);
+      tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 7:  // for double stack mTOF counter evaluation
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 9, 1, 1);
+      tofFindTracks->SetStation(1, 9, 0, 0);
+      tofFindTracks->SetStation(2, 9, 1, 0);
+      tofFindTracks->SetStation(3, 5, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 8:  // evaluation of add-on counters (BUC)
+      iMinNofHits = 5;
+      iNStations  = 6;
+
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 0, 4, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 0, 3, 1);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 81:  // evaluation of add-on counters (BUC) in July 2021
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 9, 0, 1);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 9:  // evaluation of M6, Dut=202
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 0, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 5, 0, 0);
+      tofFindTracks->SetStation(4, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 992:  // evaluation of CRI cosmics 2021
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      {
+        Int_t iType[4]   = {0, 0, 0, 2};
+        Int_t iModule[4] = {0, 2, 1, 0};
+        Int_t iSt        = 0;
+        for (Int_t iM = 0; iM < iNStations; iM++) {
+          if (iType[iM] == iDut && iModule[iM] == iDutSm) continue;
+          tofFindTracks->SetStation(iSt, iType[iM], iModule[iM], iDutRpc);
+          iSt++;
+        }
+      }
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    default:
+      cout << "Tracking setup " << iTrackingSetup << " not implemented " << endl;
+      return;
+      ;
+  }
+  tofFindTracks->SetMinNofHits(iMinNofHits);
+  tofFindTracks->SetNStations(iNStations);
+  tofFindTracks->SetNReqStations(iNReqStations);
+  tofFindTracks->PrintSetup();
+  run->AddTask(tofFindTracks);
+
+  
+  // -----   Track reconstruction   ------------------------------------------
+  /*
+  Double_t beamWidthX = 0.1;
+  Double_t beamWidthY = 0.1;
+  switch (iTrackMode) {
+    case 2: {
+      Int_t iGenCor                     = 1;
+      Double_t dScalFac                 = 1.;
+      Double_t dChi2Lim2                = 3.5;
+      TString cTrkFile                  = Form("/%s_tofFindTracks.hst.root", cCalId.Data());
+      Int_t iTrackingSetup              = 1;
+      CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN();
+      tofTrackFinder->SetMaxTofTimeDifference(0.2);  // in ns/cm
+      tofTrackFinder->SetTxLIM(0.3);                 // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.3);                 // max dev from mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);                 // mean slope dy/dz
+      CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211);
+      TFitter* MyFit                    = new TFitter(1);  // initialize Minuit
+      tofTrackFinder->SetFitter(tofTrackFitter);
+      CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder");
+      tofFindTracks->UseFinder(tofTrackFinder);
+      tofFindTracks->UseFitter(tofTrackFitter);
+      tofFindTracks->SetCorMode(iGenCor);  // valid options: 0,1,2,3,4,5,6, 10 - 19
+      tofFindTracks->SetTtTarg(0.041);     // target value for inverse velocity, > 0.033 ns/cm!
+      //tofFindTracks->SetTtTarg(0.035);            // target value for inverse velocity, > 0.033 ns/cm!
+      tofFindTracks->SetCalParFileName(TofFileFolder + cTrkFile);  // Tracker parameter value file name
+      tofFindTracks->SetBeamCounter(5, 0, 0);                      // default beam counter
+      tofFindTracks->SetStationMaxHMul(30);                        // Max Hit Multiplicity in any used station
+
+
+      tofFindTracks->SetT0MAX(dScalFac);           // in ns
+      tofFindTracks->SetSIGT(0.08);                // default in ns
+      tofFindTracks->SetSIGX(0.3);                 // default in cm
+      tofFindTracks->SetSIGY(0.45);                // default in cm
+      tofFindTracks->SetSIGZ(0.05);                // default in cm
+      tofFindTracks->SetUseSigCalib(kFALSE);       // ignore resolutions in CalPar file
+      tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.);   // matching window in multiples of chi2
+      tofTrackFinder->SetChiMaxAccept(dChi2Lim2);  // max tracklet chi2
+
+      Int_t iMinNofHits   = -1;
+      Int_t iNStations    = 0;
+      Int_t iNReqStations = 3;
+
+      switch (iTrackingSetup) {
+        case 0:  // bypass mode
+          iMinNofHits = -1;
+          iNStations  = 1;
+          tofFindTracks->SetStation(0, 5, 0, 0);  // Diamond
+          break;
+
+        case 1:  // for calibration mode of full setup
+          iMinNofHits   = 3;
+          iNStations    = 30;
+          iNReqStations = 4;
+          tofFindTracks->SetStation(0, 5, 0, 0);
+          tofFindTracks->SetStation(1, 0, 2, 2);
+          tofFindTracks->SetStation(2, 0, 1, 2);
+          tofFindTracks->SetStation(3, 0, 0, 2);
+          tofFindTracks->SetStation(4, 0, 2, 1);
+          tofFindTracks->SetStation(5, 0, 1, 1);
+          tofFindTracks->SetStation(6, 0, 0, 1);
+          tofFindTracks->SetStation(7, 0, 2, 3);
+          tofFindTracks->SetStation(8, 0, 1, 3);
+          tofFindTracks->SetStation(9, 0, 0, 3);
+          tofFindTracks->SetStation(10, 0, 2, 0);
+          tofFindTracks->SetStation(11, 0, 1, 0);
+          tofFindTracks->SetStation(12, 0, 0, 0);
+          tofFindTracks->SetStation(13, 0, 2, 4);
+          tofFindTracks->SetStation(14, 0, 1, 4);
+          tofFindTracks->SetStation(15, 0, 0, 4);
+          tofFindTracks->SetStation(16, 0, 4, 0);
+          tofFindTracks->SetStation(17, 0, 3, 0);
+          tofFindTracks->SetStation(18, 0, 4, 1);
+          tofFindTracks->SetStation(19, 0, 3, 1);
+          tofFindTracks->SetStation(20, 0, 4, 2);
+          tofFindTracks->SetStation(21, 0, 3, 2);
+          tofFindTracks->SetStation(22, 0, 4, 3);
+          tofFindTracks->SetStation(23, 0, 3, 3);
+          tofFindTracks->SetStation(24, 0, 4, 4);
+          tofFindTracks->SetStation(25, 0, 3, 4);
+          tofFindTracks->SetStation(26, 9, 0, 0);
+          tofFindTracks->SetStation(27, 9, 0, 1);
+          tofFindTracks->SetStation(28, 6, 0, 0);
+          tofFindTracks->SetStation(29, 6, 0, 1);
+          break;
+      }
+      tofFindTracks->SetMinNofHits(iMinNofHits);
+      tofFindTracks->SetNStations(iNStations);
+      tofFindTracks->SetNReqStations(iNReqStations);
+      tofFindTracks->PrintSetup();
+      run->AddTask(tofFindTracks);
+    } break;
+
+    case 1: {
+    }
+
+    case 0:
+
+    default:;
+  }
+  */
+  // ------------------------------------------------------------------------
+
+
+  // =========================================================================
+  // ===                           RICH QA                                 ===
+  // =========================================================================
+
+  CbmRichMCbmQaReal* qaTask = new CbmRichMCbmQaReal();
+  if (taskId < 0) { qaTask->SetOutputDir(Form("result_run%d", runId)); }
+  else {
+    qaTask->SetOutputDir(Form("result_run%d_%05d", runId, taskId));
+  }
+  qaTask->XOffsetHistos(+25.0);
+  qaTask->SetMaxNofDrawnEvents(100);
+  qaTask->SetTotRich(23.7, 30.0);
+  qaTask->SetTriggerRichHits(eb_TriggerMinNumberRich);
+  qaTask->SetTriggerTofHits(0);  // eb_TriggerMinNumberTof);
+  run->AddTask(qaTask);
+  // ------------------------------------------------------------------------
+
+
+  // -----  Parameter database   --------------------------------------------
+  std::cout << std::endl << std::endl << "-I- " << myName << ": Set runtime DB" << std::endl;
+  FairRuntimeDb* rtdb        = run->GetRuntimeDb();
+  Bool_t kParameterMerged    = kTRUE;
+  FairParRootFileIo* parIo1  = new FairParRootFileIo(kParameterMerged);
+  FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
+  //  parIo1->open(parFile.c_str(), "UPDATE");
+  parIo2->open(parFileList, "in");
+  parIo2->print();
+  rtdb->setFirstInput(parIo2);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Run initialisation   -------------------------------------------
+  std::cout << std::endl << "-I- " << myName << ": Initialise run" << std::endl;
+  run->Init();
+  // ------------------------------------------------------------------------
+
+
+  // -----   Database update   ----------------------------------------------
+  rtdb->setOutput(parIo1);
+  rtdb->saveOutput();
+  rtdb->print();
+  rtdb->printParamContexts();
+  // ------------------------------------------------------------------------
+
+
+  //--- House Keeping -------------------------------------------------------
+  // print all important infos in a file
+  std::ofstream outfile;
+  if (taskId < 0) { outfile.open(Form("result_run%d/run_info.dat", runId)); }
+  else {
+    outfile.open(Form("result_run%d_%05d/run_info.dat", runId, taskId));
+  }
+  // write inputted data into the file.
+  outfile << "Run: " << runId << std::endl;
+  outfile << "Events: " << nEvents << std::endl;
+  //  outfile << "parFile: " << parFile << std::endl;
+  outfile << "digiFile: " << digiFile << std::endl;
+  outfile << "recoFile: " << recoFile << std::endl;
+  outfile << "Geometry: " << geoFile << std::endl;
+  outfile << "TrackCalParFile: " << TofFileFolder << cCalId << std::endl;
+  outfile << "TofClusterFile :" << TofFileFolder + cFname << std::endl;
+  outfile << "TofOutput :" << cFname << std::endl << std::endl;
+  outfile << "Trigger:" << std::endl;
+  outfile << "  fixedTimeWindow :" << eb_fixedTimeWindow << std::endl;
+  outfile << "  MinNumberT0   :" << eb_TriggerMinNumberT0 << std::endl;
+  outfile << "  MinNumberSts  :" << eb_TriggerMinNumberSts << std::endl;
+  outfile << "  MinNumberMuch :" << eb_TriggerMinNumberMuch << std::endl;
+  outfile << "  MinNumberTof  :" << eb_TriggerMinNumberTof << std::endl;
+  outfile << "  MinNumberRich :" << eb_TriggerMinNumberRich << std::endl;
+  outfile.close();
+  // ------------------------------------------------------------------------
+
+
+  // -----   Start run   ----------------------------------------------------
+  std::cout << std::endl << std::endl;
+  std::cout << "-I- " << myName << ": Starting run" << std::endl;
+  run->Run(0, nEvents);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Finish   -------------------------------------------------------
+  timer.Stop();
+  std::cout << std::endl << std::endl;
+  std::cout << "Macro finished succesfully." << std::endl;
+  std::cout << "Output file is " << recoFile << std::endl;
+  //  std::cout << "Parameter file is " << parFile << std::endl;
+  std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << " s" << std::endl;
+  std::cout << "Test passed" << std::endl << "All ok" << std::endl;
+
+  // -----   Resource monitoring   ------------------------------------------
+  //     if ( hasFairMonitor /*Has_Fair_Monitor()*/ ) {      // FairRoot Version >= 15.11
+  //         // Extract the maximal used memory an add is as Dart measurement
+  //         // This line is filtered by CTest and the value send to CDash
+  //         FairSystemInfo sysInfo;
+  //         Float_t maxMemory=sysInfo.GetMaxMemory();
+  //         std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
+  //         std::cout << maxMemory;
+  //         std::cout << "</DartMeasurement>" << std::endl;
+  //
+  //         Float_t cpuUsage=ctime/rtime;
+  //         std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
+  //         std::cout << cpuUsage;
+  //         std::cout << "</DartMeasurement>" << std::endl;
+  //
+  //         FairMonitor* tempMon = FairMonitor::GetMonitor();
+  //         tempMon->Print();
+  //     }
+}
+
+void save_hst(TString cstr = "status.hst.root", Bool_t bROOT = kFALSE)
+{
+  cout << "save all histograms to file " << cstr.Data() << endl;
+  TList* tList(NULL);
+  if (bROOT) { tList = gROOT->GetList(); }
+  else {
+    tList = gDirectory->GetList();
+  }
+  TIter next(tList);
+  // Write objects to the file
+  TFile* fHist = new TFile(cstr, "RECREATE");
+  {
+    TObject* obj;
+    while ((obj = (TObject*) next())) {
+      if (obj->InheritsFrom(TH1::Class()) || obj->InheritsFrom(TEfficiency::Class())) { obj->Write(); }
+    }
+  }
+  // fHist->ls();
+  fHist->Close();
+}
diff --git a/macro/rich/mcbm/beamtime/run_reco_mcbm_richOnly2021.C b/macro/rich/mcbm/beamtime/run_reco_mcbm_richOnly2021.C
new file mode 100644
index 0000000000000000000000000000000000000000..cb4df8f09dcabf4bf7a433981d76c6a0dedc1937
--- /dev/null
+++ b/macro/rich/mcbm/beamtime/run_reco_mcbm_richOnly2021.C
@@ -0,0 +1,129 @@
+/* Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
+   SPDX-License-Identifier: GPL-3.0-only
+   Authors: Florian Uhlig [committer] */
+
+void run_reco_mcbm_richOnly(const string srcfolder   = "/lustre/cbm/users/adrian/cbmgit/cbmsource/macro/run/data",
+                            const unsigned int runId = 1588,  // used for the output folder
+                            int nEvents = 3, const int taskId = 1)
+{
+  const string& parFile  = Form("%s/0.digi.root", srcfolder.c_str());
+  const string& digiFile = Form("%s/unp_mcbm_%d.root", srcfolder.c_str(), runId);
+  const string& recoFile = Form("reco_mcbm_mar20_%d.root", runId);
+
+  const Double_t eb_fixedTimeWindow {200.};
+  const Int_t eb_TriggerMinNumberT0 {0};
+  const Int_t eb_TriggerMinNumberSts {0};
+  const Int_t eb_TriggerMinNumberMuch {0};
+  const Int_t eb_TriggerMinNumberTof {0};
+  const Int_t eb_TriggerMinNumberRich {5};
+
+  FairLogger::GetLogger()->SetLogScreenLevel("INFO");
+  FairLogger::GetLogger()->SetLogVerbosityLevel("LOW");
+  TTree::SetMaxTreeSize(90000000000);
+
+  TString myName  = "run_reco_mcbm_richOnly2021";
+  TString srcDir  = gSystem->Getenv("VMCWORKDIR");  // top source directory
+  TString workDir = gSystem->Getenv("VMCWORKDIR");
+
+  remove(recoFile.c_str());
+
+  //    TString setupFile = srcDir + "/geometry/setup/setup_" + geoSetup + ".C";
+  //    TString setupFunct = "setup_" + geoSetup + "()";
+  //    gROOT->LoadMacro(setupFile);
+  //    gROOT->ProcessLine(setupFunct);
+
+  std::cout << std::endl << "-I- " << myName << ": Defining parameter files " << std::endl;
+  TList* parFileList = new TList();
+
+  TString geoFile     = srcDir + "/macro/mcbm/data/mcbm_beam_2021_07.geo.root";
+  TFile* fgeo         = new TFile(geoFile);
+  TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom");
+  if (geoMan == nullptr) {
+    cout << "<E> FAIRGeom not found in geoFile" << endl;
+    return;
+  }
+
+  TStopwatch timer;
+  timer.Start();
+  gDebug = 0;
+
+  FairRunAna* run             = new FairRunAna();
+  FairFileSource* inputSource = new FairFileSource(digiFile.c_str());
+  run->SetSource(inputSource);
+  run->SetOutputFile(recoFile.c_str());
+  run->SetGenerateRunInfo(kTRUE);
+
+  CbmMcbm2018EventBuilder* eventBuilder = new CbmMcbm2018EventBuilder();
+  //  eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::MaximumTimeGap);
+  //  eventBuilder->SetMaximumTimeGap(100.);
+  eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::FixedTimeWindow);
+  eventBuilder->SetFixedTimeWindow(eb_fixedTimeWindow);
+  eventBuilder->SetTriggerMinNumberT0(eb_TriggerMinNumberT0);
+  eventBuilder->SetTriggerMinNumberSts(eb_TriggerMinNumberSts);
+  eventBuilder->SetTriggerMinNumberMuch(eb_TriggerMinNumberMuch);
+  eventBuilder->SetTriggerMinNumberTof(eb_TriggerMinNumberTof);
+  eventBuilder->SetTriggerMinNumberRich(eb_TriggerMinNumberRich);
+  eventBuilder->SetFillHistos(kFALSE);  // to prevent memory leak???
+
+
+  run->AddTask(eventBuilder);
+
+
+  CbmRichMCbmHitProducer* hitProd = new CbmRichMCbmHitProducer();
+  hitProd->SetMappingFile("mRICH_Mapping_vert_20190318_elView.geo");
+  hitProd->setToTLimits(23.7, 30.0);
+  hitProd->applyToTCut();
+  run->AddTask(hitProd);
+
+  CbmRichReconstruction* richReco = new CbmRichReconstruction();
+  richReco->UseMCbmSetup();
+  run->AddTask(richReco);
+  ;
+
+  CbmRichMCbmQaRichOnly* qaTask = new CbmRichMCbmQaRichOnly();
+  if (taskId < 0) { qaTask->SetOutputDir(Form("result_richOnly_run%d", runId)); }
+  else {
+    qaTask->SetOutputDir(Form("result_richOnly_run%d_%05d", runId, taskId));
+  }
+  //    qaTask->DoRestrictToAcc();//restrict to mRICH MAR2019 in histFilling
+  qaTask->XOffsetHistos(+2.5);
+  qaTask->SetMaxNofDrawnEvents(100);
+  //qaTask->SetTotRich(23.7,30.0);
+  qaTask->SetTriggerRichHits(eb_TriggerMinNumberRich);
+  //qaTask->DoWriteHistToFile(false);
+  run->AddTask(qaTask);
+
+  std::cout << std::endl << std::endl << "-I- " << myName << ": Set runtime DB" << std::endl;
+  FairRuntimeDb* rtdb        = run->GetRuntimeDb();
+  FairParRootFileIo* parIo1  = new FairParRootFileIo();
+  FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
+  parIo1->open(parFile.c_str(), "UPDATE");
+  rtdb->setFirstInput(parIo1);
+  if (!parFileList->IsEmpty()) {
+    parIo2->open(parFileList, "in");
+    rtdb->setSecondInput(parIo2);
+  }
+
+
+  std::cout << std::endl << "-I- " << myName << ": Initialise run" << std::endl;
+  run->Init();
+
+
+  rtdb->setOutput(parIo1);
+  rtdb->saveOutput();
+  rtdb->print();
+
+
+  std::cout << std::endl << std::endl;
+  std::cout << "-I- " << myName << ": Starting run" << std::endl;
+  run->Run(0, nEvents);
+
+
+  timer.Stop();
+  std::cout << std::endl << std::endl;
+  std::cout << "Macro finished succesfully." << std::endl;
+  std::cout << "Output file is " << recoFile << std::endl;
+  std::cout << "Parameter file is " << parFile << std::endl;
+  std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << " s" << std::endl;
+  std::cout << "Test passed" << std::endl << "All ok" << std::endl;
+}
diff --git a/macro/rich/mcbm/beamtime/run_reco_mcbm_richOnly2022.C b/macro/rich/mcbm/beamtime/run_reco_mcbm_richOnly2022.C
new file mode 100644
index 0000000000000000000000000000000000000000..eea74e7639d0d8eb3c69b77cfff090d24a515f82
--- /dev/null
+++ b/macro/rich/mcbm/beamtime/run_reco_mcbm_richOnly2022.C
@@ -0,0 +1,127 @@
+/* Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
+   SPDX-License-Identifier: GPL-3.0-only
+   Authors: Florian Uhlig [committer] */
+
+void run_reco_mcbm_richOnly2022(const string srcfolder   = "/data/cbmroot/cbmsource/macro/run/data/",
+                                const unsigned int runId = 1981,  // used for the output folder
+                                int nEvents = 3, const int taskId = 1)
+{
+  const string& digiFile = Form("%s/%u.digi.root", srcfolder.c_str(), runId);
+  const string& recoFile = Form("reco_mcbm_mar22_%d.root", runId);
+
+  const Double_t eb_fixedTimeWindow {200.};
+  const Int_t eb_TriggerMinNumberT0 {0};
+  const Int_t eb_TriggerMinNumberSts {0};
+  const Int_t eb_TriggerMinNumberMuch {0};
+  const Int_t eb_TriggerMinNumberTof {0};
+  const Int_t eb_TriggerMinNumberRich {5};
+
+  FairLogger::GetLogger()->SetLogScreenLevel("INFO");
+  FairLogger::GetLogger()->SetLogVerbosityLevel("LOW");
+  TTree::SetMaxTreeSize(90000000000);
+
+  TString myName  = "run_reco_mcbm_richOnly2022";
+  TString srcDir  = gSystem->Getenv("VMCWORKDIR");  // top source directory
+  TString workDir = gSystem->Getenv("VMCWORKDIR");
+
+  remove(recoFile.c_str());
+
+  //    TString setupFile = srcDir + "/geometry/setup/setup_" + geoSetup + ".C";
+  //    TString setupFunct = "setup_" + geoSetup + "()";
+  //    gROOT->LoadMacro(setupFile);
+  //    gROOT->ProcessLine(setupFunct);
+
+  std::cout << std::endl << "-I- " << myName << ": Defining parameter files " << std::endl;
+  TList* parFileList = new TList();
+
+  TString geoFile     = srcDir + "/macro/mcbm/data/mcbm_beam_2021_07_surveyed.geo.root";
+  TFile* fgeo         = new TFile(geoFile);
+  TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom");
+  if (geoMan == nullptr) {
+    cout << "<E> FAIRGeom not found in geoFile" << endl;
+    return;
+  }
+
+  TStopwatch timer;
+  timer.Start();
+  gDebug = 0;
+
+  FairRunAna* run             = new FairRunAna();
+  FairFileSource* inputSource = new FairFileSource(digiFile.c_str());
+  run->SetSource(inputSource);
+  run->SetOutputFile(recoFile.c_str());
+  run->SetGenerateRunInfo(kTRUE);
+
+  CbmMcbm2018EventBuilder* eventBuilder = new CbmMcbm2018EventBuilder();
+  //  eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::MaximumTimeGap);
+  //  eventBuilder->SetMaximumTimeGap(100.);
+  eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::FixedTimeWindow);
+  eventBuilder->SetFixedTimeWindow(eb_fixedTimeWindow);
+  eventBuilder->SetTriggerMinNumberT0(eb_TriggerMinNumberT0);
+  eventBuilder->SetTriggerMinNumberSts(eb_TriggerMinNumberSts);
+  eventBuilder->SetTriggerMinNumberMuch(eb_TriggerMinNumberMuch);
+  eventBuilder->SetTriggerMinNumberTof(eb_TriggerMinNumberTof);
+  eventBuilder->SetTriggerMinNumberRich(eb_TriggerMinNumberRich);
+  eventBuilder->SetFillHistos(kFALSE);  // to prevent memory leak???
+
+
+  run->AddTask(eventBuilder);
+
+
+  CbmRichMCbmHitProducer* hitProd = new CbmRichMCbmHitProducer();
+  hitProd->SetMappingFile("mRICH_Mapping_vert_20190318_elView.geo");
+  hitProd->setToTLimits(23.7, 30.0);
+  hitProd->applyToTCut();
+  run->AddTask(hitProd);
+
+  CbmRichReconstruction* richReco = new CbmRichReconstruction();
+  richReco->UseMCbmSetup();
+  run->AddTask(richReco);
+  ;
+
+  CbmRichMCbmQaRichOnly* qaTask = new CbmRichMCbmQaRichOnly();
+  if (taskId < 0) { qaTask->SetOutputDir(Form("result_richOnly_run%d", runId)); }
+  else {
+    qaTask->SetOutputDir(Form("result_richOnly_run%d_%05d", runId, taskId));
+  }
+  //    qaTask->DoRestrictToAcc();//restrict to mRICH MAR2019 in histFilling
+  qaTask->XOffsetHistos(+25.0);
+  qaTask->SetMaxNofDrawnEvents(100);
+  //qaTask->SetTotRich(23.7,30.0);
+  qaTask->SetTriggerRichHits(eb_TriggerMinNumberRich);
+  //qaTask->DoWriteHistToFile(false);
+  run->AddTask(qaTask);
+
+  std::cout << std::endl << std::endl << "-I- " << myName << ": Set runtime DB" << std::endl;
+  FairRuntimeDb* rtdb        = run->GetRuntimeDb();
+  FairParRootFileIo* parIo1  = new FairParRootFileIo();
+  FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
+  //parIo1->open(parFile.c_str(), "UPDATE");
+  //rtdb->setFirstInput(parIo1);
+  if (!parFileList->IsEmpty()) {
+    parIo2->open(parFileList, "in");
+    rtdb->setSecondInput(parIo2);
+  }
+
+
+  std::cout << std::endl << "-I- " << myName << ": Initialise run" << std::endl;
+  run->Init();
+
+
+  rtdb->setOutput(parIo1);
+  rtdb->saveOutput();
+  rtdb->print();
+
+
+  std::cout << std::endl << std::endl;
+  std::cout << "-I- " << myName << ": Starting run" << std::endl;
+  run->Run(0, nEvents);
+
+
+  timer.Stop();
+  std::cout << std::endl << std::endl;
+  std::cout << "Macro finished succesfully." << std::endl;
+  std::cout << "Output file is " << recoFile << std::endl;
+  std::cout << "Real time " << timer.RealTime() << " s, CPU time " << timer.CpuTime() << " s" << std::endl;
+  std::cout << "Test passed" << std::endl << "All ok" << std::endl;
+}
diff --git a/reco/detectors/rich/mcbm/CbmRichMCbmQaReal.cxx b/reco/detectors/rich/mcbm/CbmRichMCbmQaReal.cxx
index b26e5a3f928d136d712ae7b7f0e0e5a567dd232d..d0250153504865c1a6441c322165e1c2d6992c46 100644
--- a/reco/detectors/rich/mcbm/CbmRichMCbmQaReal.cxx
+++ b/reco/detectors/rich/mcbm/CbmRichMCbmQaReal.cxx
@@ -70,6 +70,7 @@ CbmRichMCbmQaReal::CbmRichMCbmQaReal()
   , fRichRings(nullptr)
   , fTofHits(nullptr)
   , fTofTracks(nullptr)
+  , fTSHeader(nullptr)
   , fCbmEvent(nullptr)
   , fHM(nullptr)
   , fXOffsetHisto(0.)
@@ -90,53 +91,55 @@ InitStatus CbmRichMCbmQaReal::Init()
   cout << "CbmRichMCbmQaReal::Init" << endl;
 
   FairRootManager* ioman = FairRootManager::Instance();
-  if (nullptr == ioman) { Fatal("CbmRichMCbmQaReal::Init", "RootManager not instantised!"); }
+  if (nullptr == ioman)
+    LOG(fatal) << "CbmRichMCbmQaReal::Init "
+               << "RootManager not instantised!";
 
   fDigiMan = CbmDigiManager::Instance();
   fDigiMan->Init();
 
-  if (!fDigiMan->IsPresent(ECbmModuleId::kRich)) Fatal("CbmRichMCbmQaReal::Init", "No Rich Digis!");
-
-  if (!fDigiMan->IsPresent(ECbmModuleId::kTof)) Fatal("CbmRichMCbmQaReal::Init", "No Tof Digis!");
+  if (!fDigiMan->IsPresent(ECbmModuleId::kRich))
+    LOG(fatal) << "CbmRichMCbmQaReal::Init: "
+               << "No Rich Digis!";
 
+  if (!fDigiMan->IsPresent(ECbmModuleId::kTof))
+    LOG(fatal) << "CbmRichMCbmQaReal::Init: "
+               << "No Tof Digis!";
 
   fRichHits = (TClonesArray*) ioman->GetObject("RichHit");
-  if (nullptr == fRichHits) { Fatal("CbmRichMCbmQaReal::Init", "No Rich Hits!"); }
+  if (nullptr == fRichHits)
+    LOG(fatal) << "CbmRichMCbmQaReal::Init: "
+               << "No Rich Hits!";
 
   fRichRings = (TClonesArray*) ioman->GetObject("RichRing");
-  if (nullptr == fRichRings) { Fatal("CbmRichMCbmQaReal::Init", "No Rich Rings!"); }
+  if (nullptr == fRichRings)
+    LOG(fatal) << "CbmRichMCbmQaReal::Init: "
+               << "No Rich Rings!";
 
   fTofHits = (TClonesArray*) ioman->GetObject("TofHit");
-  if (nullptr == fTofHits) { Fatal("CbmRichMCbmQaReal::Init", "No Tof Hits!"); }
+  if (nullptr == fTofHits)
+    LOG(fatal) << "CbmRichMCbmQaReal::Init: "
+               << "No Tof Hits!";
 
   fTofTracks = (TClonesArray*) ioman->GetObject("TofTracks");
-  if (nullptr == fTofTracks) { Fatal("CbmRichMCbmQaReal::Init", "No Tof Tracks!"); }
+  if (nullptr == fTofTracks)
+    LOG(warning) << "CbmRichMCbmQaReal::Init: "
+                 << "No Tof Tracks!";
 
-  //     fT0Digis =(TClonesArray*) ioman->GetObject("CbmT0Digi");
-  //     if (nullptr == fT0Digis) { Fatal("CbmRichMCbmQaReal::Init", "No T0 Digis!");}
-  //  Get a pointer to the previous already existing data level
   fT0Digis = ioman->InitObjectAs<std::vector<CbmTofDigi> const*>("T0Digi");
-  /*if ( ! fT0DigiVec ) {
-       fT0DigiArr = dynamic_cast<TClonesArray*>(ioman->GetObject("T0Digi"));
-       if ( ! fT0DigiArr ) {
-         LOG(fatal) << "No TClonesArray with T0 digis found.";
-       }
-    }*/
+  if (nullptr == fT0Digis)
+    LOG(warning) << "CbmRichMCbmQaReal::Init: "
+                 << "No T0 Digis!";
 
-  // ---- Init Z Positioning ---------
-  /*    CbmSetup *pSetup=CbmSetup::Instance();
-    TString geoTag;
-	if ( pSetup->IsActive(ECbmModuleId::kRich) ) {
-		pSetup->GetGeoTag(ECbmModuleId::kRich, geoTag);
-    }
-
-    if (geoTag == "v20d") RichZPos = 340.8;
-    std::cout<<"mRICH Geo Tag is "<< geoTag<< ". Z Position of PMT plane set to "<<RichZPos<<"."<<std::endl;
-    */
-  // ---------------------------------
+  fTSHeader = ioman->InitObjectAs<CbmTsEventHeader const*>("EventHeader.");
+  if (nullptr == fTSHeader)
+    LOG(warning) << "CbmRichMCbmQaReal::Init: "
+                 << "No EventHeader!";
 
   fCbmEvent = dynamic_cast<TClonesArray*>(ioman->GetObject("CbmEvent"));
-  if (nullptr == fCbmEvent) { Fatal("CbmRichMCbmQaReal::Init", "No Event!"); }
+  if (nullptr == fCbmEvent)
+    LOG(fatal) << "CbmRichMCbmQaReal::Init: "
+               << "No Event!";
 
   InitHistograms();
 
@@ -475,6 +478,8 @@ void CbmRichMCbmQaReal::InitHistograms()
   fHM->Create2<TH2D>("fhTofTracksXYRICH_Accectance", "fhTofTracksXYRICH_Accectance;X[cm];Y[cm];NofTracks/cm^2", 50,
                      -20 + fXOffsetHisto, 30 + fXOffsetHisto, 180, -90,
                      90);  // projected in RICH Plane
+
+  fHM->Create1<TH1D>("fhHitTimeEvent", "fhHitTimeEvent;time [ns];Entries", 700, -100., 600);
 }
 
 
@@ -484,6 +489,10 @@ void CbmRichMCbmQaReal::Exec(Option_t* /*option*/)
   fHM->H1("fhNofEvents")->Fill(1);
   cout << "CbmRichMCbmQaReal, event No. " << fEventNum << endl;
 
+  uint64_t tsStartTime = 0;
+  if (nullptr != fTSHeader) tsStartTime = fTSHeader->GetTsStartTime();
+
+  uint64_t TSMinTime = 0;
   if (fDigiHitsInitialized == false) {
     auto nOfCbmEvent = fCbmEvent->GetEntriesFast();
     if (nOfCbmEvent > 0) {
@@ -524,6 +533,7 @@ void CbmRichMCbmQaReal::Exec(Option_t* /*option*/)
         fHM->H1("fhT0DigisTimeLogZoom")->GetXaxis()->SetLimits(minTime, minTime + dTZoom1);
         fHM->H1("fhT0DigisTimeLogZoom2")->GetXaxis()->SetLimits(minTime, minTime + dTZoom2);
 
+        TSMinTime            = tsStartTime;
         fDigiHitsInitialized = true;
       }
     }
@@ -531,38 +541,39 @@ void CbmRichMCbmQaReal::Exec(Option_t* /*option*/)
 
   if (fDigiHitsInitialized == true) {
 
+    double TsTimeAfterStart = static_cast<double>(tsStartTime - TSMinTime);
     int nofRichDigis = fDigiMan->GetNofDigis(ECbmModuleId::kRich);
     fHM->H1("fhNofRichDigisInTimeslice")->Fill(nofRichDigis);
     for (int i = 0; i < nofRichDigis; i++) {
       const CbmRichDigi* digi = fDigiMan->Get<CbmRichDigi>(i);
-      fHM->H1("fhRichDigisTimeLog")->Fill(digi->GetTime());
-      fHM->H1("fhRichDigisTimeLogZoom")->Fill(digi->GetTime());
-      fHM->H1("fhRichDigisTimeLogZoom2")->Fill(digi->GetTime());
+      fHM->H1("fhRichDigisTimeLog")->Fill(digi->GetTime() + TsTimeAfterStart);
+      fHM->H1("fhRichDigisTimeLogZoom")->Fill(digi->GetTime() + TsTimeAfterStart);
+      fHM->H1("fhRichDigisTimeLogZoom2")->Fill(digi->GetTime() + TsTimeAfterStart);
     }
 
     int nofRichRings = fRichRings->GetEntriesFast();
     for (int i = 0; i < nofRichRings; i++) {
       CbmRichRing* ring = static_cast<CbmRichRing*>(fRichRings->At(i));
-      fHM->H1("fhRichRingsTimeLog")->Fill(ring->GetTime());
-      fHM->H1("fhRichRingsTimeLogZoom")->Fill(ring->GetTime());
-      fHM->H1("fhRichRingsTimeLogZoom2")->Fill(ring->GetTime());
+      fHM->H1("fhRichRingsTimeLog")->Fill(ring->GetTime() + TsTimeAfterStart);
+      fHM->H1("fhRichRingsTimeLogZoom")->Fill(ring->GetTime() + TsTimeAfterStart);
+      fHM->H1("fhRichRingsTimeLogZoom2")->Fill(ring->GetTime() + TsTimeAfterStart);
     }
 
     int nofTofDigis = fDigiMan->GetNofDigis(ECbmModuleId::kTof);
     for (int i = 0; i < nofTofDigis; i++) {
       const CbmTofDigi* digi = fDigiMan->Get<CbmTofDigi>(i);
-      fHM->H1("fhTofDigisTimeLog")->Fill(digi->GetTime());
-      fHM->H1("fhTofDigisTimeLogZoom")->Fill(digi->GetTime());
-      fHM->H1("fhTofDigisTimeLogZoom2")->Fill(digi->GetTime());
+      fHM->H1("fhTofDigisTimeLog")->Fill(digi->GetTime() + TsTimeAfterStart);
+      fHM->H1("fhTofDigisTimeLogZoom")->Fill(digi->GetTime() + TsTimeAfterStart);
+      fHM->H1("fhTofDigisTimeLogZoom2")->Fill(digi->GetTime() + TsTimeAfterStart);
     }
 
     if (fDigiMan->IsPresent(ECbmModuleId::kSts)) {
       int nofStsDigis = fDigiMan->GetNofDigis(ECbmModuleId::kSts);
       for (int i = 0; i < nofStsDigis; i++) {
         const CbmStsDigi* digi = fDigiMan->Get<CbmStsDigi>(i);
-        fHM->H1("fhStsDigisTimeLog")->Fill(digi->GetTime());
-        fHM->H1("fhStsDigisTimeLogZoom")->Fill(digi->GetTime());
-        fHM->H1("fhStsDigisTimeLogZoom2")->Fill(digi->GetTime());
+        fHM->H1("fhStsDigisTimeLog")->Fill(digi->GetTime() + TsTimeAfterStart);
+        fHM->H1("fhStsDigisTimeLogZoom")->Fill(digi->GetTime() + TsTimeAfterStart);
+        fHM->H1("fhStsDigisTimeLogZoom2")->Fill(digi->GetTime() + TsTimeAfterStart);
       }
     }
 
@@ -577,9 +588,9 @@ void CbmRichMCbmQaReal::Exec(Option_t* /*option*/)
         if (fT0Digis) T0Digi = &(fT0Digis->at(iT0));
         //else if ( fT0DigiArr ) T0Digi = dynamic_cast<const CbmTofDigi*>(fT0DigiArr->At(iT0));
         assert(T0Digi);
-        fHM->H1("fhT0DigisTimeLog")->Fill(T0Digi->GetTime());
-        fHM->H1("fhT0DigisTimeLogZoom")->Fill(T0Digi->GetTime());
-        fHM->H1("fhT0DigisTimeLogZoom2")->Fill(T0Digi->GetTime());
+        fHM->H1("fhT0DigisTimeLog")->Fill(T0Digi->GetTime() + TsTimeAfterStart);
+        fHM->H1("fhT0DigisTimeLogZoom")->Fill(T0Digi->GetTime() + TsTimeAfterStart);
+        fHM->H1("fhT0DigisTimeLogZoom2")->Fill(T0Digi->GetTime() + TsTimeAfterStart);
       }
     }
   }
@@ -651,6 +662,7 @@ void CbmRichMCbmQaReal::Exec(Option_t* /*option*/)
       auto iRichHit = ev->GetIndex(ECbmDataType::kRichHit, j);
       evRichHitIndx.push_back(iRichHit);
       CbmRichHit* richHit = static_cast<CbmRichHit*>(fRichHits->At(iRichHit));
+      fHM->H1("fhHitTimeEvent")->Fill(richHit->GetTime() - fCbmEventStartTime);
       fHM->H1("fhRichHitToTEvent")->Fill(richHit->GetToT());
       fHM->H2("fhRichHitXYEvent")->Fill(richHit->GetX(), richHit->GetY());
       //Blob finder
@@ -1820,6 +1832,11 @@ void CbmRichMCbmQaReal::DrawHist()
     fHM->CreateCanvas("TofTracksXYRICH_Accectance", "TofTracksXYRICH_Accectance", 1200, 1200);
     DrawH2(fHM->H2("fhTofTracksXYRICH_Accectance"));
   }
+
+  {
+    fHM->CreateCanvas("HitTimeEvent", "HitTimeEvent", 1200, 1200);
+    DrawH1(fHM->H1("fhHitTimeEvent"));
+  }
 }
 
 void CbmRichMCbmQaReal::DrawRing(CbmRichRing* ring)
diff --git a/reco/detectors/rich/mcbm/CbmRichMCbmQaReal.h b/reco/detectors/rich/mcbm/CbmRichMCbmQaReal.h
index eb6d6d9e4acfaf80b75bd46525c9eea6aab4b99f..c216ea57b83dd568510b0f755fcc925e26b556fd 100644
--- a/reco/detectors/rich/mcbm/CbmRichMCbmQaReal.h
+++ b/reco/detectors/rich/mcbm/CbmRichMCbmQaReal.h
@@ -8,6 +8,7 @@
 #include "CbmEvent.h"
 #include "CbmHistManager.h"  // for ROOTCLING
 #include "CbmRichRingFinderHoughImpl.h"
+#include "CbmTsEventHeader.h"
 
 #include "FairTask.h"
 
@@ -141,6 +142,8 @@ private:
 
   TClonesArray* fTofTracks;
 
+  const CbmTsEventHeader* fTSHeader;
+
   TClonesArray* fCbmEvent;
 
 
diff --git a/reco/detectors/rich/mcbm/CbmRichMCbmQaRichOnly.cxx b/reco/detectors/rich/mcbm/CbmRichMCbmQaRichOnly.cxx
index 662d98c206e4896b6dce8aea595a253c61681484..afb825327b695839e1bff9a3fa86a39db7e4593a 100644
--- a/reco/detectors/rich/mcbm/CbmRichMCbmQaRichOnly.cxx
+++ b/reco/detectors/rich/mcbm/CbmRichMCbmQaRichOnly.cxx
@@ -109,6 +109,7 @@ InitStatus CbmRichMCbmQaRichOnly::Init()
   ///fSeDisplay->SetTofTracks(fTofTracks);
   fSeDisplay->SetTotRich(23.7, 30.);
   fSeDisplay->SetMaxNofDrawnEvents(fMaxNofDrawnEvents);
+  fSeDisplay->XOffsetHistos(fXOffsetHisto);
   fSeDisplay->SetOutDir(fOutputDir);
 
   //Init OffsetCorrection ICD