diff --git a/macro/beamtime/hd2020/ana_trks.C b/macro/beamtime/hd2020/ana_trks.C
index de66018ecc080dd381402a99f5428a6c83dcd67c..e9499edd6a0bc808af9b26dc4390bc5a18d0560e 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 c70f557b9c09dc59a251ba8b37b4af1df86b3c00..d77c67cc67e0b126b46ba18e4481afe2fefcc787 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 9582590d67d502633894b06877dc29a1528b6cb6..6a94e7f91bacc8593fef98baee7269abf3f1b152 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/hd2020/pl_all_Track2D.C b/macro/beamtime/hd2020/pl_all_Track2D.C
index 668b37b101b8cc23e208050a265f647bf0ad0c54..382bc4ed578e69fa27531edeeb6455becd270e63 100644
--- a/macro/beamtime/hd2020/pl_all_Track2D.C
+++ b/macro/beamtime/hd2020/pl_all_Track2D.C
@@ -1,136 +1,122 @@
-void pl_all_Track2D(Int_t iOpt=1, Int_t iNSt=2)
-{
+void pl_all_Track2D(Int_t iOpt = 1, 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(5,6,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(5, 6, 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);
 
- TH2 *h;
- TH2 *h2;
- const Int_t  iType[6]={0,9,5,5,7,8};
- const Int_t  iSmNum[6]={5,1,1,1,1,1};
- const Int_t iRpcNum[6]={5,1,1,1,1,8};
- TString cOpt; 
+  TH2* h;
+  TH2* h2;
+  const Int_t iType[6]   = {0, 9, 5, 5, 7, 8};
+  const Int_t iSmNum[6]  = {5, 1, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 1, 1, 1, 1, 8};
+  TString cOpt;
 
- switch(iOpt){
- case 0: 
-   cOpt="Size";
-   break;
- case 1:
-   cOpt="Pos";
-   break;
- case 2:
-   cOpt="TOff";
-   break;
- case 3:
-   cOpt="Tot";
-   break;
- case 4:
-   cOpt="Walk";
-   break;
- case 5:
-   cOpt="Walk";
-   break;
- case 6:
-   cOpt="Mul";
-   break;
- case 7:
-   cOpt="Trms";
-   break;
- case 8:
-   cOpt="DelPos";
-   break;
- case 9:
-   cOpt="DelTOff";
-   break;
- case 10:
-   cOpt="DelMatPos";
-   break;
- case 11:
-   cOpt="DelMatTOff";
-   break;
- default:
-   ;
- }
+  switch (iOpt) {
+    case 0: cOpt = "Size"; break;
+    case 1: cOpt = "Pos"; break;
+    case 2: cOpt = "TOff"; break;
+    case 3: cOpt = "Tot"; break;
+    case 4: cOpt = "Walk"; break;
+    case 5: cOpt = "Walk"; break;
+    case 6: cOpt = "Mul"; break;
+    case 7: cOpt = "Trms"; break;
+    case 8: cOpt = "DelPos"; break;
+    case 9: cOpt = "DelTOff"; break;
+    case 10: cOpt = "DelMatPos"; break;
+    case 11: cOpt = "DelMatTOff"; break;
+    default:;
+  }
 
- Int_t iDet=0;
- Double_t dAvMean=0.;
- Double_t dAvRMS=0.;
- Int_t iCanv=0;
+  Int_t iDet       = 0;
+  Double_t dAvMean = 0.;
+  Double_t dAvRMS  = 0.;
+  Int_t iCanv      = 0;
 
- for(Int_t iSt=0; iSt<iNSt; iSt++){
-   // cout << "plot station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
-  for(Int_t iSm=0; iSm<iSmNum[iSt];iSm++){
-    //cout << "plot module at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
-    for(Int_t iRp=0; iRp<iRpcNum[iSt];iRp++){
-      //cout << "plot rpc at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
-      can->cd(iCanv+1); iCanv++;
-      gROOT->cd();
-      TString hname="";
-      Int_t iCol=1;
-      switch(iOpt) {
-		case 4:
-		  for (Int_t iSide=0; iSide<2; iSide++)
-		    for (Int_t iCh=0; iCh<32; iCh++) {
-			  hname=Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",iType[iSt],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(iCh==0 && iSide==0) {
-				  hProf->SetMaximum(0.4);
-				  hProf->SetMinimum(-0.4);
-				  hProf->GetXaxis()->SetRangeUser(0.,10.);
-				  hProf->Draw("LP");
-			    } else {
-				  hProf->Draw("LPsame");
-			    }
-			  }
-              
-		    }
-		  break;
-		default:
-            hname=Form("cal_SmT%01d_sm%03d_rpc%03d_%s",iType[iSt],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");
-				iDet++;
-				dAvMean += h->ProfileX()->GetMean(2);
-				dAvRMS  += h->ProfileX()->GetRMS(2);
-				cout << "TrackQA " << cOpt.Data() <<" for TSR " << iType[iSt] << iSm << iRp << ": Off "<< h->ProfileX()->GetMean(2) 
-				<< ", RMS "<< h->ProfileX()->GetRMS(2) << endl;
-			}
-		}	  
-	}
+  for (Int_t iSt = 0; iSt < iNSt; iSt++) {
+    // cout << "plot station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
+    for (Int_t iSm = 0; iSm < iSmNum[iSt]; iSm++) {
+      //cout << "plot module at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
+      for (Int_t iRp = 0; iRp < iRpcNum[iSt]; iRp++) {
+        //cout << "plot rpc at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
+        can->cd(iCanv + 1);
+        iCanv++;
+        gROOT->cd();
+        TString hname = "";
+        Int_t iCol    = 1;
+        switch (iOpt) {
+          case 4:
+            for (Int_t iSide = 0; iSide < 2; iSide++)
+              for (Int_t iCh = 0; iCh < 32; iCh++) {
+                hname = Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",
+                             iType[iSt],
+                             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 (iCh == 0 && iSide == 0) {
+                    hProf->SetMaximum(0.4);
+                    hProf->SetMinimum(-0.4);
+                    hProf->GetXaxis()->SetRangeUser(0., 10.);
+                    hProf->Draw("LP");
+                  } else {
+                    hProf->Draw("LPsame");
+                  }
+                }
+              }
+            break;
+          default:
+            hname = Form("cal_SmT%01d_sm%03d_rpc%03d_%s",
+                         iType[iSt],
+                         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");
+              iDet++;
+              dAvMean += h->ProfileX()->GetMean(2);
+              dAvRMS += h->ProfileX()->GetRMS(2);
+              cout << "TrackQA " << cOpt.Data() << " for TSR " << iType[iSt]
+                   << iSm << iRp << ": Off " << h->ProfileX()->GetMean(2)
+                   << ", RMS " << h->ProfileX()->GetRMS(2) << endl;
+            }
+        }
+      }
+    }
   }
- }
- dAvMean /= (Double_t)iDet;
- dAvRMS  /= (Double_t)iDet;
- cout << "TrackQA " << cOpt.Data() <<": AvOff "<< dAvMean << ", AvRMS "<< dAvRMS << endl;
- dAvMean=TMath::Abs(dAvMean);
- gROOT->ProcessLine(Form(".! echo %d > %sAvOff.res", (Int_t)(dAvMean*1.E4),cOpt.Data()));
- gROOT->ProcessLine(Form(".! echo %d > %sAvRMS.res", (Int_t)(dAvRMS*1.E4),cOpt.Data()));
-
- can->SaveAs(Form("pl_all_Track_%s.pdf",cOpt.Data()));
+  dAvMean /= (Double_t) iDet;
+  dAvRMS /= (Double_t) iDet;
+  cout << "TrackQA " << cOpt.Data() << ": AvOff " << dAvMean << ", AvRMS "
+       << dAvRMS << endl;
+  dAvMean = TMath::Abs(dAvMean);
+  gROOT->ProcessLine(
+    Form(".! echo %d > %sAvOff.res", (Int_t)(dAvMean * 1.E4), cOpt.Data()));
+  gROOT->ProcessLine(
+    Form(".! echo %d > %sAvRMS.res", (Int_t)(dAvRMS * 1.E4), cOpt.Data()));
 
-} 
+  can->SaveAs(Form("pl_all_Track_%s.pdf", cOpt.Data()));
+}
diff --git a/macro/beamtime/mcbm2018/ana_digi_cal.C b/macro/beamtime/mcbm2018/ana_digi_cal.C
index eb9b70872e86db3cbb2cd07e2e56700ef9efacde..f792256dacc3216b876cf1f3b6b12b7df83e3257 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_trks.C b/macro/beamtime/mcbm2018/ana_trks.C
index 3fea1fc9adf651d7afea7fd8c69f27ac679d125b..42d387348df7ac9b0699a4ec3e4a24d4f3e92c83 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/mcbm2020/ana_digi_cal.C b/macro/beamtime/mcbm2020/ana_digi_cal.C
index f15dc40d0631ba7904503788eca8aa81876307db..7599670f916122901040daa3d6525e94e0cc1de7 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";
diff --git a/macro/beamtime/mcbm2020/ana_digi_cal_all.C b/macro/beamtime/mcbm2020/ana_digi_cal_all.C
index 80c4cf99b7b1274b422766f19af747f32f1ebc74..b05009550666965955a3e923f6fb24e2105888a2 100644
--- a/macro/beamtime/mcbm2020/ana_digi_cal_all.C
+++ b/macro/beamtime/mcbm2020/ana_digi_cal_all.C
@@ -45,9 +45,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";
diff --git a/macro/beamtime/mcbm2020/ana_trks.C b/macro/beamtime/mcbm2020/ana_trks.C
index a985e77df3d18dd3b0f99134c40648f38fcd8b86..835bcb842d21d993ffa16717a3ed3e22befdffea 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 = "v20b_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");
diff --git a/macro/beamtime/mcbm2020/ana_trksi.C b/macro/beamtime/mcbm2020/ana_trksi.C
index 281b3a71882e6378fe1950461a860ada2c9272fa..5fa2b9f630657f3ba9875a069fa8e39eed1f2c6b 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 = "v20b_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);
 
