From 6d62bfa76cb6cc603307ac3aa94d5503f002e7ae Mon Sep 17 00:00:00 2001
From: Norbert Herrmann <n.herrmann@physi.uni-heidelberg.de>
Date: Mon, 16 Nov 2020 17:52:25 +0100
Subject: [PATCH] formatting...

---
 macro/beamtime/fit_yPos.C                     |    8 +-
 macro/beamtime/hd2020/ana_trks.C              |   28 +-
 macro/beamtime/hd2020/dis_digi.C              | 1164 +++++++++--------
 macro/beamtime/hd2020/pl_all_3D.C             |  112 +-
 macro/beamtime/mcbm2018/ana_digi_cal.C        |    2 +-
 macro/beamtime/mcbm2018/ana_digi_cal_all.C    |    2 +-
 macro/beamtime/mcbm2018/ana_digi_cali.C       |   26 +-
 macro/beamtime/mcbm2018/ana_trks.C            |   32 +-
 macro/beamtime/mcbm2018/ana_trksi.C           |   66 +-
 macro/beamtime/mcbm2018/dis_digi.C            |  463 ++++---
 macro/beamtime/mcbm2018/dis_trks.C            |   58 +-
 macro/beamtime/mcbm2020/ana_digi_cal.C        |    7 +-
 macro/beamtime/mcbm2020/ana_digi_cal_all.C    |    7 +-
 macro/beamtime/mcbm2020/ana_digi_cali.C       |    3 +-
 macro/beamtime/mcbm2020/ana_trks.C            |   29 +-
 macro/beamtime/mcbm2020/ana_trks_eval.C       |   51 +-
 macro/beamtime/mcbm2020/ana_trksi.C           |   96 +-
 macro/beamtime/mcbm2020/build_event_win.C     |    4 +-
 macro/beamtime/mcbm2020/dis_digi.C            |  465 ++++---
 macro/beamtime/mcbm2020/dis_trks.C            |   83 +-
 macro/beamtime/mcbm2020/mtof_reco.C           |   11 +-
 .../mcbm2020/unpack_tsa_mcbm_kronos.C         |    2 +-
 macro/beamtime/pl_Dut_Vel.C                   |    2 +-
 macro/beamtime/pl_Track2D.C                   |  139 +-
 macro/beamtime/pl_XY_trk.C                    |   14 +-
 macro/beamtime/pl_over_Mat04D4best.C          |   56 +-
 26 files changed, 1499 insertions(+), 1431 deletions(-)

diff --git a/macro/beamtime/fit_yPos.C b/macro/beamtime/fit_yPos.C
index 0b8205fabd..2a3bb8d616 100644
--- a/macro/beamtime/fit_yPos.C
+++ b/macro/beamtime/fit_yPos.C
@@ -23,8 +23,8 @@ void fit_yPos(Int_t SmT = 0, Int_t iSm = 0, Int_t iRpc = 0) {
   can->cd(1);
   gROOT->cd();
   gROOT->LoadMacro("fit_ybox.h");
-   ROOT::Math::Minimizer* minimum =
-      ROOT::Math::Factory::CreateMinimizer("Minuit", "Migrad");
+  ROOT::Math::Minimizer* minimum =
+    ROOT::Math::Factory::CreateMinimizer("Minuit", "Migrad");
   minimum->SetMaxFunctionCalls(100000);
   minimum->SetTolerance(0.1);
   minimum->SetPrintLevel(3);
@@ -44,8 +44,8 @@ void fit_yPos(Int_t SmT = 0, Int_t iSm = 0, Int_t iRpc = 0) {
     h2y = h2->ProjectionY();
     cout << " Fit with ybox " << h2y->GetName() << endl;
     fit_ybox((const char*) (h2y->GetName()));
-    if( 0) { //NULL != gMinuit ) {
-      cout << "Minuit ended with " << gMinuit->fCstatu<<endl;
+    if (0) {  //NULL != gMinuit ) {
+      cout << "Minuit ended with " << gMinuit->fCstatu << endl;
     }
   } else {
     cout << hname2 << " not found" << endl;
diff --git a/macro/beamtime/hd2020/ana_trks.C b/macro/beamtime/hd2020/ana_trks.C
index de66018ecc..e9499edd6a 100644
--- a/macro/beamtime/hd2020/ana_trks.C
+++ b/macro/beamtime/hd2020/ana_trks.C
@@ -11,7 +11,7 @@ void ana_trks(Int_t nEvents        = 10000,
               TString cCalId       = "",
               Int_t iAnaCor        = 1,
               Bool_t bUseSigCalib  = kFALSE,
-	          Int_t iCalSet        = 900920910,
+              Int_t iCalSet        = 900920910,
               Int_t iCalOpt        = 1,
               Int_t iMc            = 0) {
   Int_t iVerbose = 1;
@@ -42,16 +42,16 @@ void ana_trks(Int_t nEvents        = 10000,
   TString cHstFile =
     paramDir
     + Form(
-        "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root",
-        cFileId.Data(),
-        dDeadtime,
-        cSet.Data(),
-        iSel,
-        iSel2,
-        dScalFac,
-        dChi2Lim2,
-        iTrackingSetup,
-        cCalId.Data());
+      "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root",
+      cFileId.Data(),
+      dDeadtime,
+      cSet.Data(),
+      iSel,
+      iSel2,
+      dScalFac,
+      dChi2Lim2,
+      iTrackingSetup,
+      cCalId.Data());
   TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data());
   TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cFileId.Data());
 
@@ -216,7 +216,7 @@ void ana_trks(Int_t nEvents        = 10000,
       //tofFindTracks->SetStation(8, 6, 1, 0);
       //tofFindTracks->SetStation(9, 6, 1, 1);
       break;
-      
+
     case 11:  // for calibration mode of full setup
       iMinNofHits   = 3;
       iNStations    = 6;
@@ -227,7 +227,7 @@ void ana_trks(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(3, 9, 0, 1);
       tofFindTracks->SetStation(4, 6, 0, 0);
       tofFindTracks->SetStation(5, 6, 0, 1);
-      break;      
+      break;
 
     case 2:
       iMinNofHits   = 6;
@@ -618,7 +618,7 @@ void ana_trks(Int_t nEvents        = 10000,
   gInterpreter->ProcessLine("pl_all_Track2D(1)");
   gInterpreter->ProcessLine("pl_all_Track2D(2)");
   gInterpreter->ProcessLine("pl_all_Track2D(4)");
-  
+
   TString over_trk = "pl_over_trk(" + (TString)(Form("%d", iNStations)) + ")";
   gInterpreter->ProcessLine(over_trk);
 
diff --git a/macro/beamtime/hd2020/dis_digi.C b/macro/beamtime/hd2020/dis_digi.C
index c70f557b9c..d77c67cc67 100644
--- a/macro/beamtime/hd2020/dis_digi.C
+++ b/macro/beamtime/hd2020/dis_digi.C
@@ -1,7 +1,19 @@
-void dis_digi(Int_t nEvents = 100, Int_t calMode=93, Int_t calSel=1, Int_t calSm=0, Int_t RefSel=1, 
-TString cFileId="68.50.7.1", Int_t iCalSet=10500, Bool_t bOut=0, Int_t iSel2=20, Double_t dDeadtime=50, 
-Int_t iGenCor=1, Int_t iTrackingSetup=1, Double_t dScalFac=5., Double_t dChi2Lim2=10., TString cCalId="XXX", Bool_t bUseSigCalib=kFALSE) 
-{
+void dis_digi(Int_t nEvents        = 100,
+              Int_t calMode        = 93,
+              Int_t calSel         = 1,
+              Int_t calSm          = 0,
+              Int_t RefSel         = 1,
+              TString cFileId      = "68.50.7.1",
+              Int_t iCalSet        = 10500,
+              Bool_t bOut          = 0,
+              Int_t iSel2          = 20,
+              Double_t dDeadtime   = 50,
+              Int_t iGenCor        = 1,
+              Int_t iTrackingSetup = 1,
+              Double_t dScalFac    = 5.,
+              Double_t dChi2Lim2   = 10.,
+              TString cCalId       = "XXX",
+              Bool_t bUseSigCalib  = kFALSE) {
   Int_t iVerbose = 1;
   //Specify log level (INFO, DEBUG, DEBUG1, ...)
   //TString logLevel = "FATAL";
@@ -14,351 +26,370 @@ Int_t iGenCor=1, Int_t iTrackingSetup=1, Double_t dScalFac=5., Double_t dChi2Lim
   FairLogger::GetLogger();
   gLogger->SetLogScreenLevel(logLevel);
   gLogger->SetLogVerbosityLevel("MEDIUM");
-  
-  TString workDir    = gSystem->Getenv("VMCWORKDIR");
+
+  TString workDir = gSystem->Getenv("VMCWORKDIR");
   /*
    TString workDir    = (TString)gInterpreter->ProcessLine(".! pwd");
    cout << "workdir = "<< workDir.Data() << endl;
    return;
   */
-   TString paramDir   = workDir + "/macro/beamtime/hd2020/";
-   TString ParFile    = paramDir + "data/" + cFileId + ".params.root";
-   TString InputFile  = paramDir + "data/" + cFileId + ".root";
-   TString OutputFile = paramDir + "data/disdigi_"   + cFileId + Form("_%09d%03d",iCalSet,iSel2) + ".out.root";
-
-   TString cTrkFile=Form("%s_tofFindTracks.hst.root",cFileId.Data());
-
-   TList *parFileList = new TList();
-
-   TString FId=cFileId;
-   //TString TofGeo="v18o_cosmicHD";
-   TString TofGeo="v20b_cosmicHD"; // for Buc2020 sandwiched
-    cout << "Geometry version "<<TofGeo<<endl;
-
-   TObjString *tofDigiFile = new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par"); // TOF digi file
-   parFileList->Add(tofDigiFile);   
-
-   //   TObjString tofDigiBdfFile = new TObjString( paramDir + "/tof." + FPar + "digibdf.par");
-   TObjString *tofDigiBdfFile = new TObjString( workDir  + "/parameters/tof/tof_" + TofGeo +".digibdf.par");
-   parFileList->Add(tofDigiBdfFile);
-
-   TString geoDir  = gSystem->Getenv("VMCWORKDIR");
-   TString geoFile = geoDir + "/geometry/tof/geofile_tof_" + TofGeo + ".root";
-   TFile* fgeo = new TFile(geoFile);
-   TGeoManager *geoMan = (TGeoManager*) fgeo->Get("FAIRGeom");
-   if (NULL == geoMan){
-     cout << "<E> FAIRGeom not found in geoFile"<<endl;
-     return;
-   }
-   
-   if(0){
-   TGeoVolume* master=geoMan->GetTopVolume();
-   master->SetVisContainers(1); 
-   master->Draw("ogl"); 
-   }
+  TString paramDir   = workDir + "/macro/beamtime/hd2020/";
+  TString ParFile    = paramDir + "data/" + cFileId + ".params.root";
+  TString InputFile  = paramDir + "data/" + cFileId + ".root";
+  TString OutputFile = paramDir + "data/disdigi_" + cFileId
+                       + Form("_%09d%03d", iCalSet, iSel2) + ".out.root";
+
+  TString cTrkFile = Form("%s_tofFindTracks.hst.root", cFileId.Data());
+
+  TList* parFileList = new TList();
+
+  TString FId = cFileId;
+  //TString TofGeo="v18o_cosmicHD";
+  TString TofGeo = "v20b_cosmicHD";  // for Buc2020 sandwiched
+  cout << "Geometry version " << TofGeo << endl;
+
+  TObjString* tofDigiFile = new TObjString(
+    workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par");  // TOF digi file
+  parFileList->Add(tofDigiFile);
+
+  //   TObjString tofDigiBdfFile = new TObjString( paramDir + "/tof." + FPar + "digibdf.par");
+  TObjString* tofDigiBdfFile =
+    new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par");
+  parFileList->Add(tofDigiBdfFile);
+
+  TString geoDir  = gSystem->Getenv("VMCWORKDIR");
+  TString geoFile = geoDir + "/geometry/tof/geofile_tof_" + TofGeo + ".root";
+  TFile* fgeo     = new TFile(geoFile);
+  TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom");
+  if (NULL == geoMan) {
+    cout << "<E> FAIRGeom not found in geoFile" << endl;
+    return;
+  }
+
+  if (0) {
+    TGeoVolume* master = geoMan->GetTopVolume();
+    master->SetVisContainers(1);
+    master->Draw("ogl");
+  }
 
   // -----   Reconstruction run   -------------------------------------------
-  FairRunAna *run= new FairRunAna();
+  FairRunAna* run = new FairRunAna();
   run->SetInputFile(InputFile.Data());
   //run->SetOutputFile(OutputFile);
-   run->SetUserOutputFileName(OutputFile.Data());
-   run->SetSink(new FairRootFileSink(run->GetUserOutputFileName()));
-
-   CbmTofEventClusterizer* tofClust = new CbmTofEventClusterizer("TOF Event Clusterizer",iVerbose, bOut);
-
-   tofClust->SetCalMode(calMode);
-   tofClust->SetCalSel(calSel);
-   tofClust->SetCaldXdYMax(50.);         // geometrical matching window in cm 
-   tofClust->SetCalCluMulMax(4.);        // Max Counter Cluster Multiplicity for filling calib histos  
-   tofClust->SetCalRpc(calSm);           // select detector for calibration update  
-   tofClust->SetTRefId(RefSel);          // reference trigger for offset calculation 
-   tofClust->SetTotMax(20.);             // Tot upper limit for walk corection
-   tofClust->SetTotMin(0.01);            //(12000.);  // Tot lower limit for walk correction
-   tofClust->SetTotPreRange(2.);         // effective lower Tot limit  in ns from peak position
-   tofClust->SetTotMean(2.);             // Tot calibration target value in ns 
-   tofClust->SetMaxTimeDist(1.0);        // default cluster range in ns 
-   //tofClust->SetMaxTimeDist(0.);       //Deb// default cluster range in ns 
-   tofClust->SetDelTofMax(60.);          // acceptance range for cluster correlation in cm (!)  
-   tofClust->SetSel2MulMax(4);           // limit Multiplicity in 2nd selector
-   tofClust->SetChannelDeadtime(dDeadtime);    // artificial deadtime in ns 
-   tofClust->SetEnableAvWalk(kTRUE);
-   tofClust->SetYFitMin(1.E4);
-   //tofClust->SetTimePeriod(6.25);       // ignore coarse time 
-   //tofClust->SetCorMode(2);              // correct missing hits
-
-   Int_t calSelRead = calSel;
-   if (calSel<0) calSelRead=0;
-   TString cFname=Form("%s_set%09d_%02d_%01dtofClust.hst.root",cFileId.Data(),iCalSet,calMode,calSelRead);
-   tofClust->SetCalParFileName(cFname);
-   TString cOutFname=Form("tofClust_%s_set%09d.hst.root",cFileId.Data(),iCalSet);
-   tofClust->SetOutHstFileName(cOutFname);
-
-   TString cAnaFile=Form("%s_%09d%03d_tofAnaCosmic.hst.root",cFileId.Data(),iCalSet,iSel2);
-      
-   switch (calMode) {
-   case -1:                                    // initial calibration 
-     tofClust->SetTotMax(256.);         // range in bin number 
-     tofClust->SetTotPreRange(256.);
-     //tofClust->SetTotMin(1.);
-     tofClust->SetTRefDifMax(50000.);   // in ns 
-     tofClust->PosYMaxScal(10000.);     // in % of length 
-     tofClust->SetMaxTimeDist(0.);      // no cluster building  
-     //tofClust->SetTimePeriod(0.);       // inspect coarse time 
-     break;
-    case 0:                                    // initial calibration 
-     tofClust->SetTotMax(256.);         // range in bin number 
-     tofClust->SetTotPreRange(256.);
-     //tofClust->SetTotMin(1.);
-     tofClust->SetTRefDifMax(50.);   // in ns 
-     tofClust->PosYMaxScal(10.);     // in % of length 
-     tofClust->SetMaxTimeDist(0.);      // no cluster building  
-     //tofClust->SetTimePeriod(0.);       // inspect coarse time 
-     break;
-   case 1:                                      // save offsets, update walks, for diamonds 
-     tofClust->SetTotMax(256.);           // range in bin number 
-     tofClust->SetTotPreRange(256.);
-     tofClust->SetTRefDifMax(6.25);       // in ns 
-     //tofClust->SetTimePeriod(6.25);       // inspect coarse time 
-     tofClust->PosYMaxScal(10.);       // in % of length 
-     break;
-   case 11:
-     tofClust->SetTRefDifMax(5.);       // in ns 
-     tofClust->PosYMaxScal(3.0);        // in % of length 
-     break;   
-   case 21:
-     tofClust->SetTRefDifMax(2.5);      // in ns 
-     tofClust->PosYMaxScal(2.0);        // in % of length 
-     break;
-   case 31:
-     tofClust->SetTRefDifMax(2.);    // in ns 
-     tofClust->PosYMaxScal(1.5);        // in % of length 
-     break;
-   case 41:
-     tofClust->SetTRefDifMax(1.);    // in ns 
-     tofClust->PosYMaxScal(0.8);        // in % of length 
-     break;   
-   case 51:
-     tofClust->SetTRefDifMax(0.7);     // in ns 
-     tofClust->PosYMaxScal(0.7);        // in % of length 
-     break;
-   case 61:
-     tofClust->SetTRefDifMax(0.5);      // in ns 
-     tofClust->PosYMaxScal(0.7);        // in % of length 
-     break;   
-   case 71:
-     tofClust->SetTRefDifMax(0.4);     // in ns 
-     tofClust->PosYMaxScal(0.6);        // in % of length 
-     break;
-
-   case 2:                                    // time difference calibration
-     tofClust->SetTRefDifMax(300.);     // in ns 
-     tofClust->PosYMaxScal(1000.);      //in % of length
-     break;
-
-   case 3:                                    // time offsets 
-     tofClust->SetTRefDifMax(200.);     // in ns 
-     tofClust->PosYMaxScal(100.);       //in % of length
-     tofClust->SetMaxTimeDist(0.);      // no cluster building  
-     break;
-   case 12:
-   case 13:
-     tofClust->SetTRefDifMax(100.);   // in ns 
-     tofClust->PosYMaxScal(50.);        //in % of length
-     break;
-   case 22:
-   case 23:
-     tofClust->SetTRefDifMax(50.);    // in ns 
-     tofClust->PosYMaxScal(20.);         //in % of length
-     break;
-   case 32:
-   case 33:
-     tofClust->SetTRefDifMax(25.);    // in ns 
-     tofClust->PosYMaxScal(10.);         //in % of length
-     break;
-   case 42:
-   case 43:
-     tofClust->SetTRefDifMax(12.);   // in ns 
-     tofClust->PosYMaxScal(5.);        //in % of length
-     break;
-   case 52:
-   case 53:
-     tofClust->SetTRefDifMax(5.);   // in ns 
-     tofClust->PosYMaxScal(3.);        //in % of length
-     break;
-   case 62:
-   case 63:
-     tofClust->SetTRefDifMax(3.);   // in ns 
-     tofClust->PosYMaxScal(2.);        //in % of length
-     break;
-   case 72:
-   case 73:
-     tofClust->SetTRefDifMax(2.);    // in ns 
-     tofClust->PosYMaxScal(1.5);        //in % of length
-     break;
-   case 82:
-   case 83:
-     tofClust->SetTRefDifMax(1.);    // in ns 
-     tofClust->PosYMaxScal(1.0);        //in % of length   
-     break;
-   case 92:
-   case 93:
-     tofClust->SetTRefDifMax(0.6);    // in ns 
-     tofClust->PosYMaxScal(1.0);        //in % of length   
-     break;
-
-   case 4:                                      // velocity dependence (DelTOF)
-     tofClust->SetTRefDifMax(6.);    // in ns 
-     tofClust->PosYMaxScal(1.5);        //in % of length
-     break;
-   case 14:
-     tofClust->SetTRefDifMax(5.);   // in ns 
-     tofClust->PosYMaxScal(1.);        //in % of length
-     break;
-   case 24:
-     tofClust->SetTRefDifMax(3.);   // in ns 
-     tofClust->PosYMaxScal(1.0);        //in % of length
-     break;
-   case 34:
-     tofClust->SetTRefDifMax(2.);   // in ns 
-     tofClust->PosYMaxScal(1.0);        //in % of length
-     break;
-   case 44:
-     tofClust->SetTRefDifMax(1.);   // in ns 
-     tofClust->PosYMaxScal(1.0);        //in % of length
-     break;
-   case 54:
-     tofClust->SetTRefDifMax(0.7);     // in ns 
-     tofClust->PosYMaxScal(0.7);        //in % of length
-     break;
-   case 64:
-     tofClust->SetTRefDifMax(0.5);     // in ns 
-     tofClust->PosYMaxScal(0.7);        //in % of length
-     break;
-   default:
-     cout << "<E> Calib mode not implemented! stop execution of script"<<endl;
-     return;
-   } 
-   run->AddTask(tofClust);
-
-   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
-   if(iSel2==0){
-     // iSel2=iBRef;
-   }else{
-     if(iSel2<0) iSel2=-iSel2;
-   }   
-
-   Int_t iRSelin=iRSel;
-   iRSelRpc=iRSel%10;
-   iRSelTyp = (iRSel-iRSelRpc)/10;
-   iRSelSm=iRSelTyp%10;
-   iRSelTyp = (iRSelTyp-iRSelSm)/10;
-
-   tofClust->SetBeamRefId(iRSelTyp);    // define Beam reference counter 
-   tofClust->SetBeamRefSm(iRSelSm);
-   tofClust->SetBeamRefDet(iRSelRpc);
-   tofClust->SetBeamAddRefMul(-1);
-   tofClust->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 > 0) {
-     tofClust->SetSel2Id(iSel2); 
-     tofClust->SetSel2Sm(iSel2Sm); 
-     tofClust->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;
-
-   tofClust->SetDutId(iDut);
-   tofClust->SetDutSm(iDutSm);
-   tofClust->SetDutRpc(iDutRpc);
-
-   Int_t iRefRpc = iRef%10;
-   iRef = (iRef - iRefRpc)/10;
-   Int_t iRefSm = iRef%10;
-   iRef = (iRef - iRefSm)/10;
-
-   tofClust->SetSelId(iRef);
-   tofClust->SetSelSm(iRefSm);
-   tofClust->SetSelRpc(iRefRpc);
-
-   cout << "Run with iRSel = "<<iRSel<<", iSel2 = "<<iSel2in<<endl;
-   
-   // =========================================================================
-   // ===                       Tracking                                    ===
-   // =========================================================================
-   CbmStsDigitize* stsDigitize = new CbmStsDigitize(); //necessary for kalman !!
-   CbmKF* kalman = new CbmKF();
-
-   CbmTofTrackFinder* tofTrackFinder= new CbmTofTrackFinderNN();
-   tofTrackFinder->SetMaxTofTimeDifference(5.);    // in ns/cm 
-   tofTrackFinder->SetTxLIM(1.6);                 // max slope dx/dz
-   tofTrackFinder->SetTyLIM(1.6);                 // max dev from mean slope dy/dz
-   tofTrackFinder->SetTyMean(0.);                 // mean slope dy/dz
-   tofTrackFinder->SetMaxTofTimeDifference(1.);   // 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->SetCorMode(iGenCor);           // valid options: 0,1,2,3,4,5,6, 10 - 19
-   tofFindTracks->SetTtTarg(0.035);              // target value for inverse velocity, > 0.033 ns/cm!
-   tofFindTracks->SetCalParFileName(cTrkFile);   // Tracker parameter value file name
-   //   tofFindTracks->SetBeamCounter(5,0,0);         // default beam counter 
-   //tofFindTracks->SetBeamCounter(9,0,1);
-   //tofFindTracks->SetBeamCounter(1,1,1);
-  
-   tofFindTracks->SetT0MAX(dScalFac);            // in ns
-   tofFindTracks->SetSIGT(0.08);                 // default in ns
-   tofFindTracks->SetSIGX(0.3);                  // default in cm
-   tofFindTracks->SetSIGY(0.6);                  // default in cm 
-   tofFindTracks->SetSIGZ(0.1);                  // 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
-
-   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, 9, 0, 0);       // Diamond 
-     break;
-   case 1:                                           // for calibration mode of full setup
-     iMinNofHits=3;
-     iNStations=10;
-     iNReqStations=4;
-     //     tofFindTracks->SetStation(0, 9, 0, 0);         
-     tofFindTracks->SetStation(0, 9, 1, 0);
-     tofFindTracks->SetStation(1, 9, 2, 0);         
-     tofFindTracks->SetStation(2, 9, 0, 0);         
-     tofFindTracks->SetStation(3, 9, 1, 1);         
-     tofFindTracks->SetStation(4, 9, 2, 1);
-     tofFindTracks->SetStation(5, 9, 0, 1);     
-     tofFindTracks->SetStation(6, 6, 0, 0);         
-     tofFindTracks->SetStation(7, 6, 0, 1);
-     tofFindTracks->SetStation(8, 6, 1, 0);
-     tofFindTracks->SetStation(9, 6, 1, 1);
-     /*
+  run->SetUserOutputFileName(OutputFile.Data());
+  run->SetSink(new FairRootFileSink(run->GetUserOutputFileName()));
+
+  CbmTofEventClusterizer* tofClust =
+    new CbmTofEventClusterizer("TOF Event Clusterizer", iVerbose, bOut);
+
+  tofClust->SetCalMode(calMode);
+  tofClust->SetCalSel(calSel);
+  tofClust->SetCaldXdYMax(50.);  // geometrical matching window in cm
+  tofClust->SetCalCluMulMax(
+    4.);  // Max Counter Cluster Multiplicity for filling calib histos
+  tofClust->SetCalRpc(calSm);   // select detector for calibration update
+  tofClust->SetTRefId(RefSel);  // reference trigger for offset calculation
+  tofClust->SetTotMax(20.);     // Tot upper limit for walk corection
+  tofClust->SetTotMin(
+    0.01);  //(12000.);  // Tot lower limit for walk correction
+  tofClust->SetTotPreRange(
+    2.);  // effective lower Tot limit  in ns from peak position
+  tofClust->SetTotMean(2.);       // Tot calibration target value in ns
+  tofClust->SetMaxTimeDist(1.0);  // default cluster range in ns
+  //tofClust->SetMaxTimeDist(0.);       //Deb// default cluster range in ns
+  tofClust->SetDelTofMax(
+    60.);  // acceptance range for cluster correlation in cm (!)
+  tofClust->SetSel2MulMax(4);  // limit Multiplicity in 2nd selector
+  tofClust->SetChannelDeadtime(dDeadtime);  // artificial deadtime in ns
+  tofClust->SetEnableAvWalk(kTRUE);
+  tofClust->SetYFitMin(1.E4);
+  //tofClust->SetTimePeriod(6.25);       // ignore coarse time
+  //tofClust->SetCorMode(2);              // correct missing hits
+
+  Int_t calSelRead = calSel;
+  if (calSel < 0) calSelRead = 0;
+  TString cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                        cFileId.Data(),
+                        iCalSet,
+                        calMode,
+                        calSelRead);
+  tofClust->SetCalParFileName(cFname);
+  TString cOutFname =
+    Form("tofClust_%s_set%09d.hst.root", cFileId.Data(), iCalSet);
+  tofClust->SetOutHstFileName(cOutFname);
+
+  TString cAnaFile =
+    Form("%s_%09d%03d_tofAnaCosmic.hst.root", cFileId.Data(), iCalSet, iSel2);
+
+  switch (calMode) {
+    case -1:                      // initial calibration
+      tofClust->SetTotMax(256.);  // range in bin number
+      tofClust->SetTotPreRange(256.);
+      //tofClust->SetTotMin(1.);
+      tofClust->SetTRefDifMax(50000.);  // in ns
+      tofClust->PosYMaxScal(10000.);    // in % of length
+      tofClust->SetMaxTimeDist(0.);     // no cluster building
+      //tofClust->SetTimePeriod(0.);       // inspect coarse time
+      break;
+    case 0:                       // initial calibration
+      tofClust->SetTotMax(256.);  // range in bin number
+      tofClust->SetTotPreRange(256.);
+      //tofClust->SetTotMin(1.);
+      tofClust->SetTRefDifMax(50.);  // in ns
+      tofClust->PosYMaxScal(10.);    // in % of length
+      tofClust->SetMaxTimeDist(0.);  // no cluster building
+      //tofClust->SetTimePeriod(0.);       // inspect coarse time
+      break;
+    case 1:                       // save offsets, update walks, for diamonds
+      tofClust->SetTotMax(256.);  // range in bin number
+      tofClust->SetTotPreRange(256.);
+      tofClust->SetTRefDifMax(6.25);  // in ns
+      //tofClust->SetTimePeriod(6.25);       // inspect coarse time
+      tofClust->PosYMaxScal(10.);  // in % of length
+      break;
+    case 11:
+      tofClust->SetTRefDifMax(5.);  // in ns
+      tofClust->PosYMaxScal(3.0);   // in % of length
+      break;
+    case 21:
+      tofClust->SetTRefDifMax(2.5);  // in ns
+      tofClust->PosYMaxScal(2.0);    // in % of length
+      break;
+    case 31:
+      tofClust->SetTRefDifMax(2.);  // in ns
+      tofClust->PosYMaxScal(1.5);   // in % of length
+      break;
+    case 41:
+      tofClust->SetTRefDifMax(1.);  // in ns
+      tofClust->PosYMaxScal(0.8);   // in % of length
+      break;
+    case 51:
+      tofClust->SetTRefDifMax(0.7);  // in ns
+      tofClust->PosYMaxScal(0.7);    // in % of length
+      break;
+    case 61:
+      tofClust->SetTRefDifMax(0.5);  // in ns
+      tofClust->PosYMaxScal(0.7);    // in % of length
+      break;
+    case 71:
+      tofClust->SetTRefDifMax(0.4);  // in ns
+      tofClust->PosYMaxScal(0.6);    // in % of length
+      break;
+
+    case 2:                           // time difference calibration
+      tofClust->SetTRefDifMax(300.);  // in ns
+      tofClust->PosYMaxScal(1000.);   //in % of length
+      break;
+
+    case 3:                           // time offsets
+      tofClust->SetTRefDifMax(200.);  // in ns
+      tofClust->PosYMaxScal(100.);    //in % of length
+      tofClust->SetMaxTimeDist(0.);   // no cluster building
+      break;
+    case 12:
+    case 13:
+      tofClust->SetTRefDifMax(100.);  // in ns
+      tofClust->PosYMaxScal(50.);     //in % of length
+      break;
+    case 22:
+    case 23:
+      tofClust->SetTRefDifMax(50.);  // in ns
+      tofClust->PosYMaxScal(20.);    //in % of length
+      break;
+    case 32:
+    case 33:
+      tofClust->SetTRefDifMax(25.);  // in ns
+      tofClust->PosYMaxScal(10.);    //in % of length
+      break;
+    case 42:
+    case 43:
+      tofClust->SetTRefDifMax(12.);  // in ns
+      tofClust->PosYMaxScal(5.);     //in % of length
+      break;
+    case 52:
+    case 53:
+      tofClust->SetTRefDifMax(5.);  // in ns
+      tofClust->PosYMaxScal(3.);    //in % of length
+      break;
+    case 62:
+    case 63:
+      tofClust->SetTRefDifMax(3.);  // in ns
+      tofClust->PosYMaxScal(2.);    //in % of length
+      break;
+    case 72:
+    case 73:
+      tofClust->SetTRefDifMax(2.);  // in ns
+      tofClust->PosYMaxScal(1.5);   //in % of length
+      break;
+    case 82:
+    case 83:
+      tofClust->SetTRefDifMax(1.);  // in ns
+      tofClust->PosYMaxScal(1.0);   //in % of length
+      break;
+    case 92:
+    case 93:
+      tofClust->SetTRefDifMax(0.6);  // in ns
+      tofClust->PosYMaxScal(1.0);    //in % of length
+      break;
+
+    case 4:                         // velocity dependence (DelTOF)
+      tofClust->SetTRefDifMax(6.);  // in ns
+      tofClust->PosYMaxScal(1.5);   //in % of length
+      break;
+    case 14:
+      tofClust->SetTRefDifMax(5.);  // in ns
+      tofClust->PosYMaxScal(1.);    //in % of length
+      break;
+    case 24:
+      tofClust->SetTRefDifMax(3.);  // in ns
+      tofClust->PosYMaxScal(1.0);   //in % of length
+      break;
+    case 34:
+      tofClust->SetTRefDifMax(2.);  // in ns
+      tofClust->PosYMaxScal(1.0);   //in % of length
+      break;
+    case 44:
+      tofClust->SetTRefDifMax(1.);  // in ns
+      tofClust->PosYMaxScal(1.0);   //in % of length
+      break;
+    case 54:
+      tofClust->SetTRefDifMax(0.7);  // in ns
+      tofClust->PosYMaxScal(0.7);    //in % of length
+      break;
+    case 64:
+      tofClust->SetTRefDifMax(0.5);  // in ns
+      tofClust->PosYMaxScal(0.7);    //in % of length
+      break;
+    default:
+      cout << "<E> Calib mode not implemented! stop execution of script"
+           << endl;
+      return;
+  }
+  run->AddTask(tofClust);
+
+  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
+  if (iSel2 == 0) {
+    // iSel2=iBRef;
+  } else {
+    if (iSel2 < 0) iSel2 = -iSel2;
+  }
+
+  Int_t iRSelin = iRSel;
+  iRSelRpc      = iRSel % 10;
+  iRSelTyp      = (iRSel - iRSelRpc) / 10;
+  iRSelSm       = iRSelTyp % 10;
+  iRSelTyp      = (iRSelTyp - iRSelSm) / 10;
+
+  tofClust->SetBeamRefId(iRSelTyp);  // define Beam reference counter
+  tofClust->SetBeamRefSm(iRSelSm);
+  tofClust->SetBeamRefDet(iRSelRpc);
+  tofClust->SetBeamAddRefMul(-1);
+  tofClust->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 > 0) {
+    tofClust->SetSel2Id(iSel2);
+    tofClust->SetSel2Sm(iSel2Sm);
+    tofClust->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;
+
+  tofClust->SetDutId(iDut);
+  tofClust->SetDutSm(iDutSm);
+  tofClust->SetDutRpc(iDutRpc);
+
+  Int_t iRefRpc = iRef % 10;
+  iRef          = (iRef - iRefRpc) / 10;
+  Int_t iRefSm  = iRef % 10;
+  iRef          = (iRef - iRefSm) / 10;
+
+  tofClust->SetSelId(iRef);
+  tofClust->SetSelSm(iRefSm);
+  tofClust->SetSelRpc(iRefRpc);
+
+  cout << "Run with iRSel = " << iRSel << ", iSel2 = " << iSel2in << endl;
+
+  // =========================================================================
+  // ===                       Tracking                                    ===
+  // =========================================================================
+  CbmStsDigitize* stsDigitize = new CbmStsDigitize();  //necessary for kalman !!
+  CbmKF* kalman               = new CbmKF();
+
+  CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN();
+  tofTrackFinder->SetMaxTofTimeDifference(5.);  // in ns/cm
+  tofTrackFinder->SetTxLIM(1.6);                // max slope dx/dz
+  tofTrackFinder->SetTyLIM(1.6);                // max dev from mean slope dy/dz
+  tofTrackFinder->SetTyMean(0.);                // mean slope dy/dz
+  tofTrackFinder->SetMaxTofTimeDifference(1.);  // 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->SetCorMode(iGenCor);  // valid options: 0,1,2,3,4,5,6, 10 - 19
+  tofFindTracks->SetTtTarg(
+    0.035);  // target value for inverse velocity, > 0.033 ns/cm!
+  tofFindTracks->SetCalParFileName(
+    cTrkFile);  // Tracker parameter value file name
+  //   tofFindTracks->SetBeamCounter(5,0,0);         // default beam counter
+  //tofFindTracks->SetBeamCounter(9,0,1);
+  //tofFindTracks->SetBeamCounter(1,1,1);
+
+  tofFindTracks->SetT0MAX(dScalFac);  // in ns
+  tofFindTracks->SetSIGT(0.08);       // default in ns
+  tofFindTracks->SetSIGX(0.3);        // default in cm
+  tofFindTracks->SetSIGY(0.6);        // default in cm
+  tofFindTracks->SetSIGZ(0.1);        // 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
+
+  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, 9, 0, 0);  // Diamond
+      break;
+    case 1:  // for calibration mode of full setup
+      iMinNofHits   = 3;
+      iNStations    = 10;
+      iNReqStations = 4;
+      //     tofFindTracks->SetStation(0, 9, 0, 0);
+      tofFindTracks->SetStation(0, 9, 1, 0);
+      tofFindTracks->SetStation(1, 9, 2, 0);
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 9, 1, 1);
+      tofFindTracks->SetStation(4, 9, 2, 1);
+      tofFindTracks->SetStation(5, 9, 0, 1);
+      tofFindTracks->SetStation(6, 6, 0, 0);
+      tofFindTracks->SetStation(7, 6, 0, 1);
+      tofFindTracks->SetStation(8, 6, 1, 0);
+      tofFindTracks->SetStation(9, 6, 1, 1);
+      /*
      tofFindTracks->SetStation(8, 8, 0, 0);       
      tofFindTracks->SetStation(9, 8, 0, 1);       
      tofFindTracks->SetStation(10, 8, 0, 2);       
@@ -368,209 +399,223 @@ Int_t iGenCor=1, Int_t iTrackingSetup=1, Double_t dScalFac=5., Double_t dChi2Lim
      tofFindTracks->SetStation(14, 8, 0, 6);       
      tofFindTracks->SetStation(15, 8, 0, 7);       
      */
-     break;
-
-   case 11:                                           // for debugging
-     iMinNofHits=3;
-     iNStations=5;
-     iNReqStations=5;
-     //     tofFindTracks->SetStation(0, 9, 0, 0);         
-     tofFindTracks->SetStation(0, 9, 1, 0);
-     tofFindTracks->SetStation(1, 9, 2, 0);         
-     tofFindTracks->SetStation(2, 9, 2, 1);
-     tofFindTracks->SetStation(3, 9, 0, 1);     
-     tofFindTracks->SetStation(4, 1, 0, 1);
-     break;
-     
-   case 2:
-     iMinNofHits=6;
-     iNStations=7;
-     iNReqStations=7;
-     tofFindTracks->SetStation(0, 9, 1, 0);
-     tofFindTracks->SetStation(1, 9, 2, 0);         
-     tofFindTracks->SetStation(2, 9, 1, 1);         
-     tofFindTracks->SetStation(3, 9, 2, 1);  
-     tofFindTracks->SetStation(4, 9, 0, 0);         
-     tofFindTracks->SetStation(5, 9, 0, 1);
-     tofFindTracks->SetStation(6, 1, 0, 1);
-     //     tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
-     break;
-     
-   case 21:
-     iMinNofHits=5;
-     iNStations=6;
-     iNReqStations=6;
-     tofFindTracks->SetStation(0, 9, 1, 0);
-     tofFindTracks->SetStation(1, 9, 2, 0);         
-     tofFindTracks->SetStation(2, 9, 1, 1);         
-     tofFindTracks->SetStation(3, 9, 2, 1);  
-     //tofFindTracks->SetStation(4, 9, 0, 0);         
-     tofFindTracks->SetStation(4, 9, 0, 1);
-     tofFindTracks->SetStation(5, 1, 0, 1);
-     //     tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
-     break;
-     
-   case 3:
-     iMinNofHits=4;
-     iNStations=5;
-     iNReqStations=5; 
-     tofFindTracks->SetStation(0, 9, 1, 1);         
-     tofFindTracks->SetStation(1, 9, 2, 1);  
-     tofFindTracks->SetStation(2, 9, 1, 0);
-     tofFindTracks->SetStation(3, 9, 2, 0);
-     tofFindTracks->SetStation(4, 9, 0, 1);  
-     break;
-
-   case 4:
-     iMinNofHits=5;
-
-     break;
-
-   case 5:     // for calibration of 2-stack and add-on counters (STAR2, CERN)
-     iMinNofHits=5;
-     iNStations=7;
-     iNReqStations=7;
-     //     tofFindTracks->SetStation(0, 9, 0, 0);         
-     tofFindTracks->SetStation(0, 9, 1, 0);
-     tofFindTracks->SetStation(1, 9, 2, 0);         
-     tofFindTracks->SetStation(2, 9, 1, 1);         
-     tofFindTracks->SetStation(3, 9, 2, 1);
-     tofFindTracks->SetStation(4, 9, 0, 1);         
-     tofFindTracks->SetStation(5, 6, 0, 0);         
-     tofFindTracks->SetStation(6, 6, 0, 1);
-     break;
-     
-   default:
-     cout << "Tracking setup "<<iTrackingSetup<<" not implemented "<<endl;
-     return;
-     ;
-   }
-   tofFindTracks->SetMinNofHits(iMinNofHits);
-   tofFindTracks->SetNStations(iNStations);
-   tofFindTracks->SetNReqStations(iNReqStations);
-   tofFindTracks->PrintSetup();
-   run->AddTask(tofFindTracks);
-
-   // =========================================================================
-   // ===                       Analysis                                    ===
-   // =========================================================================
-
-   CbmTofAnaTestbeam* tofAnaTestbeam = new CbmTofAnaTestbeam("TOF TestBeam Analysis",iVerbose);
-
-   //CbmTofAnaTestbeam defaults  
-   tofAnaTestbeam->SetReqTrg(0);   // 0 - no selection
-   tofAnaTestbeam->SetDXMean(0.);
-   tofAnaTestbeam->SetDYMean(0.);
-   tofAnaTestbeam->SetDTMean(0.);  // in ps
-   tofAnaTestbeam->SetDXWidth(0.4);
-   tofAnaTestbeam->SetDYWidth(0.4);
-   tofAnaTestbeam->SetDTWidth(80.); // in ps
-   tofAnaTestbeam->SetCalParFileName(cAnaFile);
-   tofAnaTestbeam->SetPosY4Sel(0.5); // Y Position selection in fraction of strip length
-   tofAnaTestbeam->SetDTDia(0.);   // Time difference to additional diamond
-   tofAnaTestbeam->SetCorMode(RefSel); // 1 - DTD4, 2 - X4 
-   tofAnaTestbeam->SetMul0Max(30);      // Max Multiplicity in dut 
-   tofAnaTestbeam->SetMul4Max(30);      // Max Multiplicity in Ref - RPC 
-   tofAnaTestbeam->SetMulDMax(10);      // Max Multiplicity in Diamond    
-   tofAnaTestbeam->SetHitDistMin(30.);  // initialization
-   tofAnaTestbeam->SetEnableMatchPosScaling(kFALSE);
-
-   tofAnaTestbeam->SetPosYS2Sel(0.5);   // Y Position selection in fraction of strip length
-   tofAnaTestbeam->SetChS2Sel(0.);      // Center of channel selection window
-   tofAnaTestbeam->SetDChS2Sel(100.);   // Width  of channel selection window
-   tofAnaTestbeam->SetTShift(0.);       // Shift DTD4 to 0
-   tofAnaTestbeam->SetSel2TOff(0.);     // Shift Sel2 time peak to 0 
-   tofAnaTestbeam->SetTOffD4(13.);   // Shift DTD4 to physical value
-
-   if(iSel2 > 0) {
-     tofAnaTestbeam->SetMrpcSel2(iSel2);           // initialization of second selector Mrpc Type 
-     tofAnaTestbeam->SetMrpcSel2Sm(iSel2Sm);       // initialization of second selector Mrpc SmId
-     tofAnaTestbeam->SetMrpcSel2Rpc(iSel2Rpc);     // initialization of second selector Mrpc RpcId
-   }
-
-   tofAnaTestbeam->SetDut(iDut);              // Device under test   
-   tofAnaTestbeam->SetDutSm(iDutSm);          // Device under test   
-   tofAnaTestbeam->SetDutRpc(iDutRpc);        // Device under test   
-   tofAnaTestbeam->SetMrpcRef(iRef);          // Reference RPC     
-   tofAnaTestbeam->SetMrpcRefSm(iRefSm);      // Reference RPC     
-   tofAnaTestbeam->SetMrpcRefRpc(iRefRpc);    // Reference RPC     
-
-   tofAnaTestbeam->SetChi2Lim(10.);           // initialization of Chi2 selection limit  
-
-   if(0)
-   switch (iSet) {
-   case 0:                                 // upper part of setup: P2 - P5
-   case 3:                                 // upper part of setup: P2 - P5
-   case 34:                                // upper part of setup: P2 - P5
-   case 400300:
-     switch (iRSel){
-         case 4:
-	   tofAnaTestbeam->SetTShift(0.);   // Shift DTD4 to 0
-	   tofAnaTestbeam->SetTOffD4(16.);   // Shift DTD4 to physical value
-	   tofAnaTestbeam->SetSel2TOff(0.);     // Shift Sel2 time peak to 0
-	   break;
-	   
-         case 5:
-	   tofAnaTestbeam->SetTShift(-3.);     // Shift DTD4 to 0
-	   tofAnaTestbeam->SetTOffD4(16.);   // Shift DTD4 to physical value
-	   tofAnaTestbeam->SetSel2TOff(0.);     // Shift Sel2 time peak to 0
-	   break;
-
-         case 9:
-	   tofAnaTestbeam->SetChi2Lim(100.);   // initialization of Chi2 selection limit  
-	   tofAnaTestbeam->SetMulDMax(3);      // Max Multiplicity in BeamRef // Diamond    
-	   tofAnaTestbeam->SetTShift(0.1);   // Shift DTD4 to 0
-	   tofAnaTestbeam->SetTOffD4(16.);   // Shift DTD4 to physical value
-	   tofAnaTestbeam->SetSel2TOff(0.5);     // Shift Sel2 time peak to 0
-	   break;
-
-         default:
-	   ;
-     }
-
-     default:
-	   cout<<"<E> detector setup "<<iSet<<" unknown, stop!"<<endl;
-	   return;
-	 ;
-   }  // end of different subsets
-
-   //run->AddTask(tofAnaTestbeam);
-   // =========================================================================
-   /*
+      break;
+
+    case 11:  // for debugging
+      iMinNofHits   = 3;
+      iNStations    = 5;
+      iNReqStations = 5;
+      //     tofFindTracks->SetStation(0, 9, 0, 0);
+      tofFindTracks->SetStation(0, 9, 1, 0);
+      tofFindTracks->SetStation(1, 9, 2, 0);
+      tofFindTracks->SetStation(2, 9, 2, 1);
+      tofFindTracks->SetStation(3, 9, 0, 1);
+      tofFindTracks->SetStation(4, 1, 0, 1);
+      break;
+
+    case 2:
+      iMinNofHits   = 6;
+      iNStations    = 7;
+      iNReqStations = 7;
+      tofFindTracks->SetStation(0, 9, 1, 0);
+      tofFindTracks->SetStation(1, 9, 2, 0);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 2, 1);
+      tofFindTracks->SetStation(4, 9, 0, 0);
+      tofFindTracks->SetStation(5, 9, 0, 1);
+      tofFindTracks->SetStation(6, 1, 0, 1);
+      //     tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 21:
+      iMinNofHits   = 5;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 9, 1, 0);
+      tofFindTracks->SetStation(1, 9, 2, 0);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 2, 1);
+      //tofFindTracks->SetStation(4, 9, 0, 0);
+      tofFindTracks->SetStation(4, 9, 0, 1);
+      tofFindTracks->SetStation(5, 1, 0, 1);
+      //     tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 3:
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 9, 1, 1);
+      tofFindTracks->SetStation(1, 9, 2, 1);
+      tofFindTracks->SetStation(2, 9, 1, 0);
+      tofFindTracks->SetStation(3, 9, 2, 0);
+      tofFindTracks->SetStation(4, 9, 0, 1);
+      break;
+
+    case 4: iMinNofHits = 5; break;
+
+    case 5:  // for calibration of 2-stack and add-on counters (STAR2, CERN)
+      iMinNofHits   = 5;
+      iNStations    = 7;
+      iNReqStations = 7;
+      //     tofFindTracks->SetStation(0, 9, 0, 0);
+      tofFindTracks->SetStation(0, 9, 1, 0);
+      tofFindTracks->SetStation(1, 9, 2, 0);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 2, 1);
+      tofFindTracks->SetStation(4, 9, 0, 1);
+      tofFindTracks->SetStation(5, 6, 0, 0);
+      tofFindTracks->SetStation(6, 6, 0, 1);
+      break;
+
+    default:
+      cout << "Tracking setup " << iTrackingSetup << " not implemented "
+           << endl;
+      return;
+      ;
+  }
+  tofFindTracks->SetMinNofHits(iMinNofHits);
+  tofFindTracks->SetNStations(iNStations);
+  tofFindTracks->SetNReqStations(iNReqStations);
+  tofFindTracks->PrintSetup();
+  run->AddTask(tofFindTracks);
+
+  // =========================================================================
+  // ===                       Analysis                                    ===
+  // =========================================================================
+
+  CbmTofAnaTestbeam* tofAnaTestbeam =
+    new CbmTofAnaTestbeam("TOF TestBeam Analysis", iVerbose);
+
+  //CbmTofAnaTestbeam defaults
+  tofAnaTestbeam->SetReqTrg(0);  // 0 - no selection
+  tofAnaTestbeam->SetDXMean(0.);
+  tofAnaTestbeam->SetDYMean(0.);
+  tofAnaTestbeam->SetDTMean(0.);  // in ps
+  tofAnaTestbeam->SetDXWidth(0.4);
+  tofAnaTestbeam->SetDYWidth(0.4);
+  tofAnaTestbeam->SetDTWidth(80.);  // in ps
+  tofAnaTestbeam->SetCalParFileName(cAnaFile);
+  tofAnaTestbeam->SetPosY4Sel(
+    0.5);  // Y Position selection in fraction of strip length
+  tofAnaTestbeam->SetDTDia(0.);        // Time difference to additional diamond
+  tofAnaTestbeam->SetCorMode(RefSel);  // 1 - DTD4, 2 - X4
+  tofAnaTestbeam->SetMul0Max(30);      // Max Multiplicity in dut
+  tofAnaTestbeam->SetMul4Max(30);      // Max Multiplicity in Ref - RPC
+  tofAnaTestbeam->SetMulDMax(10);      // Max Multiplicity in Diamond
+  tofAnaTestbeam->SetHitDistMin(30.);  // initialization
+  tofAnaTestbeam->SetEnableMatchPosScaling(kFALSE);
+
+  tofAnaTestbeam->SetPosYS2Sel(
+    0.5);  // Y Position selection in fraction of strip length
+  tofAnaTestbeam->SetChS2Sel(0.);     // Center of channel selection window
+  tofAnaTestbeam->SetDChS2Sel(100.);  // Width  of channel selection window
+  tofAnaTestbeam->SetTShift(0.);      // Shift DTD4 to 0
+  tofAnaTestbeam->SetSel2TOff(0.);    // Shift Sel2 time peak to 0
+  tofAnaTestbeam->SetTOffD4(13.);     // Shift DTD4 to physical value
+
+  if (iSel2 > 0) {
+    tofAnaTestbeam->SetMrpcSel2(
+      iSel2);  // initialization of second selector Mrpc Type
+    tofAnaTestbeam->SetMrpcSel2Sm(
+      iSel2Sm);  // initialization of second selector Mrpc SmId
+    tofAnaTestbeam->SetMrpcSel2Rpc(
+      iSel2Rpc);  // initialization of second selector Mrpc RpcId
+  }
+
+  tofAnaTestbeam->SetDut(iDut);            // Device under test
+  tofAnaTestbeam->SetDutSm(iDutSm);        // Device under test
+  tofAnaTestbeam->SetDutRpc(iDutRpc);      // Device under test
+  tofAnaTestbeam->SetMrpcRef(iRef);        // Reference RPC
+  tofAnaTestbeam->SetMrpcRefSm(iRefSm);    // Reference RPC
+  tofAnaTestbeam->SetMrpcRefRpc(iRefRpc);  // Reference RPC
+
+  tofAnaTestbeam->SetChi2Lim(10.);  // initialization of Chi2 selection limit
+
+  if (0) switch (iSet) {
+      case 0:   // upper part of setup: P2 - P5
+      case 3:   // upper part of setup: P2 - P5
+      case 34:  // upper part of setup: P2 - P5
+      case 400300:
+        switch (iRSel) {
+          case 4:
+            tofAnaTestbeam->SetTShift(0.);    // Shift DTD4 to 0
+            tofAnaTestbeam->SetTOffD4(16.);   // Shift DTD4 to physical value
+            tofAnaTestbeam->SetSel2TOff(0.);  // Shift Sel2 time peak to 0
+            break;
+
+          case 5:
+            tofAnaTestbeam->SetTShift(-3.);   // Shift DTD4 to 0
+            tofAnaTestbeam->SetTOffD4(16.);   // Shift DTD4 to physical value
+            tofAnaTestbeam->SetSel2TOff(0.);  // Shift Sel2 time peak to 0
+            break;
+
+          case 9:
+            tofAnaTestbeam->SetChi2Lim(
+              100.);  // initialization of Chi2 selection limit
+            tofAnaTestbeam->SetMulDMax(
+              3);  // Max Multiplicity in BeamRef // Diamond
+            tofAnaTestbeam->SetTShift(0.1);    // Shift DTD4 to 0
+            tofAnaTestbeam->SetTOffD4(16.);    // Shift DTD4 to physical value
+            tofAnaTestbeam->SetSel2TOff(0.5);  // Shift Sel2 time peak to 0
+            break;
+
+          default:;
+        }
+
+      default:
+        cout << "<E> detector setup " << iSet << " unknown, stop!" << endl;
+        return;
+        ;
+    }  // end of different subsets
+
+  //run->AddTask(tofAnaTestbeam);
+  // =========================================================================
+  /*
    CbmTofOnlineDisplay* display = new CbmTofOnlineDisplay();
    display->SetUpdateInterval(1000);
    run->AddTask(display);   
    */
   // -----  Parameter database   --------------------------------------------
- 
-   FairRuntimeDb* rtdb = run->GetRuntimeDb();
-   Bool_t kParameterMerged = kTRUE;
-   FairParRootFileIo* parIo2 = new FairParRootFileIo(kParameterMerged);
-   parIo2->open(ParFile.Data(), "UPDATE");
-   parIo2->print();
-   rtdb->setFirstInput(parIo2);
-  
-   FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
-   parIo1->open(parFileList, "in");
-   parIo1->print();
-   rtdb->setSecondInput(parIo1);
-   rtdb->print();
-   rtdb->printParamContexts();
-
-   //  FairParRootFileIo* parInput1 = new FairParRootFileIo();
-   //  parInput1->open(ParFile.Data());
-   //  rtdb->setFirstInput(parInput1);
-
-   FairEventManager *fMan= new FairEventManager();
- 
-  CbmEvDisTracks *Tracks =  new CbmEvDisTracks("Tof Tracks",1,kFALSE,kTRUE); //name, verbosity, RnrChildren points, RnrChildren track
-   //  CbmEvDisTracks *Tracks =  new CbmEvDisTracks("Tof Tracks",1);
+
+  FairRuntimeDb* rtdb       = run->GetRuntimeDb();
+  Bool_t kParameterMerged   = kTRUE;
+  FairParRootFileIo* parIo2 = new FairParRootFileIo(kParameterMerged);
+  parIo2->open(ParFile.Data(), "UPDATE");
+  parIo2->print();
+  rtdb->setFirstInput(parIo2);
+
+  FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo();
+  parIo1->open(parFileList, "in");
+  parIo1->print();
+  rtdb->setSecondInput(parIo1);
+  rtdb->print();
+  rtdb->printParamContexts();
+
+  //  FairParRootFileIo* parInput1 = new FairParRootFileIo();
+  //  parInput1->open(ParFile.Data());
+  //  rtdb->setFirstInput(parInput1);
+
+  FairEventManager* fMan = new FairEventManager();
+
+  CbmEvDisTracks* Tracks = new CbmEvDisTracks(
+    "Tof Tracks",
+    1,
+    kFALSE,
+    kTRUE);  //name, verbosity, RnrChildren points, RnrChildren track
+             //  CbmEvDisTracks *Tracks =  new CbmEvDisTracks("Tof Tracks",1);
   fMan->AddTask(Tracks);
-  CbmPixelHitSetDraw *TofUHits = new CbmPixelHitSetDraw ("TofUHit", kRed, kOpenCross );
+  CbmPixelHitSetDraw* TofUHits =
+    new CbmPixelHitSetDraw("TofUHit", kRed, kOpenCross);
   fMan->AddTask(TofUHits);
-   CbmPointSetArrayDraw *TofHits = new CbmPointSetArrayDraw ("TofHit", 1, 1, 4, kTRUE); //name, colorMode, markerMode, verbosity, RnrChildren
-   //  CbmPixelHitSetDraw *TofHits = new CbmPixelHitSetDraw ("TofHit", kRed, kOpenCircle, 4);// kFullSquare);
-  fMan->AddTask(TofHits); 
+  CbmPointSetArrayDraw* TofHits = new CbmPointSetArrayDraw(
+    "TofHit",
+    1,
+    1,
+    4,
+    kTRUE);  //name, colorMode, markerMode, verbosity, RnrChildren
+  //  CbmPixelHitSetDraw *TofHits = new CbmPixelHitSetDraw ("TofHit", kRed, kOpenCircle, 4);// kFullSquare);
+  fMan->AddTask(TofHits);
 
 
   TGeoVolume* top = gGeoManager->GetTopVolume();
@@ -578,9 +623,9 @@ Int_t iGenCor=1, Int_t iTrackingSetup=1, Double_t dScalFac=5., Double_t dChi2Lim
   gGeoManager->SetVisLevel(5);
   TObjArray* allvolumes = gGeoManager->GetListOfVolumes();
   //cout<<"GeoVolumes  "  << gGeoManager->GetListOfVolumes()->GetEntries()<<endl;
-  for(Int_t i=0; i<allvolumes->GetEntries(); i++){
-    TGeoVolume* vol     = (TGeoVolume*)allvolumes->At(i);
-    TString name = vol->GetName();
+  for (Int_t i = 0; i < allvolumes->GetEntries(); i++) {
+    TGeoVolume* vol = (TGeoVolume*) allvolumes->At(i);
+    TString name    = vol->GetName();
     //    cout << " GeoVolume "<<i<<" Name: "<< name << endl;
     vol->SetTransparency(90);
     /* switch (char *) not allowed any more in root 6 :(
@@ -605,32 +650,31 @@ Int_t iGenCor=1, Int_t iTrackingSetup=1, Double_t dScalFac=5., Double_t dChi2Lim
     */
   }
   //  gGeoManager->SetVisLevel(3);
-  //  top->SetTransparency(80); 
+  //  top->SetTransparency(80);
   //  top->Draw("ogl");
 
-  //  fMan->Init(1,4,10000);                     
-  fMan->Init(1,5); 
-                    
-  cout << "customize TEveManager gEve "<< gEve << endl;
-  gEve->GetDefaultGLViewer()->SetClearColor(kYellow-10);
-  TGLViewer* v = gEve->GetDefaultGLViewer();
-  TGLAnnotation* ann = new TGLAnnotation(v,cFileId,0.01,0.98);
-  ann->SetTextSize(0.03);// % of window diagonal
+  //  fMan->Init(1,4,10000);
+  fMan->Init(1, 5);
+
+  cout << "customize TEveManager gEve " << gEve << endl;
+  gEve->GetDefaultGLViewer()->SetClearColor(kYellow - 10);
+  TGLViewer* v       = gEve->GetDefaultGLViewer();
+  TGLAnnotation* ann = new TGLAnnotation(v, cFileId, 0.01, 0.98);
+  ann->SetTextSize(0.03);  // % of window diagonal
   ann->SetTextColor(4);
 
   //  gEve->TEveProjectionAxes()->SetDrawOrigin(kTRUE);
 
-  {   // from readCurrentCamera(const char* fname)
-  TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera();
-  const char* fname="Cam.sav";
-  TFile* f = TFile::Open(fname, "READ");
-  if (!f) 
-    return;
-  if (f->GetKey(c.ClassName())) {
-    f->GetKey(c.ClassName())->Read(&c);
-    c.IncTimeStamp();
-    gEve->GetDefaultGLViewer()->RequestDraw();
-  }
+  {  // from readCurrentCamera(const char* fname)
+    TGLCamera& c      = gEve->GetDefaultGLViewer()->CurrentCamera();
+    const char* fname = "Cam.sav";
+    TFile* f          = TFile::Open(fname, "READ");
+    if (!f) return;
+    if (f->GetKey(c.ClassName())) {
+      f->GetKey(c.ClassName())->Read(&c);
+      c.IncTimeStamp();
+      gEve->GetDefaultGLViewer()->RequestDraw();
+    }
   }
 
   // -----   Intialise and run   --------------------------------------------
@@ -638,7 +682,7 @@ Int_t iGenCor=1, Int_t iTrackingSetup=1, Double_t dScalFac=5., Double_t dChi2Lim
   //  cout << "Starting run" << endl;
   //  run->Run(0, nEvents);
   // ------------------------------------------------------------------------
-  // default display 
+  // default display
   /*
   TString Display_Status = "pl_over_Mat04D4best.C";
   TString Display_Funct = "pl_over_Mat04D4best()";  
diff --git a/macro/beamtime/hd2020/pl_all_3D.C b/macro/beamtime/hd2020/pl_all_3D.C
index 9582590d67..6a94e7f91b 100644
--- a/macro/beamtime/hd2020/pl_all_3D.C
+++ b/macro/beamtime/hd2020/pl_all_3D.C
@@ -1,65 +1,69 @@
-void pl_all_3D(Int_t iOpt=0, Int_t iSel=0, Int_t iNSt=2)
-{
+void pl_all_3D(Int_t iOpt = 0, Int_t iSel = 0, Int_t iNSt = 2) {
   //  TCanvas *can = new TCanvas("can22","can22");
-  //  can->Divide(2,2); 
+  //  can->Divide(2,2);
   //  TCanvas *can = new TCanvas("can","can",48,55,700,900);
-  TCanvas *can = new TCanvas("can","can",48,56,900,900);
-  can->Divide(4,3,0.01,0.01); 
-  //  can->Divide(2,2,0,0); 
-  Float_t lsize=0.07;
+  TCanvas* can = new TCanvas("can", "can", 48, 56, 900, 900);
+  can->Divide(4, 3, 0.01, 0.01);
+  //  can->Divide(2,2,0,0);
+  Float_t lsize = 0.07;
 
- gPad->SetFillColor(0);
- gStyle->SetPalette(1);
- gStyle->SetLabelSize(lsize);
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
 
- //gStyle->SetOptStat(kTRUE);
- //gROOT->cd();
- //gROOT->SetDirLevel(2);
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
 
- TH3 *h;
- TH2 *h2;
- const Int_t   iType[6]={9,6,7,5,6,8};
- const Int_t  iSmNum[6]={3,2,1,1,1,1};
- const Int_t iRpcNum[6]={2,2,1,1,2,8};
- TString cOpt; 
+  TH3* h;
+  TH2* h2;
+  const Int_t iType[6]   = {9, 6, 7, 5, 6, 8};
+  const Int_t iSmNum[6]  = {3, 2, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {2, 2, 1, 1, 2, 8};
+  TString cOpt;
 
- Int_t iCanv=0;
- // if (h!=NULL) h->Delete();
+  Int_t iCanv = 0;
+  // if (h!=NULL) h->Delete();
 
- for(Int_t iSt=0; iSt<iNSt; iSt++){
-  for(Int_t iSm=0; iSm<iSmNum[iSt];iSm++){
-    for(Int_t iRp=0; iRp<iRpcNum[iSt];iRp++){
-      can->cd(iCanv+1); iCanv++;
-      gROOT->cd();
-      TString hname=Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2",iType[iSt],iSm,iRp,iSel);
-      h=(TH3 *)gROOT->FindObjectAny(hname);
-      if (h!=NULL) {
-		switch(iOpt){
-		  case 0: 
-			cOpt="yx";
-			h->Project3D(cOpt)->Draw("colz");
-			break;
+  for (Int_t iSt = 0; iSt < iNSt; iSt++) {
+    for (Int_t iSm = 0; iSm < iSmNum[iSt]; iSm++) {
+      for (Int_t iRp = 0; iRp < iRpcNum[iSt]; iRp++) {
+        can->cd(iCanv + 1);
+        iCanv++;
+        gROOT->cd();
+        TString hname = Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2",
+                             iType[iSt],
+                             iSm,
+                             iRp,
+                             iSel);
+        h             = (TH3*) gROOT->FindObjectAny(hname);
+        if (h != NULL) {
+          switch (iOpt) {
+            case 0:
+              cOpt = "yx";
+              h->Project3D(cOpt)->Draw("colz");
+              break;
 
-		  case 1:
-			cOpt="yx";
-			h->Project3D(cOpt)->Draw("colz");
-		    gPad->SetLogz();
-			break;
+            case 1:
+              cOpt = "yx";
+              h->Project3D(cOpt)->Draw("colz");
+              gPad->SetLogz();
+              break;
 
-		  case 2: 
-			cOpt="pfyx";
-			h2 = (TH2 *)h->Project3DProfile("yx");
-			h2->SetMinimum(-0.2);
-			h2->SetMaximum(0.2);
-			h2->Draw("colz");
-			break;
-		  default:
-			;
-		}
-      }else{cout<<"Histogram "<<hname<<" not existing. "<<endl;}
+            case 2:
+              cOpt = "pfyx";
+              h2   = (TH2*) h->Project3DProfile("yx");
+              h2->SetMinimum(-0.2);
+              h2->SetMaximum(0.2);
+              h2->Draw("colz");
+              break;
+            default:;
+          }
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+      }
     }
   }
- }
- can->SaveAs(Form("pl_all_%s.pdf",cOpt.Data()));
-
-} 
+  can->SaveAs(Form("pl_all_%s.pdf", cOpt.Data()));
+}
diff --git a/macro/beamtime/mcbm2018/ana_digi_cal.C b/macro/beamtime/mcbm2018/ana_digi_cal.C
index eb9b70872e..f792256dac 100644
--- a/macro/beamtime/mcbm2018/ana_digi_cal.C
+++ b/macro/beamtime/mcbm2018/ana_digi_cal.C
@@ -46,7 +46,7 @@ void ana_digi_cal(Int_t nEvents      = 10000000,
   TString FId    = cFileId;
   TString TofGeo = "v18m_mcbm";
   cout << "Geometry version " << TofGeo << endl;
-/*
+  /*
   TObjString* tofDigiFile = new TObjString(
     workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par");  // TOF digi file
   parFileList->Add(tofDigiFile);
diff --git a/macro/beamtime/mcbm2018/ana_digi_cal_all.C b/macro/beamtime/mcbm2018/ana_digi_cal_all.C
index 519b527a7b..ecc1acd60b 100644
--- a/macro/beamtime/mcbm2018/ana_digi_cal_all.C
+++ b/macro/beamtime/mcbm2018/ana_digi_cal_all.C
@@ -48,7 +48,7 @@ void ana_digi_cal_all(Int_t nEvents      = 10000000,
   TString FId    = cFileId;
   TString TofGeo = "v18m_mcbm";
   cout << "Geometry version " << TofGeo << endl;
-/*
+  /*
   TObjString* tofDigiFile = new TObjString(
     workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par");  // TOF digi file
   parFileList->Add(tofDigiFile);
diff --git a/macro/beamtime/mcbm2018/ana_digi_cali.C b/macro/beamtime/mcbm2018/ana_digi_cali.C
index 6fa1fa55ae..e9afe85d41 100644
--- a/macro/beamtime/mcbm2018/ana_digi_cali.C
+++ b/macro/beamtime/mcbm2018/ana_digi_cali.C
@@ -1,15 +1,15 @@
 void ana_digi_cali(Int_t nEvents      = 10000000,
-                  Int_t calMode      = 53,
-                  Int_t calSel       = 0,
-                  Int_t calSm        = 900,
-                  Int_t RefSel       = 1,
-                  TString cFileId    = "Test",
-                  Int_t iCalSet      = 910601600,
-                  Bool_t bOut        = 0,
-                  Int_t iSel2        = 0,
-                  Double_t dDeadtime = 50,
-                  TString cCalId     = "XXX",
-                  Int_t iPlot        = 1) {
+                   Int_t calMode      = 53,
+                   Int_t calSel       = 0,
+                   Int_t calSm        = 900,
+                   Int_t RefSel       = 1,
+                   TString cFileId    = "Test",
+                   Int_t iCalSet      = 910601600,
+                   Bool_t bOut        = 0,
+                   Int_t iSel2        = 0,
+                   Double_t dDeadtime = 50,
+                   TString cCalId     = "XXX",
+                   Int_t iPlot        = 1) {
   Int_t iVerbose = 1;
   Int_t iBugCor  = 0;
   //Specify log level (INFO, DEBUG, DEBUG1, ...)
@@ -31,7 +31,7 @@ void ana_digi_cali(Int_t nEvents      = 10000000,
    return;
   */
   //TString paramDir  = workDir + "/macro/beamtime/mcbm2018/";
-  TString paramDir  = "./"; 
+  TString paramDir  = "./";
   TString ParFile   = paramDir + "data/" + cFileId + ".params.root";
   TString InputFile = paramDir + "data/" + cFileId + ".root";
   TString OutputFile =
@@ -47,7 +47,7 @@ void ana_digi_cali(Int_t nEvents      = 10000000,
   TString FId    = cFileId;
   TString TofGeo = "v18m_mcbm";
   cout << "Geometry version " << TofGeo << endl;
-/*
+  /*
   TObjString* tofDigiFile = new TObjString(
     workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par");  // TOF digi file
   parFileList->Add(tofDigiFile);
diff --git a/macro/beamtime/mcbm2018/ana_trks.C b/macro/beamtime/mcbm2018/ana_trks.C
index 3fea1fc9ad..42d387348d 100644
--- a/macro/beamtime/mcbm2018/ana_trks.C
+++ b/macro/beamtime/mcbm2018/ana_trks.C
@@ -66,7 +66,7 @@ void ana_trks(Int_t nEvents        = 10000,
   gSystem->Exec(shcmd.Data());
 
   TList* parFileList = new TList();
-  Int_t iGeo = 0;  //iMc;
+  Int_t iGeo         = 0;  //iMc;
   if (iGeo == 0) {
     TString TofGeo = "v18m_mcbm";  //default
 
@@ -178,12 +178,12 @@ void ana_trks(Int_t nEvents        = 10000,
       tofTrackFinder->SetTxLIM(0.15);   // max slope dx/dz
       tofTrackFinder->SetTyLIM(0.18);   // max dev from mean slope dy/dz
       break;
-    case 2:                             // for triple stack 012 counter evaluation
-      tofTrackFinder->SetTxMean(0.0);  // mean slope dx/dz
-      tofTrackFinder->SetTyMean(-0.03);   // mean slope dy/dz
-      tofTrackFinder->SetTxLIM(0.06);  // max slope dx/dz
-      tofTrackFinder->SetTyLIM(0.03);  // max dev from mean slope dy/dz
-      break;      
+    case 2:  // for triple stack 012 counter evaluation
+      tofTrackFinder->SetTxMean(0.0);    // mean slope dx/dz
+      tofTrackFinder->SetTyMean(-0.03);  // mean slope dy/dz
+      tofTrackFinder->SetTxLIM(0.06);    // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.03);    // max dev from mean slope dy/dz
+      break;
   }
 
   CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211);
@@ -197,14 +197,15 @@ void ana_trks(Int_t nEvents        = 10000,
   tofFindTracks->SetCorMode(iGenCor);  // valid options: 0,1,2,3,4,5,6, 10 - 19
   //tofFindTracks->SetTtTarg(0.041);     // Mar19, Run 159
   //tofFindTracks->SetTtTarg(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.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(
     cTrkFile);                             // Tracker parameter value file name
   tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
-  tofFindTracks->SetR0Lim(0.); // for calibration
+  tofFindTracks->SetR0Lim(0.);             // for calibration
   tofFindTracks->SetStationMaxHMul(
     30);  // Max Hit Multiplicity in any used station
 
@@ -212,12 +213,13 @@ void ana_trks(Int_t nEvents        = 10000,
   tofFindTracks->SetSIGT(0.08);       // default in ns
   tofFindTracks->SetSIGX(0.45);       // local-y default in cm
   tofFindTracks->SetSIGY(0.3);        // local-x default in cm
-  tofFindTracks->SetSIGZ(10.05);       // default in cm
+  tofFindTracks->SetSIGZ(10.05);      // default in cm
   tofFindTracks->SetUseSigCalib(
     bUseSigCalib);  // ignore resolutions in CalPar file
   tofTrackFinder->SetSIGLIM(dChi2Lim2
                             * 2.);  // matching window in multiples of chi2
-  tofTrackFinder->SetSIGLIMMOD(1.5);   // search window modifier for last hit (DUT)
+  tofTrackFinder->SetSIGLIMMOD(
+    1.5);  // search window modifier for last hit (DUT)
   tofTrackFinder->SetChiMaxAccept(dChi2Lim2);  // max tracklet chi2
 
   Int_t iMinNofHits   = -1;
@@ -348,8 +350,8 @@ void ana_trks(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(2, 0, 0, 2);
       tofFindTracks->SetStation(3, 0, 1, 2);
       break;
-      
-    case 14:    // for eval 012
+
+    case 14:  // for eval 012
       iMinNofHits   = 3;
       iNStations    = 4;
       iNReqStations = 4;
@@ -358,8 +360,8 @@ void ana_trks(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(1, 0, 0, 2);
       tofFindTracks->SetStation(2, 0, 1, 2);
       break;
-      
-    case 24:    // for geometry tuning 012
+
+    case 24:  // for geometry tuning 012
       iMinNofHits   = 3;
       iNStations    = 3;
       iNReqStations = 3;
diff --git a/macro/beamtime/mcbm2018/ana_trksi.C b/macro/beamtime/mcbm2018/ana_trksi.C
index 2f2c9ecb2c..f5a01ebc59 100644
--- a/macro/beamtime/mcbm2018/ana_trksi.C
+++ b/macro/beamtime/mcbm2018/ana_trksi.C
@@ -1,19 +1,19 @@
 void ana_trksi(Int_t nEvents        = 10000,
-              Int_t iSel           = 1,
-              Int_t iGenCor        = 1,
-              TString cFileId      = "48.50.7.1",
-              TString cSet         = "000010020",
-              Int_t iSel2          = 20,
-              Int_t iTrackingSetup = 2,
-              Double_t dScalFac    = 1.,
-              Double_t dChi2Lim2   = 500.,
-              Double_t dDeadtime   = 50,
-              TString cCalId       = "",
-              Int_t iAnaCor        = 1,
-              Bool_t bUseSigCalib  = kFALSE,
-              Int_t iCalSet        = 30040500,
-              Int_t iCalOpt        = 1,
-              Int_t iMc            = 0) {
+               Int_t iSel           = 1,
+               Int_t iGenCor        = 1,
+               TString cFileId      = "48.50.7.1",
+               TString cSet         = "000010020",
+               Int_t iSel2          = 20,
+               Int_t iTrackingSetup = 2,
+               Double_t dScalFac    = 1.,
+               Double_t dChi2Lim2   = 500.,
+               Double_t dDeadtime   = 50,
+               TString cCalId       = "",
+               Int_t iAnaCor        = 1,
+               Bool_t bUseSigCalib  = kFALSE,
+               Int_t iCalSet        = 30040500,
+               Int_t iCalOpt        = 1,
+               Int_t iMc            = 0) {
   Int_t iVerbose = 1;
   if (cCalId == "") cCalId = cFileId;
   TString FId = cFileId;
@@ -27,9 +27,9 @@ void ana_trksi(Int_t nEvents        = 10000,
   //TString logLevel = "DEBUG1";
   //TString logLevel = "DEBUG2";
   //TString logLevel = "DEBUG3";
-  TString workDir  = gSystem->Getenv("VMCWORKDIR");
+  TString workDir = gSystem->Getenv("VMCWORKDIR");
   //TString paramDir = workDir + "/macro/beamtime/mcbm2018";
-  TString paramDir       = ".";
+  TString paramDir = ".";
 
   TString ParFile       = paramDir + "/data/" + cFileId.Data() + ".params.root";
   TString InputFile     = paramDir + "/data/" + cFileId.Data() + ".root";
@@ -66,7 +66,7 @@ void ana_trksi(Int_t nEvents        = 10000,
   gSystem->Exec(shcmd.Data());
 
   TList* parFileList = new TList();
-  Int_t iGeo = 0;  //iMc;
+  Int_t iGeo         = 0;  //iMc;
   if (iGeo == 0) {
     TString TofGeo = "v18m_mcbm";  //default
 
@@ -178,12 +178,12 @@ void ana_trksi(Int_t nEvents        = 10000,
       tofTrackFinder->SetTxLIM(0.15);   // max slope dx/dz
       tofTrackFinder->SetTyLIM(0.18);   // max dev from mean slope dy/dz
       break;
-    case 2:                             // for triple stack 012 counter evaluation
-      tofTrackFinder->SetTxMean(0.0);  // mean slope dx/dz
-      tofTrackFinder->SetTyMean(-0.03);   // mean slope dy/dz
-      tofTrackFinder->SetTxLIM(0.06);  // max slope dx/dz
-      tofTrackFinder->SetTyLIM(0.03);  // max dev from mean slope dy/dz
-      break;      
+    case 2:  // for triple stack 012 counter evaluation
+      tofTrackFinder->SetTxMean(0.0);    // mean slope dx/dz
+      tofTrackFinder->SetTyMean(-0.03);  // mean slope dy/dz
+      tofTrackFinder->SetTxLIM(0.06);    // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.03);    // max dev from mean slope dy/dz
+      break;
   }
 
   CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211);
@@ -196,7 +196,8 @@ void ana_trksi(Int_t nEvents        = 10000,
     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.041);     // Mar19, Run 159
-  tofFindTracks->SetTtTarg(0.0605);  // target value for Mar2020 triple stack -> betapeak ~ 0.95
+  tofFindTracks->SetTtTarg(
+    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
@@ -216,8 +217,9 @@ void ana_trksi(Int_t nEvents        = 10000,
   tofFindTracks->SetUseSigCalib(
     bUseSigCalib);  // ignore resolutions in CalPar file
   tofTrackFinder->SetSIGLIM(dChi2Lim2
-                            * 2.);     // matching window in multiples of chi2
-  tofTrackFinder->SetSIGLIMMOD(1.5);   // search window modifier for last hit (DUT)
+                            * 2.);  // matching window in multiples of chi2
+  tofTrackFinder->SetSIGLIMMOD(
+    1.5);  // search window modifier for last hit (DUT)
   tofTrackFinder->SetChiMaxAccept(dChi2Lim2);  // max tracklet chi2
 
   Int_t iMinNofHits   = -1;
@@ -348,8 +350,8 @@ void ana_trksi(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(2, 0, 0, 2);
       tofFindTracks->SetStation(3, 0, 1, 2);
       break;
-      
-    case 14:    // for eval 012
+
+    case 14:  // for eval 012
       iMinNofHits   = 3;
       iNStations    = 4;
       iNReqStations = 4;
@@ -358,8 +360,8 @@ void ana_trksi(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(1, 0, 0, 2);
       tofFindTracks->SetStation(2, 0, 1, 2);
       break;
-      
-    case 24:    // for geometry tuning 012
+
+    case 24:  // for geometry tuning 012
       iMinNofHits   = 3;
       iNStations    = 3;
       iNReqStations = 3;
@@ -678,7 +680,7 @@ void ana_trksi(Int_t nEvents        = 10000,
 
   TString SaveToHstFile = "save_hst(\"" + cHstFile + "\")";
   gInterpreter->ProcessLine(SaveToHstFile);
-  
+
   return;
 
   //gInterpreter->ProcessLine("pl_over_MatD4sel()");
diff --git a/macro/beamtime/mcbm2018/dis_digi.C b/macro/beamtime/mcbm2018/dis_digi.C
index 272f454ffa..068617809c 100644
--- a/macro/beamtime/mcbm2018/dis_digi.C
+++ b/macro/beamtime/mcbm2018/dis_digi.C
@@ -15,14 +15,14 @@ void dis_digi(Int_t nEvents        = 100,
               TString cCalId       = "XXX",
               Bool_t bUseSigCalib  = kFALSE,
               Int_t iCalOpt        = 1) {
-  
+
   Int_t iVerbose = 1;
   if (cCalId == "") cCalId = cFileId;
   TString FId = cFileId;
   TString cRun(FId(0, 3));
   Int_t iRun = cRun.Atoi();
   cout << "dis_digi for Run " << iRun << endl;
-  
+
   //Specify log level (INFO, DEBUG, DEBUG1, ...)
   //TString logLevel = "FATAL";
   //TString logLevel = "ERROR";
@@ -56,7 +56,7 @@ void dis_digi(Int_t nEvents        = 100,
 
   TString shcmd = "rm -v " + ParFile;
   gSystem->Exec(shcmd.Data());
-  
+
   Int_t iGeo = 0;  //iMc;
   if (iGeo == 0) {
     TString TofGeo = "v18m_mcbm";
@@ -67,8 +67,8 @@ void dis_digi(Int_t nEvents        = 100,
       workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par");  // TOF digi file
     parFileList->Add(tofDigiFile);
     */
-    TObjString* tofDigiBdfFile =
-      new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par");
+    TObjString* tofDigiBdfFile = new TObjString(workDir + "/parameters/tof/tof_"
+                                                + TofGeo + ".digibdf.par");
     parFileList->Add(tofDigiBdfFile);
 
     TString geoDir  = gSystem->Getenv("VMCWORKDIR");
@@ -86,7 +86,7 @@ void dis_digi(Int_t nEvents        = 100,
       master->Draw("ogl");
     }
   }
-  
+
   // Local steering variables
   Int_t iBRef    = iCalSet % 1000;
   Int_t iSet     = (iCalSet - iBRef) / 1000;
@@ -326,154 +326,153 @@ void dis_digi(Int_t nEvents        = 100,
   // =========================================================================
 
   CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN();
-    tofTrackFinder->SetMaxTofTimeDifference(0.4);  // in ns/cm
-    Int_t TrackerPar = 0;
-    switch (TrackerPar) {
-      case 0:                           // for full mTof setup
-        tofTrackFinder->SetTxLIM(0.3);  // max slope dx/dz
-        tofTrackFinder->SetTyLIM(0.3);  // max dev from mean slope dy/dz
-        tofTrackFinder->SetTxMean(0.);  // mean slope dy/dz
-        tofTrackFinder->SetTyMean(0.);  // mean slope dy/dz
-        break;
-      case 1:                             // for double stack test counters
-        tofTrackFinder->SetTxMean(0.21);  // 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
-        break;
+  tofTrackFinder->SetMaxTofTimeDifference(0.4);  // in ns/cm
+  Int_t TrackerPar = 0;
+  switch (TrackerPar) {
+    case 0:                           // for full mTof setup
+      tofTrackFinder->SetTxLIM(0.3);  // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.3);  // max dev from mean slope dy/dz
+      tofTrackFinder->SetTxMean(0.);  // mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);  // mean slope dy/dz
+      break;
+    case 1:                             // for double stack test counters
+      tofTrackFinder->SetTxMean(0.21);  // 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
+      break;
+  }
+
+  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.057);  // target value for inverse velocity, > 0.033 ns/cm!
+  //tofFindTracks->SetTtTarg(0.035);            // target value for inverse velocity, > 0.033 ns/cm!
+  tofFindTracks->SetCalParFileName(
+    cTrkFile);                             // Tracker parameter value file name
+  tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
+  tofFindTracks->SetR0Lim(100.);
+
+  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.6);        // 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
+
+
+  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    = 28;
+      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;
 
-    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.057);  // target value for inverse velocity, > 0.033 ns/cm!
-    //tofFindTracks->SetTtTarg(0.035);            // target value for inverse velocity, > 0.033 ns/cm!
-    tofFindTracks->SetCalParFileName(
-      cTrkFile);  // Tracker parameter value file name
-    tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
-    tofFindTracks->SetR0Lim(100.);
-
-    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.6);        // 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
-
-
-    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    = 28;
-        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;
-
-      case 2:
-        iMinNofHits   = 3;
-        iNStations    = 14;
-        iNReqStations = 5;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 1);
-        tofFindTracks->SetStation(2, 0, 3, 1);
-        tofFindTracks->SetStation(3, 0, 4, 0);
-        tofFindTracks->SetStation(4, 0, 3, 0);
-        tofFindTracks->SetStation(5, 0, 4, 2);
-        tofFindTracks->SetStation(6, 0, 3, 2);
-        tofFindTracks->SetStation(7, 0, 4, 3);
-        tofFindTracks->SetStation(8, 0, 3, 3);
-        tofFindTracks->SetStation(9, 0, 4, 4);
-        tofFindTracks->SetStation(10, 0, 3, 4);
-        tofFindTracks->SetStation(11, 9, 0, 0);
-        tofFindTracks->SetStation(12, 9, 0, 1);
-        tofFindTracks->SetStation(13, 7, 0, 0);
-        break;
-
-      case 3:
-        iMinNofHits   = 3;
-        iNStations    = 16;
-        iNReqStations = 4;
-        
-		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, 5, 0, 0);
-        /*
+    case 2:
+      iMinNofHits   = 3;
+      iNStations    = 14;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, 0, 4, 0);
+      tofFindTracks->SetStation(4, 0, 3, 0);
+      tofFindTracks->SetStation(5, 0, 4, 2);
+      tofFindTracks->SetStation(6, 0, 3, 2);
+      tofFindTracks->SetStation(7, 0, 4, 3);
+      tofFindTracks->SetStation(8, 0, 3, 3);
+      tofFindTracks->SetStation(9, 0, 4, 4);
+      tofFindTracks->SetStation(10, 0, 3, 4);
+      tofFindTracks->SetStation(11, 9, 0, 0);
+      tofFindTracks->SetStation(12, 9, 0, 1);
+      tofFindTracks->SetStation(13, 7, 0, 0);
+      break;
+
+    case 3:
+      iMinNofHits   = 3;
+      iNStations    = 16;
+      iNReqStations = 4;
+
+      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, 5, 0, 0);
+      /*
      tofFindTracks->SetStation(16, 0, 3, 2);         
      tofFindTracks->SetStation(17, 0, 4, 2);  
      tofFindTracks->SetStation(18, 0, 3, 1);         
@@ -485,87 +484,87 @@ void dis_digi(Int_t nEvents        = 100,
      tofFindTracks->SetStation(24, 0, 3, 4);         
      tofFindTracks->SetStation(25, 0, 4, 4); 
      */
-        break;
-
-      case 4:
-        iMinNofHits   = 3;
-        iNStations    = 4;
-        iNReqStations = 4;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 1);
-        tofFindTracks->SetStation(2, 0, 3, 1);
-        tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
-        break;
-
-      case 5:  // for calibration of 2-stack and add-on counters (STAR2, BUC)
-        iMinNofHits   = 3;
-        iNStations    = 5;
-        iNReqStations = 4;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 1);
-        tofFindTracks->SetStation(2, 0, 3, 1);
-        tofFindTracks->SetStation(3, 9, 0, 0);
-        tofFindTracks->SetStation(4, 9, 0, 1);
-        break;
-
-      case 6:
-        iMinNofHits   = 3;
-        iNStations    = 4;
-        iNReqStations = 4;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 1);
-        tofFindTracks->SetStation(2, 0, 3, 1);
-        tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
-        //    tofFindTracks->SetStation(3, 9, 0, 0);
-        //    tofFindTracks->SetStation(3, 9, 0, 1);
-        //    tofFindTracks->SetStation(3, 7, 0, 0);
-        break;
-
-      case 7:  // for calibration of 2-stack and add-on counters (BUC)
-        iMinNofHits   = 4;
-        iNStations    = 5;
-        iNReqStations = 5;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 3);
-        tofFindTracks->SetStation(2, 0, 3, 3);
-        tofFindTracks->SetStation(3, 6, 0, 0);
-        tofFindTracks->SetStation(4, 6, 0, 1);
-        break;
-
-      case 8:  // evaluation of add-on counters (BUC)
-        iMinNofHits   = 3;
-        iNStations    = 4;
-        iNReqStations = 4;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 3);
-        tofFindTracks->SetStation(2, 0, 3, 3);
-        tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
-        break;
-
-      case 10:
-        iMinNofHits   = 3;
-        iNStations    = 4;
-        iNReqStations = 4;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 1, 2);
-        tofFindTracks->SetStation(2, 0, 0, 2);
-        tofFindTracks->SetStation(3, 0, 2, 2);
+      break;
 