diff --git a/macro/beamtime/mcbm2020/dis_digi.C b/macro/beamtime/mcbm2020/dis_digi.C
index 41f5a934e30c580d86ece01546f3f944db5170fd..78a81ea032450257fadf075dbd43f739407cc9ba 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 = "v20b_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 da93d0f077f8558ca6e7058c4fca3e8a6f765024..789a07a96228ab7b451f2361642b6b0bd048231b 100644
--- a/macro/beamtime/mcbm2020/dis_trks.C
+++ b/macro/beamtime/mcbm2020/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());
 
@@ -101,8 +101,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   -------------------------------------------
@@ -293,28 +293,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/pl_XY_trk.C b/macro/beamtime/pl_XY_trk.C
index 15c848a20961d9e7c29c220bf3d345cab77554c5..65e1687678e8c1b8e57a4ace222b997dc3c04460 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_trk.C b/macro/beamtime/pl_over_trk.C
index 500bdd27284b0652cbd37a8190a66860d766598b..60d6af2f9595311b05e956281bce6e0efc53168b 100644
--- a/macro/beamtime/pl_over_trk.C
+++ b/macro/beamtime/pl_over_trk.C
@@ -210,7 +210,7 @@ void pl_over_trk(Int_t NSt = 4) {
     gPad->SetLogy();
   } else {
     cout << hname << " not found" << endl;
-  }  
+  }
 
   can->cd(14);
   gROOT->cd();