-      default:
-        cout << "Tracking setup " << iTrackingSetup << " not implemented "
-             << endl;
-        return;
-        ;
-    }
-    tofFindTracks->SetMinNofHits(iMinNofHits);
-    tofFindTracks->SetNStations(iNStations);
-    tofFindTracks->SetNReqStations(iNReqStations);
-    tofFindTracks->PrintSetup();
-    run->AddTask(tofFindTracks);
-
-    // =========================================================================
-    // ===                       Analysis                                    ===
-    // =========================================================================
+    case 4:
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 5:  // for calibration of 2-stack and add-on counters (STAR2, BUC)
+      iMinNofHits   = 3;
+      iNStations    = 5;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 9, 0, 1);
+      break;
+
+    case 6:
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      //    tofFindTracks->SetStation(3, 9, 0, 0);
+      //    tofFindTracks->SetStation(3, 9, 0, 1);
+      //    tofFindTracks->SetStation(3, 7, 0, 0);
+      break;
+
+    case 7:  // for calibration of 2-stack and add-on counters (BUC)
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 3);
+      tofFindTracks->SetStation(2, 0, 3, 3);
+      tofFindTracks->SetStation(3, 6, 0, 0);
+      tofFindTracks->SetStation(4, 6, 0, 1);
+      break;
+
+    case 8:  // evaluation of add-on counters (BUC)
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 3);
+      tofFindTracks->SetStation(2, 0, 3, 3);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 10:
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 1, 2);
+      tofFindTracks->SetStation(2, 0, 0, 2);
+      tofFindTracks->SetStation(3, 0, 2, 2);
+
+    default:
+      cout << "Tracking setup " << iTrackingSetup << " not implemented "
+           << endl;
+      return;
+      ;
+  }
+  tofFindTracks->SetMinNofHits(iMinNofHits);
+  tofFindTracks->SetNStations(iNStations);
+  tofFindTracks->SetNReqStations(iNReqStations);
+  tofFindTracks->PrintSetup();
+  run->AddTask(tofFindTracks);
+
+  // =========================================================================
+  // ===                       Analysis                                    ===
+  // =========================================================================
 
   CbmTofAnaTestbeam* tofAnaTestbeam =
     new CbmTofAnaTestbeam("TOF TestBeam Analysis", iVerbose);
diff --git a/macro/beamtime/mcbm2018/dis_trks.C b/macro/beamtime/mcbm2018/dis_trks.C
index c3e06005cc..84ab33e4f6 100644
--- a/macro/beamtime/mcbm2018/dis_trks.C
+++ b/macro/beamtime/mcbm2018/dis_trks.C
@@ -48,16 +48,16 @@ void dis_trks(Int_t nEvents        = 10,
   TString cHstFile =
     paramDir
     + Form(
-        "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Dis.hst.root",
-        cFileId.Data(),
-        dDeadtime,
-        cSet.Data(),
-        iSel,
-        iSel2,
-        dScalFac,
-        dChi2Lim2,
-        iTrackingSetup,
-        cCalId.Data());
+      "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Dis.hst.root",
+      cFileId.Data(),
+      dDeadtime,
+      cSet.Data(),
+      iSel,
+      iSel2,
+      dScalFac,
+      dChi2Lim2,
+      iTrackingSetup,
+      cCalId.Data());
   TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data());
   TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cCalId.Data());
 
@@ -97,8 +97,8 @@ void dis_trks(Int_t nEvents        = 10,
     //TObjString *tofDigiFile = new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par"); // TOF digi file
     //parFileList->Add(tofDigiFile);
 
-    TObjString* tofDigiBdfFile =
-      new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par");
+    TObjString* tofDigiBdfFile = new TObjString(workDir + "/parameters/tof/tof_"
+                                                + TofGeo + ".digibdf.par");
     parFileList->Add(tofDigiBdfFile);
 
     // -----   Reconstruction run   -------------------------------------------
@@ -289,28 +289,28 @@ void dis_trks(Int_t nEvents        = 10,
         iMinNofHits   = 3;
         iNStations    = 16;
         iNReqStations = 4;
-        
-		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(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(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(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(12, 0, 2, 4);
+        tofFindTracks->SetStation(13, 0, 1, 4);
+        tofFindTracks->SetStation(14, 0, 0, 4);
 
-		tofFindTracks->SetStation(15, 5, 0, 0);
+        tofFindTracks->SetStation(15, 5, 0, 0);
         /*
      tofFindTracks->SetStation(16, 0, 3, 2);         
      tofFindTracks->SetStation(17, 0, 4, 2);  
diff --git a/macro/beamtime/mcbm2020/ana_digi_cal.C b/macro/beamtime/mcbm2020/ana_digi_cal.C
index ef411b17c3..d782526719 100644
--- a/macro/beamtime/mcbm2020/ana_digi_cal.C
+++ b/macro/beamtime/mcbm2020/ana_digi_cal.C
@@ -45,9 +45,9 @@ void ana_digi_cal(Int_t nEvents      = 10000000,
 
   TList* parFileList = new TList();
 
-  TString FId    = cFileId;
+  TString FId = cFileId;
   TString cRun(FId(0, 3));
-  Int_t iRun = cRun.Atoi();
+  Int_t iRun     = cRun.Atoi();
   TString TofGeo = "";
   if (iRun < 690)
     TofGeo = "v20a_mcbm";
@@ -97,8 +97,7 @@ void ana_digi_cal(Int_t nEvents      = 10000000,
   tofClust->SetCalRpc(calSm);   // select detector for calibration update
   tofClust->SetTRefId(RefSel);  // reference trigger for offset calculation
   tofClust->SetTotMax(20.);     // Tot upper limit for walk corection
-  tofClust->SetTotMin(
-    0.);  //(12000.);  // Tot lower limit for walk correction
+  tofClust->SetTotMin(0.);  //(12000.);  // Tot lower limit for walk correction
   tofClust->SetTotPreRange(
     5.);  // effective lower Tot limit  in ns from peak position
   tofClust->SetTotMean(5.);       // Tot calibration target value in ns
diff --git a/macro/beamtime/mcbm2020/ana_digi_cal_all.C b/macro/beamtime/mcbm2020/ana_digi_cal_all.C
index c1c282a7c4..4d18ed803d 100644
--- a/macro/beamtime/mcbm2020/ana_digi_cal_all.C
+++ b/macro/beamtime/mcbm2020/ana_digi_cal_all.C
@@ -46,9 +46,9 @@ void ana_digi_cal_all(Int_t nEvents      = 10000000,
 
   TList* parFileList = new TList();
 
-  TString FId    = cFileId;
+  TString FId = cFileId;
   TString cRun(FId(0, 3));
-  Int_t iRun = cRun.Atoi();
+  Int_t iRun     = cRun.Atoi();
   TString TofGeo = "";
   if (iRun < 690)
     TofGeo = "v20a_mcbm";
@@ -98,8 +98,7 @@ void ana_digi_cal_all(Int_t nEvents      = 10000000,
   tofClust->SetCalRpc(calSm);   // select detector for calibration update
   tofClust->SetTRefId(RefSel);  // reference trigger for offset calculation
   tofClust->SetTotMax(20.);     // Tot upper limit for walk corection
-  tofClust->SetTotMin(
-    0.);  //(12000.);  // Tot lower limit for walk correction
+  tofClust->SetTotMin(0.);  //(12000.);  // Tot lower limit for walk correction
   tofClust->SetTotPreRange(
     5.);  // effective lower Tot limit  in ns from peak position
   tofClust->SetTotMean(5.);       // Tot calibration target value in ns
diff --git a/macro/beamtime/mcbm2020/ana_digi_cali.C b/macro/beamtime/mcbm2020/ana_digi_cali.C
index 9f187f4abf..ec722cf5ce 100644
--- a/macro/beamtime/mcbm2020/ana_digi_cali.C
+++ b/macro/beamtime/mcbm2020/ana_digi_cali.C
@@ -91,8 +91,7 @@ void ana_digi_cali(Int_t nEvents      = 10000000,
   tofClust->SetCalRpc(calSm);   // select detector for calibration update
   tofClust->SetTRefId(RefSel);  // reference trigger for offset calculation
   tofClust->SetTotMax(20.);     // Tot upper limit for walk corection
-  tofClust->SetTotMin(
-    0.);  //(12000.);  // Tot lower limit for walk correction
+  tofClust->SetTotMin(0.);  //(12000.);  // Tot lower limit for walk correction
   tofClust->SetTotPreRange(
     5.);  // effective lower Tot limit  in ns from peak position
   tofClust->SetTotMean(5.);       // Tot calibration target value in ns
diff --git a/macro/beamtime/mcbm2020/ana_trks.C b/macro/beamtime/mcbm2020/ana_trks.C
index 2f9bdb35f1..091442c90d 100644
--- a/macro/beamtime/mcbm2020/ana_trks.C
+++ b/macro/beamtime/mcbm2020/ana_trks.C
@@ -47,16 +47,16 @@ void ana_trks(Int_t nEvents        = 10000,
   TString cHstFile =
     paramDir
     + Form(
-        "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root",
-        cFileId.Data(),
-        dDeadtime,
-        cSet.Data(),
-        iSel,
-        iSel2,
-        dScalFac,
-        dChi2Lim2,
-        iTrackingSetup,
-        cCalId.Data());
+      "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root",
+      cFileId.Data(),
+      dDeadtime,
+      cSet.Data(),
+      iSel,
+      iSel2,
+      dScalFac,
+      dChi2Lim2,
+      iTrackingSetup,
+      cCalId.Data());
   TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data());
   TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cFileId.Data());
 
@@ -76,8 +76,8 @@ void ana_trks(Int_t nEvents        = 10000,
       TofGeo = "v20f_mcbm";
     cout << "Geometry version " << TofGeo << endl;
 
-    TObjString* tofDigiBdfFile =
-      new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par");
+    TObjString* tofDigiBdfFile = new TObjString(workDir + "/parameters/tof/tof_"
+                                                + TofGeo + ".digibdf.par");
     parFileList->Add(tofDigiBdfFile);
 
     TString geoDir  = gSystem->Getenv("VMCWORKDIR");
@@ -192,7 +192,8 @@ void ana_trks(Int_t nEvents        = 10000,
   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.065);          // target value for Mar2020 triple stack -> betapeak ~ 0.95
+  tofFindTracks->SetTtTarg(
+    0.065);  // target value for Mar2020 triple stack -> betapeak ~ 0.95
   //tofFindTracks->SetTtTarg(0.0605);  // target value for Mar2020 triple stack -> betapeak ~ 0.95
   //tofFindTracks->SetTtTarg(0.058);          // target value for Mar2020 double stack
   //tofFindTracks->SetTtTarg(0.055);            // target value Nov2019 (triple stack run 831)
@@ -418,7 +419,7 @@ void ana_trks(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
       break;
 
-    case 9:  // calibration of Star2 
+    case 9:  // calibration of Star2
       iMinNofHits   = 4;
       iNStations    = 5;
       iNReqStations = 5;
diff --git a/macro/beamtime/mcbm2020/ana_trks_eval.C b/macro/beamtime/mcbm2020/ana_trks_eval.C
index fa5f84dc70..9c306f332a 100644
--- a/macro/beamtime/mcbm2020/ana_trks_eval.C
+++ b/macro/beamtime/mcbm2020/ana_trks_eval.C
@@ -42,11 +42,11 @@ void ana_trks_eval(Int_t nEvents        = 10000,
     iRun          = 700;
   }
   TString InputTrklFile = paramDir + "/data/TofTrks_" + cFileId.Data()
-                       + Form("_%s_%06d_%03d", cSet.Data(), iSel, iSel2)
-                       + ".out.root";
+                          + Form("_%s_%06d_%03d", cSet.Data(), iSel, iSel2)
+                          + ".out.root";
   TString OutputFile = paramDir + "/data/ana_" + cFileId.Data()
                        + Form("_%s_%06d_%03d", cSet.Data(), iSel, iSel2)
-                       + ".out.root";                       
+                       + ".out.root";
   TString cHstFile =
     paramDir
     + Form(
@@ -80,8 +80,8 @@ void ana_trks_eval(Int_t nEvents        = 10000,
       TofGeo = "v20f_mcbm";
     cout << "Geometry version " << TofGeo << endl;
 
-    TObjString* tofDigiBdfFile =
-      new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par");
+    TObjString* tofDigiBdfFile = new TObjString(workDir + "/parameters/tof/tof_"
+                                                + TofGeo + ".digibdf.par");
     parFileList->Add(tofDigiBdfFile);
 
     TString geoDir  = gSystem->Getenv("VMCWORKDIR");
@@ -421,8 +421,8 @@ void ana_trks_eval(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(4, 0, 3, 1);
       tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
       break;
-     
-    case 9:  // calibration of Star2 
+
+    case 9:  // calibration of Star2
       iMinNofHits   = 4;
       iNStations    = 5;
       iNReqStations = 5;
@@ -432,7 +432,7 @@ void ana_trks_eval(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(3, 9, 0, 0);
       tofFindTracks->SetStation(4, 0, 3, 1);
       break;
-      
+
     case 10:
       iMinNofHits   = 3;
       iNStations    = 4;
@@ -462,7 +462,7 @@ void ana_trks_eval(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(2, 0, 0, 2);
       tofFindTracks->SetStation(3, 0, 1, 2);
       break;
-      
+
     case 13:
       iMinNofHits   = 3;
       iNStations    = 4;
@@ -472,7 +472,7 @@ void ana_trks_eval(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(2, 0, 0, 2);
       tofFindTracks->SetStation(3, 0, 1, 2);
       break;
-      
+
 
     case 14:
       iMinNofHits   = 3;
@@ -483,7 +483,7 @@ void ana_trks_eval(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(2, 0, 0, 2);
       tofFindTracks->SetStation(3, 0, 1, 2);
       break;
-            
+
     default:
       cout << "Tracking setup " << iTrackingSetup << " not implemented "
            << endl;
@@ -650,17 +650,20 @@ void ana_trks_eval(Int_t nEvents        = 10000,
                 break;
               case 31:
                 if (iMc == 0) {
-			      switch (iRun) {
-				    case 717:
-	                  tofAnaTestbeam->SetTShift(6.5);  // Shift DTD4 to 0
-					  tofAnaTestbeam->SetSel2TOff(0.6);  // Shift Sel2 time peak to 0
-				    break;
-				    default: // 714
-//                    tofAnaTestbeam->SetSel2TOff(-1.3);  // Shift Sel2 time peak to 0
-                      tofAnaTestbeam->SetSel2TOff(0.3);  // Shift Sel2 time peak to 0
-				  }
-                } else {    // MC
-                  tofAnaTestbeam->SetSel2TOff(-1.3);  // Shift Sel2 time peak to 0
+                  switch (iRun) {
+                    case 717:
+                      tofAnaTestbeam->SetTShift(6.5);  // Shift DTD4 to 0
+                      tofAnaTestbeam->SetSel2TOff(
+                        0.6);  // Shift Sel2 time peak to 0
+                      break;
+                    default:  // 714
+                      //                    tofAnaTestbeam->SetSel2TOff(-1.3);  // Shift Sel2 time peak to 0
+                      tofAnaTestbeam->SetSel2TOff(
+                        0.3);  // Shift Sel2 time peak to 0
+                  }
+                } else {  // MC
+                  tofAnaTestbeam->SetSel2TOff(
+                    -1.3);  // Shift Sel2 time peak to 0
                 }
                 break;
               case 600:
@@ -697,14 +700,14 @@ void ana_trks_eval(Int_t nEvents        = 10000,
       case 12022:
         switch (iRSelin) {
           case 500:
-            tofAnaTestbeam->SetTShift(3.);  // Shift DTD4 to 0
+            tofAnaTestbeam->SetTShift(3.);   // Shift DTD4 to 0
             tofAnaTestbeam->SetTOffD4(15.);  // Shift DTD4 to physical value
 
             switch (iSel2in) {
               case 2:
                 tofAnaTestbeam->SetSel2TOff(0.25);  // Shift Sel2 time peak to 0
                 break;
-                
+
               default:;
             }
             break;
diff --git a/macro/beamtime/mcbm2020/ana_trksi.C b/macro/beamtime/mcbm2020/ana_trksi.C
index 35d58e8676..07036e1cff 100644
--- a/macro/beamtime/mcbm2020/ana_trksi.C
+++ b/macro/beamtime/mcbm2020/ana_trksi.C
@@ -1,19 +1,19 @@
 void ana_trksi(Int_t nEvents        = 10000,
-              Int_t iSel           = 1,
-              Int_t iGenCor        = 1,
-              TString cFileId      = "48.50.7.1",
-              TString cSet         = "000010020",
-              Int_t iSel2          = 20,
-              Int_t iTrackingSetup = 2,
-              Double_t dScalFac    = 1.,
-              Double_t dChi2Lim2   = 500.,
-              Double_t dDeadtime   = 50,
-              TString cCalId       = "",
-              Int_t iAnaCor        = 1,
-              Bool_t bUseSigCalib  = kFALSE,
-              Int_t iCalSet        = 30040500,
-              Int_t iCalOpt        = 1,
-              Int_t iMc            = 0) {
+               Int_t iSel           = 1,
+               Int_t iGenCor        = 1,
+               TString cFileId      = "48.50.7.1",
+               TString cSet         = "000010020",
+               Int_t iSel2          = 20,
+               Int_t iTrackingSetup = 2,
+               Double_t dScalFac    = 1.,
+               Double_t dChi2Lim2   = 500.,
+               Double_t dDeadtime   = 50,
+               TString cCalId       = "",
+               Int_t iAnaCor        = 1,
+               Bool_t bUseSigCalib  = kFALSE,
+               Int_t iCalSet        = 30040500,
+               Int_t iCalOpt        = 1,
+               Int_t iMc            = 0) {
   Int_t iVerbose = 1;
   if (cCalId == "") cCalId = cFileId;
   TString FId = cFileId;
@@ -46,16 +46,16 @@ void ana_trksi(Int_t nEvents        = 10000,
   TString cHstFile =
     paramDir
     + Form(
-        "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root",
-        cFileId.Data(),
-        dDeadtime,
-        cSet.Data(),
-        iSel,
-        iSel2,
-        dScalFac,
-        dChi2Lim2,
-        iTrackingSetup,
-        cCalId.Data());
+      "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root",
+      cFileId.Data(),
+      dDeadtime,
+      cSet.Data(),
+      iSel,
+      iSel2,
+      dScalFac,
+      dChi2Lim2,
+      iTrackingSetup,
+      cCalId.Data());
   TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data());
   TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cFileId.Data());
 
@@ -75,8 +75,8 @@ void ana_trksi(Int_t nEvents        = 10000,
       TofGeo = "v20f_mcbm";
     cout << "Geometry version " << TofGeo << endl;
 
-    TObjString* tofDigiBdfFile =
-      new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par");
+    TObjString* tofDigiBdfFile = new TObjString(workDir + "/parameters/tof/tof_"
+                                                + TofGeo + ".digibdf.par");
     parFileList->Add(tofDigiBdfFile);
 
     TString geoDir  = gSystem->Getenv("VMCWORKDIR");
@@ -316,7 +316,7 @@ void ana_trksi(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(7, 0, 1, 3);
       tofFindTracks->SetStation(8, 0, 0, 3);
 
-      tofFindTracks->SetStation(9,  0, 2, 0);
+      tofFindTracks->SetStation(9, 0, 2, 0);
       tofFindTracks->SetStation(10, 0, 1, 0);
       tofFindTracks->SetStation(11, 0, 0, 0);
 
@@ -324,21 +324,21 @@ void ana_trksi(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(13, 0, 1, 4);
       tofFindTracks->SetStation(14, 0, 0, 4);
 
-      tofFindTracks->SetStation(15, 0, 3, 2);         
-      tofFindTracks->SetStation(16, 0, 4, 2);  
-      tofFindTracks->SetStation(17, 0, 3, 1);         
+      tofFindTracks->SetStation(15, 0, 3, 2);
+      tofFindTracks->SetStation(16, 0, 4, 2);
+      tofFindTracks->SetStation(17, 0, 3, 1);
       tofFindTracks->SetStation(18, 0, 4, 1);
-      tofFindTracks->SetStation(19, 0, 3, 3);         
+      tofFindTracks->SetStation(19, 0, 3, 3);
       tofFindTracks->SetStation(20, 0, 4, 3);
-      tofFindTracks->SetStation(21, 0, 3, 0);         
+      tofFindTracks->SetStation(21, 0, 3, 0);
       tofFindTracks->SetStation(22, 0, 4, 0);
-      tofFindTracks->SetStation(23, 0, 3, 4);         
+      tofFindTracks->SetStation(23, 0, 3, 4);
       tofFindTracks->SetStation(24, 0, 4, 4);
-       
+
       tofFindTracks->SetStation(25, 9, 0, 0);
       tofFindTracks->SetStation(26, 9, 0, 1);
       tofFindTracks->SetStation(27, 5, 0, 0);
-   
+
       break;
 
     case 4:  // for USTC evaluation
@@ -419,7 +419,7 @@ void ana_trksi(Int_t nEvents        = 10000,
       tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
       break;
 
-    case 9:  // calibration of Star2 
+    case 9:  // calibration of Star2
       iMinNofHits   = 4;
       iNStations    = 5;
       iNReqStations = 5;
@@ -600,14 +600,16 @@ void ana_trksi(Int_t nEvents        = 10000,
                 tofAnaTestbeam->SetSel2TOff(-0.3);  // Shift Sel2 time peak to 0
                 break;
               case 31:
-              switch (iRun) {
-				  case 717:
-	                tofAnaTestbeam->SetTShift(6.5);  // Shift DTD4 to 0
-					tofAnaTestbeam->SetSel2TOff(0.6);  // Shift Sel2 time peak to 0
-				  break;
-				  default: //714
-                  tofAnaTestbeam->SetSel2TOff(0.3);  // Shift Sel2 time peak to 0
-			    }
+                switch (iRun) {
+                  case 717:
+                    tofAnaTestbeam->SetTShift(6.5);  // Shift DTD4 to 0
+                    tofAnaTestbeam->SetSel2TOff(
+                      0.6);  // Shift Sel2 time peak to 0
+                    break;
+                  default:  //714
+                    tofAnaTestbeam->SetSel2TOff(
+                      0.3);  // Shift Sel2 time peak to 0
+                }
                 break;
               case 600:
                 tofAnaTestbeam->SetSel2TOff(-0.2);  // Shift Sel2 time peak to 0
@@ -643,14 +645,14 @@ void ana_trksi(Int_t nEvents        = 10000,
       case 12022:
         switch (iRSelin) {
           case 500:
-            tofAnaTestbeam->SetTShift(3.);  // Shift DTD4 to 0
+            tofAnaTestbeam->SetTShift(3.);   // Shift DTD4 to 0
             tofAnaTestbeam->SetTOffD4(16.);  // Shift DTD4 to physical value
 
             switch (iSel2in) {
               case 2:
                 tofAnaTestbeam->SetSel2TOff(0.25);  // Shift Sel2 time peak to 0
                 break;
-                
+
               default:;
             }
             break;
diff --git a/macro/beamtime/mcbm2020/build_event_win.C b/macro/beamtime/mcbm2020/build_event_win.C
index c0a722405f..42dff9606c 100644
--- a/macro/beamtime/mcbm2020/build_event_win.C
+++ b/macro/beamtime/mcbm2020/build_event_win.C
@@ -14,8 +14,8 @@ void build_event_win(UInt_t uRunId  = 0,
 
   // --- Set log output levels
   FairLogger::GetLogger();
-  gLogger->SetLogScreenLevel("INFO");
-  //  gLogger->SetLogScreenLevel("DEBUG");
+  //gLogger->SetLogScreenLevel("INFO");
+  gLogger->SetLogScreenLevel("DEBUG");
   gLogger->SetLogVerbosityLevel("MEDIUM");
 
   // MC file
diff --git a/macro/beamtime/mcbm2020/dis_digi.C b/macro/beamtime/mcbm2020/dis_digi.C
index 81054c6139..cfc8514f9f 100644
--- a/macro/beamtime/mcbm2020/dis_digi.C
+++ b/macro/beamtime/mcbm2020/dis_digi.C
@@ -15,14 +15,14 @@ void dis_digi(Int_t nEvents        = 100,
               TString cCalId       = "XXX",
               Bool_t bUseSigCalib  = kFALSE,
               Int_t iCalOpt        = 1) {
-  
+
   Int_t iVerbose = 1;
   if (cCalId == "") cCalId = cFileId;
   TString FId = cFileId;
   TString cRun(FId(0, 3));
   Int_t iRun = cRun.Atoi();
   cout << "dis_digi for Run " << iRun << endl;
-  
+
   //Specify log level (INFO, DEBUG, DEBUG1, ...)
   //TString logLevel = "FATAL";
   //TString logLevel = "ERROR";
@@ -56,7 +56,7 @@ void dis_digi(Int_t nEvents        = 100,
 
   TString shcmd = "rm -v " + ParFile;
   gSystem->Exec(shcmd.Data());
-  
+
   Int_t iGeo = 0;  //iMc;
   if (iGeo == 0) {
     TString TofGeo = "";
@@ -65,13 +65,13 @@ void dis_digi(Int_t nEvents        = 100,
     else
       TofGeo = "v20f_mcbm";
     cout << "Geometry version " << TofGeo << endl;
-/*  
+    /*  
     TObjString* tofDigiFile = new TObjString(
       workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par");  // TOF digi file
     parFileList->Add(tofDigiFile);
 */
-    TObjString* tofDigiBdfFile =
-      new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par");
+    TObjString* tofDigiBdfFile = new TObjString(workDir + "/parameters/tof/tof_"
+                                                + TofGeo + ".digibdf.par");
     parFileList->Add(tofDigiBdfFile);
 
     TString geoDir  = gSystem->Getenv("VMCWORKDIR");
@@ -89,7 +89,7 @@ void dis_digi(Int_t nEvents        = 100,
       master->Draw("ogl");
     }
   }
-  
+
   // Local steering variables
   Int_t iBRef    = iCalSet % 1000;
   Int_t iSet     = (iCalSet - iBRef) / 1000;
@@ -329,154 +329,153 @@ void dis_digi(Int_t nEvents        = 100,
   // =========================================================================
 
   CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN();
-    tofTrackFinder->SetMaxTofTimeDifference(0.4);  // in ns/cm
-    Int_t TrackerPar = 0;
-    switch (TrackerPar) {
-      case 0:                           // for full mTof setup
-        tofTrackFinder->SetTxLIM(0.3);  // max slope dx/dz
-        tofTrackFinder->SetTyLIM(0.3);  // max dev from mean slope dy/dz
-        tofTrackFinder->SetTxMean(0.);  // mean slope dy/dz
-        tofTrackFinder->SetTyMean(0.);  // mean slope dy/dz
-        break;
-      case 1:                             // for double stack test counters
-        tofTrackFinder->SetTxMean(0.21);  // 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
-        break;
+  tofTrackFinder->SetMaxTofTimeDifference(0.4);  // in ns/cm
+  Int_t TrackerPar = 0;
+  switch (TrackerPar) {
+    case 0:                           // for full mTof setup
+      tofTrackFinder->SetTxLIM(0.3);  // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.3);  // max dev from mean slope dy/dz
+      tofTrackFinder->SetTxMean(0.);  // mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);  // mean slope dy/dz
+      break;
+    case 1:                             // for double stack test counters
+      tofTrackFinder->SetTxMean(0.21);  // 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
+      break;
+  }
+
+  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.057);  // target value for inverse velocity, > 0.033 ns/cm!
+  //tofFindTracks->SetTtTarg(0.035);            // target value for inverse velocity, > 0.033 ns/cm!
+  tofFindTracks->SetCalParFileName(
+    cTrkFile);                             // Tracker parameter value file name
+  tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
+  tofFindTracks->SetR0Lim(100.);
+
+  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.6);        // 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
+
+
+  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    = 28;
+      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;
 
-    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.057);  // target value for inverse velocity, > 0.033 ns/cm!
-    //tofFindTracks->SetTtTarg(0.035);            // target value for inverse velocity, > 0.033 ns/cm!
-    tofFindTracks->SetCalParFileName(
-      cTrkFile);  // Tracker parameter value file name
-    tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
-    tofFindTracks->SetR0Lim(100.);
-
-    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.6);        // 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
-
-
-    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    = 28;
-        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;
-
-      case 2:
-        iMinNofHits   = 3;
-        iNStations    = 14;
-        iNReqStations = 5;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 1);
-        tofFindTracks->SetStation(2, 0, 3, 1);
-        tofFindTracks->SetStation(3, 0, 4, 0);
-        tofFindTracks->SetStation(4, 0, 3, 0);
-        tofFindTracks->SetStation(5, 0, 4, 2);
-        tofFindTracks->SetStation(6, 0, 3, 2);
-        tofFindTracks->SetStation(7, 0, 4, 3);
-        tofFindTracks->SetStation(8, 0, 3, 3);
-        tofFindTracks->SetStation(9, 0, 4, 4);
-        tofFindTracks->SetStation(10, 0, 3, 4);
-        tofFindTracks->SetStation(11, 9, 0, 0);
-        tofFindTracks->SetStation(12, 9, 0, 1);
-        tofFindTracks->SetStation(13, 7, 0, 0);
-        break;
-
-      case 3:
-        iMinNofHits   = 3;
-        iNStations    = 16;
-        iNReqStations = 4;
-        
-		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, 5, 0, 0);
-        /*
+    case 2:
+      iMinNofHits   = 3;
+      iNStations    = 14;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, 0, 4, 0);
+      tofFindTracks->SetStation(4, 0, 3, 0);
+      tofFindTracks->SetStation(5, 0, 4, 2);
+      tofFindTracks->SetStation(6, 0, 3, 2);
+      tofFindTracks->SetStation(7, 0, 4, 3);
+      tofFindTracks->SetStation(8, 0, 3, 3);
+      tofFindTracks->SetStation(9, 0, 4, 4);
+      tofFindTracks->SetStation(10, 0, 3, 4);
+      tofFindTracks->SetStation(11, 9, 0, 0);
+      tofFindTracks->SetStation(12, 9, 0, 1);
+      tofFindTracks->SetStation(13, 7, 0, 0);
+      break;
+
+    case 3:
+      iMinNofHits   = 3;
+      iNStations    = 16;
+      iNReqStations = 4;
+
+      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, 5, 0, 0);
+      /*
      tofFindTracks->SetStation(16, 0, 3, 2);         
      tofFindTracks->SetStation(17, 0, 4, 2);  
      tofFindTracks->SetStation(18, 0, 3, 1);         
@@ -488,87 +487,87 @@ void dis_digi(Int_t nEvents        = 100,
      tofFindTracks->SetStation(24, 0, 3, 4);         
      tofFindTracks->SetStation(25, 0, 4, 4); 
      */