diff --git a/macro/beamtime/pl_pull_trk.C b/macro/beamtime/pl_pull_trk.C
index 233406789cfa2a8d605cf2bea61b6c7b9137fbc5..efdaf052da76469b0a01a6cf5406f189899984f7 100644
--- a/macro/beamtime/pl_pull_trk.C
+++ b/macro/beamtime/pl_pull_trk.C
@@ -1,4 +1,7 @@
-void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0, Int_t iDrop=-1) {
+void pl_pull_trk(Int_t NSt   = 8,
+                 Int_t iVar  = 0,
+                 Int_t iFit  = 0,
+                 Int_t iDrop = -1) {
   //  TCanvas *can = new TCanvas("can22","can22");
   //  can->Divide(2,2);
   TCanvas* can = new TCanvas("can", "can", 50, 0, 800, 800);
@@ -31,8 +34,8 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0, Int_t iDrop=-1)
   Double_t vSigErr[MSt];
   Double_t vResErr[MSt];
   // if (h!=NULL) h->Delete();
-  Int_t iCan = 1;
-  Int_t iIndSt=0;
+  Int_t iCan   = 1;
+  Int_t iIndSt = 0;
   TString var;
   Double_t Nall;
 
@@ -54,18 +57,18 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0, Int_t iDrop=-1)
       gPad->SetLogy();
       gPad->SetGridx();
       if (iFit > 0) {
-        Double_t dFMean = h1->GetMean();
-        Double_t dFLim  = 3.0 * h1->GetRMS();
+        Double_t dFMean   = h1->GetMean();
+        Double_t dFLim    = 3.0 * h1->GetRMS();
         Double_t dBinSize = h1->GetBinWidth(1);
-        dFLim=TMath::Max(dFLim,5.*dBinSize);
+        dFLim             = TMath::Max(dFLim, 5. * dBinSize);
         TFitResultPtr fRes =
           h1->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim);
         //cout << " fRes = "<< fRes <<endl;
         if (-1 == fRes) return;
-        if ( iDrop == iSt ) { // drop station from deconvolution
-		  continue;
-		}
-		cout << "Add " << iSt << " as station index " << iIndSt << endl;
+        if (iDrop == iSt) {  // drop station from deconvolution
+          continue;
+        }
+        cout << "Add " << iSt << " as station index " << iIndSt << endl;
         vSt[iIndSt]      = iSt;
         vMean[iIndSt]    = fRes->Parameter(1);
         vSig[iIndSt]     = fRes->Parameter(2);
diff --git a/macro/beamtime/pl_vert_trk.C b/macro/beamtime/pl_vert_trk.C
index 49121bf97af3e4d2eedbed025791f725a20f938f..b37f3d610310017d7a097c65c16386284ba57540 100644
--- a/macro/beamtime/pl_vert_trk.C
+++ b/macro/beamtime/pl_vert_trk.C
@@ -29,55 +29,64 @@ void pl_vert_trk() {
 
   can->cd(2);
   gROOT->cd();
-  Double_t MeanX0=0.;
-  Double_t SigX0=0.;
-  Double_t MeanX0Err=0.;
-  Double_t SigX0Err=0.;
-  h1    = (TH1*) h2->ProjectionX();
+  Double_t MeanX0    = 0.;
+  Double_t SigX0     = 0.;
+  Double_t MeanX0Err = 0.;
+  Double_t SigX0Err  = 0.;
+  h1                 = (TH1*) h2->ProjectionX();
   if (h1 != NULL) {
     Double_t dFMean = h1->GetMean();
     Double_t dFLim  = 3.0 * h1->GetRMS();
-    dFMean=h1->GetBinCenter( h1-> GetMaximumBin() ); 
-    dFLim=15.;
+    dFMean          = h1->GetBinCenter(h1->GetMaximumBin());
+    dFLim           = 15.;
     TFitResultPtr fRes =
-        h1->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim);
+      h1->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim);
     //cout << " fRes = "<< fRes <<endl;
     if (-1 != fRes) {
       MeanX0    = fRes->Parameter(1);
       SigX0     = fRes->Parameter(2);
-      MeanX0Err   = 0.;
+      MeanX0Err = 0.;
       MeanX0Err = fRes->ParError(1);
       SigX0Err  = fRes->ParError(2);
-	}
+    }
   }
 