-        break;
-
-      case 4:
-        iMinNofHits   = 3;
-        iNStations    = 4;
-        iNReqStations = 4;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 1);
-        tofFindTracks->SetStation(2, 0, 3, 1);
-        tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
-        break;
-
-      case 5:  // for calibration of 2-stack and add-on counters (STAR2, BUC)
-        iMinNofHits   = 3;
-        iNStations    = 5;
-        iNReqStations = 4;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 1);
-        tofFindTracks->SetStation(2, 0, 3, 1);
-        tofFindTracks->SetStation(3, 9, 0, 0);
-        tofFindTracks->SetStation(4, 9, 0, 1);
-        break;
-
-      case 6:
-        iMinNofHits   = 3;
-        iNStations    = 4;
-        iNReqStations = 4;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 1);
-        tofFindTracks->SetStation(2, 0, 3, 1);
-        tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
-        //    tofFindTracks->SetStation(3, 9, 0, 0);
-        //    tofFindTracks->SetStation(3, 9, 0, 1);
-        //    tofFindTracks->SetStation(3, 7, 0, 0);
-        break;
-
-      case 7:  // for calibration of 2-stack and add-on counters (BUC)
-        iMinNofHits   = 4;
-        iNStations    = 5;
-        iNReqStations = 5;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 3);
-        tofFindTracks->SetStation(2, 0, 3, 3);
-        tofFindTracks->SetStation(3, 6, 0, 0);
-        tofFindTracks->SetStation(4, 6, 0, 1);
-        break;
-
-      case 8:  // evaluation of add-on counters (BUC)
-        iMinNofHits   = 3;
-        iNStations    = 4;
-        iNReqStations = 4;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 4, 3);
-        tofFindTracks->SetStation(2, 0, 3, 3);
-        tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
-        break;
-
-      case 10:
-        iMinNofHits   = 3;
-        iNStations    = 4;
-        iNReqStations = 4;
-        tofFindTracks->SetStation(0, 5, 0, 0);
-        tofFindTracks->SetStation(1, 0, 1, 2);
-        tofFindTracks->SetStation(2, 0, 0, 2);
-        tofFindTracks->SetStation(3, 0, 2, 2);
+      break;
 