-  Double_t MeanY0=0.;
-  Double_t SigY0=0.;
-  Double_t MeanY0Err=0.;
-  Double_t SigY0Err=0.;
-  h1    = (TH1*) h2->ProjectionY();
+  Double_t MeanY0    = 0.;
+  Double_t SigY0     = 0.;
+  Double_t MeanY0Err = 0.;
+  Double_t SigY0Err  = 0.;
+  h1                 = (TH1*) h2->ProjectionY();
   if (h1 != NULL) {
     Double_t dFMean = h1->GetMean();
     Double_t dFLim  = 3.0 * h1->GetRMS();
-    dFMean=h1->GetBinCenter( h1-> GetMaximumBin() ); 
-    dFLim=15.;
+    dFMean          = h1->GetBinCenter(h1->GetMaximumBin());
+    dFLim           = 15.;
     TFitResultPtr fRes =
-        h1->Fit("gaus", "S", "same", dFMean - dFLim, dFMean + dFLim);
-        h1->SetLineColor(7);
+      h1->Fit("gaus", "S", "same", dFMean - dFLim, dFMean + dFLim);
+    h1->SetLineColor(7);
     //cout << " fRes = "<< fRes <<endl;
     if (-1 != fRes) {
       MeanY0    = fRes->Parameter(1);
       SigY0     = fRes->Parameter(2);
-      MeanY0Err   = 0.;
+      MeanY0Err = 0.;
       MeanY0Err = fRes->ParError(1);
       SigY0Err  = fRes->ParError(2);
-	}
+    }
   }
-  
-  
-  cout << Form("TrkXY0_0: MeanX %6.2f (%5.2f), SigX %6.2f (%5.2f) ",MeanX0, MeanX0Err, SigX0, SigX0Err)
-       << Form(" MeanY %6.2f (%5.2f), SigY %6.2f (%5.2f) ",MeanY0, MeanY0Err, SigY0, SigY0Err) << endl; 
-   
+
+
+  cout << Form("TrkXY0_0: MeanX %6.2f (%5.2f), SigX %6.2f (%5.2f) ",
+               MeanX0,
+               MeanX0Err,
+               SigX0,
+               SigX0Err)
+       << Form(" MeanY %6.2f (%5.2f), SigY %6.2f (%5.2f) ",
+               MeanY0,
+               MeanY0Err,
+               SigY0,
+               SigY0Err)
+       << endl;
+
   can->cd(3);
   gROOT->cd();
   hname = Form("hTrklXY0_1");
@@ -85,54 +94,62 @@ void pl_vert_trk() {
   if (h2 != NULL) {
     h2->Draw("colz");
     gPad->SetLogz();
-    Double_t MeanX1=0.;
-	Double_t SigX1=0.;
-	Double_t MeanX1Err=0.;
-	Double_t SigX1Err=0.;
-	h1    = (TH1*) h2->ProjectionX();
-	if (h1 != NULL) {
+    Double_t MeanX1    = 0.;
+    Double_t SigX1     = 0.;
+    Double_t MeanX1Err = 0.;
+    Double_t SigX1Err  = 0.;
+    h1                 = (TH1*) h2->ProjectionX();
+    if (h1 != NULL) {
       Double_t dFMean = h1->GetMean();
       Double_t dFLim  = 3.0 * h1->GetRMS();
-      dFMean=h1->GetBinCenter( h1-> GetMaximumBin() ); 
-      dFLim=15.;
+      dFMean          = h1->GetBinCenter(h1->GetMaximumBin());
+      dFLim           = 15.;
       TFitResultPtr fRes =
         h1->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim);
       //cout << " fRes = "<< fRes <<endl;
       if (-1 != fRes) {
-		MeanX1    = fRes->Parameter(1);
-		SigX1     = fRes->Parameter(2);
-		MeanX1Err   = 0.;
-		MeanX1Err = fRes->ParError(1);
-		SigX1Err  = fRes->ParError(2);
-	  }
-	
-	  Double_t MeanY1=0.;
-	  Double_t SigY1=0.;
-	  Double_t MeanY1Err=0.;
-	  Double_t SigY1Err=0.;
-	  h1    = (TH1*) h2->ProjectionY();
-	  if (h1 != NULL) {
-		Double_t dFMean = h1->GetMean();
-		Double_t dFLim  = 3.0 * h1->GetRMS();
-		dFMean=h1->GetBinCenter( h1-> GetMaximumBin() ); 
-		dFLim=15.;
-		TFitResultPtr fRes =
+        MeanX1    = fRes->Parameter(1);
+        SigX1     = fRes->Parameter(2);
+        MeanX1Err = 0.;
+        MeanX1Err = fRes->ParError(1);
+        SigX1Err  = fRes->ParError(2);
+      }
+
+      Double_t MeanY1    = 0.;
+      Double_t SigY1     = 0.;
+      Double_t MeanY1Err = 0.;
+      Double_t SigY1Err  = 0.;
+      h1                 = (TH1*) h2->ProjectionY();
+      if (h1 != NULL) {
+        Double_t dFMean = h1->GetMean();
+        Double_t dFLim  = 3.0 * h1->GetRMS();
+        dFMean          = h1->GetBinCenter(h1->GetMaximumBin());
+        dFLim           = 15.;
+        TFitResultPtr fRes =
           h1->Fit("gaus", "S", "same", dFMean - dFLim, dFMean + dFLim);
         h1->SetLineColor(7);
         //cout << " fRes = "<< fRes <<endl;
         if (-1 != fRes) {
-		  MeanY1    = fRes->Parameter(1);
-		  SigY1     = fRes->Parameter(2);
-		  MeanY1Err   = 0.;
-		  MeanY1Err = fRes->ParError(1);
-		  SigY1Err  = fRes->ParError(2);
-	    }
-	  }
-  
-	  cout << Form("TrkXY0_1: MeanX %6.2f (%5.2f), SigX %6.2f (%5.2f) ",MeanX1, MeanX1Err, SigX1, SigX1Err)
-           << Form(" MeanY %6.2f (%5.2f), SigY %6.2f (%5.2f) ",MeanY1, MeanY1Err, SigY1, SigY1Err) << endl; 
-     
-	}
+          MeanY1    = fRes->Parameter(1);
+          SigY1     = fRes->Parameter(2);
+          MeanY1Err = 0.;
+          MeanY1Err = fRes->ParError(1);
+          SigY1Err  = fRes->ParError(2);
+        }
+      }
+
+      cout << Form("TrkXY0_1: MeanX %6.2f (%5.2f), SigX %6.2f (%5.2f) ",
+                   MeanX1,
+                   MeanX1Err,
+                   SigX1,
+                   SigX1Err)
+           << Form(" MeanY %6.2f (%5.2f), SigY %6.2f (%5.2f) ",
+                   MeanY1,
+                   MeanY1Err,
+                   SigY1,
+                   SigY1Err)
+           << endl;
+    }
 
   } else {
     cout << hname << " not found" << endl;
@@ -204,5 +221,4 @@ void pl_vert_trk() {
     cout << hname << " not found" << endl;
   }
   can->SaveAs(Form("pl_vtx.pdf"));
-
 }