-      default:
-        cout << "Tracking setup " << iTrackingSetup << " not implemented "
-             << endl;
-        return;
-        ;
-    }
-    tofFindTracks->SetMinNofHits(iMinNofHits);
-    tofFindTracks->SetNStations(iNStations);
-    tofFindTracks->SetNReqStations(iNReqStations);
-    tofFindTracks->PrintSetup();
-    run->AddTask(tofFindTracks);
-
-    // =========================================================================
-    // ===                       Analysis                                    ===
-    // =========================================================================
+    case 4:
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 5:  // for calibration of 2-stack and add-on counters (STAR2, BUC)
+      iMinNofHits   = 3;
+      iNStations    = 5;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 9, 0, 1);
+      break;
+
+    case 6:
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 1);
+      tofFindTracks->SetStation(2, 0, 3, 1);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      //    tofFindTracks->SetStation(3, 9, 0, 0);
+      //    tofFindTracks->SetStation(3, 9, 0, 1);
+      //    tofFindTracks->SetStation(3, 7, 0, 0);
+      break;
+
+    case 7:  // for calibration of 2-stack and add-on counters (BUC)
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 3);
+      tofFindTracks->SetStation(2, 0, 3, 3);
+      tofFindTracks->SetStation(3, 6, 0, 0);
+      tofFindTracks->SetStation(4, 6, 0, 1);
+      break;
+
+    case 8:  // evaluation of add-on counters (BUC)
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 4, 3);
+      tofFindTracks->SetStation(2, 0, 3, 3);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 10:
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 1, 2);
+      tofFindTracks->SetStation(2, 0, 0, 2);
+      tofFindTracks->SetStation(3, 0, 2, 2);
+
+    default:
+      cout << "Tracking setup " << iTrackingSetup << " not implemented "
+           << endl;
+      return;
+      ;
+  }
+  tofFindTracks->SetMinNofHits(iMinNofHits);
+  tofFindTracks->SetNStations(iNStations);
+  tofFindTracks->SetNReqStations(iNReqStations);
+  tofFindTracks->PrintSetup();
+  run->AddTask(tofFindTracks);
+
+  // =========================================================================
+  // ===                       Analysis                                    ===
+  // =========================================================================
 
   CbmTofAnaTestbeam* tofAnaTestbeam =
     new CbmTofAnaTestbeam("TOF TestBeam Analysis", iVerbose);