diff --git a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C
index 1f25574ab2f1fea1c78afff400dd89cffead7e35..cf4dbbb47b07be8568b719de8c804b7bb358e626 100644
--- a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C
+++ b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C
@@ -327,7 +327,7 @@ void Create_TOF_Geometry_v20b_mcbm() {
   // TGeoTranslation*  stand_trans   = new TGeoTranslation("", 12., 0., TOF_Z_Front_Stand);
   // TGeoTranslation*  stand_trans   = new TGeoTranslation("",  0., 0., TOF_Z_Front_Stand);
   TGeoRotation* stand_rot = new TGeoRotation();
-  stand_rot->RotateY(-1.5); //-2.7);
+  stand_rot->RotateY(-1.5);  //-2.7);
   TGeoCombiTrans* stand_combi_trans =
     new TGeoCombiTrans(*stand_trans, *stand_rot);
   //tof->AddNode(tofstand, 1, stand_combi_trans);
diff --git a/reco/detectors/tof/CbmTofCalibrator.cxx b/reco/detectors/tof/CbmTofCalibrator.cxx
index db0b9fc4d11ffd3da4bbd8ddc910cdb50cea05cb..17aa4ffc99fa4d81e49c3763f3c0ff2d79f9dde5 100644
--- a/reco/detectors/tof/CbmTofCalibrator.cxx
+++ b/reco/detectors/tof/CbmTofCalibrator.cxx
@@ -129,7 +129,8 @@ Bool_t CbmTofCalibrator::CreateCalHist() {
   Int_t iNbDet = fDigiBdfPar->GetNbDet();
   LOG(info) << "Define Calibrator histos for " << iNbDet << " detectors ";
 
-  fhCalR0 = new TH1D("hCalR0","Tracklet distance to nominal vertex; R_0 [cm]",100,0.,0.5);
+  fhCalR0 = new TH1D(
+    "hCalR0", "Tracklet distance to nominal vertex; R_0 [cm]", 100, 0., 0.5);
 
   fhCalPos.resize(iNbDet);
   fhCalTOff.resize(iNbDet);
@@ -183,7 +184,7 @@ Bool_t CbmTofCalibrator::CreateCalHist() {
       -TSumMax,
       TSumMax);
 
-    Double_t TotMax    = 20.; //FIXME: has to be consistent with Clusterizer!
+    Double_t TotMax    = 20.;  //FIXME: has to be consistent with Clusterizer!
     fhCalTot[iDetIndx] = new TH2F(
       Form("cal_SmT%01d_sm%03d_rpc%03d_Tot", iSmType, iSmId, iRpcId),
       Form(
@@ -242,7 +243,7 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, Int_t iOpt) {
     && fdR0Lim
          > 0.)  // consider only tracks originating from nominal interaction point
   {
-	fhCalR0->Fill(pTrk->GetR0());
+    fhCalR0->Fill(pTrk->GetR0());
     if (pTrk->GetR0() > fdR0Lim) return;
   }
   for (Int_t iHit = 0; iHit < pTrk->GetNofHits(); iHit++) {
@@ -350,20 +351,21 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, Int_t iOpt) {
                   << hlocal_f[1] << ", " << hlocal_p[1] << ", " << hlocal_d[1]
                   << ", TOT: " << tDigi0->GetTot() << " " << tDigi1->GetTot();
       }
-      Int_t iWalkMode=(iOpt - iOpt%10)/10;
-      switch(iWalkMode) {
+      Int_t iWalkMode = (iOpt - iOpt % 10) / 10;
+      switch (iWalkMode) {
         case 0:
           fhCalWalk[iDetIndx][iCh0][iSide0]->Fill(
-          tDigi0->GetTot(),
-          tDigi0->GetTime()
-            + (1. - 2. * tDigi0->GetSide()) * hlocal_d[1]
-              / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)
-            - pTrk->GetFitT(
-              pHit->GetZ())  //-fTrackletTools->GetTexpected(pTrk, iDetId, pHit)
-            + fTofFindTracks->GetTOff(iDetId)
-            + 2. * (1. - 2. * tDigi0->GetSide()) * (hlocal_d[1] - hlocal_f[1])
-                / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc));
-        /*
+            tDigi0->GetTot(),
+            tDigi0->GetTime()
+              + (1. - 2. * tDigi0->GetSide()) * hlocal_d[1]
+                  / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)
+              - pTrk->GetFitT(
+                pHit
+                  ->GetZ())  //-fTrackletTools->GetTexpected(pTrk, iDetId, pHit)
+              + fTofFindTracks->GetTOff(iDetId)
+              + 2. * (1. - 2. * tDigi0->GetSide()) * (hlocal_d[1] - hlocal_f[1])
+                  / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc));
+          /*
         LOG(info)<<"TSRCS "<<iSmType<<iSm<<iRpc<<iCh<<iSide0<<Form(": digi0 %f, ex %f, prop %f, Off %f, res %f",
                             tDigi0->GetTime(),
                             fTrackletTools->GetTexpected(pTrk, iDetId, pHit) ,
@@ -374,24 +376,24 @@ void CbmTofCalibrator::FillCalHist(CbmTofTracklet* pTrk, Int_t iOpt) {
         */
 
           fhCalWalk[iDetIndx][iCh1][iSide1]->Fill(
-        	  	tDigi1->GetTot(),
-		  tDigi1->GetTime()
-            + (1. - 2. * tDigi1->GetSide()) * hlocal_d[1]
-              / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)
-			  - pTrk->GetFitT(
-			              pHit->GetZ())  //-fTrackletTools->GetTexpected(pTrk, iDetId, pHit)
-            + fTofFindTracks->GetTOff(iDetId)
-            + 2. * (1. - 2. * tDigi1->GetSide()) * (hlocal_d[1] - hlocal_f[1])
-              / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc));
+            tDigi1->GetTot(),
+            tDigi1->GetTime()
+              + (1. - 2. * tDigi1->GetSide()) * hlocal_d[1]
+                  / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc)
+              - pTrk->GetFitT(
+                pHit
+                  ->GetZ())  //-fTrackletTools->GetTexpected(pTrk, iDetId, pHit)
+              + fTofFindTracks->GetTOff(iDetId)
+              + 2. * (1. - 2. * tDigi1->GetSide()) * (hlocal_d[1] - hlocal_f[1])
+                  / fDigiBdfPar->GetSigVel(iSmType, iSm, iRpc));
           break;
 
-        case  1: {
-    	  Double_t dDeltaT = 0.5*(tDigi0->GetTime()+tDigi1->GetTime())
-		                   - pTrk->GetFitT(pHit->GetZ());
-          fhCalWalk[iDetIndx][iCh1][iSide0]->Fill(tDigi0->GetTot(),dDeltaT);
-          fhCalWalk[iDetIndx][iCh1][iSide1]->Fill(tDigi1->GetTot(),dDeltaT);
-        }
-        break;
+        case 1: {
+          Double_t dDeltaT = 0.5 * (tDigi0->GetTime() + tDigi1->GetTime())
+                             - pTrk->GetFitT(pHit->GetZ());
+          fhCalWalk[iDetIndx][iCh1][iSide0]->Fill(tDigi0->GetTot(), dDeltaT);
+          fhCalWalk[iDetIndx][iCh1][iSide1]->Fill(tDigi1->GetTot(), dDeltaT);
+        } break;
       }
     }
   }
@@ -427,7 +429,7 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) {
       continue;
     }
 
-    switch (iOpt%10) {
+    switch (iOpt % 10) {
       case 0:  // none
         break;
       case 1:  // update channel mean
@@ -458,14 +460,16 @@ Bool_t CbmTofCalibrator::UpdateCalHist(Int_t iOpt) {
           Double_t dDp   = hpP->GetBinContent(iBin + 1);
           Double_t dCorP = fhCorPos[iDetIndx]->GetBinContent(iBin + 1);
           if (dCts > MINCTS) {
-        	// Fit Gaussian around peak
-        	TH1* hpPy=(TH1*) fhCalPos[iDetIndx]->ProjectionY(Form("PosPy_%d_%d",iDetIndx,iBin),iBin+1,iBin+1);
-            Double_t dFMean=hpPy->GetBinCenter( hpPy->GetMaximumBin() );
-            Double_t dFLim  = 0.5;  // CAUTION, fixed numeric value
+            // Fit Gaussian around peak
+            TH1* hpPy = (TH1*) fhCalPos[iDetIndx]->ProjectionY(
+              Form("PosPy_%d_%d", iDetIndx, iBin), iBin + 1, iBin + 1);
+            Double_t dFMean   = hpPy->GetBinCenter(hpPy->GetMaximumBin());
+            Double_t dFLim    = 0.5;  // CAUTION, fixed numeric value
             Double_t dBinSize = hpPy->GetBinWidth(1);
-            dFLim=TMath::Max(dFLim,5.*dBinSize);
-            TFitResultPtr fRes = hpPy->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim);
-            dDp = fRes->Parameter(1); //overwrite mean
+            dFLim             = TMath::Max(dFLim, 5. * dBinSize);
+            TFitResultPtr fRes =
+              hpPy->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim);
+            dDp = fRes->Parameter(1);  //overwrite mean
             // Double_t dDpRes = fRes->Parameter(2);
 
             fhCorTOff[iDetIndx]->SetBinContent(iBin + 1, dCorT + dDt + dAvOff);
diff --git a/reco/detectors/tof/CbmTofEventClusterizer.cxx b/reco/detectors/tof/CbmTofEventClusterizer.cxx
index 3bc253e07036639909b1a0c006de81eca6d2b93b..ae5d2287ecb8b0e0454f21f9035a00700fe58660 100644
--- a/reco/detectors/tof/CbmTofEventClusterizer.cxx
+++ b/reco/detectors/tof/CbmTofEventClusterizer.cxx
@@ -4138,9 +4138,8 @@ Bool_t CbmTofEventClusterizer::WriteHistos() {
                 != iSmAddr)) {  // select detectors for updating offsets
           LOG(debug) << "WriteHistos: (case 2) update Offsets and keep Gains, "
                         "Walk and DELTOF for "
-        		     << Form(" 0x%08x ", TMath::Abs(fCalSmAddr))
-                     << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc "
-                     << iRpc;
+                     << Form(" 0x%08x ", TMath::Abs(fCalSmAddr)) << "Smtype"
+                     << iSmType << ", Sm " << iSm << ", Rpc " << iRpc;
           Int_t iB        = iSm * iNbRpc + iRpc;
           Double_t dVscal = 1.;
           if (0)  //NULL != fhSmCluSvel[iSmType])
@@ -4368,9 +4367,9 @@ Bool_t CbmTofEventClusterizer::WriteHistos() {
                 != iSmAddr)) {  // select detectors for updating offsets
           LOG(info) << "WriteHistos (calMode==3): update Offsets and Gains, "
                        "keep Walk and DelTof for "
-     		        << Form("Addr 0x%08x ", TMath::Abs(fCalSmAddr))
-                    << "Smtype" << iSmType << ", Sm " << iSm << ", Rpc " << iRpc
-                    << " with " << iNbCh << " channels "
+                    << Form("Addr 0x%08x ", TMath::Abs(fCalSmAddr)) << "Smtype"
+                    << iSmType << ", Sm " << iSm << ", Rpc " << iRpc << " with "
+                    << iNbCh << " channels "
                     << " using selector " << fCalSel;
           /*
            Double_t dTRefMean=0.;
@@ -7332,7 +7331,7 @@ Bool_t CbmTofEventClusterizer::CalibRawDigis() {
                 << Form("%2d", (Int_t) pDigi->GetChannel()) << " "
                 << pDigi->GetSide() << " " << Form("%f", pDigi->GetTime())
                 << " " << pDigi->GetTot();
-/*
+    /*
     if (pDigi->GetType() == 5
         || pDigi->GetType()
              == 8)  // for Pad counters generate fake digi to mockup a strip
@@ -7511,26 +7510,26 @@ Bool_t CbmTofEventClusterizer::CalibRawDigis() {
     }
 
     if (bAddBeamCounterSideDigi)
-    if (pCalDigi->GetType() == 5
-        || pCalDigi->GetType()
-             == 8) {  // for Pad counters generate fake digi to mockup a strip
-      fTofCalDigiVec->push_back(CbmTofDigi(*pCalDigi));
-      CbmTofDigi* pCalDigi2 = &(fTofCalDigiVec->back());
-      iDigIndCal++;
-      //      CbmTofDigi *pCalDigi2 = new((*fTofCalDigisColl)[++iDigIndCal]) CbmTofDigi( *pCalDigi );
-      if (pCalDigi->GetSide() == 0)
-        pCalDigi2->SetAddress(pCalDigi->GetSm(),
-                              pCalDigi->GetRpc(),
-                              pCalDigi->GetChannel(),
-                              1,
-                              pCalDigi->GetType());
-      else
-        pCalDigi2->SetAddress(pCalDigi->GetSm(),
-                              pCalDigi->GetRpc(),
-                              pCalDigi->GetChannel(),
-                              0,
-                              pCalDigi->GetType());
-    }
+      if (pCalDigi->GetType() == 5
+          || pCalDigi->GetType()
+               == 8) {  // for Pad counters generate fake digi to mockup a strip
+        fTofCalDigiVec->push_back(CbmTofDigi(*pCalDigi));
+        CbmTofDigi* pCalDigi2 = &(fTofCalDigiVec->back());
+        iDigIndCal++;
+        //      CbmTofDigi *pCalDigi2 = new((*fTofCalDigisColl)[++iDigIndCal]) CbmTofDigi( *pCalDigi );
+        if (pCalDigi->GetSide() == 0)
+          pCalDigi2->SetAddress(pCalDigi->GetSm(),
+                                pCalDigi->GetRpc(),
+                                pCalDigi->GetChannel(),
+                                1,
+                                pCalDigi->GetType());
+        else
+          pCalDigi2->SetAddress(pCalDigi->GetSm(),
+                                pCalDigi->GetRpc(),
+                                pCalDigi->GetChannel(),
+                                0,
+                                pCalDigi->GetType());
+      }
 
   }  // for( Int_t iDigInd = 0; iDigInd < nTofDigi; iDigInd++ )
 
diff --git a/reco/detectors/tof/CbmTofFindTracks.cxx b/reco/detectors/tof/CbmTofFindTracks.cxx
index 85d2bc8012be0cd2d1ba2c9a14f6b9ceedf40879..5274c17bb9c2d497c15e867a3e8a2f3a840cdff9 100644
--- a/reco/detectors/tof/CbmTofFindTracks.cxx
+++ b/reco/detectors/tof/CbmTofFindTracks.cxx
@@ -769,7 +769,7 @@ Bool_t CbmTofFindTracks::WriteHistos() {
       if (fhPullX_Smt_Off != NULL) {
         Double_t nx = htmp1D->GetNbinsX();
         for (Int_t ix = 0; ix < nx; ix++) {
-          TH1D* hpy = fhPullX_Smt->ProjectionY("_py", ix + 1, ix + 1);
+          TH1D* hpy     = fhPullX_Smt->ProjectionY("_py", ix + 1, ix + 1);
           Double_t dVal = fhPullX_Smt_Off->GetBinContent(ix + 1);
           //dVal -= htmp1D->GetBinContent(ix + 1);
           if (hpy->GetEntries() > 100.) {
@@ -780,21 +780,22 @@ Bool_t CbmTofFindTracks::WriteHistos() {
             Int_t nPeaks=s->Search(hpy,dRMS,"new");
             if (nPeaks==1) {
             */
-            if(kTRUE) {
+            if (kTRUE) {
               //Double_t *xPeaks=s->GetPositionX();
               //LOG(info) << "Found peak at" << xPeaks[0];
               // Fit gaussian
               //Double_t dFMean = xPeaks[0];
-              Double_t dFMean=hpy->GetBinCenter( hpy-> GetMaximumBin() );
-              Double_t dFLim  = 0.5;  // CAUTION, fixed numeric value
+              Double_t dFMean   = hpy->GetBinCenter(hpy->GetMaximumBin());
+              Double_t dFLim    = 0.5;  // CAUTION, fixed numeric value
               Double_t dBinSize = hpy->GetBinWidth(1);
-              dFLim=TMath::Max(dFLim,5.*dBinSize);
+              dFLim             = TMath::Max(dFLim, 5. * dBinSize);
               TFitResultPtr fRes =
                 hpy->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim);
               dVal -= fRes->Parameter(1);
-              dRMS  = fRes->Parameter(2);
-              LOG(info)<<"PeakFit at " << dFMean << ", lim " << dFLim
-            		   <<" : mean " << fRes->Parameter(1) << ", width " << dRMS;
+              dRMS = fRes->Parameter(2);
+              LOG(info) << "PeakFit at " << dFMean << ", lim " << dFLim
+                        << " : mean " << fRes->Parameter(1) << ", width "
+                        << dRMS;
             }
 
             if (dRMS < fSIGX * 0.5) dRMS = fSIGX * 0.5;
@@ -802,7 +803,7 @@ Bool_t CbmTofFindTracks::WriteHistos() {
 
             // limit maximal shift in X, for larger values, change geometry file
             if (dVal < -3.) dVal = -3.;
-            if (dVal > 3.)  dVal =  3.;
+            if (dVal > 3.) dVal = 3.;
             //if( fRpcAddr[ix] != fiBeamCounter )  // don't correct beam counter position
             LOG(info) << "Update hPullX_Smt_Off " << ix << ": "
                       << fhPullX_Smt_Off->GetBinContent(ix + 1) << " + "
@@ -1867,7 +1868,10 @@ void CbmTofFindTracks::FillHistograms() {
         default:;
       }
 
-      if (fiBeamCounter > -1 && fdR0Lim > 0.)  // consider only tracks originating from nominal interaction point
+      if (
+        fiBeamCounter > -1
+        && fdR0Lim
+             > 0.)  // consider only tracks originating from nominal interaction point
       {
         if (pTrk->GetR0() > fdR0Lim) continue;
       }
diff --git a/reco/detectors/tof/CbmTofTrackFinderNN.cxx b/reco/detectors/tof/CbmTofTrackFinderNN.cxx
index 9b926b1ed98747a4587bdc241bb9492406b9bfce..f040a37bd16fd2fb5e34a5e9b12352918980f8ef 100644
--- a/reco/detectors/tof/CbmTofTrackFinderNN.cxx
+++ b/reco/detectors/tof/CbmTofTrackFinderNN.cxx
@@ -512,9 +512,12 @@ Int_t CbmTofTrackFinderNN::DoFind(TClonesArray* fTofHits,
                 (dYex - pHit->GetY()) / fFindTracks->GetSigY(iAddr),
                 dChi);
 
-              if ( dChi < fSIGLIM // FIXME: should scale limit with material budget between hit and track reference
-            		  * (pTrk->GetNofHits() < fFindTracks->GetNReqStations() - 1 ? 1. : fSIGLIMMOD ) )
-              {             // extend and update tracklet
+              if (
+                dChi
+                < fSIGLIM  // FIXME: should scale limit with material budget between hit and track reference
+                    * (pTrk->GetNofHits() < fFindTracks->GetNReqStations() - 1
+                         ? 1.
+                         : fSIGLIMMOD)) {  // extend and update tracklet
                 LOG(debug) << Form("<IP> TofTracklet %lu, HMul %d, Hits %d, %d "
                                    "mark for extension by %d, add = 0x%08x, DT "
                                    "%6.2f, DX %6.2f, DY=%6.2f ",