diff --git a/macro/beamtime/mcbm2020/dis_trks.C b/macro/beamtime/mcbm2020/dis_trks.C
index 37255117cd..230aa5935e 100644
--- a/macro/beamtime/mcbm2020/dis_trks.C
+++ b/macro/beamtime/mcbm2020/dis_trks.C
@@ -16,14 +16,14 @@ void dis_trks(Int_t nEvents        = 10,
               Int_t iMc            = 0) {
 
   Int_t iVerbose = 1;
-  TString FId = cFileId;
+  TString FId    = cFileId;
   TString cRun(FId(0, 3));
-  Int_t iRun=-1;
-  if(cRun == "unp") {
-	iRun=831;  
-	cCalId="831.100.4.0";
-	iCalSet=10020500;
-  }else {
+  Int_t iRun = -1;
+  if (cRun == "unp") {
+    iRun    = 831;
+    cCalId  = "831.100.4.0";
+    iCalSet = 10020500;
+  } else {
     iRun = cRun.Atoi();
     if (cCalId == "") cCalId = cFileId;
   }
@@ -41,14 +41,13 @@ void dis_trks(Int_t nEvents        = 10,
   TString paramDir      = "./";
   TString ParFile       = paramDir + "data/" + cFileId.Data() + ".params.root";
   TString InputFile     = paramDir + "data/" + cFileId.Data() + ".root";
-  TString InputDigiFile ="";
-  if(cRun == "unp") {
-	InputDigiFile = paramDir + "data/" + cFileId.Data()
-	              + ".root";
+  TString InputDigiFile = "";
+  if (cRun == "unp") {
+    InputDigiFile = paramDir + "data/" + cFileId.Data() + ".root";
   } else {
     InputDigiFile = paramDir + "data/TofHits_" + cFileId.Data()
-                  + Form("_%s_%02.0f_Cal", cSet.Data(), dDeadtime)
-                  + cCalId + ".out.root";
+                    + Form("_%s_%02.0f_Cal", cSet.Data(), dDeadtime) + cCalId
+                    + ".out.root";
   }
   if (iMc == 1) {
     InputFile     = paramDir + "data/" + cFileId.Data() + ".raw.root";
@@ -61,16 +60,16 @@ void dis_trks(Int_t nEvents        = 10,
   TString cHstFile =
     paramDir
     + Form(
-        "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Dis.hst.root",
-        cFileId.Data(),
-        dDeadtime,
-        cSet.Data(),
-        iSel,
-        iSel2,
-        dScalFac,
-        dChi2Lim2,
-        iTrackingSetup,
-        cCalId.Data());
+      "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Dis.hst.root",
+      cFileId.Data(),
+      dDeadtime,
+      cSet.Data(),
+      iSel,
+      iSel2,
+      dScalFac,
+      dChi2Lim2,
+      iTrackingSetup,
+      cCalId.Data());
   TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data());
   TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cCalId.Data());
 
@@ -114,8 +113,8 @@ void dis_trks(Int_t nEvents        = 10,
     //TObjString *tofDigiFile = new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par"); // TOF digi file
     //parFileList->Add(tofDigiFile);
 
-    TObjString* tofDigiBdfFile =
-      new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par");
+    TObjString* tofDigiBdfFile = new TObjString(workDir + "/parameters/tof/tof_"
+                                                + TofGeo + ".digibdf.par");
     parFileList->Add(tofDigiBdfFile);
 
     // -----   Reconstruction run   -------------------------------------------
@@ -319,28 +318,28 @@ void dis_trks(Int_t nEvents        = 10,
         iMinNofHits   = 3;
         iNStations    = 16;
         iNReqStations = 4;
-        
-		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(0, 0, 2, 2);
+        tofFindTracks->SetStation(1, 0, 1, 2);
+        tofFindTracks->SetStation(2, 0, 0, 2);
 
-		tofFindTracks->SetStation(6, 0, 2, 3);
-		tofFindTracks->SetStation(7, 0, 1, 3);
-		tofFindTracks->SetStation(8, 0, 0, 3);
+        tofFindTracks->SetStation(3, 0, 2, 1);
+        tofFindTracks->SetStation(4, 0, 1, 1);
+        tofFindTracks->SetStation(5, 0, 0, 1);
 
-		tofFindTracks->SetStation(9,  0, 2, 0);
-		tofFindTracks->SetStation(10, 0, 1, 0);
-		tofFindTracks->SetStation(11, 0, 0, 0);
+        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(12, 0, 2, 4);
+        tofFindTracks->SetStation(13, 0, 1, 4);
+        tofFindTracks->SetStation(14, 0, 0, 4);
 
-		tofFindTracks->SetStation(15, 5, 0, 0);
+        tofFindTracks->SetStation(15, 5, 0, 0);
         /*
      tofFindTracks->SetStation(16, 0, 3, 2);         
      tofFindTracks->SetStation(17, 0, 4, 2);  
diff --git a/macro/beamtime/mcbm2020/mtof_reco.C b/macro/beamtime/mcbm2020/mtof_reco.C
index 4bdf7ea7f8..7a9fa316dd 100644
--- a/macro/beamtime/mcbm2020/mtof_reco.C
+++ b/macro/beamtime/mcbm2020/mtof_reco.C
@@ -273,11 +273,12 @@ void mtof_reco(Int_t nEvents      = 100,  // number of Timeslices
         new CbmTofFindTracks("TOF Track Finder");
       tofFindTracks->UseFinder(tofTrackFinder);
       tofFindTracks->UseFitter(tofTrackFitter);
-      tofFindTracks->SetCalOpt(iCalOpt);  
-                   // 1 - update offsets, 2 - update walk, 0 - bypass
+      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.065);          // target value for Mar2020 triple stack -> betapeak ~ 0.95
+      tofFindTracks->SetTtTarg(
+        0.065);  // target value for Mar2020 triple stack -> betapeak ~ 0.95
       //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(
@@ -340,7 +341,7 @@ void mtof_reco(Int_t nEvents      = 100,  // number of Timeslices
           tofFindTracks->SetStation(26, 9, 0, 0);
           tofFindTracks->SetStation(27, 9, 0, 1);
           break;
-          
+
         case 2:  // for geometry check mode of full setup
           iMinNofHits   = 3;
           iNStations    = 27;
@@ -406,7 +407,7 @@ void mtof_reco(Int_t nEvents      = 100,  // number of Timeslices
           tofFindTracks->SetStation(25, 9, 0, 0);
           tofFindTracks->SetStation(26, 9, 0, 1);
           tofFindTracks->SetStation(27, 5, 0, 0);
-          break;                    
+          break;
       }
       tofFindTracks->SetMinNofHits(iMinNofHits);
       tofFindTracks->SetNStations(iNStations);
diff --git a/macro/beamtime/mcbm2020/unpack_tsa_mcbm_kronos.C b/macro/beamtime/mcbm2020/unpack_tsa_mcbm_kronos.C
index f2cc51ac52..2e10cc9022 100644
--- a/macro/beamtime/mcbm2020/unpack_tsa_mcbm_kronos.C
+++ b/macro/beamtime/mcbm2020/unpack_tsa_mcbm_kronos.C
@@ -172,7 +172,7 @@ void unpack_tsa_mcbm_kronos(UInt_t uRunIdx  = 99999,
 
   unpacker_sts ->MaskNoisyChannel(3,770 ,  true );
 
-  unpacker_tof->SetSeparateArrayT0();
+  //unpacker_tof->SetSeparateArrayT0();
 
   // ------------------------------ //
   // Enable Asic type for MUCH data.
diff --git a/macro/beamtime/pl_Dut_Vel.C b/macro/beamtime/pl_Dut_Vel.C
index 78d20bd9e9..e3832b0ff3 100644
--- a/macro/beamtime/pl_Dut_Vel.C
+++ b/macro/beamtime/pl_Dut_Vel.C
@@ -1,5 +1,5 @@
 void pl_Dut_Vel(const char* cDut = "900",
-                Double_t dEffMin  =0.7,
+                Double_t dEffMin = 0.7,
                 Double_t Tstart  = 0.,
                 Double_t Tend    = 50.,
                 TString sysinfo  = "") {
diff --git a/macro/beamtime/pl_Track2D.C b/macro/beamtime/pl_Track2D.C
index 73cde6d7ac..d2bb9c6817 100644
--- a/macro/beamtime/pl_Track2D.C
+++ b/macro/beamtime/pl_Track2D.C
@@ -1,11 +1,14 @@
-void pl_Track2D(Int_t iOpt = 1, Int_t iCounterId=22, Int_t iStrip=-1, Double_t TotMax=10.) {
+void pl_Track2D(Int_t iOpt       = 1,
+                Int_t iCounterId = 22,
+                Int_t iStrip     = -1,
+                Double_t TotMax  = 10.) {
   //  TCanvas *can = new TCanvas("can22","can22");
   //  TCanvas *can = new TCanvas("can","can",48,55,700,900);
   TCanvas* can = new TCanvas("can", "can", 48, 56, 900, 900);
   //can->Divide(4, 4, 0.01, 0.01);
   //  can->Divide(2,2,0,0);
-  if(iStrip > -1) can->Divide(1,2,0.01,0.01);
-  
+  if (iStrip > -1) can->Divide(1, 2, 0.01, 0.01);
+
   Float_t lsize = 0.07;
 
   gPad->SetFillColor(0);
@@ -26,9 +29,8 @@ void pl_Track2D(Int_t iOpt = 1, Int_t iCounterId=22, Int_t iStrip=-1, Double_t T
     case 1: cOpt = "Pos"; break;
     case 2: cOpt = "TOff"; break;
     case 3: cOpt = "Tot"; break;
-    case 4: 
-    case 14:
-		    cOpt = "Walk"; break;
+    case 4:
+    case 14: cOpt = "Walk"; break;
     case 5: cOpt = "Walk"; break;
     case 6: cOpt = "Mul"; break;
     case 7: cOpt = "Trms"; break;
@@ -44,86 +46,99 @@ void pl_Track2D(Int_t iOpt = 1, Int_t iCounterId=22, Int_t iStrip=-1, Double_t T
   Double_t dAvRMS  = 0.;
   Int_t iCanv      = 0;
 
-  Int_t iRp=iCounterId%10;
-  Int_t iSm=((iCounterId-iRp)/10) % 10;
-  Int_t iType=(iCounterId-iSm*10-iRp)/100;
+  Int_t iRp   = iCounterId % 10;
+  Int_t iSm   = ((iCounterId - iRp) / 10) % 10;
+  Int_t iType = (iCounterId - iSm * 10 - iRp) / 100;
 
 
   gROOT->cd();
   TString hname = "";
   Int_t iCol    = 1;
   switch (iOpt) {
-    case 4:
-    {
-    Int_t iDraw=0;
-    for (Int_t iSide = 0; iSide < 2; iSide++) {
-	  iCol=1;
-      for (Int_t iCh = 0; iCh < 32; iCh++) {
-		if(iStrip > -1) if (iCh != iStrip) continue;
-		cout << "CS "<<iCh<<iSide<<endl;
-        hname = Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",
-                     iType,iSm,iRp,iCh,iSide,cOpt.Data());
-        h     = (TH2*) gROOT->FindObjectAny(hname);
-        if (h != NULL) {
-          TProfile* hProf =
-          h->ProfileX(Form("%s_pfx%d%d", hname.Data(), iCh, iSide));
-          hProf->SetLineColor(iCol);
-          hProf->SetLineStyle(1);
-          hProf->SetMarkerColor(iCol);
-          hProf->SetMarkerStyle(24 + iSide);
-          iCol++;
-          if (iCh == 0) iCol = 1;
-          if ( iDraw == 0 ) {
-            hProf->SetMaximum(0.4);
-            hProf->SetMinimum(-0.4);
-            hProf->GetXaxis()->SetRangeUser(0., TotMax);
-            hProf->Draw("LP");
-          } else {
-            hProf->Draw("LPsame");
+    case 4: {
+      Int_t iDraw = 0;
+      for (Int_t iSide = 0; iSide < 2; iSide++) {
+        iCol = 1;
+        for (Int_t iCh = 0; iCh < 32; iCh++) {
+          if (iStrip > -1)
+            if (iCh != iStrip) continue;
+          cout << "CS " << iCh << iSide << endl;
+          hname = Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",
+                       iType,
+                       iSm,
+                       iRp,
+                       iCh,
+                       iSide,
+                       cOpt.Data());
+          h     = (TH2*) gROOT->FindObjectAny(hname);
+          if (h != NULL) {
+            TProfile* hProf =
+              h->ProfileX(Form("%s_pfx%d%d", hname.Data(), iCh, iSide));
+            hProf->SetLineColor(iCol);
+            hProf->SetLineStyle(1);
+            hProf->SetMarkerColor(iCol);
+            hProf->SetMarkerStyle(24 + iSide);
+            iCol++;
+            if (iCh == 0) iCol = 1;
+            if (iDraw == 0) {
+              hProf->SetMaximum(0.4);
+              hProf->SetMinimum(-0.4);
+              hProf->GetXaxis()->SetRangeUser(0., TotMax);
+              hProf->Draw("LP");
+            } else {
+              hProf->Draw("LPsame");
+            }
+            iDraw++;
           }
-          iDraw++;
         }
       }
-    }
-    }
-    break;
-    
-    case 14:
-    {
-      Int_t iCanv=1;
+    } break;
+
+    case 14: {
+      Int_t iCanv = 1;
       for (Int_t iSide = 0; iSide < 2; iSide++)
         for (Int_t iCh = 0; iCh < 32; iCh++) {
-		  if(iStrip > -1) if (iCh != iStrip) continue;
+          if (iStrip > -1)
+            if (iCh != iStrip) continue;
           hname = Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",
-                     iType,iSm,iRp,iCh,iSide,cOpt.Data());
+                       iType,
+                       iSm,
+                       iRp,
+                       iCh,
+                       iSide,
+                       cOpt.Data());
           h     = (TH2*) gROOT->FindObjectAny(hname);
           if (h != NULL) {
             can->cd(iCanv++);
             h->Draw("colz");
             gPad->SetLogz();
             h->ProfileX()->Draw("same");
-            TString hName2 = Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_Walk_px",
-                                  iType,iSm,iRp,iCh,iSide);
+            TString hName2 =
+              Form("Cor_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_Walk_px",
+                   iType,
+                   iSm,
+                   iRp,
+                   iCh,
+                   iSide);
             TH1* hCor = (TH1*) gROOT->FindObjectAny(hName2);
-            if ( NULL != hCor ) {
-			  hCor->SetLineColor(6);
-			  hCor->Draw("same");
-			}                      
+            if (NULL != hCor) {
+              hCor->SetLineColor(6);
+              hCor->Draw("same");
+            }
           }
         }
-    }
-    break;
-        
+    } break;
+
     default:
-      hname = Form("cal_SmT%01d_sm%03d_rpc%03d_%s",
-                   iType,iSm,iRp,cOpt.Data());
-      h     = (TH2*) gROOT->FindObjectAny(hname);
+      hname =
+        Form("cal_SmT%01d_sm%03d_rpc%03d_%s", iType, iSm, iRp, cOpt.Data());
+      h = (TH2*) gROOT->FindObjectAny(hname);
       if (h != NULL) {
         if (iOpt == 2 || iOpt == 2) { gPad->SetLogz(); }
-          h->Draw("colz");
-          h->ProfileX()->Draw("same");
+        h->Draw("colz");
+        h->ProfileX()->Draw("same");
       }
   }
-  
-  can->SaveAs(Form("pl_Track_%s_%d.pdf", cOpt.Data(),iCounterId));
+
+  can->SaveAs(Form("pl_Track_%s_%d.pdf", cOpt.Data(), iCounterId));
 }
diff --git a/macro/beamtime/pl_XY_trk.C b/macro/beamtime/pl_XY_trk.C
index 15c848a209..65e1687678 100644
--- a/macro/beamtime/pl_XY_trk.C
+++ b/macro/beamtime/pl_XY_trk.C
@@ -37,13 +37,13 @@ void pl_XY_trk(Int_t NSt = 4, Double_t MinEff = 0.5, Double_t dThr = 0.1) {
       h2acc->Reset();
       Int_t Nbins   = h2->GetNbinsX() * h2->GetNbinsY();
       Double_t dMax = dThr * h2->GetMaximum();
-      for (Int_t i = 0; i < (Int_t)h2->GetNbinsX(); i++) 
-      for (Int_t j = 0; j < (Int_t)h2->GetNbinsY(); j++) 
-      {
-        h2->GetBinContent(i+1, j+1) < dMax ? h2acc->SetBinContent(i+1, j+1, 0.)
-                                           : h2acc->SetBinContent(i+1, j+1, 1.);
-        //cout << "Bin "<<i<<","<<j<<": "<< h2->GetBinContent(i+1,j+1) <<" filled with "<<h2acc->GetBinContent(i+1,j+1)<<endl;
-	  }
+      for (Int_t i = 0; i < (Int_t) h2->GetNbinsX(); i++)
+        for (Int_t j = 0; j < (Int_t) h2->GetNbinsY(); j++) {
+          h2->GetBinContent(i + 1, j + 1) < dMax
+            ? h2acc->SetBinContent(i + 1, j + 1, 0.)
+            : h2acc->SetBinContent(i + 1, j + 1, 1.);
+          //cout << "Bin "<<i<<","<<j<<": "<< h2->GetBinContent(i+1,j+1) <<" filled with "<<h2acc->GetBinContent(i+1,j+1)<<endl;
+        }
       TH2D* h2aall = (TH2D*) h2->Clone(Form("ALL_acc%d", iSt));
       h2aall->Multiply(h2aall, h2acc, 1., 1., "B");
       Nall = h2aall->Integral();
diff --git a/macro/beamtime/pl_over_Mat04D4best.C b/macro/beamtime/pl_over_Mat04D4best.C
index fcf98a4cad..05f0cf6e42 100644
--- a/macro/beamtime/pl_over_Mat04D4best.C
+++ b/macro/beamtime/pl_over_Mat04D4best.C
@@ -119,8 +119,8 @@ void pl_over_Mat04D4best(Int_t iLog = 0) {
       TString hname2 = "hDTD4DT04D4best_pfx_px";
       h2pfxpx        = (TH1*) gROOT->FindObjectAny(hname2);
       if (h2pfxpx != NULL) {
-		  h2pfxpx->SetLineColor(6);
-		  h2pfxpx->Draw("same");
+        h2pfxpx->SetLineColor(6);
+        h2pfxpx->Draw("same");
       }
       Int_t iNbinsX = h2->GetNbinsX();
       cout << " Histo " << hname << " has " << iNbinsX << " Xbins" << endl;
@@ -200,8 +200,8 @@ void pl_over_Mat04D4best(Int_t iLog = 0) {
       TString hname2 = "hTexpDT04D4best_pfx_px";
       TH1* hpfxpx    = (TH1*) gROOT->FindObjectAny(hname2);
       if (hpfxpx != NULL) {
-		  hpfxpx->SetLineColor(6);
-		  hpfxpx->Draw("same");
+        hpfxpx->SetLineColor(6);
+        hpfxpx->Draw("same");
       }
     } else {
       cout << hname << " not found" << endl;
@@ -231,12 +231,12 @@ void pl_over_Mat04D4best(Int_t iLog = 0) {
       gPad->SetLogz();
       TProfile* h2pfx = h2->ProfileX();
       h2pfx->Draw("same");
-      
+
       TString hname2 = "hDTX4D4best_pfx_px";
       TH1* hpfxpx    = (TH1*) gROOT->FindObjectAny(hname2);
       if (hpfxpx != NULL) {
-		  hpfxpx->SetLineColor(6);
-		  hpfxpx->Draw("same");
+        hpfxpx->SetLineColor(6);
+        hpfxpx->Draw("same");
       }
     } else {
       cout << hname << " not found" << endl;
@@ -257,8 +257,8 @@ void pl_over_Mat04D4best(Int_t iLog = 0) {
       TString hname2 = "hDTY4D4best_pfx_px";
       TH1* hpfxpx    = (TH1*) gROOT->FindObjectAny(hname2);
       if (hpfxpx != NULL) {
-		  hpfxpx->SetLineColor(6);
-		  hpfxpx->Draw("same");
+        hpfxpx->SetLineColor(6);
+        hpfxpx->Draw("same");
       }
 
     } else {
@@ -316,14 +316,14 @@ void pl_over_Mat04D4best(Int_t iLog = 0) {
       TH1D* h2clu   = h2->ProjectionX("_px", 1, h2->GetNbinsY());
       dMeanCluSize0 = h2clu->GetMean();
       h2->ProfileX()->Draw("same");
-      
+
       TString hname2 = "hCluSize0DT04D4best_pfx_px";
       TH1* hpfxpx    = (TH1*) gROOT->FindObjectAny(hname2);
       if (hpfxpx != NULL) {
-		  hpfxpx->SetLineColor(6);
-		  hpfxpx->Draw("same");
+        hpfxpx->SetLineColor(6);
+        hpfxpx->Draw("same");
       }
-      
+
     } else {
       cout << hname << " not found" << endl;
     }
@@ -340,14 +340,14 @@ void pl_over_Mat04D4best(Int_t iLog = 0) {
       TH1D* h2clu   = h2->ProjectionX("_px", 1, h2->GetNbinsY());
       dMeanCluSize4 = h2clu->GetMean();
       h2->ProfileX()->Draw("same");
-      
+
       TString hname2 = "hCluSize4DT04D4best_pfx_px";
       TH1* hpfxpx    = (TH1*) gROOT->FindObjectAny(hname2);
       if (hpfxpx != NULL) {
-		  hpfxpx->SetLineColor(6);
-		  hpfxpx->Draw("same");
-      }      
-      
+        hpfxpx->SetLineColor(6);
+        hpfxpx->Draw("same");
+      }
+
     } else {
       cout << hname << " not found" << endl;
     }
@@ -363,14 +363,14 @@ void pl_over_Mat04D4best(Int_t iLog = 0) {
       TProfile* h2pfxt = h2->ProfileX();
       h2pfxt->Draw("same");
       gPad->SetLogz();
-      
+
       TString hname2 = "hTot0DT04D4best_pfx_px";
       TH1* hpfxpx    = (TH1*) gROOT->FindObjectAny(hname2);
       if (hpfxpx != NULL) {
-		  hpfxpx->SetLineColor(6);
-		  hpfxpx->Draw("same");
-      }      
-      
+        hpfxpx->SetLineColor(6);
+        hpfxpx->Draw("same");
+      }
+
     } else {
       cout << hname << " not found" << endl;
     }
@@ -386,14 +386,14 @@ void pl_over_Mat04D4best(Int_t iLog = 0) {
       TProfile* h2pfxt = h2->ProfileX();
       h2pfxt->Draw("same");
       gPad->SetLogz();
-      
+
       TString hname2 = "hTot4DT04D4best_pfx_px";
       TH1* hpfxpx    = (TH1*) gROOT->FindObjectAny(hname2);
       if (hpfxpx != NULL) {
-		  hpfxpx->SetLineColor(6);
-		  hpfxpx->Draw("same");
-      }      
-      
+        hpfxpx->SetLineColor(6);
+        hpfxpx->Draw("same");
+      }
+
     } else {
       cout << hname << " not found" << endl;
     }
-- 
GitLab