diff --git a/macro/beamtime/hd2020/.root_hist b/macro/beamtime/hd2020/.root_hist
new file mode 100644
index 0000000000000000000000000000000000000000..051a59a2ba6f5b694a91f4405a4ab2ea5720279f
--- /dev/null
+++ b/macro/beamtime/hd2020/.root_hist
@@ -0,0 +1,449 @@
+ cl_SmT9_sm002_rpc001_Sel00_Walk2->Project3DProfile("yx")->Draw("colz")
+ cl_SmT6_sm000_rpc001_Sel00_Walk2->Project3DProfile("yx")->Draw("colz")
+ .x pl_all_3D.C(0,0,2)
+ .x pl_all_3D.C(0,0,2)
+ .x pl_all_3D.C(1,0,2)
+ .x pl_all_3D.C(2,0,2)
+ .x pl_XY_3D.C(4,0,0,1)
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_600921_911_1.1_3.5_trk021_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+ .x pl_XY_3D.C(4,0,0,1)
+ .x pl_XY_3D.C(0,0,0,1)
+ .x pl_XY_3D.C(1,0,0,1)
+ .x pl_XY_3D.C(2,0,0,1)
+ .x pl_XY_3D.C(2,1,0,1)
+ .x pl_XY_3D.C(3,1,0,1)
+ .x pl_XY_3D.C(5,1,0,1)
+ .x pl_XY_3D.C(5,0,0,1)
+ .x pl_XY_3D.C(5,2,0,1)
+ .x pl_XY_3D.C(5,3,0,1)
+ .x pl_XY_3D.C(5,4,0,1)
+ .x pl_XY_3D.C(5,5,0,1)
+ .x pl_XY_3D.C(5,3,0,1)
+ .x pl_XY_3D.C(5,2,0,1)
+ .x pl_XY_3D.C(5,2,1,1)
+ .x pl_XY_3D.C(5,2,1,0)
+ .x pl_XY_3D.C(5,2,0,0)
+ .x pl_XY_3D.C(5,0,0,0)
+ .x pl_XY_3D.C(5,1,0,0)
+ .x pl_XY_3D.C(5,1,0,0,1.)
+ .x pl_XY_3D.C(5,1,0,1,1.)
+ .x pl_XY_3D.C(5,1,0,0,1.)
+ .x pl_XY_3D.C(5,1,1,0,1.)
+ .x pl_XY_3D.C(5,1,0,0,1.)
+ .x pl_XY_3D.C(5,0,0,0,1.)
+ .x pl_XY_3D.C(5,0,0,0,0.3)
+ .x pl_XY_3D.C(5,1,0,0,0.3)
+ .x pl_XY_3D.C(5,2,0,0,0.3)
+ .x pl_XY_3D.C(5,2,0,0,0.2)
+ .x pl_XY_3D.C(5,2,1,0,0.2)
+ .x pl_XY_3D.C(5,2,0,0,0.2)
+ .x pl_XY_3D.C(5,2,0,1,0.2)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/tofClust_HD_cosmic_2020-08-21.50.3.0.0_set900921911.hst.root")
+.x pl_cor_walk.C(9,1,1)
+.x pl_cor_walk.C(6,0,1)
+.x pl_cor_walk.C(6,0,0)
+.ls
+Cor_SmT6_sm000_rpc000_Ch016_S1_Walk_px->Draw()
+.x pl_cor_walk.C(6,0,0)
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_911910_901_3.0_2.5_trk011_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_trk_Walk.C 
+.x pl_trk_Walk.C 
+.x pl_trk_Walk.C 
+.x pl_trk_Walk.C 
+.x pl_trk_Walk.C 
+.x pl_trk_Walk.C 
+.x pl_trk_Walk.C 
+.x pl_trk_Walk.C (600)
+.x pl_trk_Walk.C (601)
+.x pl_trk_Walk.C (901)
+.x pl_trk_Walk.C (901,20)
+.x pl_trk_Walk.C (601,20)
+.x pl_trk_Walk.C (600,20)
+.x pl_trk_Walk.C (600,21)
+.ls
+cal_SmT6_sm000_rpc001_Ch009_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc001_Ch009_S1_Walk_pfx271->Draw("same")
+.x pl_trk_Walk.C (601)
+cal_SmT6_sm000_rpc001_Ch009_S1_Walk.ls
+.ls
+cal_SmT6_sm000_rpc001_Ch021_S1_Walk_pfx211->Draw()
+cal_SmT6_sm000_rpc001_Ch009_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc001_Ch009_S1_Walk_pfx91->Draw("same")
+.x pl_trk_Walk.C (921)
+.x pl_trk_Walk.C (921)
+.x pl_trk_Walk.C (921,20)
+.x pl_trk_Walk.C (921,21)
+.x pl_trk_Walk.C (921,20)
+cal_SmT6_sm000_rpc001_Ch015_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc001_Ch015_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc001_Ch015_S1_Walk->GetNbinsX()
+cal_SmT9_sm000_rpc001_Ch015_S1_Walk->Draw("colz")
+cal_SmT9_sm002_rpc001_Ch015_S1_Walk->Draw("colz")
+cal_SmT9_sm002_rpc001_Ch015_S0_Walk->Draw("colz")
+cal_SmT6_sm002_rpc001_Ch015_S0_Walk->Draw("colz")
+cal_SmT6_sm000_rpc001_Ch015_S0_Walk->Draw("colz")
+.x pl_trk_Walk.C (600)
+.x pl_trk_Walk.C (600,20)
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_911910_901_3.0_2.5_trk011_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_trk_Walk.C (600)
+.x pl_trk_Walk.C (601)
+.x pl_trk_Walk.C (900)
+.x pl_trk_Walk.C (901)
+.x pl_trk_Walk.C (901,20)
+.x pl_trk_Walk.C (601,20)
+.x pl_pull_trk.C(6,0,1)
+.x pl_pull_trk.C(6,1,1)
+.x pl_pull_trk.C(6,3,1)
+.x pl_pull_trk.C(6,4,1)
+.x pl_trk_Walk.C (921,20)
+.ls
+cal_SmT9_sm000_rpc001_Ch027_S0_Walk->Draw("colz")
+cal_SmT9_sm000_rpc001_Ch027_S0_Walk->Draw("colz")
+cal_SmT6_sm000_rpc001_Ch027_S0_Walk->Draw("colz")
+.q
+.x ana_trks.C(2000000,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.0,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,1)
+.x pl_trk_Walk.C (600)
+.x pl_over_MatD4sel.C
+.x pl_calib_trk.C
+.x pl_over_trk.C(6)
+.x pl_trk_Walk.C (600,20)
+.q
+.x ana_trks.C(2000000,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.0,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,1)
+.x pl_over_MatD4sel.C
+.q
+.x ana_trks.C(2000000,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.0,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,1)
+.x pl_over_MatD4sel.C
+.x pl_trk_Walk.C (601,20)
+.x pl_trk_Walk.C (601)
+.x pl_trk_Walk.C (901)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/CluStatus900921911_901_Cal_HD_cosmic_2020-08-21.50.3.0.0.hst.root")
+.x pl_trk_Walk.C (901,200)
+.x pl_trk_Walk.C (601,200)
+.x pl_trk_Walk.C (601,201)
+.q
+.x ana_digi_cal.C(2000000,93,1,921,1,"HD_cosmic_2020-08-21.50.3.0.0",900921911,1,901,50,"HD_cosmic_2020-08-21.50.3.0.0")
+.x pl_trk_Walk.C (601,201)
+.ls
+cl_SmT6_sm000_rpc001_Ch005_S1_Walk->Draw("colz")
+cl_SmT6_sm000_rpc001_Ch005_S1_Walk->Draw("colz")
+.ls
+cl_SmT6_sm000_rpc001_Ch005_S1_Walk_pfx->Draw("same")
+cl_SmT6_sm000_rpc001_Ch005_S1_Walk_px->Draw()
+.! mv ./c1_n3.pdf ./walk601_5_1.pdf
+.q
+.x ana_trks.C(2000000,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.5,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,2)
+.x pl_trk_Walk.C (601,21)
+cal_SmT6_sm000_rpc001_Ch005_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc001_Ch005_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc001_Ch005_S1_Walk_px->Draw("colz")
+cal_SmT6_sm000_rpc001_Ch005_S1_Walk->Draw("colz")
+cal_SmT9_sm000_rpc001_Ch005_S1_Walk->Draw("colz")
+cal_SmT9_sm002_rpc001_Ch005_S1_Walk->Draw("colz")
+.ls 
+Cor_SmT9_sm002_rpc001_Ch005_S1_Walk->Draw("colz")
+Cor_SmT9_sm002_rpc001_Ch005_S1_Walk_px->Draw()
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/CluStatus900921911_901_Cal_HD_cosmic_2020-08-21.50.3.0.0.hst.root")
+cp_SmT9_sm002_rpc001_Ch005_S1_Walk->Draw("colz")
+cl_SmT9_sm002_rpc001_Ch005_S1_Walk->Draw("colz")
+cl_SmT6_sm000_rpc001_Ch005_S1_Walk->Draw("colz")
+Cor_SmT6_sm000_rpc001_Ch005_S1_Walk->Draw("colz")
+cl_CorSmT6_sm000_rpc001_Ch005_S1_Walk->Draw("colz")
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_911921_901_2.0_4.0_trk011_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_trk_walk.C (600)
+.x pl_trk_walk.C (601)
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_911921_901_2.0_4.0_trk011_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_over_trk.C(6)
+.x pl_trk_walk.C (600)
+.x pl_all_Track2D.C (1)
+.x pl_all_Track2D.C (2)
+.x pl_all_Track2D.C (4)
+.x pl_trk_walk.C (600)
+.x pl_trk_walk.C (900)
+.x pl_trk_walk.C (900,1)
+.x pl_trk_walk.C (900,20)
+.x pl_trk_walk.C (901,1)
+.ls
+cal_SmT6_sm001_rpc001_Ch031_S1_Walk_pfx311->Draw()
+cal_SmT6_sm001_rpc001_Ch031_S1_Walk->Draw()
+.x pl_trk_walk.C (901,1)
+.x pl_trk_walk.C (900,1)
+cal_SmT900_sm000_rpc000_Ch029_S0_Walk->Draw()
+.q
+.x ana_trks.C(2000000,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.0,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,1)
+.x pl_all_Track2D.C (4)
+.x pl_trk_walk.C 
+.ls
+cal_SmT6_sm001_rpc000_Ch005_S1_Walk->Draw()
+cal_SmT6_sm000_rpc000_Ch005_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch005_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch005_S0_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch005_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch006_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch006_S0_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch005_S0_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch006_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch005_S1_Walk->Draw("colz")
+.x pl_trk_walk.C(600,20) 
+.x pl_trk_walk.C(600,20) 
+.x pl_trk_Walk.C(600,20) 
+.x pl_trk_Walk.C(600,21) 
+cal_SmT6_sm000_rpc000_Ch006_S1_Walk->Draw("colz")
+TCanvas a
+cal_SmT6_sm000_rpc000_Ch006_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch007_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch008_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch009_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch009_S0_Walk->Draw("colz")
+.q
+TFile *_file0 = TFile::Open("HD_cosmic_2020-08-21.50.3.0.0/CluStatus900921911_901_Cal_HD_cosmic_2020-08-21.50.3.0.0.hst.root")
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/CluStatus900921911_901_Cal_HD_cosmic_2020-08-21.50.3.0.0.hst.root")
+.L fit_ybox.h 
+.x pl_over_clu.C(6,0,0)
+.x pl_over_clu.C(6,0,1)
+.x pl_over_clu.C(6,0,0)
+.x pl_over_clu.C(9,0,0)
+.x pl_over_clu.C(9,0,1)
+.x pl_over_clu.C(9,1,1)
+.x pl_over_clu.C(9,2,1)
+.x pl_over_cluSel.C(9,2,1)
+.x pl_over_cluSel.C(1,9,2,1)
+.x pl_over_cluSel.C(1,6,0,1)
+.x pl_over_clu.C(6,0,1)
+.x pl_over_clu.C(6,0,0)
+.x pl_over_clu.C(6,0,1)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/Init14/CluStatus900921911_911_Cal_XXX.hst.root")
+.L fit_ybox.h
+.x pl_over_clu.C(6,0,0)
+.x pl_over_clu.C(6,0,1)
+.x pl_over_cluSel.C(1,6,0,1)
+.x pl_over_cluSel.C(0,6,0,1)
+.q
+.x ana_trks.C(100,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.0,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,1)
+.q
+.x ana_trks.C(100,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.0,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,1)
+.q
+.x ana_trks.C(100,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.0,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,1)
+.x ana_trks.C(100,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.0,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,1) | grep CMPY
+.q
+.x ana_trks.C(100,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.0,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,1)
+.q
+.x ana_trks.C(100,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.0,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,1)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/CluStatus900921911_901_Cal_HD_cosmic_2020-08-21.50.3.0.0.hst.root")
+.L fit_ybox.h
+.x pl_over_clu.C(6,0,0)
+.x pl_over_clu.C(6,0,1)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/CluStatus900921911_901_Cal_HD_cosmic_2020-08-21.50.3.0.0.hst.root")
+.x pl_trk_Walk.C 
+.x pl_all_Sel2D.C(1)
+.L fit_ybox.h 
+.x pl_over_clu.C(6,0,0
+.x pl_over_clu.C(6,0,0)
+.x pl_over_clu.C(6,0,1)
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_911921_901_2.0_3.0_trk011_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_trk_Walk.C(600)
+.x pl_trk_Walk.C(601)
+.x pl_trk_Walk.C(601,20)
+.x pl_trk_Walk.C(601,21)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/HD_cosmic_2020-08-21.50.3.0.0_set900921911_93_1tofClust.hst.root")
+.x pl_cor_walk.C (6,0,0)
+.ls
+Cor_SmT6_sm000_rpc000_Ch005_S1_Walk_px->Draw()
+Cor_SmT6_sm000_rpc000_Ch000_S1_Walk_px->Draw()
+Cor_SmT6_sm000_rpc000_Ch000_S0_Walk_px->Draw()
+Cor_SmT6_sm000_rpc000_Ch001_S0_Walk_px->Draw()
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/Init14/HD_cosmic_2020-08-21.50.3.0.0_set900921911_93_1tofClust.hst.root")
+Cor_SmT6_sm000_rpc000_Ch001_S0_Walk_px->Draw()
+.x pl_cor_walk.C (6,0,0)
+Cor_SmT6_sm000_rpc000_Ch000_S0_Walk_px->Draw()
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/Init2/HD_cosmic_2020-08-21.50.3.0.0_set900921911_23_0tofClust.hst.root")
+Cor_SmT6_sm000_rpc000_Ch000_S0_Walk_px->Draw()
+.x pl_cor_walk.C (6,0,0)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/Init10/HD_cosmic_2020-08-21.50.3.0.0_set900921911_63_0tofClust.hst.root")
+.x pl_cor_walk.C (6,0,0)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/Init3/HD_cosmic_2020-08-21.50.3.0.0_set900921911_23_1tofClust.hst.root")
+.x pl_cor_walk.C (6,0,0)
+Cor_SmT6_sm000_rpc000_Ch000_S0_Walk_px->Draw()
+Cor_SmT6_sm000_rpc000_Ch000_S1_Walk_px->Draw()
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/Init1/tofClust_HD_cosmic_2020-08-21.50.3.0.0_set900921911.hst.root")
+.x pl_cor_walk.C (6,0,0)
+.ls
+Cor_SmT6_sm000_rpc000_Ch000_S1_Walk_px->Draw()
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/Init2/HD_cosmic_2020-08-21.50.3.0.0_set900921911_23_0tofClust.hst.root")
+Cor_SmT6_sm000_rpc000_Ch000_S1_Walk_px->Draw()
+.x pl_cor_walk.C (6,0,0)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/Init3/HD_cosmic_2020-08-21.50.3.0.0_set900921911_23_1tofClust.hst.root")
+.x pl_cor_walk.C (6,0,0)
+.x pl_cor_walk.C (6,0,1)
+.x pl_cor_walk.C (9,0,1)
+.x pl_cor_walk.C (9,0,0)
+.x pl_cor_walk.C (9,1,0)
+.x pl_cor_walk.C (9,2,0)
+.x pl_cor_walk.C (6,0,0)
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_911921_901_2.0_4.0_trk011_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_all_Track2D.C (4)
+.ls
+.x pl_trk_Walk.C (600)
+.x pl_trk_Walk.C (921)
+.x pl_all_Track2D.C (4)
+.ls
+cal_SmT6_sm000_rpc000_Ch000_S0_Walk_pfx00->Draw()
+cal_SmT6_sm000_rpc000_Ch000_S0_Walk_pfx00->Draw("LP")
+cal_SmT6_sm000_rpc000_Ch000_S0_Walk_pfx00->Draw("CP")
+cal_SmT6_sm000_rpc000_Ch000_S0_Walk_pfx00->Draw("PL")
+cal_SmT6_sm000_rpc000_Ch000_S0_Walk_pfx00->Draw("L")
+cal_SmT6_sm000_rpc000_Ch000_S0_Walk_pfx00->Draw("L")
+cal_SmT6_sm000_rpc000_Ch000_S0_Walk_pfx00->Draw("LE")
+cal_SmT6_sm000_rpc000_Ch000_S0_Walk->Draw("LE")
+cal_SmT6_sm000_rpc000_Ch000_S0_Walk->ProfileX()->Draw("LP")
+.x pl_all_Track2D.C (4)
+.x pl_trk_Walk.C (601)
+.x pl_trk_Walk.C (601,20)
+.x pl_trk_Walk.C (921,20)
+.x pl_trk_Walk.C (921,1)
+.x pl_trk_Walk.C (921,1)
+.x pl_trk_Walk.C (921,20)
+.ls
+cal_SmT6_sm000_rpc001_Ch028_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc001_Ch028_S1_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch000_S0_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch005_S0_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch006_S0_Walk->Draw("colz")
+cal_SmT7_sm000_rpc000_Ch006_S0_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch007_S0_Walk->Draw("colz")
+cal_SmT6_sm000_rpc000_Ch008_S0_Walk->Draw("colz")
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/Init14/HD_cosmic_2020-08-21.50.3.0.0_set900921911_93_1tofClust.hst.root")
+.x pl_cor_walk.C (6,0,0)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/Init14/CluStatus900921911_911_Cal_XXX.hst.root")
+.x pl_all_2D.C(1)
+.x pl_all_2D.C(2)
+.x pl_all_2D.C(3)
+.L fit_ybox.h
+.x pl_over_clu.C(6,0,0)
+.x pl_over_clu.C(6,0,1)
+.x pl_over_clu.C(9,2,1)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/CluStatus900921911_901_Cal_HD_cosmic_2020-08-21.50.3.0.0.hst.root")
+.L fit_ybox.h
+.x pl_over_clu.C6,0,0)
+.x pl_over_clu.C(6,0,0)
+.x pl_over_clu.C(6,0,1)
+.x pl_over_clu.C(9,0,1)
+.x pl_over_clu.C(9,0,0)
+.x pl_over_clu.C(9,1,1)
+.x pl_over_clu.C(9,2,1)
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_911921_901_2.0_3.0_trk011_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_trk_Walk.C(900)
+.x pl_trk_Walk.C(600)
+.x pl_trk_Walk.C(601)
+.x pl_trk_Walk.C(601,21)
+.x pl_trk_Walk.C(601,201)
+.x pl_trk_Walk.C(911,1)
+.x pl_trk_Walk.C(911,1)
+.x pl_trk_Walk.C(911,1)
+.x pl_trk_Walk.C(911,1,0.5)
+.x pl_trk_Walk.C(601,1,0.5)
+.x pl_trk_Walk.C(600,1,1.)
+.x pl_trk_Walk.C(600,21,1.)
+.x pl_trk_Walk.C(600,1,1.)
+.x pl_trk_Walk.C(601,1,1.)
+.x pl_trk_Walk.C(601,21,1.)
+.x pl_all_Track2D.C (4)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/HD_cosmic_2020-08-21.50.3.0.0_set900921911_93_1tofClust.hst.root")
+.x pl_cor_walk.C (6,0,0)
+.x pl_cor_walk.C (6,0,1)
+.x pl_cor_walk.C (9,0,1)
+.q
+.x load_hst.C("HD_cosmic_2020-08-21.50.3.0.0/HD_cosmic_2020-08-21.50.3.0.0_set900921911_93_1tofClust.hst.root")
+.x pl_over_cor.C(9,0,0)
+.x pl_over_cor.C(6,0,0)
+.x pl_over_cor.C(6,0,1)
+.q
+.x ana_trks.C(2000000,911921,3,"HD_cosmic_2020-08-21.50.3.0.0","900921911_901",901,11,2.,4.5,50,"HD_cosmic_2020-08-21.50.3.0.0",1,1,900921911,2)
+.q
+.x load_hst.C("New_HD_cosmic_2020-08-21.50.3.0.0_set900921911_93_1tofClust.hst.root")
+.x pl_over_cor.C(6,0,1)
+.x pl_cor_walk.C(6,0,1)
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_600921_911_1.1_3.5_trk021_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_XY_trk.C(4)
+.x pl_XY_trk.C(5)
+.x pl_XY_trk.C(5,0.7,0.5)
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_601921_911_1.1_3.5_trk021_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_XY_trk.C(5,0.7,0.5)
+.x pl_pull_trk.C(5,3,1)
+.x pl_pull_trk.C(5,4,1)
+.x pl_pull_trk.C(5,1,1)
+.x pl_pull_trk.C(5,0,1)
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_911921_901_1.1_3.5_trk003_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_XY_trk.C(4)
+.x pl_XY_trk.C(4,0.7,0.5)
+.x pl_XY_trk.C(4,0.7,0.1)
+.x pl_XY_trk.C(4,0.7,0.01)
+.x pl_pull_trk.C(4,4,1)
+.x pl_trk_Walk.C(911)
+.x pl_trk_Walk.C(911,20)
+.x pl_over_trk.C
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_911921_901_1.1_3.5_trk003_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_trk_XY.C(4)
+.x pl_XY_trk.C(4)
+.x pl_XY_trk.C(4,0.7,0.2)
+.x pl_over_trk(4)
+.x pl_over_trk.C(4)
+.x pl_Eff_XY.C(911)
+.x pl_Eff_XY.C(911,0.7)
+.x pl_Eff_XY.C(911,0.7,0.5)
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_911921_901_1.1_3.5_trk003_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_Efficiency_XY.C 
+.x pl_Eff_TIR.C 
+.x pl_Eff_TIR.C (911)
+.ls
+.x pl_EvCluMul.C 
+.x pl_EvCluMul.C(911) 
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-21.50.3.0.0_050_900921911_901_601921_911_1.1_3.5_trk021_CalHD_cosmic_2020-08-21.50.3.0.0_Ana.hst.root")
+.x pl_XY_trk.C(5)
+.x pl_Eff_XY.C(601)
+.x pl_Eff_XY.C(601,0.5)
+.x pl_Eff_XY.C(601,0.5,0.2)
+.x pl_Eff_XY.C(601,0.5,1.,0.2)
+.x pl_Eff_XY.C(601,0.5,1.,0.3)
+.x pl_Eff_XY.C(601,0.5,1.,0.5)
+.x pl_pull_trk.C(5,4,1)
+.x pl_pull_trk.C(5,3,1)
+.x pl_pull_trk.C(5,0,1)
+.x pl_pull_trk.C(5,1,1)
+.x pl_pull_trk.C(5,2,1)
+.x pl_pull_trk.C(5,4,1)
+.q
+.x load_hst.C("hst/HD_cosmic_2020-08-27_12:44:34.50.3.0.0_050_900921911_901_911921_901_2.0_4.5_trk001_CalHD_cosmic_2020-08-27_12:44:34.50.3.0.0_Ana.hst.root")
+.x pl_trk_Walk.C(900)
+.x pl_trk_Walk.C(900,20)
+.q
diff --git a/macro/beamtime/hd2020/.rootrc b/macro/beamtime/hd2020/.rootrc
new file mode 100755
index 0000000000000000000000000000000000000000..cc8b6f3ddd43c0f598dd1e70c353e2b77bb56450
--- /dev/null
+++ b/macro/beamtime/hd2020/.rootrc
@@ -0,0 +1,91 @@
+# Path used by dynamic loader to find shared libraries and macros
+# Paths are different for Unix and Windows. The example shows the defaults
+# for all ROOT applications for either Unix or Windows.
+Unix.*.Root.DynamicPath:    .:$ROOTSYS/lib:
+Unix.*.Root.MacroPath:      .:../:../../:../../../:../../../../:../../tof:../../tof/beamtime:$ROOTSYS/share/doc/root/tutorials
+
+
+# Path where to look for TrueType fonts
+#Unix.*.Root.UseTTFonts:     true
+#Unix.*.Root.TTFontPath:     /usr/local/ttf/fonts
+
+# Use thread library (if exists)
+#Unix.*.Root.UseThreads:     false
+
+# Show where item is found in the specified path
+#Root.ShowPath:           false
+
+
+# Activate memory statistics (size and cnt is used to trap allocation of
+# blocks of a certain size after cnt times)
+Root.MemStat:            0
+Root.MemStat.size:      -1
+Root.MemStat.cnt:       -1
+Root.ObjectStat:         0
+ 
+# Global debug mode. When >0 turns on progressively more details debugging.
+# When >4 X11 runs in synchronous mode.
+Root.Debug:              0
+ 
+# Default editor
+Unix.*.Editor:           emacs
+
+# Specify list of file endings which TTabCom (TAB completion) should ignore.
+#TabCom.FileIgnore:       .cpp:.h:.cmz:.C
+
+
+# TCanvas specific settings. Opaque move and resize show full pad during
+# the operation instead of only the outline. Especially for resize you'll
+# need serious CPU power. UseScreenFactor=true means to size canvas according
+# to size of screen, so a canvas still looks good on a low resolution
+# laptop screen without having to change canvas size in macros.
+# HighLightColor 2 = red. ShowEventStatus allows the event status bar to
+# be turned on by default. AutoExec allows TExec objects to be executed
+# on mouse and key events.
+#Canvas.MoveOpaque:          false
+#Canvas.ResizeOpaque:        false
+#Canvas.UseScreenFactor:     true
+#Canvas.HighLightColor:      2
+#Canvas.ShowEventStatus:     false
+#Canvas.AutoExec:            true
+ 
+# Example of custom setting for the Rint application (root.exe).
+# This overrides the default specified above for a generic application.
+# Color 5 is yellow.
+#Rint.Canvas.HighLightColor:      5
+ 
+
+# THtml specific settings.
+#Root.Html.OutputDir:         $(HOME)/aix/www/html/
+#Unix.*.Root.Html.SourceDir:  .:
+#Root.Html.Author:           nh
+#Root.Html.HomePage:         http://pktw09.phy.tu-dresden.de/~plettner
+#Root.Html.Copyright:        Copyright by IKTP, TU Dresden
+#Root.Html.LastUpdate:       @(#)
+#Root.Html.Description:      TofROOT Project
+#Root.Html.Root:             http://root.cern.ch/root/html
+#Root.Html.SearchEngine:     ../Search.phtml
+ 
+# GUI specific settings
+#Gui.NormalFont:        -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1
+#Gui.BoldFont:          -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1
+#Gui.SmallFont:         -adobe-helvetica-medium-r-*-*-10-*-*-*-*-*-iso8859-1
+#Gui.ProportionalFont:  -adobe-courier-medium-r-*-*-12-*-*-*-*-*-iso8859-1
+#Gui.BackgroundColor:        #c0c0c0
+#Gui.ForegroundColor:        black
+#Gui.SelectForegroundColor:  white
+#Gui.SelectBackgroundColor:  #000080
+#Gui.IconPath:               $(HOME)/icons:$(ROOTSYS)/icons:.
+# If above does not exists defaults to this:
+#Gui.MimeTypeFile:           $ROOTSYS/icons/root.mimes
+# Can be either small, big, list, details
+#Browser.IconStyle:          big
+# Can be either name, type, size, date
+#Browser.SortBy:             name
+ 
+
+# Rint (interactive ROOT executable) specific alias, logon and logoff macros
+Rint.Load:               ~/.rootalias.C
+Rint.Logon:              ./rootlogon.C
+Rint.Logoff:             ~/.rootlogoff.C
+Rint.History:            ./.root_hist
diff --git a/macro/beamtime/hd2020/iter_calib.sh b/macro/beamtime/hd2020/iter_calib.sh
new file mode 100755
index 0000000000000000000000000000000000000000..d5a748a13c826aaa0d227c8e31a600bb3cc82368
--- /dev/null
+++ b/macro/beamtime/hd2020/iter_calib.sh
@@ -0,0 +1,182 @@
+
+#!/bin/bash
+# shell script to iterate clusterizer calibrations 
+cRun=$1
+
+c0='000000'
+#c0='00000'
+
+iCalSet=$2
+((iTmp  = $iCalSet ))
+((iBRef = $iTmp % 1000))
+((iTmp  = $iTmp - $iBRef))
+((iSet  = $iTmp / 1000))
+((iRef  = $iTmp % 1000000))
+((iRef  = $iRef / 1000))
+((iTmp  = $iTmp - $iRef))
+((iDut  = $iTmp / 1000000))
+
+iSel2=$3
+
+if((${iSel2}<0));then
+ ((iBRef=-$iSel2))
+fi
+
+echo iter_calib with iDut=$iDut, iRef=$iRef, iSet=$iSet, iSel2=$iSel2, iBRef=$iBRef
+
+cCalSet=$iCalSet
+if (( iCalSet<100000000 )); then 
+cCalSet="0"$iCalSet
+fi
+if (( iCalSet<10000000 )); then 
+cCalSet="00"$iCalSet
+fi
+if (( iCalSet<1000000 )); then 
+cCalSet="000"$iCalSet
+fi
+if (( iCalSet<100000 )); then 
+cCalSet="0000"$iCalSet
+fi
+echo cCalSet = $cCalSet
+
+#mkdir ${cRun}
+#cp rootlogon.C ${cRun}
+#cp .rootrc ${cRun}
+cd ${cRun}
+
+iStep=0
+iStepLast=0
+
+#for mode in 4
+#for mode in 5
+#for mode in 1
+#for mode in 0 3 1 0
+#for mode in 0 1 2 0
+for mode in 0 4 0
+#for mode in 0 3 1 2 4 0
+#for mode in 0 3 1 8 0
+#for mode in 0 3 1 2 4 8 4 2 8 0
+
+do
+
+case $mode in 
+0) 
+nIter=1
+alist=`echo '1'$c0',93,1,'$iRef''`
+;;
+1)
+nIter=2
+alist=`echo  '1'$c0'00,41,1,-'$iRef'' '1'$c0'0,93,0,'$iDut'' '1'$c0'00,41,0,-'$iDut'' '1'$c0'0,93,1,'$iRef''`
+;;
+2)
+nIter=2
+alist=`echo  '1'$c0'00,61,1,-'$iRef'' '1'$c0'0,93,0,'$iDut'' '1'$c0'00,61,0,-'$iDut'' '1'$c0'0,93,1,'$iRef''`
+;;
+3)
+nIter=2
+alist=`echo '1'$c0',93,0,'$iDut'' '1'$c0',64,0,-'$iDut''  '1'$c0',93,1,'$iRef'' '1'$c0',64,1,-'$iRef'' '1'$c0',93,1,'$iRef''`
+;;
+4)
+nIter=4
+alist=`echo  '1'$c0'00,71,1,-'$iRef'' '1'$c0'0,93,0,'$iDut'' '1'$c0'00,71,0,-'$iDut'' '1'$c0'0,93,1,'$iRef''`
+;;
+5)
+nIter=2
+alist=`echo '5'$c0'0,93,1,'$iRef'' '5'$c0'0,93,-2,2' '1'$c0'00,74,1,-'$iRef'' '1'$c0'00,74,0,-'$iDut'' '5'$c0'0,93,-3,2' ` 
+;;
+6)
+nIter=2
+alist=`echo '1'$c0'0,93,1,'$iRef'' '1'$c0'00,93,-2,-2' '1'$c0'0,93,0,'$iDut'' '1'$c0'00,93,-2,-2' '1'$c0'0,93,1,'$iRef''` 
+;;
+7)
+nIter=3
+alist=`echo '1'$c0',92,1,4' '1'$c0'00,93,-2,-2' '1'$c0',92,0,3' '1'$c0'00,93,-2,2' '1'$c0',92,1,4'` 
+;;
+8)
+nIter=3
+alist=`echo '1'$c0'0,93,0,'$iDut'' '1'$c0'00,61,-1,-2' '1'$c0'0,93,1,'$iRef''`
+;;
+9)
+nIter=2
+alist=`echo '1'$c0',92,1,4' '1'$c0',92,0,3' '1'$c0'00,61,-1,-2' '1'$c0'0,93,-2,2' '1'$c0',92,1,4'`
+;;
+10)
+nIter=1
+alist=`echo '1'$c0'0,92,1,'$iRef'' '1'$c0'00,93,-3,2' '1'$c0'00,93,-2,2' '1'$c0'00,61,-1,-2' '1'$c0'0,92,1,'$iRef''`
+;;
+11)
+nIter=1
+alist=`echo '1'$c0',92,1,'$iRef'' '1'$c0'00,93,-3,2' '1'$c0'00,93,-2,2' '1'$c0'00,61,-1,-2' '1'$c0'0,92,1,'$iRef''`
+;;
+esac
+
+echo 'Iterate Clusterizer calibration for run '$cRun, Set ${iCalSet} - execute $nIter iterations of ${alist}
+#lastOpt=''
+
+while [[ $nIter > 0 ]]; do
+for inOpt in $alist 
+do
+
+((iStepLast = ${iStep}))
+((iStep += 1))
+mkdir Iter${iStep}
+cp rootlogon.C Iter${iStep}
+cp .rootrc Iter${iStep}
+cd Iter${iStep}
+
+if [[ ${iStep} = 1 ]]; then 
+    lastOpt=$inOpt
+fi 
+
+if [[ ${lastOpt:+1} ]] ; then
+# echo last round was done with $lastOpt, extract 2. and 3. word
+i1=`expr index $inOpt , `
+i2=($i1+3)
+#echo `expr index $inOpt , ` = $i1
+cMode=${inOpt:$i1:2}
+cSel=${inOpt:$i2:1}
+echo Next iteration: cMode=$cMode, cSel=$cSel 
+if [[ ${cSel} = "-" ]];then 
+    cSel=${inOpt:$i2:2}
+    echo cSel=$cSel 
+    cSel="0"
+fi
+#copy calibration file 
+
+if [[ ${iStep} = 1 ]]; then 
+    cp -v ../${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root .
+else 
+    cp -v ../Iter${iStepLast}/tofClust_${cRun}_set${cCalSet}.hst.root ${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+fi
+fi 
+
+
+cSel2=$iSel2;
+if [[ $iSel2 = 0 ]]; then
+cSel2="000"
+fi
+cp -v  ../${cRun}_${cCalSet}${cSel2}_tofAna.hst.root .
+
+# generate new calibration file
+root -b -q '../../ana_digi_cal.C('$inOpt',1,"'$cRun'",'$iCalSet',0,'$iSel2') '
+#root -b -q '../../ana_digi_cos.C('$inOpt',1,"'$cRun'",'$iCalSet',0,'$iSel2') '
+#root -b -q '../../ana_digi_star.C('$inOpt',1,"'$cRun'",'$iCalSet',0,'$iSel2') '
+
+lastOpt=$inOpt
+
+#./screenshot.sh 
+cp -v tofClust_${cRun}_set${cCalSet}.hst.root ../${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+
+cp -v tofAna.hst.root ../${cRun}_${cCalSet}${cSel2}_tofAna.hst.root
+cp *pdf ../
+cd .. 
+rm ../${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+ln -s ./${cRun}/${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root ../${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+
+done
+(( nIter -= 1))
+done
+#cp -v tofClust_${cRun}_set${cCalSet}.hst.root ${cRun}_set${cCalSet}_${cMode}_${cSel}${mode}tofClust.hst.root
+
+done 
+#
diff --git a/macro/beamtime/hd2020/iter_tracks.sh b/macro/beamtime/hd2020/iter_tracks.sh
new file mode 100644
index 0000000000000000000000000000000000000000..ee46f2cb2962141595a884548aeba95291ffac8a
--- /dev/null
+++ b/macro/beamtime/hd2020/iter_tracks.sh
@@ -0,0 +1,188 @@
+#!/bin/bash
+# shell script to iterate tracklet calibration histograms
+#SBATCH -J track
+#SBATCH -D /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020
+#SBATCH --time=6-00:00:00
+#SBATCH --mem=4000
+#SBATCH --partition=long
+
+X=$((${SLURM_ARRAY_TASK_ID} - 0))
+XXX=$(printf "%03d" "$X")
+
+cRun=$1
+iTraSetup=$2
+
+#which file should be analyzed ?  
+cSet=$3
+if [[ $cSet = "" ]]; then 
+    cSet="900920910_911"
+    #cSet="900041500_901"
+    #cSet="900041500_500"
+fi
+
+# extract iCalSet from cSet
+i1=0
+while [ "${cSet:$i1:1}" = "0" ]; do
+(( i1 += 1 ))
+done
+i2=0
+while [ "${cSet:$i2:1}" != "_" ] && [ $i2 -lt  ${#cSet} ]; do
+(( i2 += 1 ))
+done
+(( i2 -= i1 ))
+iCalSet=${cSet:$i1:$i2}
+echo got i1=$i1, i2=$i2, iCalSet=$iCalSet from $cSet
+
+cCalId=$4;
+if [[ $cCalId = "" ]]; then 
+    cCalId=$cRun;
+fi
+
+iMc=0
+McId=${cRun:0:4}
+if [ "$McId" = "mcbm" ]; then 
+  echo processing MC simulation
+  iMc=1
+fi
+
+# what should be done ?
+iDut=600; iRef=921; iSel2=901
+((iSel=$iDut*1000+$iRef))
+
+nEvt=100000
+dDTres=2000
+dDTRMSres=2000
+iter=0;
+
+if [ -e /lustre/cbm ]; then
+source /lustre/cbm/users/nh/CBM/cbmroot/trunk/build/config.sh 
+wdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020
+outdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020/${cRun}
+else 
+wdir=`pwd`
+outdir=${wdir}/${cRun}
+fi
+
+# frange2 limits chi2
+fRange2=8.
+TRange2Limit=3. 
+
+#frange1 limits DT spectrum range 
+fRange1=3.
+TRange1Limit=1.
+dDeadtime=50
+
+if [ ! -e ${cRun} ]; then 
+  mkdir $cRun
+fi
+cd ${cRun}
+cp ../.rootrc .
+cp ../rootlogon.C .
+
+# clean directory for start from scratch
+# rm -v ${cRun}_tofFindTracks.hst.root
+rm -v TCalib.res
+
+if [[ $iter > 0 ]]; then
+ cp -v  ${cRun}_tofFindTracks.hst${iter}.root  ${cRun}_tofFindTracks.hst.root
+fi
+
+nEvtMax=0
+(( nEvtMax = nEvt*10 ))
+
+while [[ $dDTres > 0 ]]; do
+
+nEvt=`echo "scale=0;$nEvt * 1./1." | bc`
+#nEvt=`echo "scale=0;$nEvt * 1.1/1." | bc`
+
+if [ $nEvt -gt $nEvtMax ]; then
+    nEvt=$nEvtMax
+fi
+
+#((fRange2 /= 2))
+#if((${fRange2}<$Range2Limit));then
+# ((fRange2=$Range2Limit))
+#fi
+fRange2=`echo "$fRange2 * 0.8" | bc`
+compare_TRange2=`echo "$fRange2 < $TRange2Limit" | bc`
+if  [[ $compare_TRange2 > 0 ]]; then
+fRange2=$TRange2Limit
+fi
+
+#bash only handles integers!!
+#((fRange1 /= 2))  
+#if((${fRange1}<1));then
+# ((fRange1=1))
+#fi
+fRange1=`echo "$fRange1 * 0.8" | bc`
+compare_TRange=`echo "$fRange1 < $TRange1Limit" | bc`
+if  [[ $compare_TRange > 0 ]]; then
+fRange1=$TRange1Limit
+fi
+
+# correction modes: 2 - TOff from Tt, 3 - Pull t, 4 - x, 5 - y, 6 - z, >10 - Pull t of individual stations 
+#for iCal in 3 2 10 11 12 13 14 15 4 5; do
+for iCal in 3 4 5; do
+#for iCal in 3 2 4; do
+#for iCal in 3 2 ; do
+#for iCal in 2 ; do
+    nIt=1
+    if [ $iter -eq 0 ] && [ $iMc -eq 1 ]; then
+      echo skip iCal $iCal for MC calibration
+      iCal=5
+    fi
+    while [[ $nIt > 0 ]]; do
+	((iter += 1))
+	root -b -q '../ana_trks.C('$nEvt','$iSel','$iCal',"'$cRun'","'$cSet'",'$iSel2','$iTraSetup','$fRange1','$fRange2','$dDeadtime',"'$cCalId'",1,1,'$iCalSet',0,'$iMc')'
+	cp -v tofFindTracks.hst.root ${cRun}_tofFindTracks.hst.root
+	cp -v tofFindTracks.hst.root ${cRun}_tofFindTracks.hst${iter}.root
+	cp -v tofAnaTestBeam.hst.root ${cRun}_TrkAnaTestBeam.hst.root
+	((nIt -= 1))
+    done
+done
+
+iTres=`cat TCalib.res`
+if [[ $iTres = 0 ]]; then
+    echo All tracks lost, stop at iter = $iter
+    return
+fi
+
+((TRMSres=$iTres%1000))
+((iTres -= TRMSres ))
+((Tres   = iTres / 1000)) 
+
+if [[ $Tres = 0 ]]; then
+    Tres=1
+fi
+dTdif=`echo "$dDTres - $Tres" | bc`
+compare_result=`echo "$Tres < $dDTres" | bc`
+
+dTRMSdif=`echo "$dDTRMSres - $TRMSres" | bc`
+compare_RMS=`echo "$TRMSres < $dDTRMSres" | bc`
+
+echo at iter=$iter got TOff = $Tres, compare to $dDTres, dTdif = $dTdif, result = $compare_result, TRMS = $TRMSres, old $dDTRMSres, dif = $dTRMSdif, result = $compare_RMS 
+
+((compare_result += $compare_RMS))
+echo result_summary: $compare_result 
+
+if [[ $compare_result > 0 ]]; then
+  if [[ $Tres = 0 ]]; then
+    Tres=1
+  fi
+  dDTres=$Tres
+  dDTRMSres=$TRMSres
+else
+  dDTres=0
+  rm ../${cRun}_tofFindTracks.hst.root
+  cp -v  tofFindTracks.hst.root  ../${cRun}_tofFindTracks.hst.root
+  cp -v  tofFindTracks.hst.root  ./${cRun}_${cSet}._${iTraSetup}_tofFindTracks.hst.root  # keep a copy 
+  rm ../${cRun}_TrkAnaTestBeam.hst.root
+  cp -v  tofAnaTestBeam.hst.root ../${cRun}_TrkAnaTestBeam.hst.root
+fi
+
+done
+
+cd ..
+#mv -v slurm-${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID}.out ${outdir}/IterTrack_${cRun}_${cSet}.out
+mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/IterTrack_${cRun}_${cSet}.out
+
diff --git a/macro/beamtime/mcbm2020/calib_batch.sh b/macro/beamtime/mcbm2020/calib_batch.sh
new file mode 100644
index 0000000000000000000000000000000000000000..3fe474f6e89767ab0f9e099a318a9ccbd2c5863a
--- /dev/null
+++ b/macro/beamtime/mcbm2020/calib_batch.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+#SBATCH -J calib
+#SBATCH -D /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020
+#SBATCH --time=6-00:00:00
+#SBATCH --mem=4000
+#SBATCH --partition=long
+
+X=$((${SLURM_ARRAY_TASK_ID} - 0))
+XXX=$(printf "%03d" "$X")
+
+CalSet="$1"
+if [[ ${CalSet} = "" ]]; then
+  echo please specify CalSet!
+  return
+fi
+
+Sel2="$2"
+if [[ ${Sel2} = "" ]]; then
+  echo please specify Sel2!
+  return
+fi
+
+RunId="$3"
+if [[ ${RunId} = "" ]]; then
+RunList1=' 
+20161121_2133_run1_gdpb
+'
+    I=1
+    RunId=""
+    for RunId in $RunList1
+    do
+    #echo check $RunId
+     if (($I == $X)); then
+       echo found RunId $RunId
+       break
+     fi
+     ((I=$I+1))
+    done
+fi
+
+CalMode="$4"
+if [[ ${CalMode} = "" ]]; then
+#CalMode="_DT200_0x00005006"
+#CalMode="_DT50_0x00005006"
+#CalMode="_DT50_0x00000000"
+#CalMode="_DT50_0x00019026"
+#CalMode="_DT50_Req5"
+#CalMode="_DT50_Req0"
+#CalMode="_DT50000_Req-3"
+#CalMode="_DT50000_Req-4"
+#CalMode="_DT26000_Req-4"
+CalMode=".100.3" 
+#CalMode="_DT100_Req-4"
+#CalMode="_DT50_Req-3"
+#CalMode="_DT50_Req-2"
+fi
+
+RunIdMode=`echo $RunId$CalMode`
+Deadtime=50
+
+echo define root execution environment at I=$I for Run $RunId Mode $RunIdMode
+
+if [ -e /lustre/nyx ]; then
+source /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build6/config.sh 
+wdir=/lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020
+outdir=/lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020/${RunId}
+else 
+wdir=`pwd`
+outdir=${wdir}/${RunId}
+fi
+mkdir ${outdir}
+
+cd  ${wdir}
+echo execute: ./init_cal_all.sh ${RunIdMode} ${CalSet} ${Deadtime}
+source ./init_cal_all.sh ${RunIdMode} ${CalSet} ${Deadtime}
+#echo execute: ./init_calib_star.sh ${RunIdMode} ${CalSet} ${Deadtime}
+#source ./init_calib_star.sh ${RunIdMode} ${CalSet} ${Deadtime}
+
+cd  ${wdir}
+#echo execute: ./iter_calib.sh ${RunIdMode} ${CalSet} ${Sel2} ${Deadtime}
+#source ./iter_calib.sh ${RunIdMode} ${CalSet} ${Sel2} ${Deadtime}
+
+cd  ${wdir}
+echo execute: ./gen_hits.sh ${RunIdMode} ${CalSet} ${Sel2} ${Deadtime}
+source ./gen_hits.sh ${RunIdMode} ${CalSet} ${Sel2} ${Deadtime}
+
+mv -v slurm-${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID}.out ${outdir}/Calib_${RunIdMode}_${CalSet}_${Sel2}.out
diff --git a/macro/beamtime/mcbm2020/gen_hits.sh b/macro/beamtime/mcbm2020/gen_hits.sh
new file mode 100755
index 0000000000000000000000000000000000000000..1556840ea64c2c51a760af8bfde5692cf0d3ad68
--- /dev/null
+++ b/macro/beamtime/mcbm2020/gen_hits.sh
@@ -0,0 +1,93 @@
+#!/bin/bash
+# shell script to apply clusterizer calibrations
+#SBATCH -J gen_hits
+#SBATCH -D /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020
+#SBATCH --time=8:00:00
+#SBATCH --mem=2000
+##SBATCH --partition=long
+cRun=$1
+
+iCalSet=$2
+((iTmp  = $iCalSet ))
+((iBRef = $iTmp % 1000))
+((iTmp  = $iTmp - $iBRef))
+((iSet  = $iTmp / 1000))
+((iRef  = $iTmp % 1000000))
+((iRef  = $iRef / 1000))
+((iTmp  = $iTmp - $iRef))
+((iDut  = $iTmp / 1000000))
+
+iSel2=$3
+
+cCalSet=$iCalSet
+if (( iCalSet<100000000 )); then 
+cCalSet="0"$iCalSet
+fi
+if (( iCalSet<10000000 )); then 
+cCalSet="00"$iCalSet
+fi
+if (( iCalSet<1000000 )); then 
+cCalSet="000"$iCalSet
+fi
+if (( iCalSet<100000 )); then 
+cCalSet="0000"$iCalSet
+fi
+echo cCalSet = $cCalSet
+
+Deadtime=$4
+if [[ ${Deadtime} = "" ]]; then
+Deadtime=50.
+fi
+
+CalIdMode=$5
+if [[ ${CalIdMode} = "" ]]; then
+ echo use native calibration file 
+ CalIdMode=${cRun}
+ CalFile=${cRun}_set${cCalSet}_93_1tofClust.hst.root
+else 
+ CalFile=${CalIdMode}_set${cCalSet}_93_1tofClust.hst.root
+ RunFile=${cRun}_set${cCalSet}_93_1tofClust.hst.root
+# rm ${RunFile}
+# ln -s ${CalFile} ${RunFile} 
+ echo use calibrations from  ${CalFile}
+fi
+
+CalIdSet=$6
+if [[ ${CalIdSet} = "" ]]; then
+    echo use native calibration file
+    CalIdSet=$cCalSet
+else
+    CalFile=${CalIdMode}_set${CalIdSet}_93_1tofClust.hst.root    
+fi
+
+Nevt=$7
+if [[ ${Nevt} = "" ]]; then
+    echo use all events
+    Nevt=-1
+fi
+
+echo gen_hits for $cRun with iDut=$iDut, iRef=$iRef, iSet=$iCalSet, iSel2=$iSel2, iBRef=$iBRef, Deadtime=$Deadtime, CalFile=$CalFile
+
+if [ -e /lustre/cbm ]; then
+source /lustre/cbm/users/nh/CBM/cbmroot/trunk/build/config.sh 
+wdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020
+outdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020/${cRun}
+else 
+wdir=`pwd`
+outdir=${wdir}/${cRun}
+fi
+
+cd $wdir
+mkdir $cRun
+cd    $cRun 
+cp    ../.rootrc .
+cp    ../rootlogon.C .
+cp -v ../${CalFile}  .
+#root -b -q '../ana_digi_cal.C(100000,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+root -b -q '../ana_digi_cal_all.C('$Nevt',93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+#root -b -q '../ana_digi_cos.C(-1,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+#root -b -q '../ana_digi_star.C(-1,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+
+cd ..
+
+mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/GenHits_${cRun}_${iCalSet}_${iSel2}_${CalIdMode}.out
diff --git a/macro/beamtime/mcbm2020/mcbm_event_reco_ana.C b/macro/beamtime/mcbm2020/mcbm_event_reco_ana.C
new file mode 100644
index 0000000000000000000000000000000000000000..b43308c8903fb5b35d2908743c5bf5cf26df2472
--- /dev/null
+++ b/macro/beamtime/mcbm2020/mcbm_event_reco_ana.C
@@ -0,0 +1,444 @@
+// --------------------------------------------------------------------------
+//
+// Macro for reconstruction of mcbm data (2020)
+// Combined Event based local reconstruction (Event Building (Florian one) +
+// cluster + hit finder) for different subsystems.
+//
+// --------------------------------------------------------------------------
+
+void mcbm_event_reco_ana(Int_t runId = 831, Int_t nTimeslices = 1000) {
+
+  // --- Logger settings ----------------------------------------------------
+  TString logLevel     = "WARN";
+  TString logVerbosity = "LOW";
+  // ------------------------------------------------------------------------
+
+
+  // -----   Environment   --------------------------------------------------
+  TString myName   = "mcbm_event_reco";  // this macro's name for screen output
+  TString srcDir   = gSystem->Getenv("VMCWORKDIR");  // top source directory
+  TString paramDir = srcDir + "/macro/beamtime/mcbm2020/";
+  TString parDir   = srcDir + "/parameters";
+  // ------------------------------------------------------------------------
+
+
+  // -----   In- and output file names   ------------------------------------
+  TString inFile  = Form("./data/unp_mcbm_%i.root", runId);
+  TString parFile = Form("./data/unp_mcbm_params_%i.root", runId);
+  TString geoFile = paramDir + "mcbm2020_reco.geo.root";  // Created in sim. run
+  TString outFile = Form("./data/reco_mcbm_%i.root", runId);
+  // ------------------------------------------------------------------------
+
+  // -----   Parameter files as input to the runtime database   -------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Defining parameter files " << std::endl;
+  TList* parFileList = new TList();
+
+  // -----   Timer   --------------------------------------------------------
+  TStopwatch timer;
+  timer.Start();
+  // ------------------------------------------------------------------------
+
+
+  // -----   FairRunAna   ---------------------------------------------------
+  FairRunAna* run             = new FairRunAna();
+  FairFileSource* inputSource = new FairFileSource(inFile);
+  run->SetSource(inputSource);
+
+  FairRootFileSink* outputSink = new FairRootFileSink(outFile);
+  run->SetSink(outputSink);
+  run->SetGeomFile(geoFile);
+
+  // Define output file for FairMonitor histograms
+  TString monitorFile {outFile};
+  monitorFile.ReplaceAll("rec", "rec.monitor");
+  FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Logger settings   ----------------------------------------------
+  FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data());
+  FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data());
+  // ------------------------------------------------------------------------
+
+  //--------------------event builder-------------------//
+  CbmMcbm2018EventBuilder* eventBuilder = new CbmMcbm2018EventBuilder();
+  // eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::MaximumTimeGap);
+  //eventBuilder->SetMaximumTimeGap(50.);
+  eventBuilder->SetEventBuilderAlgo(EventBuilderAlgo::FixedTimeWindow);
+  eventBuilder->SetFixedTimeWindow(200.);
+  eventBuilder->SetTriggerMinNumberT0(1);
+  //eventBuilder->SetTriggerMinNumberSts(0);
+  eventBuilder->SetTriggerMinNumberMuch(1);
+  eventBuilder->SetTriggerMinNumberTof(10);
+  run->AddTask(eventBuilder);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Reconstruction tasks   -----------------------------------------
+
+  // -----   Local reconstruction in MUCH   ---------------------------------
+  Int_t flag = 1;
+  TString muchDigiFile(
+    parDir + "/much/much_v19c_mcbm_digi_sector.root");  // MUCH digi file
+  CbmMuchFindHitsGem* muchFindHits =
+    new CbmMuchFindHitsGem(muchDigiFile.Data(), flag);
+  muchFindHits->SetBeamTimeDigi(kTRUE);
+  run->AddTask(muchFindHits);
+  std::cout << "-I- : Added task " << muchFindHits->GetName() << std::endl;
+  //-------------------------------------------------------------------------------
+
+
+  // -----   Local reconstruction in STS   ----------------------------------
+  CbmRecoSts* recoSts = new CbmRecoSts();
+  recoSts->SetMode(kCbmRecoEvent);
+
+  //recoSts->SetTimeCutDigisAbs( 20 );// cluster finder: time cut in ns
+  //recoSts->SetTimeCutClustersAbs(20.); // hit finder: time cut in ns
+
+  // ASIC params: #ADC channels, dyn. range, threshold, time resol., dead time,
+  // noise RMS, zero-threshold crossing rate
+  auto parAsic =
+    new CbmStsParAsic(32, 75000., 3000., 5., 800., 1000., 3.9789e-3);
+
+  // Module params: number of channels, number of channels per ASIC
+  auto parMod = new CbmStsParModule(2048, 128);
+  parMod->SetAllAsics(*parAsic);
+  recoSts->UseModulePar(parMod);
+
+  // Sensor params
+  auto sensorPar = new CbmStsParSensor(CbmStsSensorClass::kDssdStereo);
+  sensorPar->SetPar(0, 6.2092);  // Extension in x
+  sensorPar->SetPar(1, 6.2);     // Extension in y
+  sensorPar->SetPar(2, 0.03);    // Extension in z
+  sensorPar->SetPar(3, 5.9692);  // Active size in y
+  sensorPar->SetPar(4, 1024.);   // Number of strips front side
+  sensorPar->SetPar(5, 1024.);   // Number of strips back side
+  sensorPar->SetPar(6, 0.0058);  // Strip pitch front side
+  sensorPar->SetPar(7, 0.0058);  // Strip pitch back side
+  sensorPar->SetPar(8, 7.5);     // Stereo angle front side
+  sensorPar->SetPar(9, 0.0);     // Stereo angle back side
+  recoSts->UseSensorPar(sensorPar);
+
+  // Sensor conditions: full depletion voltage, bias voltage, temperature,
+  // coupling capacitance, inter-strip capacitance
+  auto sensorCond = new CbmStsParSensorCond(70., 140., 268., 17.5, 1.);
+  recoSts->UseSensorCond(sensorCond);
+
+  run->AddTask(recoSts);
+  std::cout << "-I- : Added task " << recoSts->GetName() << std::endl;
+  // ------------------------------------------------------------------------
+
+
+  // -----   Local reconstruction in TRD   ----------------------------------
+  // ------------------------------------------------------------------------
+
+
+  // -----   Local reconstruction in TOF   ----------------------------------
+  // ------------------------------------------------------------------------
+  // TOF defaults
+  Int_t calMode      = 93;
+  Int_t calSel       = 1;
+  Int_t calSm        = 0;
+  Int_t RefSel       = 0;
+  Double_t dDeadtime = 50.;
+  Int_t iSel2        = 500;
+  TString TofGeoTag  = "v20f_mcbm";
+  TString cCalId     = "831.50.3.0";
+  Int_t iCalSet      = 12022500;  // calibration settings
+
+  TObjString* tofBdfFile =
+    new TObjString(parDir + "/tof/tof_" + TofGeoTag + ".digibdf.par");
+  parFileList->Add(tofBdfFile);
+  std::cout << "-I- Using parameter file " << tofBdfFile->GetString()
+            << std::endl;
+
+  CbmTofEventClusterizer* tofCluster =
+    new CbmTofEventClusterizer("TOF Event Clusterizer", 0, 1);
+  TString cFname = parDir + "/tof/"
+                   + Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                          cCalId.Data(),
+                          iCalSet,
+                          calMode,
+                          calSel);
+  tofCluster->SetCalParFileName(cFname);
+  tofCluster->SetCalMode(calMode);
+  tofCluster->SetCalSel(calSel);
+  tofCluster->PosYMaxScal(0.75);              //in % of 2*length
+  tofCluster->SetChannelDeadtime(dDeadtime);  // artificial deadtime in ns
+
+  run->AddTask(tofCluster);
+  std::cout << "-I- Added task " << tofCluster->GetName() << std::endl;
+
+  // -----   Track reconstruction   ------------------------------------------
+  Int_t iTrackMode = 2;
+  switch (iTrackMode) {
+    case 2: {
+      Int_t iGenCor      = 1;
+      Double_t dScalFac  = 1.;
+      Double_t dChi2Lim2 = 3.5;
+      TString cTrkFile =
+        parDir + "/tof/" + Form("%s_tofFindTracks.hst.root", cCalId.Data());
+      Int_t iTrackingSetup = 1;
+      Int_t iCalOpt        = 0;
+
+      CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN();
+      tofTrackFinder->SetMaxTofTimeDifference(0.2);  // in ns/cm
+      tofTrackFinder->SetTxLIM(0.3);                 // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.3);  // max dev from mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);  // mean slope dy/dz
+      CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211);
+      TFitter* MyFit                    = new TFitter(1);  // initialize Minuit
+      tofTrackFinder->SetFitter(tofTrackFitter);
+
+      CbmTofFindTracks* tofFindTracks =
+        new CbmTofFindTracks("TOF Track Finder");
+      tofFindTracks->UseFinder(tofTrackFinder);
+      tofFindTracks->UseFitter(tofTrackFitter);
+      tofFindTracks->SetCalOpt(iCalOpt);
+      // 1 - update offsets, 2 - update walk, 0 - bypass
+      tofFindTracks->SetCorMode(
+        iGenCor);  // valid options: 0,1,2,3,4,5,6, 10 - 19
+      tofFindTracks->SetTtTarg(
+        0.065);  // target value for Mar2020 triple stack -> betapeak ~ 0.95
+      //tofFindTracks->SetTtTarg(0.041);  // target value for inverse velocity, > 0.033 ns/cm!
+      //tofFindTracks->SetTtTarg(0.035);  // target value for inverse velocity, > 0.033 ns/cm!
+      tofFindTracks->SetCalParFileName(
+        cTrkFile);  // Tracker parameter value file name
+      tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
+      tofFindTracks->SetStationMaxHMul(
+        30);  // Max Hit Multiplicity in any used station
+
+      tofFindTracks->SetT0MAX(dScalFac);  // in ns
+      tofFindTracks->SetSIGT(0.08);       // default in ns
+      tofFindTracks->SetSIGX(0.3);        // default in cm
+      tofFindTracks->SetSIGY(0.45);       // default in cm
+      tofFindTracks->SetSIGZ(0.05);       // default in cm
+      tofFindTracks->SetUseSigCalib(
+        kFALSE);  // ignore resolutions in CalPar file
+      tofTrackFinder->SetSIGLIM(dChi2Lim2
+                                * 2.);  // matching window in multiples of chi2
+      tofTrackFinder->SetChiMaxAccept(dChi2Lim2);  // max tracklet chi2
+
+      Int_t iMinNofHits   = -1;
+      Int_t iNStations    = 0;
+      Int_t iNReqStations = 3;
+      switch (iTrackingSetup) {
+        case 0:  // bypass mode
+          iMinNofHits = -1;
+          iNStations  = 1;
+          tofFindTracks->SetStation(0, 5, 0, 0);  // Diamond
+          break;
+
+        case 1:  // for calibration mode of full setup
+          iMinNofHits   = 3;
+          iNStations    = 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);
+          break;
+
+        case 2:  // for geometry check mode of full setup
+          iMinNofHits   = 3;
+          iNStations    = 27;
+          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, 0, 4, 0);
+          tofFindTracks->SetStation(16, 0, 3, 0);
+          tofFindTracks->SetStation(17, 0, 4, 1);
+          tofFindTracks->SetStation(18, 0, 3, 1);
+          tofFindTracks->SetStation(19, 0, 4, 2);
+          tofFindTracks->SetStation(20, 0, 3, 2);
+          tofFindTracks->SetStation(21, 0, 4, 3);
+          tofFindTracks->SetStation(22, 0, 3, 3);
+          tofFindTracks->SetStation(23, 0, 4, 4);
+          tofFindTracks->SetStation(24, 0, 3, 4);
+          tofFindTracks->SetStation(25, 9, 0, 0);
+          tofFindTracks->SetStation(26, 9, 0, 1);
+          break;
+
+        case 3:  // for reduced bias tracking of full setup
+          iMinNofHits   = 3;
+          iNStations    = 28;
+          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, 0, 4, 0);
+          tofFindTracks->SetStation(16, 0, 3, 0);
+          tofFindTracks->SetStation(17, 0, 4, 1);
+          tofFindTracks->SetStation(18, 0, 3, 1);
+          tofFindTracks->SetStation(19, 0, 4, 2);
+          tofFindTracks->SetStation(20, 0, 3, 2);
+          tofFindTracks->SetStation(21, 0, 4, 3);
+          tofFindTracks->SetStation(22, 0, 3, 3);
+          tofFindTracks->SetStation(23, 0, 4, 4);
+          tofFindTracks->SetStation(24, 0, 3, 4);
+          tofFindTracks->SetStation(25, 9, 0, 0);
+          tofFindTracks->SetStation(26, 9, 0, 1);
+          tofFindTracks->SetStation(27, 5, 0, 0);
+          break;
+      }
+      tofFindTracks->SetMinNofHits(iMinNofHits);
+      tofFindTracks->SetNStations(iNStations);
+      tofFindTracks->SetNReqStations(iNReqStations);
+      //tofFindTracks->PrintSetup();
+      run->AddTask(tofFindTracks);
+    } break;
+    case 1: {
+    }
+    case 0:
+    default:;
+  }
+
+  // -----   Local reconstruction of RICH Hits ------------------------------
+  CbmRichMCbmHitProducer* hitProdRich = new CbmRichMCbmHitProducer();
+  hitProdRich->setToTLimits(23.7, 30.0);
+  hitProdRich->applyToTCut();
+  TString sRichMapFile =
+    srcDir + "/macro/rich/mcbm/beamtime/mRICH_Mapping_vert_20190318_elView.geo";
+  hitProdRich->SetMappingFile(sRichMapFile.Data());
+  run->AddTask(hitProdRich);
+  // ------------------------------------------------------------------------
+
+  // -----   Local reconstruction in RICh -> Finding of Rings ---------------
+  CbmRichReconstruction* richReco = new CbmRichReconstruction();
+  richReco->UseMCbmSetup();
+  run->AddTask(richReco);
+  // ------------------------------------------------------------------------
+
+
+  // -----  Psd hit producer   ----------------------------------------------
+  CbmPsdMCbmHitProducer* hitProdPsd = new CbmPsdMCbmHitProducer();
+  run->AddTask(hitProdPsd);
+  // ------------------------------------------------------------------------
+
+  // --- Analysis by TOF track extension
+  CbmTofExtendTracks* tofExtendTracks =
+    new CbmTofExtendTracks("TofExtAna");
+  tofExtendTracks->SetCalParFileName("TofExtTracksPar.root");
+  tofExtendTracks->SetCalOutFileName("TofExtTracksOut.root");
+  tofExtendTracks->SetCorMode(210);
+  run->AddTask(tofExtendTracks);
+
+  // -----  Parameter database   --------------------------------------------
+  std::cout << std::endl << std::endl;
+  std::cout << "-I- " << myName << ": Set runtime DB" << std::endl;
+  FairRuntimeDb* rtdb        = run->GetRuntimeDb();
+  FairParRootFileIo* parIo1  = new FairParRootFileIo();
+  FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
+  parIo1->open(parFile.Data(), "UPDATE");
+  parIo2->open(parFileList, "in");
+  rtdb->setFirstInput(parIo1);
+  rtdb->setSecondInput(parIo2);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Run initialisation   -------------------------------------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Initialise run" << std::endl;
+  run->Init();
+  rtdb->setOutput(parIo1);
+  rtdb->saveOutput();
+  rtdb->print();
+  // ------------------------------------------------------------------------
+
+
+  // -----   Start run   ----------------------------------------------------
+  std::cout << std::endl << std::endl;
+  std::cout << "-I- " << myName << ": Starting run" << std::endl;
+  run->Run(0, nTimeslices);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Finish   -------------------------------------------------------
+  timer.Stop();
+  FairMonitor::GetMonitor()->Print();
+  Double_t rtime = timer.RealTime();
+  Double_t ctime = timer.CpuTime();
+  std::cout << std::endl << std::endl;
+  std::cout << "Macro finished successfully." << std::endl;
+  std::cout << "Output file is " << outFile << std::endl;
+  std::cout << "Parameter file is " << parFile << std::endl;
+  std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s"
+            << std::endl;
+  std::cout << std::endl;
+  // ------------------------------------------------------------------------
+
+
+  // -----   Resource monitoring   ------------------------------------------
+  // Extract the maximal used memory an add is as Dart measurement
+  // This line is filtered by CTest and the value send to CDash
+  FairSystemInfo sysInfo;
+  Float_t maxMemory = sysInfo.GetMaxMemory();
+  std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
+  std::cout << maxMemory;
+  std::cout << "</DartMeasurement>" << std::endl;
+
+  Float_t cpuUsage = ctime / rtime;
+  std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
+  std::cout << cpuUsage;
+  std::cout << "</DartMeasurement>" << std::endl;
+  // ------------------------------------------------------------------------
+
+
+  // -----   Function needed for CTest runtime dependency   -----------------
+  //  RemoveGeoManager();
+  // ------------------------------------------------------------------------
+
+  /// --- Screen output for automatic tests
+  std::cout << " Test passed" << std::endl;
+  std::cout << " All ok " << std::endl;
+}
diff --git a/macro/beamtime/mcbm2020/mtof_build_and_reco.C b/macro/beamtime/mcbm2020/mtof_build_and_reco.C
new file mode 100644
index 0000000000000000000000000000000000000000..85bab108245fe1dadd377d7acbbcf18d94b9edd0
--- /dev/null
+++ b/macro/beamtime/mcbm2020/mtof_build_and_reco.C
@@ -0,0 +1,567 @@
+//
+// N.Herrmann   02.05.2020
+//
+// --------------------------------------------------------------------------
+
+void mtof_build_and_reco_kronos 
+  (            Int_t nEvents      = -1,  // number of Timeslices
+			   UInt_t uRunId      = 831,
+               TString setup      = "mcbm_beam_2020_03",
+               TString cCalId     = "831.50.3.0",
+               Int_t iCalSet      = 12022500,  // calibration settings
+               TString outDir     = "data/",
+               Double_t Tint      = 50.,   // coincidence time interval
+               Double_t ReqTofMul = 10.,   // requested TOF digi multiplicity
+               Int_t iTrackMode   = 2,     // 2 for TofTracker
+               Double_t ReqT0Mul  = 1.) {
+  // ========================================================================
+  //          Adjust this part according to your requirements
+  TString dataset    = Form("data/unp_mcbm_%03u",uRunId);
+
+  // --- Logger settings ----------------------------------------------------
+  TString logLevel     = "INFO";
+  TString logVerbosity = "VERYHIGH";
+  // ------------------------------------------------------------------------
+
+  Int_t iTofCluMode = 1;
+
+  // -----   Environment   --------------------------------------------------
+  TString myName = "mtof_reco";  // this macro's name for screen output
+  TString srcDir = gSystem->Getenv("VMCWORKDIR");  // top source directory
+  TString parDir = srcDir + "/parameters";
+  // ------------------------------------------------------------------------
+
+
+  // -----   File names   ---------------------------------------------------
+  TString rawFile = dataset + ".root";
+  TString parFile = dataset + ".par.root";
+  TString recFile =
+    dataset + Form(".%d.%d", (Int_t) Tint, (Int_t) ReqTofMul) + ".recEvtWin.root";
+  TString hstFile = "./hst/" + dataset
+                    + Form(".%d.%d", (Int_t) Tint, (Int_t) ReqTofMul)
+                    + ".recEvtWin.hst.root";
+  // ------------------------------------------------------------------------
+  TString shcmd = "rm -v " + parFile;
+  gSystem->Exec(shcmd.Data());
+
+  // -----   Load the geometry setup   -------------------------------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Loading setup " << setup << std::endl;
+  CbmSetup* pSetup = CbmSetup::Instance();
+  pSetup->LoadSetup(setup);
+  // You can modify the pre-defined setup by using
+  // CbmSetup::Instance()->RemoveModule(ESystemId) or
+  // CbmSetup::Instance()->SetModule(ESystemId, const char*, Bool_t) or
+  //CbmSetup::Instance()->SetActive(ESystemId, Bool_t)
+  pSetup->SetActive(ECbmModuleId::kMvd, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kSts, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kMuch, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kRich, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kTrd, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kPsd, kFALSE);
+
+  // ------------------------------------------------------------------------
+
+
+  // -----   Parameter files as input to the runtime database   -------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Defining parameter files " << std::endl;
+  TList* parFileList = new TList();
+  TString geoTag;
+
+  // - TOF digitisation parameters
+  if (pSetup->IsActive(ECbmModuleId::kTof)) {
+
+    pSetup->GetGeoTag(ECbmModuleId::kTof, geoTag);
+
+    TObjString* tofBdfFile =
+      new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par");
+    parFileList->Add(tofBdfFile);
+    std::cout << "-I- " << myName << ": Using parameter file "
+              << tofBdfFile->GetString() << std::endl;
+
+    TString geoFile = srcDir + "/geometry/tof/geofile_tof_" + geoTag + ".root";
+    TFile* fgeo     = new TFile(geoFile);
+    TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom");
+    if (NULL == geoMan) {
+      cout << "<E> FAIRGeom not found in geoFile " << geoFile.Data() << endl;
+      return;
+    }
+  }
+  // ------------------------------------------------------------------------
+
+  // In general, the following parts need not be touched
+  // ========================================================================
+
+
+  // -----   Timer   --------------------------------------------------------
+  TStopwatch timer;
+  timer.Start();
+  // ------------------------------------------------------------------------
+
+
+  // ----    Debug option   -------------------------------------------------
+  gDebug = 0;
+  // ------------------------------------------------------------------------
+
+
+  // -----   Input file   ---------------------------------------------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Using input file " << rawFile
+            << std::endl;
+  // ------------------------------------------------------------------------
+
+
+  // -----   FairRunAna   ---------------------------------------------------
+  FairRunAna* run = new FairRunAna();
+  run->SetInputFile(rawFile);
+  run->SetOutputFile(recFile);
+  run->SetGenerateRunInfo(kFALSE);
+  Bool_t hasFairMonitor = kFALSE;  //Has_Fair_Monitor();
+  if (hasFairMonitor) FairMonitor::GetMonitor()->EnableMonitor(kTRUE);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Logger settings   ----------------------------------------------
+  FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data());
+  FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data());
+  // ------------------------------------------------------------------------
+
+  //-------- Event builder --------------------------------------------------
+  //  CbmMcbm2019TimeWinEventBuilder* eventBuilder = new CbmMcbm2019TimeWinEventBuilder();
+  CbmMcbm2019TimeWinEventBuilderTask* eventBuilder =
+    new CbmMcbm2019TimeWinEventBuilderTask();
+
+  eventBuilder->SetFillHistos(kTRUE);
+
+  eventBuilder->SetEventOverlapMode(EOverlapMode::NoOverlap);
+  //  eventBuilder->SetEventOverlapMode(EOverlapMode::MergeOverlap);
+  //  eventBuilder->SetEventOverlapMode(EOverlapMode::AllowOverlap);
+
+  /*
+ * Available Pre-defined detectors:
+ * kEventBuilderDetSts
+ * kEventBuilderDetMuch
+ * kEventBuilderDetTrd
+ * kEventBuilderDetTof
+ * kEventBuilderDetRich
+ * kEventBuilderDetPsd
+ * kEventBuilderDetT0
+ */
+
+  /// Change the selection window limits for T0 as ref
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kSts, -50, 100);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kMuch, -150, 50);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kTrd, -250, 100);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kTof, -Tint, Tint);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kRich, -50, 50);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kPsd, -50, 50);
+  /// To get T0 Digis (seed + close digis) in the event
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kT0, -1, 10);
+
+  /*
+  /// Use TOF as reference
+  eventBuilder->SetReferenceDetector( kEventBuilderDetTof );
+  eventBuilder->AddDetector( kEventBuilderDetT0 );
+
+  /// Change the selection window limits for TOF as ref
+  /// => Should always be after changes of detector lists!
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kT0, -150, 0);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kSts, -50, 100);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kMuch, -50, 200);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kTrd, -50, 300);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kTof, 0, 60);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kRich, -100, 150);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kPsd, -200, 50);
+*/
+
+  /// Change the trigger requirements
+  /// => Should always be after changes of detector lists!
+  /// --- Minimum
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kT0, ReqT0Mul);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kSts, 0);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kMuch, 0);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kTrd, 0);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kTof, ReqTofMul);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kRich, 0);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kPsd, 0);
+  /// --- Maximum  (-1 to disable cut)
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kT0, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kSts, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kMuch, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kTrd, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kTof, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kRich, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kPsd, -1);
+
+
+  if (0 < uRunId)
+    eventBuilder->SetOutFilename(
+      Form("%sHistosEvtWin_%03u.root", outDir.Data(), uRunId));
+
+  run->AddTask(eventBuilder);
+
+  // ------------------------------------------------------------------------
+  // TOF defaults
+  Int_t calMode      = 93;
+  Int_t calSel       = 1;
+  Int_t calSm        = 0;
+  Int_t RefSel       = 0;
+  Double_t dDeadtime = 50.;
+  Int_t iSel2        = 500;
+
+  // -----   Local reconstruction in TOF   ----------------------------------
+  if (pSetup->IsActive(ECbmModuleId::kTof)) {
+    switch (iTofCluMode) {
+      case 1: {
+        CbmTofEventClusterizer* tofCluster =
+          new CbmTofEventClusterizer("TOF Event Clusterizer", 0, 1);
+        TString cFname = parDir + "/tof/"
+                         + Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                                cCalId.Data(),
+                                iCalSet,
+                                calMode,
+                                calSel);
+        tofCluster->SetCalParFileName(cFname);
+        tofCluster->SetCalMode(calMode);
+        tofCluster->SetCalSel(calSel);
+        tofCluster->SetCaldXdYMax(3.);  // geometrical matching window in cm
+        tofCluster->SetCalCluMulMax(
+          5.);  // Max Counter Cluster Multiplicity for filling calib histos
+        tofCluster->SetCalRpc(calSm);  // select detector for calibration update
+        tofCluster->SetTRefId(
+          RefSel);                   // reference trigger for offset calculation
+        tofCluster->SetTotMax(20.);  // Tot upper limit for walk corection
+        tofCluster->SetTotMin(
+          0.01);  //(12000.);  // Tot lower limit for walk correction
+        tofCluster->SetTotPreRange(
+          5.);  // effective lower Tot limit  in ns from peak position
+        tofCluster->SetTotMean(5.);       // Tot calibration target value in ns
+        tofCluster->SetMaxTimeDist(1.0);  // default cluster range in ns
+        tofCluster->SetDelTofMax(
+          15.);  // acceptance range for cluster distance in ns (!)
+        tofCluster->SetSel2MulMax(3);  // limit Multiplicity in 2nd selector
+        tofCluster->SetChannelDeadtime(dDeadtime);  // artificial deadtime in ns
+        tofCluster->SetEnableAvWalk(kFALSE);
+        //tofCluster->SetEnableMatchPosScaling(kFALSE); // turn off projection to nominal target
+        tofCluster->SetYFitMin(1.E4);
+        tofCluster->SetToDAv(0.04);
+        tofCluster->SetIdMode(1);        // calibrate on module level
+        tofCluster->SetTRefDifMax(2.0);  // in ns
+        tofCluster->PosYMaxScal(0.75);   //in % of length
+
+        Int_t iBRef    = iCalSet % 1000;
+        Int_t iSet     = (iCalSet - iBRef) / 1000;
+        Int_t iRSel    = 0;
+        Int_t iRSelTyp = 0;
+        Int_t iRSelSm  = 0;
+        Int_t iRSelRpc = 0;
+
+        iRSel         = iBRef;  // use diamond
+        Int_t iRSelin = iRSel;
+        iRSelRpc      = iRSel % 10;
+        iRSelTyp      = (iRSel - iRSelRpc) / 10;
+        iRSelSm       = iRSelTyp % 10;
+        iRSelTyp      = (iRSelTyp - iRSelSm) / 10;
+
+        tofCluster->SetBeamRefId(iRSelTyp);  // define Beam reference counter
+        tofCluster->SetBeamRefSm(iRSelSm);
+        tofCluster->SetBeamRefDet(iRSelRpc);
+        tofCluster->SetBeamAddRefMul(-1);
+        tofCluster->SetBeamRefMulMax(3);
+
+        Int_t iSel2in  = iSel2;
+        Int_t iSel2Rpc = iSel2 % 10;
+        iSel2          = (iSel2 - iSel2Rpc) / 10;
+        Int_t iSel2Sm  = iSel2 % 10;
+        iSel2          = (iSel2 - iSel2Sm) / 10;
+        if (iSel2 > -1) {
+          tofCluster->SetSel2Id(iSel2);
+          tofCluster->SetSel2Sm(iSel2Sm);
+          tofCluster->SetSel2Rpc(iSel2Rpc);
+        }
+
+        Int_t iRef    = iSet % 1000;
+        Int_t iDut    = (iSet - iRef) / 1000;
+        Int_t iDutRpc = iDut % 10;
+        iDut          = (iDut - iDutRpc) / 10;
+        Int_t iDutSm  = iDut % 10;
+        iDut          = (iDut - iDutSm) / 10;
+
+        //tofCluster->SetDutId(iDut);
+        tofCluster->SetDutSm(iDutSm);
+        tofCluster->SetDutRpc(iDutRpc);
+
+        Int_t iRefRpc = iRef % 10;
+        iRef          = (iRef - iRefRpc) / 10;
+        Int_t iRefSm  = iRef % 10;
+        iRef          = (iRef - iRefSm) / 10;
+
+        tofCluster->SetSelId(iRef);
+        tofCluster->SetSelSm(iRefSm);
+        tofCluster->SetSelRpc(iRefRpc);
+
+        run->AddTask(tofCluster);
+        std::cout << "-I- " << myName << ": Added task "
+                  << tofCluster->GetName() << std::endl;
+      } break;
+      default: {
+        ;
+      }
+    }
+  }
+  // -------------------------------------------------------------------------
+
+
+  // -----   Track reconstruction   ------------------------------------------
+  Double_t beamWidthX = 0.1;
+  Double_t beamWidthY = 0.1;
+  switch (iTrackMode) {
+    case 2: {
+      Int_t iGenCor      = 1;
+      Double_t dScalFac  = 1.;
+      Double_t dChi2Lim2 = 3.5;
+      TString cTrkFile =
+        parDir + "/tof/" + Form("%s_tofFindTracks.hst.root", cCalId.Data());
+      Int_t iTrackingSetup = 1;
+      Int_t iCalOpt        = 0;
+
+      CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN();
+      tofTrackFinder->SetMaxTofTimeDifference(0.2);  // in ns/cm
+      tofTrackFinder->SetTxLIM(0.3);                 // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.3);  // max dev from mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);  // mean slope dy/dz
+      CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211);
+      TFitter* MyFit                    = new TFitter(1);  // initialize Minuit
+      tofTrackFinder->SetFitter(tofTrackFitter);
+
+      CbmTofFindTracks* tofFindTracks =
+        new CbmTofFindTracks("TOF Track Finder");
+      tofFindTracks->UseFinder(tofTrackFinder);
+      tofFindTracks->UseFitter(tofTrackFitter);
+      tofFindTracks->SetCalOpt(iCalOpt);
+      // 1 - update offsets, 2 - update walk, 0 - bypass
+      tofFindTracks->SetCorMode(
+        iGenCor);  // valid options: 0,1,2,3,4,5,6, 10 - 19
+      tofFindTracks->SetTtTarg(
+        0.065);  // target value for Mar2020 triple stack -> betapeak ~ 0.95
+      //tofFindTracks->SetTtTarg(0.041);  // target value for inverse velocity, > 0.033 ns/cm!
+      //tofFindTracks->SetTtTarg(0.035);  // target value for inverse velocity, > 0.033 ns/cm!
+      tofFindTracks->SetCalParFileName(
+        cTrkFile);  // Tracker parameter value file name
+      tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
+      tofFindTracks->SetStationMaxHMul(
+        30);  // Max Hit Multiplicity in any used station
+
+      tofFindTracks->SetT0MAX(dScalFac);  // in ns
+      tofFindTracks->SetSIGT(0.08);       // default in ns
+      tofFindTracks->SetSIGX(0.3);        // default in cm
+      tofFindTracks->SetSIGY(0.45);       // default in cm
+      tofFindTracks->SetSIGZ(0.05);       // default in cm
+      tofFindTracks->SetUseSigCalib(
+        kFALSE);  // ignore resolutions in CalPar file
+      tofTrackFinder->SetSIGLIM(dChi2Lim2
+                                * 2.);  // matching window in multiples of chi2
+      tofTrackFinder->SetChiMaxAccept(dChi2Lim2);  // max tracklet chi2
+
+      Int_t iMinNofHits   = -1;
+      Int_t iNStations    = 0;
+      Int_t iNReqStations = 3;
+      switch (iTrackingSetup) {
+        case 0:  // bypass mode
+          iMinNofHits = -1;
+          iNStations  = 1;
+          tofFindTracks->SetStation(0, 5, 0, 0);  // Diamond
+          break;
+
+        case 1:  // for calibration mode of full setup
+          iMinNofHits   = 3;
+          iNStations    = 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);
+          break;
+
+        case 2:  // for geometry check mode of full setup
+          iMinNofHits   = 3;
+          iNStations    = 27;
+          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, 0, 4, 0);
+          tofFindTracks->SetStation(16, 0, 3, 0);
+          tofFindTracks->SetStation(17, 0, 4, 1);
+          tofFindTracks->SetStation(18, 0, 3, 1);
+          tofFindTracks->SetStation(19, 0, 4, 2);
+          tofFindTracks->SetStation(20, 0, 3, 2);
+          tofFindTracks->SetStation(21, 0, 4, 3);
+          tofFindTracks->SetStation(22, 0, 3, 3);
+          tofFindTracks->SetStation(23, 0, 4, 4);
+          tofFindTracks->SetStation(24, 0, 3, 4);
+          tofFindTracks->SetStation(25, 9, 0, 0);
+          tofFindTracks->SetStation(26, 9, 0, 1);
+          break;
+
+        case 3:  // for reduced bias tracking of full setup
+          iMinNofHits   = 3;
+          iNStations    = 28;
+          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, 0, 4, 0);
+          tofFindTracks->SetStation(16, 0, 3, 0);
+          tofFindTracks->SetStation(17, 0, 4, 1);
+          tofFindTracks->SetStation(18, 0, 3, 1);
+          tofFindTracks->SetStation(19, 0, 4, 2);
+          tofFindTracks->SetStation(20, 0, 3, 2);
+          tofFindTracks->SetStation(21, 0, 4, 3);
+          tofFindTracks->SetStation(22, 0, 3, 3);
+          tofFindTracks->SetStation(23, 0, 4, 4);
+          tofFindTracks->SetStation(24, 0, 3, 4);
+          tofFindTracks->SetStation(25, 9, 0, 0);
+          tofFindTracks->SetStation(26, 9, 0, 1);
+          tofFindTracks->SetStation(27, 5, 0, 0);
+          break;
+      }
+      tofFindTracks->SetMinNofHits(iMinNofHits);
+      tofFindTracks->SetNStations(iNStations);
+      tofFindTracks->SetNReqStations(iNReqStations);
+      tofFindTracks->PrintSetup();
+      run->AddTask(tofFindTracks);
+    } break;
+    case 1: {
+    }
+    case 0:
+    default:;
+  }
+  // ------------------------------------------------------------------------
+
+
+  // =========================================================================
+  // ===                               Your QA                             ===
+  // =========================================================================
+
+  // -----  Parameter database   --------------------------------------------
+  std::cout << std::endl << std::endl;
+  std::cout << "-I- " << myName << ": Set runtime DB" << std::endl;
+  FairRuntimeDb* rtdb        = run->GetRuntimeDb();
+  Bool_t kParameterMerged    = kTRUE;
+  FairParRootFileIo* parIo1  = new FairParRootFileIo(kParameterMerged);
+  FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
+  parIo1->open(parFile.Data(), "UPDATE");
+  parIo2->open(parFileList, "in");
+  rtdb->setFirstInput(parIo1);
+  rtdb->setSecondInput(parIo2);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Run initialisation   -------------------------------------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Initialise run" << std::endl;
+  run->Init();
+  // ------------------------------------------------------------------------
+
+
+  // -----   Database update   ----------------------------------------------
+  rtdb->setOutput(parIo1);
+  rtdb->saveOutput();
+  rtdb->print();
+  // ------------------------------------------------------------------------
+
+
+  // -----   Start run   ----------------------------------------------------
+  std::cout << std::endl << std::endl;
+  std::cout << "-I- " << myName << ": Starting run" << std::endl;
+  run->Run(0, nEvents);
+  // ------------------------------------------------------------------------
+  // save all historgrams
+  gROOT->LoadMacro("fit_ybox.h");
+  gROOT->LoadMacro("save_hst.C");
+  TString FSave = Form("save_hst(\"%s\")", hstFile.Data());
+  gInterpreter->ProcessLine(FSave.Data());
+
+  // -----   Finish   -------------------------------------------------------
+  timer.Stop();
+  Double_t rtime = timer.RealTime();
+  Double_t ctime = timer.CpuTime();
+  std::cout << std::endl << std::endl;
+  std::cout << "Macro finished successfully." << std::endl;
+  std::cout << "Output file is " << recFile << std::endl;
+  std::cout << "Parameter file is " << parFile << std::endl;
+  std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s"
+            << std::endl;
+  std::cout << std::endl;
+  std::cout << " Test passed" << std::endl;
+  std::cout << " All ok " << std::endl;
+
+  // -----   Resource monitoring   ------------------------------------------
+  if (hasFairMonitor /*Has_Fair_Monitor()*/) {  // FairRoot Version >= 15.11
+    // Extract the maximal used memory an add is as Dart measurement
+    // This line is filtered by CTest and the value send to CDash
+    FairSystemInfo sysInfo;
+    Float_t maxMemory = sysInfo.GetMaxMemory();
+    std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
+    std::cout << maxMemory;
+    std::cout << "</DartMeasurement>" << std::endl;
+
+    Float_t cpuUsage = ctime / rtime;
+    std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
+    std::cout << cpuUsage;
+    std::cout << "</DartMeasurement>" << std::endl;
+
+    FairMonitor* tempMon = FairMonitor::GetMonitor();
+    tempMon->Print();
+  }
+}
diff --git a/macro/beamtime/mcbm2020/mtof_build_and_reco_kronos.C b/macro/beamtime/mcbm2020/mtof_build_and_reco_kronos.C
new file mode 100644
index 0000000000000000000000000000000000000000..85bab108245fe1dadd377d7acbbcf18d94b9edd0
--- /dev/null
+++ b/macro/beamtime/mcbm2020/mtof_build_and_reco_kronos.C
@@ -0,0 +1,567 @@
+//
+// N.Herrmann   02.05.2020
+//
+// --------------------------------------------------------------------------
+
+void mtof_build_and_reco_kronos 
+  (            Int_t nEvents      = -1,  // number of Timeslices
+			   UInt_t uRunId      = 831,
+               TString setup      = "mcbm_beam_2020_03",
+               TString cCalId     = "831.50.3.0",
+               Int_t iCalSet      = 12022500,  // calibration settings
+               TString outDir     = "data/",
+               Double_t Tint      = 50.,   // coincidence time interval
+               Double_t ReqTofMul = 10.,   // requested TOF digi multiplicity
+               Int_t iTrackMode   = 2,     // 2 for TofTracker
+               Double_t ReqT0Mul  = 1.) {
+  // ========================================================================
+  //          Adjust this part according to your requirements
+  TString dataset    = Form("data/unp_mcbm_%03u",uRunId);
+
+  // --- Logger settings ----------------------------------------------------
+  TString logLevel     = "INFO";
+  TString logVerbosity = "VERYHIGH";
+  // ------------------------------------------------------------------------
+
+  Int_t iTofCluMode = 1;
+
+  // -----   Environment   --------------------------------------------------
+  TString myName = "mtof_reco";  // this macro's name for screen output
+  TString srcDir = gSystem->Getenv("VMCWORKDIR");  // top source directory
+  TString parDir = srcDir + "/parameters";
+  // ------------------------------------------------------------------------
+
+
+  // -----   File names   ---------------------------------------------------
+  TString rawFile = dataset + ".root";
+  TString parFile = dataset + ".par.root";
+  TString recFile =
+    dataset + Form(".%d.%d", (Int_t) Tint, (Int_t) ReqTofMul) + ".recEvtWin.root";
+  TString hstFile = "./hst/" + dataset
+                    + Form(".%d.%d", (Int_t) Tint, (Int_t) ReqTofMul)
+                    + ".recEvtWin.hst.root";
+  // ------------------------------------------------------------------------
+  TString shcmd = "rm -v " + parFile;
+  gSystem->Exec(shcmd.Data());
+
+  // -----   Load the geometry setup   -------------------------------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Loading setup " << setup << std::endl;
+  CbmSetup* pSetup = CbmSetup::Instance();
+  pSetup->LoadSetup(setup);
+  // You can modify the pre-defined setup by using
+  // CbmSetup::Instance()->RemoveModule(ESystemId) or
+  // CbmSetup::Instance()->SetModule(ESystemId, const char*, Bool_t) or
+  //CbmSetup::Instance()->SetActive(ESystemId, Bool_t)
+  pSetup->SetActive(ECbmModuleId::kMvd, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kSts, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kMuch, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kRich, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kTrd, kFALSE);
+  pSetup->SetActive(ECbmModuleId::kPsd, kFALSE);
+
+  // ------------------------------------------------------------------------
+
+
+  // -----   Parameter files as input to the runtime database   -------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Defining parameter files " << std::endl;
+  TList* parFileList = new TList();
+  TString geoTag;
+
+  // - TOF digitisation parameters
+  if (pSetup->IsActive(ECbmModuleId::kTof)) {
+
+    pSetup->GetGeoTag(ECbmModuleId::kTof, geoTag);
+
+    TObjString* tofBdfFile =
+      new TObjString(srcDir + "/parameters/tof/tof_" + geoTag + ".digibdf.par");
+    parFileList->Add(tofBdfFile);
+    std::cout << "-I- " << myName << ": Using parameter file "
+              << tofBdfFile->GetString() << std::endl;
+
+    TString geoFile = srcDir + "/geometry/tof/geofile_tof_" + geoTag + ".root";
+    TFile* fgeo     = new TFile(geoFile);
+    TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom");
+    if (NULL == geoMan) {
+      cout << "<E> FAIRGeom not found in geoFile " << geoFile.Data() << endl;
+      return;
+    }
+  }
+  // ------------------------------------------------------------------------
+
+  // In general, the following parts need not be touched
+  // ========================================================================
+
+
+  // -----   Timer   --------------------------------------------------------
+  TStopwatch timer;
+  timer.Start();
+  // ------------------------------------------------------------------------
+
+
+  // ----    Debug option   -------------------------------------------------
+  gDebug = 0;
+  // ------------------------------------------------------------------------
+
+
+  // -----   Input file   ---------------------------------------------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Using input file " << rawFile
+            << std::endl;
+  // ------------------------------------------------------------------------
+
+
+  // -----   FairRunAna   ---------------------------------------------------
+  FairRunAna* run = new FairRunAna();
+  run->SetInputFile(rawFile);
+  run->SetOutputFile(recFile);
+  run->SetGenerateRunInfo(kFALSE);
+  Bool_t hasFairMonitor = kFALSE;  //Has_Fair_Monitor();
+  if (hasFairMonitor) FairMonitor::GetMonitor()->EnableMonitor(kTRUE);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Logger settings   ----------------------------------------------
+  FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data());
+  FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data());
+  // ------------------------------------------------------------------------
+
+  //-------- Event builder --------------------------------------------------
+  //  CbmMcbm2019TimeWinEventBuilder* eventBuilder = new CbmMcbm2019TimeWinEventBuilder();
+  CbmMcbm2019TimeWinEventBuilderTask* eventBuilder =
+    new CbmMcbm2019TimeWinEventBuilderTask();
+
+  eventBuilder->SetFillHistos(kTRUE);
+
+  eventBuilder->SetEventOverlapMode(EOverlapMode::NoOverlap);
+  //  eventBuilder->SetEventOverlapMode(EOverlapMode::MergeOverlap);
+  //  eventBuilder->SetEventOverlapMode(EOverlapMode::AllowOverlap);
+
+  /*
+ * Available Pre-defined detectors:
+ * kEventBuilderDetSts
+ * kEventBuilderDetMuch
+ * kEventBuilderDetTrd
+ * kEventBuilderDetTof
+ * kEventBuilderDetRich
+ * kEventBuilderDetPsd
+ * kEventBuilderDetT0
+ */
+
+  /// Change the selection window limits for T0 as ref
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kSts, -50, 100);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kMuch, -150, 50);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kTrd, -250, 100);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kTof, -Tint, Tint);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kRich, -50, 50);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kPsd, -50, 50);
+  /// To get T0 Digis (seed + close digis) in the event
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kT0, -1, 10);
+
+  /*
+  /// Use TOF as reference
+  eventBuilder->SetReferenceDetector( kEventBuilderDetTof );
+  eventBuilder->AddDetector( kEventBuilderDetT0 );
+
+  /// Change the selection window limits for TOF as ref
+  /// => Should always be after changes of detector lists!
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kT0, -150, 0);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kSts, -50, 100);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kMuch, -50, 200);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kTrd, -50, 300);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kTof, 0, 60);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kRich, -100, 150);
+  eventBuilder->SetTriggerWindow(ECbmModuleId::kPsd, -200, 50);
+*/
+
+  /// Change the trigger requirements
+  /// => Should always be after changes of detector lists!
+  /// --- Minimum
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kT0, ReqT0Mul);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kSts, 0);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kMuch, 0);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kTrd, 0);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kTof, ReqTofMul);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kRich, 0);
+  eventBuilder->SetTriggerMinNumber(ECbmModuleId::kPsd, 0);
+  /// --- Maximum  (-1 to disable cut)
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kT0, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kSts, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kMuch, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kTrd, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kTof, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kRich, -1);
+  eventBuilder->SetTriggerMaxNumber(ECbmModuleId::kPsd, -1);
+
+
+  if (0 < uRunId)
+    eventBuilder->SetOutFilename(
+      Form("%sHistosEvtWin_%03u.root", outDir.Data(), uRunId));
+
+  run->AddTask(eventBuilder);
+
+  // ------------------------------------------------------------------------
+  // TOF defaults
+  Int_t calMode      = 93;
+  Int_t calSel       = 1;
+  Int_t calSm        = 0;
+  Int_t RefSel       = 0;
+  Double_t dDeadtime = 50.;
+  Int_t iSel2        = 500;
+
+  // -----   Local reconstruction in TOF   ----------------------------------
+  if (pSetup->IsActive(ECbmModuleId::kTof)) {
+    switch (iTofCluMode) {
+      case 1: {
+        CbmTofEventClusterizer* tofCluster =
+          new CbmTofEventClusterizer("TOF Event Clusterizer", 0, 1);
+        TString cFname = parDir + "/tof/"
+                         + Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                                cCalId.Data(),
+                                iCalSet,
+                                calMode,
+                                calSel);
+        tofCluster->SetCalParFileName(cFname);
+        tofCluster->SetCalMode(calMode);
+        tofCluster->SetCalSel(calSel);
+        tofCluster->SetCaldXdYMax(3.);  // geometrical matching window in cm
+        tofCluster->SetCalCluMulMax(
+          5.);  // Max Counter Cluster Multiplicity for filling calib histos
+        tofCluster->SetCalRpc(calSm);  // select detector for calibration update
+        tofCluster->SetTRefId(
+          RefSel);                   // reference trigger for offset calculation
+        tofCluster->SetTotMax(20.);  // Tot upper limit for walk corection
+        tofCluster->SetTotMin(
+          0.01);  //(12000.);  // Tot lower limit for walk correction
+        tofCluster->SetTotPreRange(
+          5.);  // effective lower Tot limit  in ns from peak position
+        tofCluster->SetTotMean(5.);       // Tot calibration target value in ns
+        tofCluster->SetMaxTimeDist(1.0);  // default cluster range in ns
+        tofCluster->SetDelTofMax(
+          15.);  // acceptance range for cluster distance in ns (!)
+        tofCluster->SetSel2MulMax(3);  // limit Multiplicity in 2nd selector
+        tofCluster->SetChannelDeadtime(dDeadtime);  // artificial deadtime in ns
+        tofCluster->SetEnableAvWalk(kFALSE);
+        //tofCluster->SetEnableMatchPosScaling(kFALSE); // turn off projection to nominal target
+        tofCluster->SetYFitMin(1.E4);
+        tofCluster->SetToDAv(0.04);
+        tofCluster->SetIdMode(1);        // calibrate on module level
+        tofCluster->SetTRefDifMax(2.0);  // in ns
+        tofCluster->PosYMaxScal(0.75);   //in % of length
+
+        Int_t iBRef    = iCalSet % 1000;
+        Int_t iSet     = (iCalSet - iBRef) / 1000;
+        Int_t iRSel    = 0;
+        Int_t iRSelTyp = 0;
+        Int_t iRSelSm  = 0;
+        Int_t iRSelRpc = 0;
+
+        iRSel         = iBRef;  // use diamond
+        Int_t iRSelin = iRSel;
+        iRSelRpc      = iRSel % 10;
+        iRSelTyp      = (iRSel - iRSelRpc) / 10;
+        iRSelSm       = iRSelTyp % 10;
+        iRSelTyp      = (iRSelTyp - iRSelSm) / 10;
+
+        tofCluster->SetBeamRefId(iRSelTyp);  // define Beam reference counter
+        tofCluster->SetBeamRefSm(iRSelSm);
+        tofCluster->SetBeamRefDet(iRSelRpc);
+        tofCluster->SetBeamAddRefMul(-1);
+        tofCluster->SetBeamRefMulMax(3);
+
+        Int_t iSel2in  = iSel2;
+        Int_t iSel2Rpc = iSel2 % 10;
+        iSel2          = (iSel2 - iSel2Rpc) / 10;
+        Int_t iSel2Sm  = iSel2 % 10;
+        iSel2          = (iSel2 - iSel2Sm) / 10;
+        if (iSel2 > -1) {
+          tofCluster->SetSel2Id(iSel2);
+          tofCluster->SetSel2Sm(iSel2Sm);
+          tofCluster->SetSel2Rpc(iSel2Rpc);
+        }
+
+        Int_t iRef    = iSet % 1000;
+        Int_t iDut    = (iSet - iRef) / 1000;
+        Int_t iDutRpc = iDut % 10;
+        iDut          = (iDut - iDutRpc) / 10;
+        Int_t iDutSm  = iDut % 10;
+        iDut          = (iDut - iDutSm) / 10;
+
+        //tofCluster->SetDutId(iDut);
+        tofCluster->SetDutSm(iDutSm);
+        tofCluster->SetDutRpc(iDutRpc);
+
+        Int_t iRefRpc = iRef % 10;
+        iRef          = (iRef - iRefRpc) / 10;
+        Int_t iRefSm  = iRef % 10;
+        iRef          = (iRef - iRefSm) / 10;
+
+        tofCluster->SetSelId(iRef);
+        tofCluster->SetSelSm(iRefSm);
+        tofCluster->SetSelRpc(iRefRpc);
+
+        run->AddTask(tofCluster);
+        std::cout << "-I- " << myName << ": Added task "
+                  << tofCluster->GetName() << std::endl;
+      } break;
+      default: {
+        ;
+      }
+    }
+  }
+  // -------------------------------------------------------------------------
+
+
+  // -----   Track reconstruction   ------------------------------------------
+  Double_t beamWidthX = 0.1;
+  Double_t beamWidthY = 0.1;
+  switch (iTrackMode) {
+    case 2: {
+      Int_t iGenCor      = 1;
+      Double_t dScalFac  = 1.;
+      Double_t dChi2Lim2 = 3.5;
+      TString cTrkFile =
+        parDir + "/tof/" + Form("%s_tofFindTracks.hst.root", cCalId.Data());
+      Int_t iTrackingSetup = 1;
+      Int_t iCalOpt        = 0;
+
+      CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN();
+      tofTrackFinder->SetMaxTofTimeDifference(0.2);  // in ns/cm
+      tofTrackFinder->SetTxLIM(0.3);                 // max slope dx/dz
+      tofTrackFinder->SetTyLIM(0.3);  // max dev from mean slope dy/dz
+      tofTrackFinder->SetTyMean(0.);  // mean slope dy/dz
+      CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211);
+      TFitter* MyFit                    = new TFitter(1);  // initialize Minuit
+      tofTrackFinder->SetFitter(tofTrackFitter);
+
+      CbmTofFindTracks* tofFindTracks =
+        new CbmTofFindTracks("TOF Track Finder");
+      tofFindTracks->UseFinder(tofTrackFinder);
+      tofFindTracks->UseFitter(tofTrackFitter);
+      tofFindTracks->SetCalOpt(iCalOpt);
+      // 1 - update offsets, 2 - update walk, 0 - bypass
+      tofFindTracks->SetCorMode(
+        iGenCor);  // valid options: 0,1,2,3,4,5,6, 10 - 19
+      tofFindTracks->SetTtTarg(
+        0.065);  // target value for Mar2020 triple stack -> betapeak ~ 0.95
+      //tofFindTracks->SetTtTarg(0.041);  // target value for inverse velocity, > 0.033 ns/cm!
+      //tofFindTracks->SetTtTarg(0.035);  // target value for inverse velocity, > 0.033 ns/cm!
+      tofFindTracks->SetCalParFileName(
+        cTrkFile);  // Tracker parameter value file name
+      tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
+      tofFindTracks->SetStationMaxHMul(
+        30);  // Max Hit Multiplicity in any used station
+
+      tofFindTracks->SetT0MAX(dScalFac);  // in ns
+      tofFindTracks->SetSIGT(0.08);       // default in ns
+      tofFindTracks->SetSIGX(0.3);        // default in cm
+      tofFindTracks->SetSIGY(0.45);       // default in cm
+      tofFindTracks->SetSIGZ(0.05);       // default in cm
+      tofFindTracks->SetUseSigCalib(
+        kFALSE);  // ignore resolutions in CalPar file
+      tofTrackFinder->SetSIGLIM(dChi2Lim2
+                                * 2.);  // matching window in multiples of chi2
+      tofTrackFinder->SetChiMaxAccept(dChi2Lim2);  // max tracklet chi2
+
+      Int_t iMinNofHits   = -1;
+      Int_t iNStations    = 0;
+      Int_t iNReqStations = 3;
+      switch (iTrackingSetup) {
+        case 0:  // bypass mode
+          iMinNofHits = -1;
+          iNStations  = 1;
+          tofFindTracks->SetStation(0, 5, 0, 0);  // Diamond
+          break;
+
+        case 1:  // for calibration mode of full setup
+          iMinNofHits   = 3;
+          iNStations    = 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);
+          break;
+
+        case 2:  // for geometry check mode of full setup
+          iMinNofHits   = 3;
+          iNStations    = 27;
+          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, 0, 4, 0);
+          tofFindTracks->SetStation(16, 0, 3, 0);
+          tofFindTracks->SetStation(17, 0, 4, 1);
+          tofFindTracks->SetStation(18, 0, 3, 1);
+          tofFindTracks->SetStation(19, 0, 4, 2);
+          tofFindTracks->SetStation(20, 0, 3, 2);
+          tofFindTracks->SetStation(21, 0, 4, 3);
+          tofFindTracks->SetStation(22, 0, 3, 3);
+          tofFindTracks->SetStation(23, 0, 4, 4);
+          tofFindTracks->SetStation(24, 0, 3, 4);
+          tofFindTracks->SetStation(25, 9, 0, 0);
+          tofFindTracks->SetStation(26, 9, 0, 1);
+          break;
+
+        case 3:  // for reduced bias tracking of full setup
+          iMinNofHits   = 3;
+          iNStations    = 28;
+          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, 0, 4, 0);
+          tofFindTracks->SetStation(16, 0, 3, 0);
+          tofFindTracks->SetStation(17, 0, 4, 1);
+          tofFindTracks->SetStation(18, 0, 3, 1);
+          tofFindTracks->SetStation(19, 0, 4, 2);
+          tofFindTracks->SetStation(20, 0, 3, 2);
+          tofFindTracks->SetStation(21, 0, 4, 3);
+          tofFindTracks->SetStation(22, 0, 3, 3);
+          tofFindTracks->SetStation(23, 0, 4, 4);
+          tofFindTracks->SetStation(24, 0, 3, 4);
+          tofFindTracks->SetStation(25, 9, 0, 0);
+          tofFindTracks->SetStation(26, 9, 0, 1);
+          tofFindTracks->SetStation(27, 5, 0, 0);
+          break;
+      }
+      tofFindTracks->SetMinNofHits(iMinNofHits);
+      tofFindTracks->SetNStations(iNStations);
+      tofFindTracks->SetNReqStations(iNReqStations);
+      tofFindTracks->PrintSetup();
+      run->AddTask(tofFindTracks);
+    } break;
+    case 1: {
+    }
+    case 0:
+    default:;
+  }
+  // ------------------------------------------------------------------------
+
+
+  // =========================================================================
+  // ===                               Your QA                             ===
+  // =========================================================================
+
+  // -----  Parameter database   --------------------------------------------
+  std::cout << std::endl << std::endl;
+  std::cout << "-I- " << myName << ": Set runtime DB" << std::endl;
+  FairRuntimeDb* rtdb        = run->GetRuntimeDb();
+  Bool_t kParameterMerged    = kTRUE;
+  FairParRootFileIo* parIo1  = new FairParRootFileIo(kParameterMerged);
+  FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo();
+  parIo1->open(parFile.Data(), "UPDATE");
+  parIo2->open(parFileList, "in");
+  rtdb->setFirstInput(parIo1);
+  rtdb->setSecondInput(parIo2);
+  // ------------------------------------------------------------------------
+
+
+  // -----   Run initialisation   -------------------------------------------
+  std::cout << std::endl;
+  std::cout << "-I- " << myName << ": Initialise run" << std::endl;
+  run->Init();
+  // ------------------------------------------------------------------------
+
+
+  // -----   Database update   ----------------------------------------------
+  rtdb->setOutput(parIo1);
+  rtdb->saveOutput();
+  rtdb->print();
+  // ------------------------------------------------------------------------
+
+
+  // -----   Start run   ----------------------------------------------------
+  std::cout << std::endl << std::endl;
+  std::cout << "-I- " << myName << ": Starting run" << std::endl;
+  run->Run(0, nEvents);
+  // ------------------------------------------------------------------------
+  // save all historgrams
+  gROOT->LoadMacro("fit_ybox.h");
+  gROOT->LoadMacro("save_hst.C");
+  TString FSave = Form("save_hst(\"%s\")", hstFile.Data());
+  gInterpreter->ProcessLine(FSave.Data());
+
+  // -----   Finish   -------------------------------------------------------
+  timer.Stop();
+  Double_t rtime = timer.RealTime();
+  Double_t ctime = timer.CpuTime();
+  std::cout << std::endl << std::endl;
+  std::cout << "Macro finished successfully." << std::endl;
+  std::cout << "Output file is " << recFile << std::endl;
+  std::cout << "Parameter file is " << parFile << std::endl;
+  std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s"
+            << std::endl;
+  std::cout << std::endl;
+  std::cout << " Test passed" << std::endl;
+  std::cout << " All ok " << std::endl;
+
+  // -----   Resource monitoring   ------------------------------------------
+  if (hasFairMonitor /*Has_Fair_Monitor()*/) {  // FairRoot Version >= 15.11
+    // Extract the maximal used memory an add is as Dart measurement
+    // This line is filtered by CTest and the value send to CDash
+    FairSystemInfo sysInfo;
+    Float_t maxMemory = sysInfo.GetMaxMemory();
+    std::cout << "<DartMeasurement name=\"MaxMemory\" type=\"numeric/double\">";
+    std::cout << maxMemory;
+    std::cout << "</DartMeasurement>" << std::endl;
+
+    Float_t cpuUsage = ctime / rtime;
+    std::cout << "<DartMeasurement name=\"CpuLoad\" type=\"numeric/double\">";
+    std::cout << cpuUsage;
+    std::cout << "</DartMeasurement>" << std::endl;
+
+    FairMonitor* tempMon = FairMonitor::GetMonitor();
+    tempMon->Print();
+  }
+}
diff --git a/macro/beamtime/mcbm2020/pos_cal_all.sh b/macro/beamtime/mcbm2020/pos_cal_all.sh
new file mode 100755
index 0000000000000000000000000000000000000000..5d9b83c1fa893366beb76c13fe63a1f840794b82
--- /dev/null
+++ b/macro/beamtime/mcbm2020/pos_cal_all.sh
@@ -0,0 +1,146 @@
+#!/bin/bash
+# shell script to initialize clusterizer calibrations
+#SBATCH -J calall
+#SBATCH -D /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020
+#SBATCH --time=8:00:00
+##SBATCH --time=6-00:00:00
+#SBATCH --mem=2000
+##SBATCH --partition=long
+cRun=$1
+
+echo 'Initialize clusterizer calibration for run '$cRun
+
+iCalSet=$2
+((iTmp  = $iCalSet ))
+((iBRef = $iTmp % 1000))
+((iTmp  = $iTmp - $iBRef))
+((iSet  = $iTmp / 1000))
+((iMRef = $iTmp % 1000000))
+((iMRef = $iMRef / 1000))
+((iTmp  = $iTmp - $iMRef))
+((iDut  = $iTmp / 1000000))
+echo Calib setup is ${iCalSet}, iSet=$iSet, iDut=$iDut, iMRef=$iMRef, iBRef=$iBRef
+cCalSet=$iCalSet
+if (( iCalSet<100000000 )); then 
+cCalSet="0"$iCalSet
+fi
+if (( iCalSet<10000000 )); then 
+cCalSet="00"$iCalSet
+fi
+if (( iCalSet<1000000 )); then 
+cCalSet="000"$iCalSet
+fi
+if (( iCalSet<100000 )); then 
+cCalSet="0000"$iCalSet
+fi
+echo cCalSet = $cCalSet
+#iSet=0
+#lastOpt=''
+nEvi0=50000 # start value965311965311
+nEvi1=50000 # increment 
+
+if [ -e /lustre ]; then
+source /lustre/cbm/users/nh/CBM/cbmroot/trunk/build/config.sh 
+wdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020
+outdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020/${cRun}
+else 
+wdir=`pwd`
+outdir=${wdir}/${cRun}
+fi
+mkdir ${outdir}
+
+cd  ${wdir}
+mkdir ${cRun}
+cp rootlogon.C ${cRun}
+cp .rootrc ${cRun}
+cd ${cRun}
+
+# Global variables, for for-loops
+iRestart=0
+#iRestart=29
+iStep=0
+iStepLast=0
+iCalSel0=0
+iCalSel1=1
+#iCalSel0=-3 #0
+#iCalSel1=-4 #1
+# ************************** Starting while Loop ***************************** #
+(( nEvi = nEvi0 + 10*nEvi1 ))
+optList=""
+optList=`echo " $nEvi,93,1,$iMRef,0 "`$optList 
+icalmod=5
+for icallev in 9 9
+do
+    (( nEvi = nEvi0 + (icallev-1)*nEvi1 ))
+    optList=`echo " $nEvi,$icallev$icalmod,$iCalSel0,$iDut,0 "`$optList
+    if [ $iMRef -ne 14 ]; then 
+	  optList=`echo " $nEvi,$icallev$icalmod,$iCalSel1,$iMRef,0 "`$optList
+    else 
+	  for iMod in 40  10 
+	  do
+	    if [ $iMod -ne $iDut ]; then
+		  optList=`echo " $nEvi,$icallev$icalmod,$iCalSel1,$iMod,0 "`$optList
+	    fi
+	  done
+    fi
+    if [ $icallev -lt 7 ]; then
+      optList=`echo " $nEvi,$icallev$icalmod,$iCalSel0,$iBRef,50 "`$optList 
+      optList=`echo " $nEvi,$icallev$icalmod,$iCalSel1,$iBRef,50 "`$optList
+    else
+#      optList=`echo " $nEvi,$icallev$icalmod,-2,2,0 "`$optList
+      echo skip add options
+    fi 
+done
+ optList=`echo " $nEvi,0,0,$iBRef,50 "`$optList      # start Init1
+ echo optList:  $optList
+
+for inOpt in $optList
+do  
+    echo step ${iStep} with option $inOpt
+    ((iStepLast = ${iStep}))
+    ((iStep += 1))
+
+    mkdir Init${iStep}
+    cp rootlogon.C Init${iStep}
+    cp .rootrc Init${iStep}
+    cd Init${iStep}
+
+    if [[ ${lastOpt:+1} ]] ; then
+	# echo last round was done with $lastOpt, extract 2. and 3. word
+	i1=`expr index $inOpt , `
+	i2=($i1+3)
+	#echo `expr index $inOpt , ` = $i1
+	cMode=${inOpt:$i1:2}
+	cSel=${inOpt:$i2:1}
+	echo next iteration: cMode=$cMode, cSel=$cSel 
+	if [[ ${cSel} = "-" ]];then 
+	    cSel=${inOpt:$i2:2}
+	    echo cSel=$cSel 
+	    cSel="0"
+	fi
+	#copy calibration file 
+	if (($iStep > $iRestart)) ; then
+	    cp -v ../Init${iStepLast}/tofClust_${cRun}_set${cCalSet}.hst.root ${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+	fi
+    fi 
+
+    lastOpt=$inOpt
+    # generate new calibration file
+    if (($iStep > $iRestart)) ; then 
+	root -b -q '../../ana_digi_cal_all.C('$inOpt',"'${cRun}'",'${iCalSet}',0,'${iBRef}') '
+
+	cp -v tofClust_${cRun}_set${cCalSet}.hst.root ../${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+	cp *pdf ../
+	#./screenshot.sh
+	cd .. 
+	rm ../${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+	ln -s ./${cRun}/${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root ../${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+	echo Init step $iStep with mode ${cMode}, option $inOpt  finished
+    else 
+	cd ..
+	echo Init step $iStep with mode ${cMode}, option $inOpt  skipped
+    fi   
+done
+
+cd  ${wdir}
+mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/PosCalib_${cRun}_${cCalSet}.out
diff --git a/macro/beamtime/mcbm2021/.rootrc b/macro/beamtime/mcbm2021/.rootrc
new file mode 100755
index 0000000000000000000000000000000000000000..cc8b6f3ddd43c0f598dd1e70c353e2b77bb56450
--- /dev/null
+++ b/macro/beamtime/mcbm2021/.rootrc
@@ -0,0 +1,91 @@
+# Path used by dynamic loader to find shared libraries and macros
+# Paths are different for Unix and Windows. The example shows the defaults
+# for all ROOT applications for either Unix or Windows.
+Unix.*.Root.DynamicPath:    .:$ROOTSYS/lib:
+Unix.*.Root.MacroPath:      .:../:../../:../../../:../../../../:../../tof:../../tof/beamtime:$ROOTSYS/share/doc/root/tutorials
+
+
+# Path where to look for TrueType fonts
+#Unix.*.Root.UseTTFonts:     true
+#Unix.*.Root.TTFontPath:     /usr/local/ttf/fonts
+
+# Use thread library (if exists)
+#Unix.*.Root.UseThreads:     false
+
+# Show where item is found in the specified path
+#Root.ShowPath:           false
+
+
+# Activate memory statistics (size and cnt is used to trap allocation of
+# blocks of a certain size after cnt times)
+Root.MemStat:            0
+Root.MemStat.size:      -1
+Root.MemStat.cnt:       -1
+Root.ObjectStat:         0
+ 
+# Global debug mode. When >0 turns on progressively more details debugging.
+# When >4 X11 runs in synchronous mode.
+Root.Debug:              0
+ 
+# Default editor
+Unix.*.Editor:           emacs
+
+# Specify list of file endings which TTabCom (TAB completion) should ignore.
+#TabCom.FileIgnore:       .cpp:.h:.cmz:.C
+
+
+# TCanvas specific settings. Opaque move and resize show full pad during
+# the operation instead of only the outline. Especially for resize you'll
+# need serious CPU power. UseScreenFactor=true means to size canvas according
+# to size of screen, so a canvas still looks good on a low resolution
+# laptop screen without having to change canvas size in macros.
+# HighLightColor 2 = red. ShowEventStatus allows the event status bar to
+# be turned on by default. AutoExec allows TExec objects to be executed
+# on mouse and key events.
+#Canvas.MoveOpaque:          false
+#Canvas.ResizeOpaque:        false
+#Canvas.UseScreenFactor:     true
+#Canvas.HighLightColor:      2
+#Canvas.ShowEventStatus:     false
+#Canvas.AutoExec:            true
+ 
+# Example of custom setting for the Rint application (root.exe).
+# This overrides the default specified above for a generic application.
+# Color 5 is yellow.
+#Rint.Canvas.HighLightColor:      5
+ 
+
+# THtml specific settings.
+#Root.Html.OutputDir:         $(HOME)/aix/www/html/
+#Unix.*.Root.Html.SourceDir:  .:
+#Root.Html.Author:           nh
+#Root.Html.HomePage:         http://pktw09.phy.tu-dresden.de/~plettner
+#Root.Html.Copyright:        Copyright by IKTP, TU Dresden
+#Root.Html.LastUpdate:       @(#)
+#Root.Html.Description:      TofROOT Project
+#Root.Html.Root:             http://root.cern.ch/root/html
+#Root.Html.SearchEngine:     ../Search.phtml
+ 
+# GUI specific settings
+#Gui.NormalFont:        -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1
+#Gui.BoldFont:          -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1
+#Gui.SmallFont:         -adobe-helvetica-medium-r-*-*-10-*-*-*-*-*-iso8859-1
+#Gui.ProportionalFont:  -adobe-courier-medium-r-*-*-12-*-*-*-*-*-iso8859-1
+#Gui.BackgroundColor:        #c0c0c0
+#Gui.ForegroundColor:        black
+#Gui.SelectForegroundColor:  white
+#Gui.SelectBackgroundColor:  #000080
+#Gui.IconPath:               $(HOME)/icons:$(ROOTSYS)/icons:.
+# If above does not exists defaults to this:
+#Gui.MimeTypeFile:           $ROOTSYS/icons/root.mimes
+# Can be either small, big, list, details
+#Browser.IconStyle:          big
+# Can be either name, type, size, date
+#Browser.SortBy:             name
+ 
+
+# Rint (interactive ROOT executable) specific alias, logon and logoff macros
+Rint.Load:               ~/.rootalias.C
+Rint.Logon:              ./rootlogon.C
+Rint.Logoff:             ~/.rootlogoff.C
+Rint.History:            ./.root_hist
diff --git a/macro/beamtime/mcbm2021/ana_digi_cal.C b/macro/beamtime/mcbm2021/ana_digi_cal.C
new file mode 100644
index 0000000000000000000000000000000000000000..04eafb83947dc2e4b406de3bcc93ca087ce6b8ec
--- /dev/null
+++ b/macro/beamtime/mcbm2021/ana_digi_cal.C
@@ -0,0 +1,460 @@
+void ana_digi_cal(Int_t nEvents      = 10000000,
+                  Int_t calMode      = 53,
+                  Int_t calSel       = 0,
+                  Int_t calSm        = 900,
+                  Int_t RefSel       = 1,
+                  TString cFileId    = "Test",
+                  Int_t iCalSet      = 910601600,
+                  Bool_t bOut        = 0,
+                  Int_t iSel2        = 0,
+                  Double_t dDeadtime = 50,
+                  TString cCalId     = "XXX",
+                  Int_t iPlot        = 1) {
+  Int_t iVerbose = 1;
+  Int_t iBugCor  = 0;
+  //Specify log level (INFO, DEBUG, DEBUG1, ...)
+  //TString logLevel = "FATAL";
+  //TString logLevel = "ERROR";
+  TString logLevel = "INFO";
+  //TString logLevel = "DEBUG";
+  //TString logLevel = "DEBUG1";
+  //TString logLevel = "DEBUG2";
+  //TString logLevel = "DEBUG3";
+  FairLogger::GetLogger();
+  gLogger->SetLogScreenLevel(logLevel);
+  gLogger->SetLogVerbosityLevel("MEDIUM");
+
+  TString workDir = gSystem->Getenv("VMCWORKDIR");
+  /*
+   TString workDir    = (TString)gInterpreter->ProcessLine(".! pwd");
+   cout << "workdir = "<< workDir.Data() << endl;
+   return;
+  */
+  TString paramDir = workDir + "/macro/beamtime/mcbm2021/";
+  //TString paramDir   = "./";
+  TString ParFile   = paramDir + "data/" + cFileId + ".params.root";
+  TString InputFile = paramDir + "data/" + cFileId + ".root";
+  // TString InputFile  =  "./data/" + cFileId + ".root";
+  TString OutputFile =
+    paramDir + "data/TofHits_" + cFileId
+    + Form("_%09d_%03d_%02.0f_Cal", iCalSet, iSel2, dDeadtime) + cCalId
+    + ".out.root";
+
+  TString shcmd = "rm -v " + ParFile;
+  gSystem->Exec(shcmd.Data());
+
+  TList* parFileList = new TList();
+
+  TString FId = cFileId;
+  Int_t iNLen=FId.First(".");
+  TString cRun(FId(0, iNLen));  
+  Int_t iRun     = cRun.Atoi();
+  TString TofGeo = "";
+  if (iRun < 690)
+    TofGeo = "v20a_mcbm";
+  else
+    TofGeo = "v21a_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( 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();
+  run->SetInputFile(InputFile.Data());
+  //run->AddFriend(InputFile.Data());
+  // run->SetOutputFile(OutputFile);
+  //run->SetSink( new FairRootFileSink( OutputFile.Data() ) );
+  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(3.);  // geometrical matching window in cm
+  tofClust->SetCalCluMulMax(
+    5.);  // 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.);  //(12000.);  // Tot lower limit for walk correction
+  tofClust->SetTotPreRange(
+    5.);  // effective lower Tot limit  in ns from peak position
+  tofClust->SetTotMean(5.);       // Tot calibration target value in ns
+  tofClust->SetMaxTimeDist(1.0);  // default cluster range in ns
+  //tofClust->SetMaxTimeDist(0.);       //Deb// default cluster range in ns
+  tofClust->SetDelTofMax(
+    5.);  // acceptance range for cluster distance in ns (!)
+  tofClust->SetSel2MulMax(3);  // limit Multiplicity in 2nd selector
+  tofClust->SetChannelDeadtime(dDeadtime);  // artificial deadtime in ns
+  tofClust->SetEnableAvWalk(kFALSE);
+  //tofClust->SetEnableMatchPosScaling(kFALSE); // turn off projection to nominal target
+  tofClust->SetYFitMin(1.E4);
+  tofClust->SetToDAv(0.04);
+  // tofClust->SetTimePeriod(25600.);       // ignore coarse time
+  // tofClust->SetCorMode(iBugCor);         // correct missing hits
+  //tofClust->SetIdMode(0);  // calibrate on counter level
+  tofClust->SetIdMode(1);  // calibrate on module level
+  //   tofClust->SetDeadStrips(15,23);   // declare dead strip for T0M3,Rpc0,Strip 23
+  //tofClust->SetDeadStrips(25,16);   // declare non-existant diamond strip (#5) dead
+
+  Int_t calSelRead = calSel;
+  if (calSel < 0) calSelRead = 0;
+  TString cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                        cFileId.Data(),
+                        iCalSet,
+                        calMode,
+                        calSelRead);
+  if (cCalId != "XXX")
+    cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                  cCalId.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_tofAna.hst.root", cFileId.Data(), iCalSet, iSel2);
+
+  switch (calMode) {
+    case -1:                      // initial check of raw data
+      tofClust->SetTotMax(256.);  // range in bin number
+      tofClust->SetTotPreRange(256.);
+      //tofClust->SetTotMin(1.);
+      tofClust->SetTRefDifMax(26000.);  // in ns
+      tofClust->PosYMaxScal(10000.);    // in % of length
+      tofClust->SetMaxTimeDist(0.);     // no cluster building
+      //tofClust->SetTimePeriod(25600.);       // inspect coarse time
+      break;
+    case 0:                       // initial calibration
+      tofClust->SetTotMax(256.);  // range in bin number
+      tofClust->SetTotPreRange(256.);
+      //tofClust->SetTotMin(1.);
+      tofClust->SetTRefDifMax(1000.);  // in ns
+      tofClust->PosYMaxScal(10.);      // in % of length
+      tofClust->SetMaxTimeDist(0.);    // no cluster building
+      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(3.0);  // in ns
+      tofClust->PosYMaxScal(2.0);    // in % of length
+      break;
+    case 31:
+      tofClust->SetTRefDifMax(3.);  // in ns
+      tofClust->PosYMaxScal(1.);    // in % of length
+      break;
+    case 41:
+      tofClust->SetTRefDifMax(2.0);  // in ns
+      tofClust->PosYMaxScal(0.9);    // in % of length
+      break;
+    case 51:
+      tofClust->SetTRefDifMax(2.0);  // in ns
+      tofClust->PosYMaxScal(0.8);    // in % of length
+      break;
+    case 61:
+      tofClust->SetTRefDifMax(1.5);  // in ns
+      tofClust->PosYMaxScal(0.75);   // in % of length
+      break;
+    case 71:
+      tofClust->SetTRefDifMax(0.8);  // 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(10.);     //in % of length
+      break;
+    case 22:
+    case 23:
+      tofClust->SetTRefDifMax(50.);  // in ns
+      tofClust->PosYMaxScal(5.);     //in % of length
+      break;
+    case 32:
+    case 33:
+      tofClust->SetTRefDifMax(25.);  // in ns
+      tofClust->PosYMaxScal(4.);     //in % of length
+      break;
+    case 42:
+    case 43:
+      tofClust->SetTRefDifMax(12.);  // in ns
+      tofClust->PosYMaxScal(2.);     //in % of length
+      break;
+    case 52:
+    case 53:
+      tofClust->SetTRefDifMax(5.);  // in ns
+      tofClust->PosYMaxScal(1.5);   //in % of length
+      break;
+    case 62:
+    case 63:
+      tofClust->SetTRefDifMax(3.);  // in ns
+      tofClust->PosYMaxScal(1.);    //in % of length
+      break;
+    case 72:
+    case 73:
+      tofClust->SetTRefDifMax(2.5);  // in ns
+      tofClust->PosYMaxScal(0.9);    //in % of length
+      break;
+    case 82:
+    case 83:
+      tofClust->SetTRefDifMax(2.0);  // in ns
+      tofClust->PosYMaxScal(0.8);    //in % of length
+      break;
+    case 92:
+    case 93:
+      tofClust->SetTRefDifMax(2.0);  // in ns
+      tofClust->PosYMaxScal(0.75);   //in % of length
+      break;
+
+    case 4:  // velocity dependence (DelTOF)
+    case 14:
+      tofClust->SetTRefDifMax(25.);  // in ns
+      tofClust->PosYMaxScal(2.0);    //in % of length
+      break;
+    case 24:
+      tofClust->SetTRefDifMax(5.);  // in ns
+      tofClust->PosYMaxScal(1.5);   //in % of length
+      break;
+    case 34:
+      tofClust->SetTRefDifMax(5.);  // in ns
+      tofClust->PosYMaxScal(1.2);   //in % of length
+      break;
+    case 44:
+      tofClust->SetTRefDifMax(3.5);  // in ns
+      tofClust->PosYMaxScal(1.0);    //in % of length
+      break;
+    case 54:
+      tofClust->SetTRefDifMax(3.0);  // in ns
+      tofClust->PosYMaxScal(0.9);    //in % of length
+      break;
+    case 64:
+      tofClust->SetTRefDifMax(2.5);  // in ns
+      tofClust->PosYMaxScal(0.8);    //in % of length
+      break;
+    case 74:
+      tofClust->SetTRefDifMax(2.0);  // in ns
+      tofClust->PosYMaxScal(0.7);    //in % of length
+      break;
+    default:
+      cout << "<E> Calib mode not implemented! stop execution of script"
+           << endl;
+      return;
+  }
+
+  Int_t iBRef    = iCalSet % 1000;
+  Int_t iSet     = (iCalSet - iBRef) / 1000;
+  Int_t iRSel    = 0;
+  Int_t iRSelTyp = 0;
+  Int_t iRSelSm  = 0;
+  Int_t iRSelRpc = 0;
+  iRSel          = iBRef;  // use diamond
+
+  Int_t iRSelin = iRSel;
+  iRSelRpc      = iRSel % 10;
+  iRSelTyp      = (iRSel - iRSelRpc) / 10;
+  iRSelSm       = iRSelTyp % 10;
+  iRSelTyp      = (iRSelTyp - iRSelSm) / 10;
+
+  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;
+
+  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);
+
+  run->AddTask(tofClust);
+
+  cout << "Run with iRSel = " << iRSel << ", iSel2 = " << iSel2in << endl;
+
+
+  // -----  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);
+
+  // -----   Intialise and run   --------------------------------------------
+  run->Init();
+  cout << "Starting run" << endl;
+  run->Run(0, nEvents);
+  //tofClust->Finish();
+  // ------------------------------------------------------------------------
+  // default display
+  /*
+  TString Display_Status = "pl_over_Mat04D4best.C";
+  TString Display_Funct = "pl_over_Mat04D4best()";  
+  gROOT->LoadMacro(Display_Status);
+  */
+
+  gROOT->LoadMacro("save_hst.C");
+
+  gROOT->LoadMacro("fit_ybox.h");
+  gROOT->LoadMacro("pl_all_CluMul.C");
+  gROOT->LoadMacro("pl_all_CluRate.C");
+  gROOT->LoadMacro("pl_all_CluPosEvol.C");
+  gROOT->LoadMacro("pl_all_CluTimeEvol.C");
+  gROOT->LoadMacro("pl_over_cluSel.C");
+  gROOT->LoadMacro("pl_over_clu.C");
+  gROOT->LoadMacro("pl_over_Walk2.C");
+  gROOT->LoadMacro("pl_all_dTSel.C");
+  gROOT->LoadMacro("pl_over_MatD4sel.C");
+  gROOT->LoadMacro("pl_all_Sel2D.C");
+  gROOT->LoadMacro("pl_all_2D.C");
+
+  if (iPlot) {
+
+    switch (iSet) {
+      default:
+        for (Int_t iOpt = 0; iOpt < 8; iOpt++) {
+          for (Int_t iSel = 0; iSel < 2; iSel++) {
+            gInterpreter->ProcessLine(Form("pl_all_Sel2D(%d,%d)", iOpt, iSel));
+          }
+        }
+
+        for (Int_t iOpt = 0; iOpt < 12; iOpt++) {
+          gInterpreter->ProcessLine(Form("pl_all_2D(%d)", iOpt));
+        }
+        /*
+	gInterpreter->ProcessLine("pl_over_clu(0,0,0)");
+	gInterpreter->ProcessLine("pl_over_clu(0,0,1)");
+	gInterpreter->ProcessLine("pl_over_clu(0,0,2)");
+	gInterpreter->ProcessLine("pl_over_clu(0,0,3)");
+	gInterpreter->ProcessLine("pl_over_clu(0,0,4)");
+	gInterpreter->ProcessLine("pl_over_clu(0,1,0)");
+	gInterpreter->ProcessLine("pl_over_clu(0,1,1)");
+	gInterpreter->ProcessLine("pl_over_clu(0,1,2)");
+	gInterpreter->ProcessLine("pl_over_clu(0,1,3)");
+	gInterpreter->ProcessLine("pl_over_clu(0,1,4)");
+	gInterpreter->ProcessLine("pl_over_clu(0,2,0)");
+	gInterpreter->ProcessLine("pl_over_clu(0,2,1)");
+	gInterpreter->ProcessLine("pl_over_clu(0,2,2)");
+	gInterpreter->ProcessLine("pl_over_clu(0,2,3)");
+	gInterpreter->ProcessLine("pl_over_clu(0,2,4)");
+	gInterpreter->ProcessLine("pl_over_clu(0,3,0)");
+	gInterpreter->ProcessLine("pl_over_clu(0,3,1)");
+	gInterpreter->ProcessLine("pl_over_clu(0,3,2)");
+	gInterpreter->ProcessLine("pl_over_clu(0,3,3)");
+	gInterpreter->ProcessLine("pl_over_clu(0,3,4)");
+	gInterpreter->ProcessLine("pl_over_clu(0,4,0)");
+	gInterpreter->ProcessLine("pl_over_clu(0,4,1)");
+	gInterpreter->ProcessLine("pl_over_clu(0,4,2)");
+	gInterpreter->ProcessLine("pl_over_clu(0,4,3)");
+	gInterpreter->ProcessLine("pl_over_clu(0,4,4)");
+	
+	gInterpreter->ProcessLine("pl_over_clu(5,0,0)");
+	gInterpreter->ProcessLine("pl_over_cluSel(0,5,0,0)");
+	gInterpreter->ProcessLine("pl_over_cluSel(1,5,0,0)");
+	
+	for(Int_t iSm=0; iSm<3; iSm++)
+	for (Int_t iRpc=0; iRpc<5; iRpc++)
+	for (Int_t iSel=0; iSel<2; iSel++){
+	gInterpreter->ProcessLine(Form("pl_over_cluSel(%d,0,%d,%d)",iSel,iSm,iRpc));
+	gInterpreter->ProcessLine(Form("pl_over_Walk2(%d,0,%d,%d)",iSel,iSm,iRpc));
+	}
+      */
+        gInterpreter->ProcessLine("pl_all_CluMul()");
+        gInterpreter->ProcessLine("pl_all_CluRate()");
+        gInterpreter->ProcessLine("pl_all_CluRate(5,1)");
+        gInterpreter->ProcessLine("pl_all_CluPosEvol()");
+        gInterpreter->ProcessLine("pl_all_CluTimeEvol()");
+        gInterpreter->ProcessLine("pl_all_dTSel()");
+
+        //  gInterpreter->ProcessLine("pl_over_MatD4sel()");
+        //  gInterpreter->ProcessLine(Display_Funct.Data());
+        break;
+        ;
+    }
+  }
+  TString FSave = Form("save_hst(\"CluStatus%d_%d_Cal_%s.hst.root\")",
+                       iCalSet,
+                       iSel2in,
+                       cCalId.Data());
+  gInterpreter->ProcessLine(FSave.Data());
+}
diff --git a/macro/beamtime/mcbm2021/ana_digi_cal_all.C b/macro/beamtime/mcbm2021/ana_digi_cal_all.C
new file mode 100644
index 0000000000000000000000000000000000000000..d39061e3e7ea5b6d36ee81a07f67a4d403db4e95
--- /dev/null
+++ b/macro/beamtime/mcbm2021/ana_digi_cal_all.C
@@ -0,0 +1,462 @@
+void ana_digi_cal_all(Int_t nEvents      = 10000000,
+                      Int_t calMode      = 53,
+                      Int_t calSel       = 0,
+                      Int_t calSm        = 900,
+                      Int_t RefSel       = 1,
+                      TString cFileId    = "Test",
+                      Int_t iCalSet      = 910601600,
+                      Bool_t bOut        = 0,
+                      Int_t iSel2        = 0,
+                      Double_t dDeadtime = 50,
+                      TString cCalId     = "XXX",
+                      Int_t iPlot        = 1) {
+  Int_t iVerbose = 1;
+  Int_t iBugCor  = 0;
+  //Specify log level (INFO, DEBUG, DEBUG1, ...)
+  //TString logLevel = "FATAL";
+  //TString logLevel = "ERROR";
+  TString logLevel = "INFO";
+  //TString logLevel = "DEBUG";
+  //TString logLevel = "DEBUG1";
+  //TString logLevel = "DEBUG2";
+  //TString logLevel = "DEBUG3";
+  FairLogger::GetLogger();
+  gLogger->SetLogScreenLevel(logLevel);
+  //gLogger->SetLogVerbosityLevel("VERYHIGH");
+  gLogger->SetLogVerbosityLevel("MEDIUM");
+
+  TString workDir = gSystem->Getenv("VMCWORKDIR");
+  /*
+   TString workDir    = (TString)gInterpreter->ProcessLine(".! pwd");
+   cout << "workdir = "<< workDir.Data() << endl;
+   return;
+  */
+  TString paramDir = workDir + "/macro/beamtime/mcbm2021/";
+  //TString paramDir   = "./";
+  TString ParFile   = paramDir + "data/" + cFileId + ".params.root";
+  TString InputFile = paramDir + "data/" + cFileId + ".root";
+  // TString InputFile  =  "./data/" + cFileId + ".root";
+  TString OutputFile =
+    paramDir + "data/TofHits_" + cFileId
+    + Form("_%09d_%03d_%02.0f_Cal", iCalSet, iSel2, dDeadtime) + cCalId
+    + ".out.root";
+
+  TString shcmd = "rm -v " + ParFile;
+  gSystem->Exec(shcmd.Data());
+
+  TList* parFileList = new TList();
+
+  TString FId = cFileId;
+  Int_t iNLen=FId.First(".");
+  TString cRun(FId(0, iNLen));
+  Int_t iRun     = cRun.Atoi();
+  TString TofGeo = "";
+  if (iRun < 690)
+    TofGeo = "v20a_mcbm";
+  else
+    TofGeo = "v21a_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( 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();
+  run->SetInputFile(InputFile.Data());
+  //run->AddFriend(InputFile.Data());
+  // run->SetOutputFile(OutputFile);
+  //run->SetSink( new FairRootFileSink( OutputFile.Data() ) );
+  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(3.);  // geometrical matching window in cm
+  tofClust->SetCalCluMulMax(
+    5.);  // 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.);  //(12000.);  // Tot lower limit for walk correction
+  tofClust->SetTotPreRange(
+    5.);  // effective lower Tot limit  in ns from peak position
+  tofClust->SetTotMean(5.);       // Tot calibration target value in ns
+  tofClust->SetMaxTimeDist(1.0);  // default cluster range in ns
+  //tofClust->SetMaxTimeDist(0.);       //Deb// default cluster range in ns
+  tofClust->SetDelTofMax(
+    5.);  // acceptance range for cluster distance in ns (!)
+  tofClust->SetSel2MulMax(3);  // limit Multiplicity in 2nd selector
+  tofClust->SetChannelDeadtime(dDeadtime);  // artificial deadtime in ns
+  tofClust->SetEnableAvWalk(kFALSE);
+  //tofClust->SetEnableMatchPosScaling(kFALSE); // turn off projection to nominal target
+  tofClust->SetYFitMin(1.E3);
+  tofClust->SetToDAv(0.04);
+  // tofClust->SetTimePeriod(25600.);       // ignore coarse time
+  // tofClust->SetCorMode(iBugCor);         // correct missing hits
+  //tofClust->SetIdMode(0);                  // calibrate on counter level
+  tofClust->SetIdMode(1);  // calibrate on module level
+  //   tofClust->SetDeadStrips(15,23);   // declare dead strip for T0M3,Rpc0,Strip 23
+  //tofClust->SetDeadStrips(25,16);   // declare non-existant diamond strip (#5) dead
+
+  Int_t calSelRead = calSel;
+  if (calSel < 0) calSelRead = 0;
+  TString cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                        cFileId.Data(),
+                        iCalSet,
+                        calMode,
+                        calSelRead);
+  if (cCalId != "XXX")
+    cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                  cCalId.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_tofAna.hst.root", cFileId.Data(), iCalSet, iSel2);
+
+  switch (calMode) {
+    case -1:                      // initial check of raw data
+      tofClust->SetTotMax(256.);  // range in bin number
+      tofClust->SetTotPreRange(256.);
+      //tofClust->SetTotMin(1.);
+      tofClust->SetTRefDifMax(26000.);  // in ns
+      tofClust->PosYMaxScal(10000.);    // in % of length
+      tofClust->SetMaxTimeDist(0.);     // no cluster building
+      //tofClust->SetTimePeriod(25600.);       // inspect coarse time
+      break;
+    case 0:                       // initial calibration
+      tofClust->SetTotMax(256.);  // range in bin number
+      tofClust->SetTotPreRange(256.);
+      //tofClust->SetTotMin(1.);
+      tofClust->SetTRefDifMax(1000.);  // in ns
+      tofClust->PosYMaxScal(10.);      // in % of length
+      tofClust->SetMaxTimeDist(0.);    // no cluster building
+      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(3.0);  // in ns
+      tofClust->PosYMaxScal(2.0);    // in % of length
+      break;
+    case 31:
+      tofClust->SetTRefDifMax(3.);  // in ns
+      tofClust->PosYMaxScal(1.);    // in % of length
+      break;
+    case 41:
+      tofClust->SetTRefDifMax(2.0);  // in ns
+      tofClust->PosYMaxScal(0.9);    // in % of length
+      break;
+    case 51:
+      tofClust->SetTRefDifMax(2.0);  // in ns
+      tofClust->PosYMaxScal(0.8);    // in % of length
+      break;
+    case 61:
+      tofClust->SetTRefDifMax(1.5);  // in ns
+      tofClust->PosYMaxScal(0.75);   // in % of length
+      break;
+    case 71:
+      tofClust->SetTRefDifMax(0.8);  // 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(10.);     //in % of length
+      break;
+    case 22:
+    case 23:
+      tofClust->SetTRefDifMax(50.);  // in ns
+      tofClust->PosYMaxScal(5.);     //in % of length
+      break;
+    case 32:
+    case 33:
+      tofClust->SetTRefDifMax(25.);  // in ns
+      tofClust->PosYMaxScal(4.);     //in % of length
+      break;
+    case 42:
+    case 43:
+      tofClust->SetTRefDifMax(12.);  // in ns
+      tofClust->PosYMaxScal(2.);     //in % of length
+      break;
+    case 52:
+    case 53:
+      tofClust->SetTRefDifMax(10.);  // in ns
+      tofClust->PosYMaxScal(1.5);    //in % of length
+      break;
+    case 62:
+    case 63:
+      tofClust->SetTRefDifMax(10.);  // in ns
+      tofClust->PosYMaxScal(1.);     //in % of length
+      break;
+    case 72:
+    case 73:
+      tofClust->SetTRefDifMax(10.);  // in ns
+      tofClust->PosYMaxScal(0.9);    //in % of length
+      break;
+    case 82:
+    case 83:
+      tofClust->SetTRefDifMax(10.);  // in ns
+      tofClust->PosYMaxScal(0.8);    //in % of length
+      break;
+    case 92:
+    case 93:
+      tofClust->SetTRefDifMax(10.);  // in ns
+      tofClust->PosYMaxScal(0.75);   //in % of length
+      break;
+
+    case 4:  // velocity dependence (DelTOF)
+    case 14:
+      tofClust->SetTRefDifMax(25.);  // in ns
+      tofClust->PosYMaxScal(2.0);    //in % of length
+      break;
+    case 24:
+      tofClust->SetTRefDifMax(5.);  // in ns
+      tofClust->PosYMaxScal(1.5);   //in % of length
+      break;
+    case 34:
+      tofClust->SetTRefDifMax(5.);  // in ns
+      tofClust->PosYMaxScal(1.2);   //in % of length
+      break;
+    case 44:
+      tofClust->SetTRefDifMax(3.5);  // in ns
+      tofClust->PosYMaxScal(1.0);    //in % of length
+      break;
+    case 54:
+      tofClust->SetTRefDifMax(3.0);  // in ns
+      tofClust->PosYMaxScal(0.9);    //in % of length
+      break;
+    case 64:
+      tofClust->SetTRefDifMax(2.5);  // in ns
+      tofClust->PosYMaxScal(0.8);    //in % of length
+      break;
+    case 74:
+      tofClust->SetTRefDifMax(2.0);  // in ns
+      tofClust->PosYMaxScal(0.7);    //in % of length
+      break;
+    default:
+      cout << "<E> Calib mode not implemented! stop execution of script"
+           << endl;
+      return;
+  }
+
+  Int_t iBRef    = iCalSet % 1000;
+  Int_t iSet     = (iCalSet - iBRef) / 1000;
+  Int_t iRSel    = 0;
+  Int_t iRSelTyp = 0;
+  Int_t iRSelSm  = 0;
+  Int_t iRSelRpc = 0;
+  iRSel          = iBRef;  // use diamond
+
+  Int_t iRSelin = iRSel;
+  iRSelRpc      = iRSel % 10;
+  iRSelTyp      = (iRSel - iRSelRpc) / 10;
+  iRSelSm       = iRSelTyp % 10;
+  iRSelTyp      = (iRSelTyp - iRSelSm) / 10;
+
+  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;
+
+  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);
+
+  run->AddTask(tofClust);
+
+  cout << "Run with iRSel = " << iRSel << ", iSel2 = " << iSel2in << endl;
+
+
+  // -----  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);
+
+  // -----   Intialise and run   --------------------------------------------
+  run->Init();
+  cout << "Starting run" << endl;
+  run->Run(0, nEvents);
+  //tofClust->Finish();
+  // ------------------------------------------------------------------------
+  // default display
+  /*
+  TString Display_Status = "pl_over_Mat04D4best.C";
+  TString Display_Funct = "pl_over_Mat04D4best()";  
+  gROOT->LoadMacro(Display_Status);
+  */
+
+  gROOT->LoadMacro("save_hst.C");
+
+  gROOT->LoadMacro("fit_ybox.h");
+  gROOT->LoadMacro("pl_all_CluMul.C");
+  gROOT->LoadMacro("pl_all_CluRate.C");
+  gROOT->LoadMacro("pl_all_CluPosEvol.C");
+  gROOT->LoadMacro("pl_all_CluTimeEvol.C");
+  gROOT->LoadMacro("pl_over_cluSel.C");
+  gROOT->LoadMacro("pl_over_clu.C");
+  gROOT->LoadMacro("pl_over_Walk2.C");
+  gROOT->LoadMacro("pl_all_dTSel.C");
+  gROOT->LoadMacro("pl_over_MatD4sel.C");
+  gROOT->LoadMacro("pl_all_Sel2D.C");
+  gROOT->LoadMacro("pl_all_2D.C");
+
+  if (iPlot) {
+
+    switch (iSet) {
+      default:
+        for (Int_t iOpt = 0; iOpt < 8; iOpt++) {
+          for (Int_t iSel = 0; iSel < 2; iSel++) {
+            gInterpreter->ProcessLine(Form("pl_all_Sel2D(%d,%d)", iOpt, iSel));
+          }
+        }
+
+        for (Int_t iOpt = 0; iOpt < 12; iOpt++) {
+          gInterpreter->ProcessLine(Form("pl_all_2D(%d)", iOpt));
+        }
+        /*
+	gInterpreter->ProcessLine("pl_over_clu(0,0,0)");
+	gInterpreter->ProcessLine("pl_over_clu(0,0,1)");
+	gInterpreter->ProcessLine("pl_over_clu(0,0,2)");
+	gInterpreter->ProcessLine("pl_over_clu(0,0,3)");
+	gInterpreter->ProcessLine("pl_over_clu(0,0,4)");
+	gInterpreter->ProcessLine("pl_over_clu(0,1,0)");
+	gInterpreter->ProcessLine("pl_over_clu(0,1,1)");
+	gInterpreter->ProcessLine("pl_over_clu(0,1,2)");
+	gInterpreter->ProcessLine("pl_over_clu(0,1,3)");
+	gInterpreter->ProcessLine("pl_over_clu(0,1,4)");
+	gInterpreter->ProcessLine("pl_over_clu(0,2,0)");
+	gInterpreter->ProcessLine("pl_over_clu(0,2,1)");
+	gInterpreter->ProcessLine("pl_over_clu(0,2,2)");
+	gInterpreter->ProcessLine("pl_over_clu(0,2,3)");
+	gInterpreter->ProcessLine("pl_over_clu(0,2,4)");
+	gInterpreter->ProcessLine("pl_over_clu(0,3,0)");
+	gInterpreter->ProcessLine("pl_over_clu(0,3,1)");
+	gInterpreter->ProcessLine("pl_over_clu(0,3,2)");
+	gInterpreter->ProcessLine("pl_over_clu(0,3,3)");
+	gInterpreter->ProcessLine("pl_over_clu(0,3,4)");
+	gInterpreter->ProcessLine("pl_over_clu(0,4,0)");
+	gInterpreter->ProcessLine("pl_over_clu(0,4,1)");
+	gInterpreter->ProcessLine("pl_over_clu(0,4,2)");
+	gInterpreter->ProcessLine("pl_over_clu(0,4,3)");
+	gInterpreter->ProcessLine("pl_over_clu(0,4,4)");
+	
+	gInterpreter->ProcessLine("pl_over_clu(5,0,0)");
+	gInterpreter->ProcessLine("pl_over_cluSel(0,5,0,0)");
+	gInterpreter->ProcessLine("pl_over_cluSel(1,5,0,0)");
+	
+	for(Int_t iSm=0; iSm<3; iSm++)
+	for (Int_t iRpc=0; iRpc<5; iRpc++)
+	for (Int_t iSel=0; iSel<2; iSel++){
+	gInterpreter->ProcessLine(Form("pl_over_cluSel(%d,0,%d,%d)",iSel,iSm,iRpc));
+	gInterpreter->ProcessLine(Form("pl_over_Walk2(%d,0,%d,%d)",iSel,iSm,iRpc));
+	}
+      */
+        gInterpreter->ProcessLine("pl_all_CluMul()");
+        gInterpreter->ProcessLine("pl_all_CluRate()");
+        gInterpreter->ProcessLine("pl_all_CluRate(5,1)");
+        gInterpreter->ProcessLine("pl_all_CluPosEvol()");
+        gInterpreter->ProcessLine("pl_all_CluTimeEvol()");
+        gInterpreter->ProcessLine("pl_all_dTSel()");
+
+        //  gInterpreter->ProcessLine("pl_over_MatD4sel()");
+        //  gInterpreter->ProcessLine(Display_Funct.Data());
+        break;
+        ;
+    }
+  }
+  TString FSave = Form("save_hst(\"CluStatus%d_%d_Cal_%s.hst.root\")",
+                       iCalSet,
+                       iSel2in,
+                       cCalId.Data());
+  gInterpreter->ProcessLine(FSave.Data());
+}
diff --git a/macro/beamtime/mcbm2021/ana_trks.C b/macro/beamtime/mcbm2021/ana_trks.C
new file mode 100644
index 0000000000000000000000000000000000000000..4c917bee1365e98baa08fcf66d6db88d053cbd30
--- /dev/null
+++ b/macro/beamtime/mcbm2021/ana_trks.C
@@ -0,0 +1,755 @@
+void ana_trks(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 iVerbose = 1;
+  if (cCalId == "") cCalId = cFileId;
+  TString FId = cFileId;
+  Int_t iNLen=FId.First(".");
+  TString cRun(FId(0, iNLen));  
+  Int_t iRun = cRun.Atoi();
+  // Specify log level (INFO, DEBUG, DEBUG1, ...)
+  //TString logLevel = "FATAL";
+  //TString logLevel = "ERROR";
+  TString logLevel = "INFO";
+  //TString logLevel = "DEBUG";
+  //TString logLevel = "DEBUG1";
+  //TString logLevel = "DEBUG2";
+  //TString logLevel = "DEBUG3";
+  TString workDir  = gSystem->Getenv("VMCWORKDIR");
+  TString paramDir = workDir + "/macro/beamtime/mcbm2021";
+  //TString paramDir       = ".";
+
+  TString ParFile       = paramDir + "/data/" + cFileId.Data() + ".params.root";
+  TString InputFile     = paramDir + "/data/" + cFileId.Data() + ".root";
+  TString InputDigiFile = paramDir + "/data/TofHits_" + cFileId.Data()
+                          + Form("_%s_%02.0f_Cal", cSet.Data(), dDeadtime)
+                          + cCalId + ".out.root";
+  if (iMc == 1) {
+    InputFile     = paramDir + "/data/" + cFileId.Data() + ".raw.root";
+    InputDigiFile = paramDir + "/data/" + cFileId.Data() + ".rec.root";
+    iRun          = 700;
+  }
+  TString OutputFile = paramDir + "/data/TofTrks_" + cFileId.Data()
+                       + Form("_%s_%06d_%03d", cSet.Data(), iSel, iSel2)
+                       + ".out.root";
+  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());
+  TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data());
+  TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cFileId.Data());
+
+  cout << " InputDigiFile = " << InputDigiFile << endl;
+
+  TString shcmd = "rm -v " + ParFile;
+  gSystem->Exec(shcmd.Data());
+
+  TList* parFileList = new TList();
+
+  Int_t iGeo = 0;  //iMc;
+  if (iGeo == 0) {
+    TString TofGeo = "";
+    if (iRun < 690)
+      TofGeo = "v20a_mcbm";
+    else
+      TofGeo = "v21a_mcbm";
+    cout << "Geometry version " << TofGeo << endl;
+
+    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;
+    }
+  } else {
+    TString setupName = "mcbm_beam_2021_01";
+    // -----   Load the geometry setup   -------------------------------------
+    TString setupFile =
+      workDir + "/geometry/setup/setup_" + setupName.Data() + ".C";
+    TString setupFunct = "setup_";
+    setupFunct         = setupFunct + setupName + "()";
+    std::cout << "-I- Loading macro " << setupFile << std::endl;
+    gROOT->LoadMacro(setupFile);
+    gROOT->ProcessLine(setupFunct);
+    CbmSetup* setup = CbmSetup::Instance();
+  }
+
+  // -----   Reconstruction run   -------------------------------------------
+  FairRunAna* run = new FairRunAna();
+  cout << "InputFile:     " << InputFile.Data() << endl;
+  cout << "InputDigiFile: " << InputDigiFile.Data() << endl;
+
+  //run->SetInputFile(InputFile.Data());
+  //run->AddFriend(InputDigiFile.Data());
+  run->SetInputFile(InputDigiFile.Data());
+  //run->AddFriend(InputFile.Data());
+  //run->SetOutputFile(OutputFile);
+  run->SetUserOutputFileName(OutputFile.Data());
+  run->SetSink(new FairRootFileSink(run->GetUserOutputFileName()));
+
+  FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data());
+  FairLogger::GetLogger()->SetLogVerbosityLevel("VERYHIGH");
+
+  // -----   Local selection variables  -------------------------------------------
+
+  Int_t iRef    = iSel % 1000;
+  Int_t iDut    = (iSel - iRef) / 1000;
+  Int_t iDutRpc = iDut % 10;
+  iDut          = (iDut - iDutRpc) / 10;
+  Int_t iDutSm  = iDut % 10;
+  iDut          = (iDut - iDutSm) / 10;
+  Int_t iRefRpc = iRef % 10;
+  iRef          = (iRef - iRefRpc) / 10;
+  Int_t iRefSm  = iRef % 10;
+  iRef          = (iRef - iRefSm) / 10;
+
+  Int_t iSel2in  = iSel2;
+  Int_t iSel2Rpc = iSel2 % 10;
+  iSel2          = (iSel2 - iSel2Rpc) / 10;
+  Int_t iSel2Sm  = iSel2 % 10;
+  iSel2          = (iSel2 - iSel2Sm) / 10;
+
+
+  Int_t calMode = 93;
+  Int_t calSel  = 1;
+  Bool_t bOut   = kFALSE;
+
+  CbmTofEventClusterizer* tofClust =
+    new CbmTofEventClusterizer("TOF Event Clusterizer", iVerbose, bOut);
+  Int_t calSelRead = calSel;
+  if (calSel < 0) calSelRead = 0;
+  TString cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                        cFileId.Data(),
+                        iCalSet,
+                        calMode,
+                        calSelRead);
+  if (cCalId != "XXX")
+    cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                  cCalId.Data(),
+                  iCalSet,
+                  calMode,
+                  calSelRead);
+  tofClust->SetCalParFileName(cFname);
+  TString cOutFname =
+    Form("tofClust_%s_set%09d.hst.root", cFileId.Data(), iCalSet);
+  tofClust->SetOutHstFileName(cOutFname);
+
+  // =========================================================================
+  // ===                       Tracking                                    ===
+  // =========================================================================
+
+  CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN();
+  tofTrackFinder->SetMaxTofTimeDifference(0.2);  // 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.065);  // target value for Mar2020 triple stack -> betapeak ~ 0.95
+  //tofFindTracks->SetTtTarg(0.0605); // target value for Mar2020 triple stack -> betapeak ~ 0.95
+  //tofFindTracks->SetTtTarg(0.058);    // target value for Mar2020 double stack
+  //tofFindTracks->SetTtTarg(0.055);  // target value Nov2019 (triple stack run 831)
+  //tofFindTracks->SetTtTarg(0.048);  // target value Nov2019 (double stack run 714)
+  tofFindTracks->SetTtTarg(
+    0.047);  // target value Mar2020, after T0 fix (full run 600)
+  //  0.044);  // target value Mar2020, after T0 fix (double stack run 714)
+  //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(20.);
+  tofFindTracks->SetStationMaxHMul(
+    30);  // Max Hit Multiplicity in any used station
+
+  tofFindTracks->SetT0MAX(dScalFac);  // in ns
+  tofFindTracks->SetSIGT(0.08);       // default in ns
+  tofFindTracks->SetSIGX(0.3);        // default in cm
+  tofFindTracks->SetSIGY(0.45);       // default in cm
+  tofFindTracks->SetSIGZ(0.05);       // default in cm
+  tofFindTracks->SetUseSigCalib(
+    bUseSigCalib);  // ignore resolutions in CalPar file
+  tofTrackFinder->SetSIGLIM(dChi2Lim2
+                            * 2.);  // matching window in multiples of chi2
+  tofTrackFinder->SetChiMaxAccept(dChi2Lim2);  // max tracklet chi2
+
+  Int_t iMinNofHits   = -1;
+  Int_t iNStations    = 0;
+  Int_t iNReqStations = 3;
+
+  switch (iTrackingSetup) {
+    case 0:  // bypass mode
+      iMinNofHits = -1;
+      iNStations  = 1;
+      tofFindTracks->SetStation(0, 5, 0, 0);  // Diamond
+      break;
+
+    case 1:  // for calibration mode of full setup
+    {
+      Double_t dTsig = dScalFac * 0.03;
+      tofFindTracks->SetSIGT(dTsig);  // allow for variable deviations in ns
+    }
+      iMinNofHits   = 3;
+      iNStations    = 30;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 2, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 0, 2);
+      tofFindTracks->SetStation(4, 0, 2, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 0, 1);
+      tofFindTracks->SetStation(7, 0, 2, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 0, 3);
+      tofFindTracks->SetStation(10, 0, 2, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 0, 0);
+      tofFindTracks->SetStation(13, 0, 2, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 0, 4);
+      tofFindTracks->SetStation(16, 0, 4, 0);
+      tofFindTracks->SetStation(17, 0, 3, 0);
+      tofFindTracks->SetStation(18, 0, 4, 1);
+      tofFindTracks->SetStation(19, 0, 3, 1);
+      tofFindTracks->SetStation(20, 0, 4, 2);
+      tofFindTracks->SetStation(21, 0, 3, 2);
+      tofFindTracks->SetStation(22, 0, 4, 3);
+      tofFindTracks->SetStation(23, 0, 3, 3);
+      tofFindTracks->SetStation(24, 0, 4, 4);
+      tofFindTracks->SetStation(25, 0, 3, 4);
+      tofFindTracks->SetStation(26, 9, 0, 0);
+      tofFindTracks->SetStation(27, 9, 1, 0);
+      tofFindTracks->SetStation(28, 9, 0, 1);
+      tofFindTracks->SetStation(29, 9, 1, 1);      
+      //tofFindTracks->SetStation(28, 6, 0, 0);
+      //tofFindTracks->SetStation(29, 6, 0, 1);
+      break;
+
+    case 11:  // for calibration mode of 2-stack & test counters
+      iMinNofHits   = 4;
+      iNStations    = 9;
+      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, 2);
+      tofFindTracks->SetStation(5, 9, 0, 0);
+      tofFindTracks->SetStation(6, 9, 1, 0);
+      tofFindTracks->SetStation(7, 9, 0, 1);
+      tofFindTracks->SetStation(8, 9, 1, 1);      
+      break;
+
+    case 2:
+      iMinNofHits   = 3;
+      iNStations    = 28;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 0, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 2, 1);
+      tofFindTracks->SetStation(4, 0, 0, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 2, 3);
+      tofFindTracks->SetStation(7, 0, 0, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 2, 0);
+      tofFindTracks->SetStation(10, 0, 0, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 2, 4);
+      tofFindTracks->SetStation(13, 0, 0, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 4, 0);
+      tofFindTracks->SetStation(16, 0, 3, 0);
+      tofFindTracks->SetStation(17, 0, 4, 1);
+      tofFindTracks->SetStation(18, 0, 3, 1);
+      tofFindTracks->SetStation(19, 0, 4, 2);
+      tofFindTracks->SetStation(20, 0, 3, 2);
+      tofFindTracks->SetStation(21, 0, 4, 3);
+      tofFindTracks->SetStation(22, 0, 3, 3);
+      tofFindTracks->SetStation(23, 0, 4, 4);
+      tofFindTracks->SetStation(24, 0, 3, 4);
+      tofFindTracks->SetStation(25, 9, 0, 0);
+      tofFindTracks->SetStation(26, 9, 0, 1);
+      tofFindTracks->SetStation(27, 5, 0, 0);
+      break;
+
+    case 3:
+      iMinNofHits   = 3;
+      iNStations    = 16;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 2, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 0, 2);
+
+      tofFindTracks->SetStation(4, 0, 2, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 0, 1);
+
+      tofFindTracks->SetStation(7, 0, 2, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 0, 3);
+
+      tofFindTracks->SetStation(10, 0, 2, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 0, 0);
+
+      tofFindTracks->SetStation(13, 0, 2, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 0, 4);
+
+      /*
+     tofFindTracks->SetStation(16, 0, 3, 2);         
+     tofFindTracks->SetStation(17, 0, 4, 2);  
+     tofFindTracks->SetStation(18, 0, 3, 1);         
+     tofFindTracks->SetStation(19, 0, 4, 1);
+     tofFindTracks->SetStation(20, 0, 3, 3);         
+     tofFindTracks->SetStation(21, 0, 4, 3);
+     tofFindTracks->SetStation(22, 0, 3, 0);         
+     tofFindTracks->SetStation(23, 0, 4, 0);
+     tofFindTracks->SetStation(24, 0, 3, 4);         
+     tofFindTracks->SetStation(25, 0, 4, 4); 
+     */
+      break;
+
+    case 4:  // for USTC evaluation (dut=910,911)
+      iMinNofHits   = 4;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 0, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 5, 0, 0);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 14:
+      iMinNofHits   = 3;
+      iNStations    = 15;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 1, 2);
+      tofFindTracks->SetStation(2, 0, 0, 2);
+      tofFindTracks->SetStation(0, 0, 2, 1);
+      tofFindTracks->SetStation(1, 0, 1, 1);
+      tofFindTracks->SetStation(2, 0, 0, 1);
+      tofFindTracks->SetStation(0, 0, 2, 0);
+      tofFindTracks->SetStation(1, 0, 1, 0);
+      tofFindTracks->SetStation(2, 0, 0, 0);
+      tofFindTracks->SetStation(0, 0, 2, 3);
+      tofFindTracks->SetStation(1, 0, 1, 3);
+      tofFindTracks->SetStation(2, 0, 0, 3);
+      tofFindTracks->SetStation(0, 0, 2, 4);
+      tofFindTracks->SetStation(1, 0, 1, 4);
+      tofFindTracks->SetStation(2, 0, 0, 4);
+      break;
+
+    case 5:  // for calibration of 2-stack and add-on counters (STAR2, BUC)
+      iMinNofHits   = 3;
+      iNStations    = 7;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(6, 0, 4, 1);
+      tofFindTracks->SetStation(1, 6, 0, 1);
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 9, 0, 1);
+      tofFindTracks->SetStation(4, 6, 0, 0);
+      tofFindTracks->SetStation(5, 0, 3, 1);
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      break;
+
+    case 6:  // for double stack USTC counter evaluation
+      iMinNofHits   = 5;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 6, 0, 1);
+      tofFindTracks->SetStation(2, 0, 4, 1);
+      tofFindTracks->SetStation(3, 6, 0, 0);
+      tofFindTracks->SetStation(4, 0, 3, 1);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 7:  // for double stack USTC counter evaluation
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 6, 0, 1);
+      tofFindTracks->SetStation(2, 6, 0, 0);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 8:  // evaluation of add-on counters (BUC)
+      iMinNofHits   = 5;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 0, 4, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 0, 3, 1);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 9:  // calibration of Star2
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(2, 9, 0, 1);
+      tofFindTracks->SetStation(1, 0, 4, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 0, 3, 1);
+      break;
+
+    case 10:
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(3, 0, 1, 2);
+      tofFindTracks->SetStation(2, 0, 0, 2);
+      tofFindTracks->SetStation(1, 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                                    ===
+  // =========================================================================
+  CbmTofAnaTestbeam* tofAnaTestbeam =
+    new CbmTofAnaTestbeam("TOF TestBeam Analysis", iVerbose);
+  tofAnaTestbeam->SetCorMode(iAnaCor);  // 1 - DTD4, 2 - X4, 3 - Y4, 4 - Texp
+  tofAnaTestbeam->SetHitDistMin(30.);   // initialization
+  tofAnaTestbeam->SetEnableMatchPosScaling(kTRUE);
+  tofAnaTestbeam->SetSpillDuration(3.);
+  if (iMc == 1) {
+    tofAnaTestbeam->SetSpillDuration(0.);
+    tofAnaTestbeam->SetSpillBreak(0.);
+  }
+  //CbmTofAnaTestbeam defaults
+  tofAnaTestbeam->SetR0LimFit(
+    20.);  // limit distance of fitted track to nominal vertex
+  tofAnaTestbeam->SetDXMean(0.);
+  tofAnaTestbeam->SetDYMean(0.);
+  tofAnaTestbeam->SetDTMean(0.);  // in ns
+  tofAnaTestbeam->SetDXWidth(0.5);
+  tofAnaTestbeam->SetDYWidth(1.0);
+  tofAnaTestbeam->SetDTWidth(0.1);  // in ns
+  tofAnaTestbeam->SetCalParFileName(cAnaFile);
+  Double_t dScalFacA = 0.9;  // dScalFac is used for tracking
+  tofAnaTestbeam->SetPosY4Sel(
+    0.5 * dScalFacA);  // Y Position selection in fraction of strip length
+  tofAnaTestbeam->SetDTDia(0.);    // Time difference to additional diamond
+  tofAnaTestbeam->SetMul0Max(20);  // Max Multiplicity in dut
+  tofAnaTestbeam->SetMul4Max(30);  // Max Multiplicity in Ref - RPC
+  tofAnaTestbeam->SetMulDMax(3);   // Max Multiplicity in Diamond / BeamRef
+  tofAnaTestbeam->SetTOffD4(14.);  // initialization
+  tofAnaTestbeam->SetDTD4MAX(
+    6.);  // initialization of Max time difference Ref - BRef
+
+  //tofAnaTestbeam->SetTShift(-28000.);// initialization
+  tofAnaTestbeam->SetPosYS2Sel(
+    0.55);  // 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->SetSel2TOff(0.);    // Shift Sel2 time peak to 0
+  tofAnaTestbeam->SetChi2Lim(5.);     // initialization of Chi2 selection limit
+  tofAnaTestbeam->SetChi2Lim2(
+    3.);  // initialization of Chi2 selection limit for Mref-Sel2 pair
+  tofAnaTestbeam->SetDutDX(
+    15.);  // limit inspection of tracklets to selected region
+  tofAnaTestbeam->SetDutDY(
+    15.);  // limit inspection of tracklets to selected region
+  tofAnaTestbeam->SetSIGLIM(3.);  // max matching chi2
+  tofAnaTestbeam->SetSIGT(0.08);  // in ns
+  tofAnaTestbeam->SetSIGX(0.3);   // in cm
+  tofAnaTestbeam->SetSIGY(0.6);   // in cm
+
+  Int_t iRSel    = 500;
+  Int_t iRSelTyp = 5;
+  Int_t iRSelSm  = 0;
+  Int_t iRSelRpc = 0;
+  /*
+   Int_t iRSel=31;
+   Int_t iRSelTyp=0;
+   Int_t iRSelSm=3;
+   Int_t iRSelRpc=1;
+   */
+
+  Int_t iRSelin = iRSel;
+
+
+  tofAnaTestbeam->SetBeamRefSmType(iRSelTyp);  // common reaction reference
+  tofAnaTestbeam->SetBeamRefSmId(iRSelSm);
+  tofAnaTestbeam->SetBeamRefRpc(iRSelRpc);
+
+  if (iSel2 >= -1) {
+    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
+  }
+
+  cout << "AnaTestbeam init for Dut " << iDut << iDutSm << iDutRpc << ", Ref "
+       << iRef << iRefSm << iRefRpc << endl;
+
+  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
+
+  cout << "dispatch iSel = " << iSel << ", iSel2in = " << iSel2in
+       << ", iRSelin = " << iRSelin << ", iRSel = " << iRSel << endl;
+
+  if (1) {
+    switch (iSel) {
+
+      case 10:
+        switch (iRSelin) {
+          case 500:
+            tofAnaTestbeam->SetTShift(2.5);  // Shift DTD4 to 0
+            tofAnaTestbeam->SetTOffD4(18.);  // Shift DTD4 to physical value
+            switch (iSel2in) {
+              case 20:
+                tofAnaTestbeam->SetSel2TOff(0.);  // Shift Sel2 time peak to 0
+                break;
+              default:;
+            }
+            break;
+          default:;
+        }
+        break;
+
+      case 700040:
+      case 900040:
+      case 901040:
+        switch (iRSelin) {
+          case 500:
+            tofAnaTestbeam->SetTShift(0.3);  // Shift DTD4 to 0
+            tofAnaTestbeam->SetTOffD4(18.);  // Shift DTD4 to physical value
+
+            switch (iSel2in) {
+              case 30:
+                tofAnaTestbeam->SetSel2TOff(-0.3);  // Shift Sel2 time peak to 0
+                break;
+              case 31:
+                tofAnaTestbeam->SetSel2TOff(
+                  -0.41);  // Shift Sel2 time peak to 0
+                break;
+
+              default:;
+            }
+            break;
+          default:;
+        }
+        break;
+
+      case 700041:
+      case 900041:
+      case 901041:
+        switch (iRSelin) {
+          case 500:
+            tofAnaTestbeam->SetTShift(0.8);  // Shift DTD4 to 0
+            tofAnaTestbeam->SetTOffD4(11.);  // Shift DTD4 to physical value
+
+            switch (iSel2in) {
+              case 30:
+                tofAnaTestbeam->SetSel2TOff(-0.3);  // Shift Sel2 time peak to 0
+                break;
+              case 31:
+                tofAnaTestbeam->SetSel2TOff(0.);  // Shift Sel2 time peak to 0
+                break;
+              case 600:
+                tofAnaTestbeam->SetSel2TOff(-0.2);  // Shift Sel2 time peak to 0
+                break;
+
+              default:;
+            }
+            break;
+          default:;
+        }
+        break;
+
+      case 600041:
+      case 601041:
+        switch (iRSelin) {
+          case 500:
+            tofAnaTestbeam->SetTShift(5.3);  // Shift DTD4 to 0
+            tofAnaTestbeam->SetTOffD4(11.);  // Shift DTD4 to physical value
+
+            switch (iSel2in) {
+              case 33:
+                tofAnaTestbeam->SetSel2TOff(
+                  -0.55);  // Shift Sel2 time peak to 0
+                break;
+
+              default:;
+            }
+            break;
+          default:;
+        }
+        break;
+
+      default:
+        cout << "Better to define analysis setup! Running with default offset "
+                "parameter... "
+             << endl;
+        // return;
+    }  // end of different subsets
+
+    cout << " Initialize TSHIFT to " << tofAnaTestbeam->GetTShift() << endl;
+    //run->AddTask(tofAnaTestbeam);
+  }
+
+  // -----  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);
+
+  // -----   Intialise and run   --------------------------------------------
+  run->Init();
+  cout << "Starting run" << endl;
+  run->Run(0, nEvents);
+  //run->Run(nEvents-1, nEvents); //debugging single events for memory leak
+  // ------------------------------------------------------------------------
+
+  // default displays, plot results
+  /*
+  TString Display_Status = "pl_over_Mat04D4best.C";
+  TString Display_Funct;
+  if (iGenCor<0) {
+    Display_Funct = "pl_over_Mat04D4best(1)";
+  }else{
+    Display_Funct = "pl_over_Mat04D4best(0)";
+  }
+  gROOT->LoadMacro(Display_Status);
+
+  cout << "Exec "<< Display_Funct.Data()<< endl;
+  gInterpreter->ProcessLine(Display_Funct);
+  */
+  gROOT->LoadMacro("save_hst.C");
+  gROOT->LoadMacro("pl_over_MatD4sel.C");
+  gROOT->LoadMacro("pl_eff_XY.C");
+  gROOT->LoadMacro("pl_over_trk.C");
+  gROOT->LoadMacro("pl_calib_trk.C");
+  gROOT->LoadMacro("pl_XY_trk.C");
+  gROOT->LoadMacro("pl_vert_trk.C");
+  gROOT->LoadMacro("pl_pull_trk.C");
+  gROOT->LoadMacro("pl_all_Track2D.C");
+  gROOT->LoadMacro("pl_TIS.C");
+  gROOT->LoadMacro("pl_TIR.C");
+  gROOT->LoadMacro("pl_Eff_XY.C");
+  gROOT->LoadMacro("pl_Eff_DTLH.C");
+  gROOT->LoadMacro("pl_Eff_TIS.C");
+  gROOT->LoadMacro("pl_Dut_Res.C");
+  gROOT->LoadMacro("pl_Dut_Vel.C");
+
+  TString SaveToHstFile = "save_hst(\"" + cHstFile + "\")";
+  gInterpreter->ProcessLine(SaveToHstFile);
+
+  //gInterpreter->ProcessLine("pl_over_MatD4sel()");
+  //gInterpreter->ProcessLine("pl_TIS()");
+  //gInterpreter->ProcessLine("pl_TIR()");
+  //gInterpreter->ProcessLine("pl_eff_XY()");
+  gInterpreter->ProcessLine("pl_calib_trk()");
+  gInterpreter->ProcessLine("pl_vert_trk()");
+
+  gInterpreter->ProcessLine("pl_all_Track2D(0)");
+  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);
+
+  TString XY_trk = "pl_XY_trk(" + (TString)(Form("%d", iNStations)) + ")";
+  gInterpreter->ProcessLine(XY_trk);
+
+  TString Pull0 = (TString)(Form("pl_pull_trk(%d,%d,1)", iNStations, 0));
+  gInterpreter->ProcessLine(Pull0);
+  TString Pull1 = (TString)(Form("pl_pull_trk(%d,%d,1)", iNStations, 1));
+  gInterpreter->ProcessLine(Pull1);
+  TString Pull3 = (TString)(Form("pl_pull_trk(%d,%d,1)", iNStations, 3));
+  gInterpreter->ProcessLine(Pull3);
+  TString Pull4 = (TString)(Form("pl_pull_trk(%d,%d,1)", iNStations, 4));
+  gInterpreter->ProcessLine(Pull4);
+}
diff --git a/macro/beamtime/mcbm2021/ana_trks_eval.C b/macro/beamtime/mcbm2021/ana_trks_eval.C
new file mode 100644
index 0000000000000000000000000000000000000000..5d3c64683f19b8dc06956235c1aec66ee4f94aa0
--- /dev/null
+++ b/macro/beamtime/mcbm2021/ana_trks_eval.C
@@ -0,0 +1,807 @@
+void ana_trks_eval(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 iVerbose = 1;
+  if (cCalId == "") cCalId = cFileId;
+  TString FId = cFileId;
+  Int_t iNLen=FId.First(".");
+  TString cRun(FId(0, iNLen));  
+  Int_t iRun = cRun.Atoi();
+  // Specify log level (INFO, DEBUG, DEBUG1, ...)
+  //TString logLevel = "FATAL";
+  //TString logLevel = "ERROR";
+  TString logLevel = "INFO";
+  //TString logLevel = "DEBUG";
+  //TString logLevel = "DEBUG1";
+  //TString logLevel = "DEBUG2";
+  //TString logLevel = "DEBUG3";
+  TString workDir  = gSystem->Getenv("VMCWORKDIR");
+  TString paramDir = workDir + "/macro/beamtime/mcbm2021";
+  //TString paramDir       = ".";
+
+  TString ParFile       = paramDir + "/data/" + cFileId.Data() + ".params.root";
+  TString InputFile     = paramDir + "/data/" + cFileId.Data() + ".root";
+  TString InputDigiFile = paramDir + "/data/TofHits_" + cFileId.Data()
+                          + Form("_%s_%02.0f_Cal", cSet.Data(), dDeadtime)
+                          + cCalId + ".out.root";
+  if (iMc == 1) {
+    InputFile     = paramDir + "/data/" + cFileId.Data() + ".raw.root";
+    InputDigiFile = paramDir + "/data/" + cFileId.Data() + ".rec.root";
+    iRun          = 700;
+  }
+  TString InputTrklFile = paramDir + "/data/TofTrks_" + cFileId.Data()
+                          + Form("_%s_%06d_%03d", cSet.Data(), iSel, iSel2)
+                          + ".out.root";
+  TString OutputFile = paramDir + "/data/ana_" + cFileId.Data()
+                       + Form("_%s_%06d_%03d", cSet.Data(), iSel, iSel2)
+                       + ".out.root";
+  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());
+  TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data());
+  TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cFileId.Data());
+
+  cout << " InputDigiFile = " << InputDigiFile << endl;
+  cout << " InputTrklFile = " << InputTrklFile << endl;
+  cout << " FindTrkFile   = " << cTrkFile << endl;
+
+  TString shcmd = "rm -v " + ParFile;
+  gSystem->Exec(shcmd.Data());
+
+  TList* parFileList = new TList();
+
+  Int_t iGeo = 0;
+  if (iGeo == 0) {
+    TString TofGeo = "";
+    if (iRun < 690)
+      TofGeo = "v20a_mcbm";
+    else
+      TofGeo = "v21a_mcbm";
+    cout << "Geometry version " << TofGeo << endl;
+
+    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;
+    }
+  } else {
+    TString setupName = "mcbm_beam_2021_01";
+    // -----   Load the geometry setup   -------------------------------------
+    TString setupFile =
+      workDir + "/geometry/setup/setup_" + setupName.Data() + ".C";
+    TString setupFunct = "setup_";
+    setupFunct         = setupFunct + setupName + "()";
+    std::cout << "-I- Loading macro " << setupFile << std::endl;
+    gROOT->LoadMacro(setupFile);
+    gROOT->ProcessLine(setupFunct);
+    CbmSetup* setup = CbmSetup::Instance();
+  }
+
+  // -----   Reconstruction run   -------------------------------------------
+  FairRunAna* run = new FairRunAna();
+  cout << "InputFile:     " << InputFile.Data() << endl;
+  cout << "InputDigiFile: " << InputDigiFile.Data() << endl;
+
+  //run->SetInputFile(InputFile.Data());
+  //run->AddFriend(InputDigiFile.Data());
+  run->SetInputFile(InputDigiFile.Data());
+  //run->AddFriend(InputTrklFile.Data());
+  //run->SetInputFile(InputTrklFile.Data());
+
+  run->SetUserOutputFileName(OutputFile.Data());
+  run->SetSink(new FairRootFileSink(run->GetUserOutputFileName()));
+
+  FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data());
+  FairLogger::GetLogger()->SetLogVerbosityLevel("VERYHIGH");
+
+  // -----   Local selection variables  -------------------------------------------
+
+  Int_t iRef    = iSel % 1000;
+  Int_t iDut    = (iSel - iRef) / 1000;
+  Int_t iDutRpc = iDut % 10;
+  iDut          = (iDut - iDutRpc) / 10;
+  Int_t iDutSm  = iDut % 10;
+  iDut          = (iDut - iDutSm) / 10;
+  Int_t iRefRpc = iRef % 10;
+  iRef          = (iRef - iRefRpc) / 10;
+  Int_t iRefSm  = iRef % 10;
+  iRef          = (iRef - iRefSm) / 10;
+
+  Int_t iSel2in  = iSel2;
+  Int_t iSel2Rpc = iSel2 % 10;
+  iSel2          = (iSel2 - iSel2Rpc) / 10;
+  Int_t iSel2Sm  = iSel2 % 10;
+  iSel2          = (iSel2 - iSel2Sm) / 10;
+
+
+  Int_t calMode = 93;
+  Int_t calSel  = 1;
+  Bool_t bOut   = kFALSE;
+
+  CbmTofEventClusterizer* tofClust =
+    new CbmTofEventClusterizer("TOF Event Clusterizer", iVerbose, bOut);
+  Int_t calSelRead = calSel;
+  if (calSel < 0) calSelRead = 0;
+  TString cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                        cFileId.Data(),
+                        iCalSet,
+                        calMode,
+                        calSelRead);
+  if (cCalId != "XXX")
+    cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root",
+                  cCalId.Data(),
+                  iCalSet,
+                  calMode,
+                  calSelRead);
+  tofClust->SetCalParFileName(cFname);
+  TString cOutFname =
+    Form("tofClust_%s_set%09d.hst.root", cFileId.Data(), iCalSet);
+  tofClust->SetOutHstFileName(cOutFname);
+
+  // =========================================================================
+  // ===                       Tracking                                    ===
+  // =========================================================================
+
+  CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN();
+  tofTrackFinder->SetMaxTofTimeDifference(0.2);  // 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.047);  // target value for Mar2021 double stack 
+  //  0.0605);  // target value for Mar2020 triple stack -> betapeak ~ 0.95
+  //tofFindTracks->SetTtTarg(0.062);              // target value for Mar2020 triple stack -> betapeak ~ 0.95
+  //tofFindTracks->SetTtTarg(0.058);            // target value for Mar2020 double stack
+  //tofFindTracks->SetTtTarg(0.051);            // target value Nov2019
+  //tofFindTracks->SetTtTarg(0.035);            // target value for inverse velocity, > 0.033 ns/cm!
+  tofFindTracks->SetCalParFileName(
+    cTrkFile);                             // Tracker parameter value file name
+  tofFindTracks->SetBeamCounter(5, 0, 0);  // default beam counter
+  tofFindTracks->SetR0Lim(20.);
+  tofFindTracks->SetStationMaxHMul(
+    30);  // Max Hit Multiplicity in any used station
+
+  tofFindTracks->SetT0MAX(dScalFac);  // in ns
+  tofFindTracks->SetSIGT(0.08);       // default in ns
+  tofFindTracks->SetSIGX(0.3);        // default in cm
+  tofFindTracks->SetSIGY(0.45);       // default in cm
+  tofFindTracks->SetSIGZ(0.05);       // default in cm
+  tofFindTracks->SetUseSigCalib(
+    bUseSigCalib);  // ignore resolutions in CalPar file
+  tofTrackFinder->SetSIGLIM(dChi2Lim2
+                            * 2.);  // matching window in multiples of chi2
+  tofTrackFinder->SetChiMaxAccept(dChi2Lim2);  // max tracklet chi2
+  tofTrackFinder->SetSIGLIMMOD(5.);            // max deviation for last hit
+
+  Int_t iMinNofHits   = -1;
+  Int_t iNStations    = 0;
+  Int_t iNReqStations = 3;
+
+  switch (iTrackingSetup) {
+    case 0:  // bypass mode
+      iMinNofHits = -1;
+      iNStations  = 1;
+      tofFindTracks->SetStation(0, 5, 0, 0);  // Diamond
+      break;
+
+    case 1:  // for calibration mode of full setup
+    {
+      Double_t dTsig = dScalFac * 0.03;
+      tofFindTracks->SetSIGT(dTsig);  // allow for variable deviations in ns
+    }
+      iMinNofHits   = 3;
+      iNStations    = 30;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 2, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 0, 2);
+      tofFindTracks->SetStation(4, 0, 2, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 0, 1);
+      tofFindTracks->SetStation(7, 0, 2, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 0, 3);
+      tofFindTracks->SetStation(10, 0, 2, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 0, 0);
+      tofFindTracks->SetStation(13, 0, 2, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 0, 4);
+      tofFindTracks->SetStation(16, 0, 4, 0);
+      tofFindTracks->SetStation(17, 0, 3, 0);
+      tofFindTracks->SetStation(18, 0, 4, 1);
+      tofFindTracks->SetStation(19, 0, 3, 1);
+      tofFindTracks->SetStation(20, 0, 4, 2);
+      tofFindTracks->SetStation(21, 0, 3, 2);
+      tofFindTracks->SetStation(22, 0, 4, 3);
+      tofFindTracks->SetStation(23, 0, 3, 3);
+      tofFindTracks->SetStation(24, 0, 4, 4);
+      tofFindTracks->SetStation(25, 0, 3, 4);
+      tofFindTracks->SetStation(26, 9, 0, 0);
+      tofFindTracks->SetStation(27, 9, 1, 0);
+      tofFindTracks->SetStation(28, 9, 0, 1);
+      tofFindTracks->SetStation(29, 9, 1, 1);      
+      //tofFindTracks->SetStation(28, 6, 0, 0);
+      //tofFindTracks->SetStation(29, 6, 0, 1);
+      break;
+
+    case 11:  // for calibration mode of 2-stack & test counters
+      iMinNofHits   = 4;
+      iNStations    = 9;
+      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, 2);
+      tofFindTracks->SetStation(5, 9, 0, 0);
+      tofFindTracks->SetStation(6, 9, 1, 0);
+      tofFindTracks->SetStation(7, 9, 0, 1);
+      tofFindTracks->SetStation(8, 9, 1, 1);      
+      break;
+
+    case 2:
+      iMinNofHits   = 3;
+      iNStations    = 28;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 0, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 2, 1);
+      tofFindTracks->SetStation(4, 0, 0, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 2, 3);
+      tofFindTracks->SetStation(7, 0, 0, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 2, 0);
+      tofFindTracks->SetStation(10, 0, 0, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 2, 4);
+      tofFindTracks->SetStation(13, 0, 0, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 4, 0);
+      tofFindTracks->SetStation(16, 0, 3, 0);
+      tofFindTracks->SetStation(17, 0, 4, 1);
+      tofFindTracks->SetStation(18, 0, 3, 1);
+      tofFindTracks->SetStation(19, 0, 4, 2);
+      tofFindTracks->SetStation(20, 0, 3, 2);
+      tofFindTracks->SetStation(21, 0, 4, 3);
+      tofFindTracks->SetStation(22, 0, 3, 3);
+      tofFindTracks->SetStation(23, 0, 4, 4);
+      tofFindTracks->SetStation(24, 0, 3, 4);
+      tofFindTracks->SetStation(25, 9, 0, 0);
+      tofFindTracks->SetStation(26, 9, 0, 1);
+      tofFindTracks->SetStation(27, 5, 0, 0);
+      break;
+
+    case 3:
+      iMinNofHits   = 3;
+      iNStations    = 16;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 2, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 0, 2);
+
+      tofFindTracks->SetStation(4, 0, 2, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 0, 1);
+
+      tofFindTracks->SetStation(7, 0, 2, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 0, 3);
+
+      tofFindTracks->SetStation(10, 0, 2, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 0, 0);
+
+      tofFindTracks->SetStation(13, 0, 2, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 0, 4);
+
+      /*
+     tofFindTracks->SetStation(16, 0, 3, 2);         
+     tofFindTracks->SetStation(17, 0, 4, 2);  
+     tofFindTracks->SetStation(18, 0, 3, 1);         
+     tofFindTracks->SetStation(19, 0, 4, 1);
+     tofFindTracks->SetStation(20, 0, 3, 3);         
+     tofFindTracks->SetStation(21, 0, 4, 3);
+     tofFindTracks->SetStation(22, 0, 3, 0);         
+     tofFindTracks->SetStation(23, 0, 4, 0);
+     tofFindTracks->SetStation(24, 0, 3, 4);         
+     tofFindTracks->SetStation(25, 0, 4, 4); 
+     */
+      break;
+
+    case 4:  // for USTC evaluation (dut=910,911)
+      iMinNofHits   = 4;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 0, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 5, 0, 0);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 14:
+      iMinNofHits   = 3;
+      iNStations    = 15;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 2, 2);
+      tofFindTracks->SetStation(1, 0, 1, 2);
+      tofFindTracks->SetStation(2, 0, 0, 2);
+      tofFindTracks->SetStation(0, 0, 2, 1);
+      tofFindTracks->SetStation(1, 0, 1, 1);
+      tofFindTracks->SetStation(2, 0, 0, 1);
+      tofFindTracks->SetStation(0, 0, 2, 0);
+      tofFindTracks->SetStation(1, 0, 1, 0);
+      tofFindTracks->SetStation(2, 0, 0, 0);
+      tofFindTracks->SetStation(0, 0, 2, 3);
+      tofFindTracks->SetStation(1, 0, 1, 3);
+      tofFindTracks->SetStation(2, 0, 0, 3);
+      tofFindTracks->SetStation(0, 0, 2, 4);
+      tofFindTracks->SetStation(1, 0, 1, 4);
+      tofFindTracks->SetStation(2, 0, 0, 4);
+      break;
+
+    case 5:  // for calibration of 2-stack and add-on counters (STAR2, BUC)
+      iMinNofHits   = 3;
+      iNStations    = 7;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(6, 0, 4, 1);
+      tofFindTracks->SetStation(1, 6, 0, 1);
+      tofFindTracks->SetStation(2, 9, 0, 0);
+      tofFindTracks->SetStation(3, 9, 0, 1);
+      tofFindTracks->SetStation(4, 6, 0, 0);
+      tofFindTracks->SetStation(5, 0, 3, 1);
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      break;
+
+    case 6:  // for double stack TSHU counter (900,901) evaluation
+      iMinNofHits   = 5;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 0, 3, 1);
+      tofFindTracks->SetStation(2, 9, 1, 1);
+      tofFindTracks->SetStation(3, 9, 1, 0);
+      tofFindTracks->SetStation(4, 5, 0, 0);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 7:  // for double stack USTC counter evaluation
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 0, 4, 1);
+      tofFindTracks->SetStation(1, 6, 0, 1);
+      tofFindTracks->SetStation(2, 6, 0, 0);
+      tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 8:  // evaluation of add-on counters (BUC)
+      iMinNofHits   = 5;
+      iNStations    = 6;
+      iNReqStations = 6;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 9, 0, 1);
+      tofFindTracks->SetStation(2, 0, 4, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 0, 3, 1);
+      tofFindTracks->SetStation(5, iDut, iDutSm, iDutRpc);
+      break;
+
+    case 9:  // calibration of Star2
+      iMinNofHits   = 4;
+      iNStations    = 5;
+      iNReqStations = 5;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(2, 9, 0, 1);
+      tofFindTracks->SetStation(1, 0, 4, 1);
+      tofFindTracks->SetStation(3, 9, 0, 0);
+      tofFindTracks->SetStation(4, 0, 3, 1);
+      break;
+
+    case 10:
+      iMinNofHits   = 3;
+      iNStations    = 4;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(3, 0, 1, 2);
+      tofFindTracks->SetStation(2, 0, 0, 2);
+      tofFindTracks->SetStation(1, 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                                    ===
+  // =========================================================================
+  CbmTofAnaTestbeam* tofAnaTestbeam =
+    new CbmTofAnaTestbeam("TOF TestBeam Analysis", iVerbose);
+  tofAnaTestbeam->SetCorMode(iAnaCor);  // 1 - DTD4, 2 - X4, 3 - Y4, 4 - Texp
+  tofAnaTestbeam->SetHitDistMin(30.);   // initialization
+  tofAnaTestbeam->SetEnableMatchPosScaling(kTRUE);
+  tofAnaTestbeam->SetSpillDuration(3.);
+  if (iMc == 1) {
+    tofAnaTestbeam->SetSpillDuration(0.);
+    tofAnaTestbeam->SetSpillBreak(0.);
+  }
+  //CbmTofAnaTestbeam defaults
+  tofAnaTestbeam->SetR0LimFit(
+    20.);  // limit distance of fitted track to nominal vertex
+  tofAnaTestbeam->SetStartSpillTime(0.);
+
+  tofAnaTestbeam->SetDXMean(0.);
+  tofAnaTestbeam->SetDYMean(0.);
+  tofAnaTestbeam->SetDTMean(0.);  // in ns
+  tofAnaTestbeam->SetDXWidth(0.5);
+  tofAnaTestbeam->SetDYWidth(0.8);
+  tofAnaTestbeam->SetDTWidth(0.08);  // in ns
+  tofAnaTestbeam->SetCalParFileName(cAnaFile);
+  Double_t dScalFacA = 0.9;  // dScalFac is used for tracking
+  tofAnaTestbeam->SetPosY4Sel(
+    0.5 * dScalFacA);  // Y Position selection in fraction of strip length
+  tofAnaTestbeam->SetDTDia(0.);    // Time difference to additional diamond
+  tofAnaTestbeam->SetMul0Max(20);  // Max Multiplicity in dut
+  tofAnaTestbeam->SetMul4Max(30);  // Max Multiplicity in Ref - RPC
+  tofAnaTestbeam->SetMulDMax(3);   // Max Multiplicity in Diamond / BeamRef
+  tofAnaTestbeam->SetTOffD4(14.);  // initialization
+  tofAnaTestbeam->SetDTD4MAX(
+    6.);  // initialization of Max time difference Ref - BRef
+
+  //tofAnaTestbeam->SetTShift(-28000.);// initialization
+  tofAnaTestbeam->SetPosYS2Sel(
+    0.55);  // 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->SetSel2TOff(0.);    // Shift Sel2 time peak to 0
+  tofAnaTestbeam->SetChi2Lim(5.);     // initialization of Chi2 selection limit
+  tofAnaTestbeam->SetChi2Lim2(
+    3.);  // initialization of Chi2 selection limit for Mref-Sel2 pair
+  tofAnaTestbeam->SetDutDX(
+    15.);  // limit inspection of tracklets to selected region
+  tofAnaTestbeam->SetDutDY(
+    15.);  // limit inspection of tracklets to selected region
+  tofAnaTestbeam->SetSIGLIM(3.);  // max matching chi2
+  tofAnaTestbeam->SetSIGT(0.08);  // in ns
+  tofAnaTestbeam->SetSIGX(0.3);   // in cm
+  tofAnaTestbeam->SetSIGY(0.6);   // in cm
+
+  Int_t iRSel    = 500;
+  Int_t iRSelTyp = 5;
+  Int_t iRSelSm  = 0;
+  Int_t iRSelRpc = 0;
+  /*
+   Int_t iRSel=31;
+   Int_t iRSelTyp=0;
+   Int_t iRSelSm=3;
+   Int_t iRSelRpc=1;
+   */
+
+  Int_t iRSelin = iRSel;
+
+
+  tofAnaTestbeam->SetBeamRefSmType(iRSelTyp);  // common reaction reference
+  tofAnaTestbeam->SetBeamRefSmId(iRSelSm);
+  tofAnaTestbeam->SetBeamRefRpc(iRSelRpc);
+
+  if (iSel2 >= -1) {
+    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
+  }
+
+  cout << "AnaTestbeam init for Dut " << iDut << iDutSm << iDutRpc << ", Ref "
+       << iRef << iRefSm << iRefRpc << endl;
+
+  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
+
+  cout << "dispatch iSel = " << iSel << ", iSel2in = " << iSel2in
+       << ", iRSelin = " << iRSelin << ", iRSel = " << iRSel << endl;
+
+  if (1) {
+    switch (iSel) {
+
+      case 10:
+        switch (iRSelin) {
+          case 500:
+            tofAnaTestbeam->SetTShift(2.5);  // Shift DTD4 to 0
+            tofAnaTestbeam->SetTOffD4(18.);  // Shift DTD4 to physical value
+            switch (iSel2in) {
+              case 20:
+                tofAnaTestbeam->SetSel2TOff(0.);  // Shift Sel2 time peak to 0
+                break;
+              default:;
+            }
+            break;
+          default:;
+        }
+        break;
+
+      case 700040:
+      case 900040:
+      case 901040:
+        switch (iRSelin) {
+          case 500:
+            tofAnaTestbeam->SetTShift(0.3);  // Shift DTD4 to 0
+            tofAnaTestbeam->SetTOffD4(18.);  // Shift DTD4 to physical value
+
+            switch (iSel2in) {
+              case 30:
+                tofAnaTestbeam->SetSel2TOff(-0.3);  // Shift Sel2 time peak to 0
+                break;
+              case 31:
+                tofAnaTestbeam->SetSel2TOff(
+                  -0.41);  // Shift Sel2 time peak to 0
+                break;
+
+              default:;
+            }
+            break;
+          default:;
+        }
+        break;
+
+      case 700041:
+      case 900041:
+      case 901041:
+      case 910041:
+      case 911041:
+        switch (iRSelin) {
+          case 500:
+            if (iMc == 0) {                     // data
+              tofAnaTestbeam->SetTShift(2.);   // Shift DTD4 to 0
+              tofAnaTestbeam->SetTOffD4(15.);  // Shift DTD4 to physical value
+            } else {                           // MC
+              tofAnaTestbeam->SetTShift(-2.);  // Shift DTD4 to 0
+              tofAnaTestbeam->SetTOffD4(15.);  // Shift DTD4 to physical value
+            }
+            switch (iSel2in) {
+              case 30:
+                tofAnaTestbeam->SetSel2TOff(-0.3);  // Shift Sel2 time peak to 0
+                break;
+              case 31:
+                if (iMc == 0) {
+                  switch (iRun) {
+                    case 727:
+                    case 726:
+                    case 723:
+                    case 721:
+                      tofAnaTestbeam->SetTShift(6.5);  // Shift DTD4 to 0
+                      tofAnaTestbeam->SetSel2TOff(
+                        0.6);  // Shift Sel2 time peak to 0
+                      break;
+                    case 717:
+                    default:  // 714
+                      //tofAnaTestbeam->SetSel2TOff(-1.3);  // Shift Sel2 time peak to 0
+                      tofAnaTestbeam->SetSel2TOff(
+                        -0.5);  // Shift Sel2 time peak to 0
+                  }
+                } else {  // MC
+                  tofAnaTestbeam->SetSel2TOff(
+                    -1.3);  // Shift Sel2 time peak to 0
+                }
+                break;
+              case 600:
+                tofAnaTestbeam->SetSel2TOff(-0.2);  // Shift Sel2 time peak to 0
+                break;
+
+              default:;
+            }
+            break;
+          default:;
+        }
+        break;
+
+      case 600041:
+      case 601041:
+        switch (iRSelin) {
+          case 500:
+            tofAnaTestbeam->SetTShift(5.3);  // Shift DTD4 to 0
+            tofAnaTestbeam->SetTOffD4(11.);  // Shift DTD4 to physical value
+
+            switch (iSel2in) {
+              case 33:
+                tofAnaTestbeam->SetSel2TOff(
+                  -0.55);  // Shift Sel2 time peak to 0
+                break;
+
+              default:;
+            }
+            break;
+          default:;
+        }
+        break;
+
+      case 12022:
+        switch (iRSelin) {
+          case 500:
+            tofAnaTestbeam->SetTShift(3.);   // Shift DTD4 to 0
+            tofAnaTestbeam->SetTOffD4(15.);  // Shift DTD4 to physical value
+
+            switch (iSel2in) {
+              case 2:
+                tofAnaTestbeam->SetSel2TOff(0.25);  // Shift Sel2 time peak to 0
+                break;
+
+              default:;
+            }
+            break;
+          default:;
+        }
+        break;
+
+      default:
+        cout << "Better to define analysis setup! Running with default offset "
+                "parameter... "
+             << endl;
+        // return;
+    }  // end of different subsets
+
+    cout << " Initialize TSHIFT to " << tofAnaTestbeam->GetTShift() << endl;
+    run->AddTask(tofAnaTestbeam);
+  }
+
+  // -----  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);
+
+  // -----   Intialise and run   --------------------------------------------
+  run->Init();
+  cout << "Starting run" << endl;
+  run->Run(0, nEvents);
+  //run->Run(nEvents-1, nEvents); //debugging single events for memory leak
+  // ------------------------------------------------------------------------
+  TString SaveToHstFile = "save_hst(\"" + cHstFile + "\")";
+  gROOT->LoadMacro("save_hst.C");
+  gInterpreter->ProcessLine(SaveToHstFile);
+
+  // default displays, plot results
+
+  TString Display_Status = "pl_over_Mat04D4best.C";
+  TString Display_Funct;
+  if (iGenCor < 0) {
+    Display_Funct = "pl_over_Mat04D4best(1)";
+  } else {
+    Display_Funct = "pl_over_Mat04D4best(0)";
+  }
+  gROOT->LoadMacro(Display_Status);
+
+  cout << "Exec " << Display_Funct.Data() << endl;
+  gInterpreter->ProcessLine(Display_Funct);
+
+  gROOT->LoadMacro("pl_over_MatD4sel.C");
+  gROOT->LoadMacro("pl_eff_XY.C");
+  gROOT->LoadMacro("pl_over_trk.C");
+  gROOT->LoadMacro("pl_calib_trk.C");
+  gROOT->LoadMacro("pl_XY_trk.C");
+  gROOT->LoadMacro("pl_vert_trk.C");
+  gROOT->LoadMacro("pl_pull_trk.C");
+  gROOT->LoadMacro("pl_all_Track2D.C");
+  gROOT->LoadMacro("pl_TIS.C");
+  gROOT->LoadMacro("pl_TIR.C");
+  gROOT->LoadMacro("pl_Eff_XY.C");
+  gROOT->LoadMacro("pl_Eff_DTLH.C");
+  gROOT->LoadMacro("pl_Eff_TIS.C");
+  gROOT->LoadMacro("pl_Dut_Res.C");
+  gROOT->LoadMacro("pl_Dut_Vel.C");
+
+  cout << "Plotting for Dut " << iDut << iDutSm << iDutRpc << ", Ref " << iRef
+       << iRefSm << iRefRpc << endl;
+
+  gInterpreter->ProcessLine("pl_over_MatD4sel()");
+  gInterpreter->ProcessLine("pl_TIS()");
+  gInterpreter->ProcessLine("pl_TIR()");
+  gInterpreter->ProcessLine(
+    Form("pl_Dut_Vel(\"%d%d%d\")", iDut, iDutSm, iDutRpc));
+  gInterpreter->ProcessLine("pl_eff_XY()");
+  gInterpreter->ProcessLine("pl_calib_trk()");
+  gInterpreter->ProcessLine("pl_vert_trk()");
+
+  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);
+
+  TString XY_trk = "pl_XY_trk(" + (TString)(Form("%d", iNStations)) + ")";
+  gInterpreter->ProcessLine(XY_trk);
+
+  TString Pull0 = (TString)(Form("pl_pull_trk(%d,%d,1)", iNStations, 0));
+  gInterpreter->ProcessLine(Pull0);
+  TString Pull1 = (TString)(Form("pl_pull_trk(%d,%d,1)", iNStations, 1));
+  gInterpreter->ProcessLine(Pull1);
+  TString Pull3 = (TString)(Form("pl_pull_trk(%d,%d,1)", iNStations, 3));
+  gInterpreter->ProcessLine(Pull3);
+  TString Pull4 = (TString)(Form("pl_pull_trk(%d,%d,1)", iNStations, 4));
+  gInterpreter->ProcessLine(Pull4);
+}
diff --git a/macro/beamtime/mcbm2021/calib_batch.sh b/macro/beamtime/mcbm2021/calib_batch.sh
new file mode 100644
index 0000000000000000000000000000000000000000..e74eb4e06f32f007f0513371ada2ad4bd1909906
--- /dev/null
+++ b/macro/beamtime/mcbm2021/calib_batch.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+#SBATCH -J calib
+#SBATCH -D /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+#SBATCH --time=6-00:00:00
+#SBATCH --mem=4000
+#SBATCH --partition=long
+
+X=$((${SLURM_ARRAY_TASK_ID} - 0))
+XXX=$(printf "%03d" "$X")
+
+CalSet="$1"
+if [[ ${CalSet} = "" ]]; then
+  echo please specify CalSet!
+  return
+fi
+
+Sel2="$2"
+if [[ ${Sel2} = "" ]]; then
+  echo please specify Sel2!
+  return
+fi
+
+RunId="$3"
+if [[ ${RunId} = "" ]]; then
+RunList1=' 
+20161121_2133_run1_gdpb
+'
+    I=1
+    RunId=""
+    for RunId in $RunList1
+    do
+    #echo check $RunId
+     if (($I == $X)); then
+       echo found RunId $RunId
+       break
+     fi
+     ((I=$I+1))
+    done
+fi
+
+CalMode="$4"
+if [[ ${CalMode} = "" ]]; then
+#CalMode="_DT200_0x00005006"
+#CalMode="_DT50_0x00005006"
+#CalMode="_DT50_0x00000000"
+#CalMode="_DT50_0x00019026"
+#CalMode="_DT50_Req5"
+#CalMode="_DT50_Req0"
+#CalMode="_DT50000_Req-3"
+#CalMode="_DT50000_Req-4"
+#CalMode="_DT26000_Req-4"
+CalMode=".100.3" 
+#CalMode="_DT100_Req-4"
+#CalMode="_DT50_Req-3"
+#CalMode="_DT50_Req-2"
+fi
+
+RunIdMode=`echo $RunId$CalMode`
+Deadtime=50
+
+echo define root execution environment at I=$I for Run $RunId Mode $RunIdMode
+
+if [ -e /lustre/nyx ]; then
+source /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build6/config.sh 
+wdir=/lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+outdir=/lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021${RunId}
+else 
+wdir=`pwd`
+outdir=${wdir}/${RunId}
+fi
+mkdir ${outdir}
+
+cd  ${wdir}
+echo execute: ./init_cal_all.sh ${RunIdMode} ${CalSet} ${Deadtime}
+source ./init_cal_all.sh ${RunIdMode} ${CalSet} ${Deadtime}
+#echo execute: ./init_calib_star.sh ${RunIdMode} ${CalSet} ${Deadtime}
+#source ./init_calib_star.sh ${RunIdMode} ${CalSet} ${Deadtime}
+
+cd  ${wdir}
+#echo execute: ./iter_calib.sh ${RunIdMode} ${CalSet} ${Sel2} ${Deadtime}
+#source ./iter_calib.sh ${RunIdMode} ${CalSet} ${Sel2} ${Deadtime}
+
+cd  ${wdir}
+echo execute: ./gen_hits.sh ${RunIdMode} ${CalSet} ${Sel2} ${Deadtime}
+source ./gen_hits.sh ${RunIdMode} ${CalSet} ${Sel2} ${Deadtime}
+
+mv -v slurm-${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID}.out ${outdir}/Calib_${RunIdMode}_${CalSet}_${Sel2}.out
diff --git a/macro/beamtime/mcbm2021/dis_digi.C b/macro/beamtime/mcbm2021/dis_digi.C
new file mode 100644
index 0000000000000000000000000000000000000000..69dd4706c8fab8f8d0d81cef67ac7d6d0e6b7c59
--- /dev/null
+++ b/macro/beamtime/mcbm2021/dis_digi.C
@@ -0,0 +1,865 @@
+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 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";
+  TString logLevel = "INFO";
+  //TString logLevel = "DEBUG";
+  //TString logLevel = "DEBUG1";
+  //TString logLevel = "DEBUG2";
+  //TString logLevel = "DEBUG3";
+  FairLogger::GetLogger();
+  gLogger->SetLogScreenLevel(logLevel);
+  //gLogger->SetLogScreenLevel("DEBUG");
+  gLogger->SetLogVerbosityLevel("MEDIUM");
+
+  TString workDir = gSystem->Getenv("VMCWORKDIR");
+  /*
+   TString workDir    = (TString)gInterpreter->ProcessLine(".! pwd");
+   cout << "workdir = "<< workDir.Data() << endl;
+   return;
+  */
+  //   TString paramDir   = workDir + "/macro/beamtime/mcbm2019/";
+  TString paramDir   = "./";
+  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 shcmd = "rm -v " + ParFile;
+  gSystem->Exec(shcmd.Data());
+
+  Int_t iGeo = 0;  //iMc;
+  if (iGeo == 0) {
+    TString TofGeo = "";
+    if (iRun < 690)
+      TofGeo = "v20a_mcbm";
+    else
+      TofGeo = "v21a_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");
+    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");
+    }
+  }
+
+  // Local steering variables
+  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;
+  if (iSel2 == 0) {
+    iRSel = iBRef;  // use diamond
+    iSel2 = iBRef;
+  } else {
+    if (iSel2 < 0) iSel2 = -iSel2;
+    iRSel = iSel2;
+  }
+
+  iRSelRpc = iRSel % 10;
+  iRSelTyp = (iRSel - iRSelRpc) / 10;
+  iRSelSm  = iRSelTyp % 10;
+  iRSelTyp = (iRSelTyp - iRSelSm) / 10;
+
+  Int_t iSel2in  = iSel2;
+  Int_t iSel2Rpc = iSel2 % 10;
+  iSel2          = (iSel2 - iSel2Rpc) / 10;
+  Int_t iSel2Sm  = iSel2 % 10;
+  iSel2          = (iSel2 - iSel2Sm) / 10;
+
+  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;
+
+  Int_t iRefRpc = iRef % 10;
+  iRef          = (iRef - iRefRpc) / 10;
+  Int_t iRefSm  = iRef % 10;
+  iRef          = (iRef - iRefSm) / 10;
+
+  // -----   Reconstruction run   -------------------------------------------
+  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_tofAna.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);
+
+  // =========================================================================
+  // ===                       Tracking                                    ===
+  // =========================================================================
+
+  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;
+  }
+
+  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    = 30;
+      iNReqStations = 4;
+      tofFindTracks->SetStation(0, 5, 0, 0);
+      tofFindTracks->SetStation(1, 0, 2, 2);
+      tofFindTracks->SetStation(2, 0, 1, 2);
+      tofFindTracks->SetStation(3, 0, 0, 2);
+      tofFindTracks->SetStation(4, 0, 2, 1);
+      tofFindTracks->SetStation(5, 0, 1, 1);
+      tofFindTracks->SetStation(6, 0, 0, 1);
+      tofFindTracks->SetStation(7, 0, 2, 3);
+      tofFindTracks->SetStation(8, 0, 1, 3);
+      tofFindTracks->SetStation(9, 0, 0, 3);
+      tofFindTracks->SetStation(10, 0, 2, 0);
+      tofFindTracks->SetStation(11, 0, 1, 0);
+      tofFindTracks->SetStation(12, 0, 0, 0);
+      tofFindTracks->SetStation(13, 0, 2, 4);
+      tofFindTracks->SetStation(14, 0, 1, 4);
+      tofFindTracks->SetStation(15, 0, 0, 4);
+      tofFindTracks->SetStation(16, 0, 4, 0);
+      tofFindTracks->SetStation(17, 0, 3, 0);
+      tofFindTracks->SetStation(18, 0, 4, 1);
+      tofFindTracks->SetStation(19, 0, 3, 1);
+      tofFindTracks->SetStation(20, 0, 4, 2);
+      tofFindTracks->SetStation(21, 0, 3, 2);
+      tofFindTracks->SetStation(22, 0, 4, 3);
+      tofFindTracks->SetStation(23, 0, 3, 3);
+      tofFindTracks->SetStation(24, 0, 4, 4);
+      tofFindTracks->SetStation(25, 0, 3, 4);
+      tofFindTracks->SetStation(26, 9, 0, 0);
+      tofFindTracks->SetStation(27, 9, 1, 0);
+      tofFindTracks->SetStation(28, 9, 0, 1);
+      tofFindTracks->SetStation(29, 9, 1, 1);
+      //tofFindTracks->SetStation(28, 6, 0, 0);
+      //tofFindTracks->SetStation(29, 6, 0, 1);
+      break;
+
+    case 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);         
+     tofFindTracks->SetStation(19, 0, 4, 1);
+     tofFindTracks->SetStation(20, 0, 3, 3);         
+     tofFindTracks->SetStation(21, 0, 4, 3);
+     tofFindTracks->SetStation(22, 0, 3, 0);         
+     tofFindTracks->SetStation(23, 0, 4, 0);
+     tofFindTracks->SetStation(24, 0, 3, 4);         
+     tofFindTracks->SetStation(25, 0, 4, 4); 
+     */
+      break;
+
+    case 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);
+
+  //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(kTRUE);
+
+  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
+
+  tofAnaTestbeam->SetBeamRefSmType(iRSelTyp);  // common reaction reference
+  tofAnaTestbeam->SetBeamRefSmId(iRSelSm);
+  tofAnaTestbeam->SetBeamRefRpc(iRSelRpc);
+
+  if (iSel2 > -1) {
+    tofClust->SetSel2Id(iSel2);
+    tofClust->SetSel2Sm(iSel2Sm);
+    tofClust->SetSel2Rpc(iSel2Rpc);
+
+    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
+  }
+
+  tofClust->SetDutId(iDut);
+  tofClust->SetDutSm(iDutSm);
+  tofClust->SetDutRpc(iDutRpc);
+
+  tofClust->SetSelId(iRef);
+  tofClust->SetSelSm(iRefSm);
+  tofClust->SetSelRpc(iRefRpc);
+
+  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
+  cout << "Run with iRSel = " << iRSel << ", iSel2 = " << iSel2in << endl;
+
+  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);
+  fMan->AddTask(Tracks);
+  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);
+
+
+  TGeoVolume* top = gGeoManager->GetTopVolume();
+  gGeoManager->SetVisOption(1);
+  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();
+    //    cout << " GeoVolume "<<i<<" Name: "<< name << endl;
+    vol->SetTransparency(90);
+    /* switch (char *) not allowed any more in root 6 :(
+    switch(name.Data()) {
+    case "counter":
+      vol->SetTransparency(95);
+      break;
+
+    case "tof_glass":
+    case "Gap":
+    case "Cell":
+      vol->SetTransparency(99);
+      break;
+
+    case "pcb":
+      vol->SetTransparency(30);
+      break;
+
+    default:
+      vol->SetTransparency(96);
+    }
+    */
+  }
+  //  gGeoManager->SetVisLevel(3);
+  //  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
+  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();
+    }
+  }
+
+  // -----   Intialise and run   --------------------------------------------
+  // run->Init();
+  //  cout << "Starting run" << endl;
+  //  run->Run(0, nEvents);
+  // ------------------------------------------------------------------------
+  // default display
+  /*
+  TString Display_Status = "pl_over_Mat04D4best.C";
+  TString Display_Funct = "pl_over_Mat04D4best()";  
+  gROOT->LoadMacro(Display_Status);
+
+  gROOT->LoadMacro("fit_ybox.h");
+  gROOT->LoadMacro("pl_all_CluMul.C");
+  gROOT->LoadMacro("pl_all_CluRate.C");
+  gROOT->LoadMacro("pl_over_cluSel.C");
+  gROOT->LoadMacro("pl_over_clu.C");
+  gROOT->LoadMacro("pl_all_dTSel.C");
+  gROOT->LoadMacro("pl_over_MatD4sel.C");
+  gROOT->LoadMacro("save_hst.C");
+
+  switch(iSet){
+    default:
+  case 0:
+  case 3:
+  case 49:
+  case 79:
+  case 34:
+  case 94:
+  case 37:
+  case 97:
+  case 39:
+  case 99:
+  case 93:
+  case 300400:
+  case 400300:
+  case 910900:
+  case 300900:
+  case 400900:
+  case 901900:
+  case 921920:
+  case 300921:
+  case 920921:
+  case 920300:
+  case 921300:
+
+    gInterpreter->ProcessLine("pl_over_clu(6)");
+    gInterpreter->ProcessLine("pl_over_clu(6,0,1)");
+    gInterpreter->ProcessLine("pl_over_clu(9,0,0)");
+    gInterpreter->ProcessLine("pl_over_clu(9,0,1)");
+    gInterpreter->ProcessLine("pl_over_clu(9,1,0)");
+    gInterpreter->ProcessLine("pl_over_clu(9,1,1)");
+    gInterpreter->ProcessLine("pl_over_clu(9,2,0)");
+    gInterpreter->ProcessLine("pl_over_clu(9,2,1)");
+    gInterpreter->ProcessLine("pl_over_cluSel(0,6,0,0)");
+    gInterpreter->ProcessLine("pl_over_cluSel(0,6,0,1)");
+    gInterpreter->ProcessLine("pl_over_cluSel(0,9,0,0)");
+    gInterpreter->ProcessLine("pl_over_cluSel(0,9,0,1)");
+    gInterpreter->ProcessLine("pl_over_cluSel(0,9,1,0)");
+    gInterpreter->ProcessLine("pl_over_cluSel(0,9,1,1)");
+    gInterpreter->ProcessLine("pl_over_cluSel(0,9,2,0)");
+    gInterpreter->ProcessLine("pl_over_cluSel(0,9,2,1)");
+    gInterpreter->ProcessLine("pl_over_cluSel(1,6,0,0)");
+    gInterpreter->ProcessLine("pl_over_cluSel(1,6,0,1)");
+    gInterpreter->ProcessLine("pl_over_cluSel(1,9,0,0)");
+    gInterpreter->ProcessLine("pl_over_cluSel(1,9,0,1)");
+    gInterpreter->ProcessLine("pl_over_cluSel(1,9,1,0)");
+    gInterpreter->ProcessLine("pl_over_cluSel(1,9,1,1)");
+    gInterpreter->ProcessLine("pl_over_cluSel(1,9,2,0)");
+    gInterpreter->ProcessLine("pl_over_cluSel(1,9,2,1)");
+    gInterpreter->ProcessLine("pl_all_CluMul()");
+    gInterpreter->ProcessLine("pl_all_CluRate()");
+    gInterpreter->ProcessLine("pl_all_dTSel()");
+    TString FSave=Form("save_hst(\"cosdev-status%d_%d_Cal_%s.hst.root\")",iCalSet,iSel2in,cCalId.Data());
+    gInterpreter->ProcessLine(FSave.Data());
+    //gInterpreter->ProcessLine("pl_over_MatD4sel()");
+    break;
+    ;
+  }
+  gInterpreter->ProcessLine(Display_Funct);
+  */
+}
diff --git a/macro/beamtime/mcbm2021/eval_tracks.sh b/macro/beamtime/mcbm2021/eval_tracks.sh
new file mode 100755
index 0000000000000000000000000000000000000000..06de379c546fd3f7b4fa4e4996d11bf103cffffb
--- /dev/null
+++ b/macro/beamtime/mcbm2021/eval_tracks.sh
@@ -0,0 +1,145 @@
+#!/bin/bash
+# shell script to iterate tracklet calibration histograms
+#SBATCH -J eval_tracks
+#SBATCH -D /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+#SBATCH --time=6-00:00:00
+#SBATCH --mem=4000
+#SBATCH --partition=long
+
+X=$((${SLURM_ARRAY_TASK_ID} - 0))
+XXX=$(printf "%03d" "$X")
+
+cRun=$1
+iDut=$2 
+iRef=$3 
+iSel2=$4
+((iSel=$iDut*1000+$iRef))
+iTraSetup=$5
+
+cSet=$6
+if [[ ${cSet} = "" ]]; then
+    cSet="030040500_500"
+fi
+   
+# extract iCalSet from cSet
+i1=0
+while [ "${cSet:$i1:1}" = "0" ]; do
+(( i1 += 1 ))
+done
+i2=0
+while [ "${cSet:$i2:1}" != "_" ] && [ $i2 -lt  ${#cSet} ]; do
+(( i2 += 1 ))
+done
+(( i2 -= i1 ))
+iCalSet=${cSet:$i1:$i2}
+echo got i1=$i1, i2=$i2, iCalSet=$iCalSet from $cSet
+
+CalIdMode=$7
+if [[ ${CalIdMode} = "" ]]; then
+    echo use native calibration file
+    cCalId=$cRun;
+else
+    cCalId=${CalIdMode}
+fi
+
+cCalRef=$8
+if [[ ${cCalRef} = "" ]]; then
+    cCalRef=${cSet:0:9};
+    echo use default CalSet $cCalRef
+fi
+
+dDTres=10000000
+nEvt=1000000
+
+cSel2=$iSel2;
+if [[ $iSel2 < 100 ]]; then
+    cSel2="0"$iSel2
+    if [[ $iSel2 < 10 ]]; then
+	cSel2="00"$iSel2
+    fi
+fi
+
+iMc=0
+McId=${cRun:0:4}
+if [ "$McId" = "mcbm" ]; then 
+  echo processing MC simulation
+  iMc=1
+fi
+  
+if [ -e /lustre/cbm ]; then
+source /lustre/cbm/users/nh/CBM/cbmroot/trunk/build/config.sh 
+wdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+outdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/${cRun}
+else 
+wdir=`pwd`
+outdir=${wdir}/${cRun}
+fi
+
+# frange2 limits chi2
+fRange2=2.5
+
+#frange1 limits DT spectrum range 
+fRange1=0.9
+dDeadtime=50
+#./gen_digi.sh 600.100.5.0 30040500 500 50    600.100.5.0  30040500
+#./gen_digi.sh $cRun $iCalSet $iSel2 $Deadtime $CalIdMode CalIdSet
+
+cd $wdir 
+echo look for calfile: ls -1 ${cCalId}*set${cCalRef}_93_1tofClust.hst.root
+digiCalFile=`ls -1 ./${cCalId}*set${cCalRef}_93_1tofClust.hst.root`
+DigiCalFile=`pwd`/$digiCalFile
+echo DigiCalFile=$DigiCalFile
+
+if [ ! -e ${cRun} ]; then 
+  mkdir $cRun
+fi
+cd ${cRun}
+mkdir             Ana_${cSet}_${iSel}_${cSel2}_${iTraSetup}
+cp ../rootlogon.C Ana_${cSet}_${iSel}_${cSel2}_${iTraSetup}/
+cp ../.rootrc     Ana_${cSet}_${iSel}_${cSel2}_${iTraSetup}/
+
+cd Ana_${cSet}_${iSel}_${cSel2}_${iTraSetup}
+rm -v  *AnaTestBeam.hst.root
+cp -v ../../${cCalId}_tofFindTracks.hst.root .
+echo create symbolic link to DigiCalFile $DigiCalFile in `pwd`
+rm -v ./$digiCalFile
+ln -s -v $DigiCalFile ./$digiCalFile
+
+while [[ $dDTres > 0 ]]; do
+
+for iCal in 1 2 3 5 6 7 8 1
+do
+
+root -b -q '../../ana_trks_eval.C('$nEvt','$iSel',-1,"'$cRun'","'$cSet'",'$iSel2','$iTraSetup','$fRange1','$fRange2','$dDeadtime',"'$cCalId'",'$iCal',0,'$iCalSet',0,'$iMc')'
+mv -v tofAnaTestBeam.hst.root ${cRun}_TrkAnaTestBeam.hst.root
+rm all_*
+
+if (! (test -f Test.res)); then
+  echo no resolution file available: exit
+  exit 1
+fi
+done
+
+Tres=`cat Test.res`
+dTdif=`echo "$dDTres - $Tres" | bc`
+dDTres=`echo "$dDTres - 0.005" | bc`
+compare_result=`echo "$Tres < $dDTres" | bc`
+
+echo got Tres = $Tres, compare to $dDTres, dTdif = $dTdif, compare_result = $compare_result
+
+if [[ $compare_result > 0 ]]; then
+dDTres=$Tres
+else
+dDTres=0
+fi
+
+done
+
+# final action -> scan full statistics 
+iCal=1
+root -b -q '../../ana_trks_eval.C(-1,'$iSel',-1,"'$cRun'","'$cSet'",'$iSel2','$iTraSetup','$fRange1','$fRange2','$dDeadtime',"'$cCalId'",'$iCal',0,'$iCalSet',1,'$iMc')'
+rm all_*
+cd ../..
+
+#mv -v slurm-${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID}.out ${outdir}/IterTrack_${cRun}_${cSet}.out
+mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/EvalTrack_${cRun}_${cSet}_${iSel}_${iSel2}_${iTraSetup}.out
diff --git a/macro/beamtime/mcbm2021/gen_digi.sh b/macro/beamtime/mcbm2021/gen_digi.sh
new file mode 100755
index 0000000000000000000000000000000000000000..ef0ea3052f4d9b88c48fbf728fcdd3c0a5ef88ee
--- /dev/null
+++ b/macro/beamtime/mcbm2021/gen_digi.sh
@@ -0,0 +1,93 @@
+#!/bin/bash
+# shell script to apply clusterizer calibrations
+#SBATCH -J gen_digi
+#SBATCH -D /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+#SBATCH --time=8:00:00
+#SBATCH --mem=2000
+##SBATCH --partition=long
+cRun=$1
+
+iCalSet=$2
+((iTmp  = $iCalSet ))
+((iBRef = $iTmp % 1000))
+((iTmp  = $iTmp - $iBRef))
+((iSet  = $iTmp / 1000))
+((iRef  = $iTmp % 1000000))
+((iRef  = $iRef / 1000))
+((iTmp  = $iTmp - $iRef))
+((iDut  = $iTmp / 1000000))
+
+iSel2=$3
+
+cCalSet=$iCalSet
+if (( iCalSet<100000000 )); then 
+cCalSet="0"$iCalSet
+fi
+if (( iCalSet<10000000 )); then 
+cCalSet="00"$iCalSet
+fi
+if (( iCalSet<1000000 )); then 
+cCalSet="000"$iCalSet
+fi
+if (( iCalSet<100000 )); then 
+cCalSet="0000"$iCalSet
+fi
+echo cCalSet = $cCalSet
+
+Deadtime=$4
+if [[ ${Deadtime} = "" ]]; then
+Deadtime=50.
+fi
+
+CalIdMode=$5
+if [[ ${CalIdMode} = "" ]]; then
+ echo use native calibration file 
+ CalIdMode=${cRun}
+ CalFile=${cRun}_set${cCalSet}_93_1tofClust.hst.root
+else 
+ CalFile=${CalIdMode}_set${cCalSet}_93_1tofClust.hst.root
+ RunFile=${cRun}_set${cCalSet}_93_1tofClust.hst.root
+# rm ${RunFile}
+# ln -s ${CalFile} ${RunFile} 
+ echo use calibrations from  ${CalFile}
+fi
+
+CalIdSet=$6
+if [[ ${CalIdSet} = "" ]]; then
+    echo use native calibration file
+    CalIdSet=$cCalSet
+else
+    CalFile=${CalIdMode}_set${CalIdSet}_93_1tofClust.hst.root    
+fi
+
+Nevt=$7
+if [[ ${Nevt} = "" ]]; then
+    echo use all events
+    Nevt=-1
+fi
+
+echo gen_digi for $cRun with iDut=$iDut, iRef=$iRef, iSet=$iCalSet, iSel2=$iSel2, iBRef=$iBRef, Deadtime=$Deadtime, CalFile=$CalFile
+
+if [ -e /lustre/cbm ]; then
+source /lustre/cbm/users/nh/CBM/cbmroot/trunk/build/config.sh 
+wdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+outdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/${cRun}
+else 
+wdir=`pwd`
+outdir=${wdir}/${cRun}
+fi
+
+cd $wdir
+mkdir $cRun
+cd    $cRun 
+cp    ../.rootrc .
+cp    ../rootlogon.C .
+cp -v ../${CalFile}  .
+#root -b -q '../ana_digi_cal.C(100000,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+root -b -q '../ana_digi_cal_all.C('$Nevt',93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+#root -b -q '../ana_digi_cos.C(-1,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+#root -b -q '../ana_digi_star.C(-1,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+
+cd ..
+
+mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/GenDigi_${cRun}_${iCalSet}_${iSel2}_${CalIdMode}.out
diff --git a/macro/beamtime/mcbm2021/gen_hits.sh b/macro/beamtime/mcbm2021/gen_hits.sh
new file mode 100755
index 0000000000000000000000000000000000000000..d2329381c2b7a3119a4e00988a19938d3717a3af
--- /dev/null
+++ b/macro/beamtime/mcbm2021/gen_hits.sh
@@ -0,0 +1,93 @@
+#!/bin/bash
+# shell script to apply clusterizer calibrations
+#SBATCH -J gen_hits
+#SBATCH -D /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+#SBATCH --time=8:00:00
+#SBATCH --mem=2000
+##SBATCH --partition=long
+cRun=$1
+
+iCalSet=$2
+((iTmp  = $iCalSet ))
+((iBRef = $iTmp % 1000))
+((iTmp  = $iTmp - $iBRef))
+((iSet  = $iTmp / 1000))
+((iRef  = $iTmp % 1000000))
+((iRef  = $iRef / 1000))
+((iTmp  = $iTmp - $iRef))
+((iDut  = $iTmp / 1000000))
+
+iSel2=$3
+
+cCalSet=$iCalSet
+if (( iCalSet<100000000 )); then 
+cCalSet="0"$iCalSet
+fi
+if (( iCalSet<10000000 )); then 
+cCalSet="00"$iCalSet
+fi
+if (( iCalSet<1000000 )); then 
+cCalSet="000"$iCalSet
+fi
+if (( iCalSet<100000 )); then 
+cCalSet="0000"$iCalSet
+fi
+echo cCalSet = $cCalSet
+
+Deadtime=$4
+if [[ ${Deadtime} = "" ]]; then
+Deadtime=50.
+fi
+
+CalIdMode=$5
+if [[ ${CalIdMode} = "" ]]; then
+ echo use native calibration file 
+ CalIdMode=${cRun}
+ CalFile=${cRun}_set${cCalSet}_93_1tofClust.hst.root
+else 
+ CalFile=${CalIdMode}_set${cCalSet}_93_1tofClust.hst.root
+ RunFile=${cRun}_set${cCalSet}_93_1tofClust.hst.root
+# rm ${RunFile}
+# ln -s ${CalFile} ${RunFile} 
+ echo use calibrations from  ${CalFile}
+fi
+
+CalIdSet=$6
+if [[ ${CalIdSet} = "" ]]; then
+    echo use native calibration file
+    CalIdSet=$cCalSet
+else
+    CalFile=${CalIdMode}_set${CalIdSet}_93_1tofClust.hst.root    
+fi
+
+Nevt=$7
+if [[ ${Nevt} = "" ]]; then
+    echo use all events
+    Nevt=-1
+fi
+
+echo gen_hits for $cRun with iDut=$iDut, iRef=$iRef, iSet=$iCalSet, iSel2=$iSel2, iBRef=$iBRef, Deadtime=$Deadtime, CalFile=$CalFile
+
+if [ -e /lustre/cbm ]; then
+source /lustre/cbm/users/nh/CBM/cbmroot/trunk/build/config.sh 
+wdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+outdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/${cRun}
+else 
+wdir=`pwd`
+outdir=${wdir}/${cRun}
+fi
+
+cd $wdir
+mkdir $cRun
+cd    $cRun 
+cp    ../.rootrc .
+cp    ../rootlogon.C .
+cp -v ../${CalFile}  .
+#root -b -q '../ana_digi_cal.C(100000,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+root -b -q '../ana_digi_cal_all.C('$Nevt',93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+#root -b -q '../ana_digi_cos.C(-1,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+#root -b -q '../ana_digi_star.C(-1,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+
+cd ..
+
+mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/GenHits_${cRun}_${iCalSet}_${iSel2}_${CalIdMode}.out
diff --git a/macro/beamtime/mcbm2021/init_cal_all.sh b/macro/beamtime/mcbm2021/init_cal_all.sh
new file mode 100755
index 0000000000000000000000000000000000000000..50e156480587fe2c9a7bbe0e07dcea2ceb2ae680
--- /dev/null
+++ b/macro/beamtime/mcbm2021/init_cal_all.sh
@@ -0,0 +1,146 @@
+#!/bin/bash
+# shell script to initialize clusterizer calibrations
+#SBATCH -J calall
+#SBATCH -D /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+#SBATCH --time=8:00:00
+##SBATCH --time=6-00:00:00
+#SBATCH --mem=2000
+##SBATCH --partition=long
+cRun=$1
+
+echo 'Initialize clusterizer calibration for run '$cRun
+
+iCalSet=$2
+((iTmp  = $iCalSet ))
+((iBRef = $iTmp % 1000))
+((iTmp  = $iTmp - $iBRef))
+((iSet  = $iTmp / 1000))
+((iMRef = $iTmp % 1000000))
+((iMRef = $iMRef / 1000))
+((iTmp  = $iTmp - $iMRef))
+((iDut  = $iTmp / 1000000))
+echo Calib setup is ${iCalSet}, iSet=$iSet, iDut=$iDut, iMRef=$iMRef, iBRef=$iBRef
+cCalSet=$iCalSet
+if (( iCalSet<100000000 )); then 
+cCalSet="0"$iCalSet
+fi
+if (( iCalSet<10000000 )); then 
+cCalSet="00"$iCalSet
+fi
+if (( iCalSet<1000000 )); then 
+cCalSet="000"$iCalSet
+fi
+if (( iCalSet<100000 )); then 
+cCalSet="0000"$iCalSet
+fi
+echo cCalSet = $cCalSet
+#iSet=0
+#lastOpt=''
+nEvi0=50000 # start value965311965311
+nEvi1=50000 # increment 
+
+if [ -e /lustre ]; then
+source /lustre/cbm/users/nh/CBM/cbmroot/trunk/build/config.sh 
+wdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+outdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/${cRun}
+else 
+wdir=`pwd`
+outdir=${wdir}/${cRun}
+fi
+mkdir ${outdir}
+
+cd  ${wdir}
+mkdir ${cRun}
+cp rootlogon.C ${cRun}
+cp .rootrc ${cRun}
+cd ${cRun}
+
+# Global variables, for for-loops
+iRestart=0
+#iRestart=33
+iStep=0
+iStepLast=0
+iCalSel0=0
+iCalSel1=1
+#iCalSel0=-3 #0
+#iCalSel1=-4 #1
+# ************************** Starting while Loop ***************************** #
+(( nEvi = nEvi0 + 10*nEvi1 ))
+optList=""
+optList=`echo " $nEvi,93,1,$iMRef,0 "`$optList 
+icalmod=3
+for icallev in 8 8 7 7 6 5 4 4 3 3 1
+do
+    (( nEvi = nEvi0 + (icallev-1)*nEvi1 ))
+    optList=`echo " $nEvi,$icallev$icalmod,$iCalSel0,$iDut,0 "`$optList
+    if [ $iMRef -ne 14 ]; then 
+	  optList=`echo " $nEvi,$icallev$icalmod,$iCalSel1,$iMRef,0 "`$optList
+    else 
+	  for iMod in 40  10 
+	  do
+	    if [ $iMod -ne $iDut ]; then
+		  optList=`echo " $nEvi,$icallev$icalmod,$iCalSel1,$iMod,0 "`$optList
+	    fi
+	  done
+    fi
+    if [ $icallev -lt 7 ]; then
+      optList=`echo " $nEvi,$icallev$icalmod,$iCalSel0,$iBRef,50 "`$optList 
+      optList=`echo " $nEvi,$icallev$icalmod,$iCalSel1,$iBRef,50 "`$optList
+    else
+#      optList=`echo " $nEvi,$icallev$icalmod,-2,2,0 "`$optList
+      echo skip add options
+    fi 
+done
+ optList=`echo " $nEvi,0,0,$iBRef,50 "`$optList      # start Init1
+ echo optList:  $optList
+
+for inOpt in $optList
+do  
+    echo step ${iStep} with option $inOpt
+    ((iStepLast = ${iStep}))
+    ((iStep += 1))
+
+    mkdir Init${iStep}
+    cp rootlogon.C Init${iStep}
+    cp .rootrc Init${iStep}
+    cd Init${iStep}
+
+    if [[ ${lastOpt:+1} ]] ; then
+	# echo last round was done with $lastOpt, extract 2. and 3. word
+	i1=`expr index $inOpt , `
+	i2=($i1+3)
+	#echo `expr index $inOpt , ` = $i1
+	cMode=${inOpt:$i1:2}
+	cSel=${inOpt:$i2:1}
+	echo next iteration: cMode=$cMode, cSel=$cSel 
+	if [[ ${cSel} = "-" ]];then 
+	    cSel=${inOpt:$i2:2}
+	    echo cSel=$cSel 
+	    cSel="0"
+	fi
+	#copy calibration file 
+	if (($iStep > $iRestart)) ; then
+	    cp -v ../Init${iStepLast}/tofClust_${cRun}_set${cCalSet}.hst.root ${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+	fi
+    fi 
+
+    lastOpt=$inOpt
+    # generate new calibration file
+    if (($iStep > $iRestart)) ; then 
+	root -b -q '../../ana_digi_cal_all.C('$inOpt',"'${cRun}'",'${iCalSet}',0,'${iBRef}') '
+
+	cp -v tofClust_${cRun}_set${cCalSet}.hst.root ../${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+	cp *pdf ../
+	#./screenshot.sh
+	cd .. 
+	rm ../${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+	ln -s ./${cRun}/${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root ../${cRun}_set${cCalSet}_${cMode}_${cSel}tofClust.hst.root
+	echo Init step $iStep with mode ${cMode}, option $inOpt  finished
+    else 
+	cd ..
+	echo Init step $iStep with mode ${cMode}, option $inOpt  skipped
+    fi   
+done
+
+cd  ${wdir}
+mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/InitCalib_${cRun}_${cCalSet}.out
diff --git a/macro/beamtime/mcbm2021/iter_tracks.sh b/macro/beamtime/mcbm2021/iter_tracks.sh
new file mode 100755
index 0000000000000000000000000000000000000000..aad60160b0872e003d26edb9da61d3353f657ff6
--- /dev/null
+++ b/macro/beamtime/mcbm2021/iter_tracks.sh
@@ -0,0 +1,189 @@
+#!/bin/bash
+# shell script to iterate tracklet calibration histograms
+#SBATCH -J track
+#SBATCH -D /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+#SBATCH --time=8:00:00
+##SBATCH --time=6-00:00:00
+#SBATCH --mem=4000
+##SBATCH --partition=long
+
+X=$((${SLURM_ARRAY_TASK_ID} - 0))
+XXX=$(printf "%03d" "$X")
+
+cRun=$1
+iTraSetup=$2
+
+#which file should be analyzed ?  
+cSet=$3
+if [[ $cSet = "" ]]; then 
+    cSet="000014500_500"
+    #cSet="900041500_901"
+    #cSet="900041500_500"
+fi
+
+# extract iCalSet from cSet
+i1=0
+while [ "${cSet:$i1:1}" = "0" ]; do
+(( i1 += 1 ))
+done
+i2=0
+while [ "${cSet:$i2:1}" != "_" ] && [ $i2 -lt  ${#cSet} ]; do
+(( i2 += 1 ))
+done
+(( i2 -= i1 ))
+iCalSet=${cSet:$i1:$i2}
+echo got i1=$i1, i2=$i2, iCalSet=$iCalSet from $cSet
+
+cCalId=$4;
+if [[ $cCalId = "" ]]; then 
+    cCalId=$cRun;
+fi
+
+iMc=0
+McId=${cRun:0:4}
+if [ "$McId" = "mcbm" ]; then 
+  echo processing MC simulation
+  iMc=1
+fi
+
+# what should be done ?
+iDut=900; iRef=41; iSel2=31
+((iSel=$iDut*1000+$iRef))
+
+nEvt=100000
+dDTres=2000
+dDTRMSres=2000
+iter=0;
+
+if [ -e /lustre/cbm ]; then
+source /lustre/cbm/users/nh/CBM/cbmroot/trunk/build/config.sh 
+wdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+outdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/${cRun}
+else 
+wdir=`pwd`
+outdir=${wdir}/${cRun}
+fi
+
+# frange2 limits chi2
+fRange2=8.
+TRange2Limit=3.5 
+
+#frange1 limits DT spectrum range 
+fRange1=2.
+TRange1Limit=1.5
+dDeadtime=50
+
+if [ ! -e ${cRun} ]; then 
+  mkdir $cRun
+fi
+cd ${cRun}
+cp ../.rootrc .
+cp ../rootlogon.C .
+
+# clean directory for start from scratch
+rm -v ${cRun}_tofFindTracks.hst.root
+rm -v TCalib.res
+
+if [[ $iter > 0 ]]; then
+ cp -v  ${cRun}_tofFindTracks.hst${iter}.root  ${cRun}_tofFindTracks.hst.root
+fi
+
+nEvtMax=0
+(( nEvtMax = nEvt*10 ))
+
+while [[ $dDTres > 0 ]]; do
+
+nEvt=`echo "scale=0;$nEvt * 1./1." | bc`
+#nEvt=`echo "scale=0;$nEvt * 1.1/1." | bc`
+
+if [ $nEvt -gt $nEvtMax ]; then
+  nEvt=$nEvtMax
+fi
+
+#((fRange2 /= 2))
+#if((${fRange2}<$Range2Limit));then
+# ((fRange2=$Range2Limit))
+#fi
+fRange2=`echo "$fRange2 * 0.8" | bc`
+compare_TRange2=`echo "$fRange2 < $TRange2Limit" | bc`
+if  [[ $compare_TRange2 > 0 ]]; then
+  fRange2=$TRange2Limit
+fi
+
+#bash only handles integers!!
+#((fRange1 /= 2))  
+#if((${fRange1}<1));then
+# ((fRange1=1))
+#fi
+fRange1=`echo "$fRange1 * 0.8" | bc`
+compare_TRange=`echo "$fRange1 < $TRange1Limit" | bc`
+if  [[ $compare_TRange > 0 ]]; then
+fRange1=$TRange1Limit
+fi
+
+# correction modes: 2 - TOff from Tt, 3 - Pull t, 4 - x, 5 - y, 6 - z, >10 - Pull t of individual stations 
+#for iCal in 3 2 10 11 12 13 14 15 4 5; do
+for iCal in 3 4 5; do
+#for iCal in 3 2 4; do
+#for iCal in 3 2 ; do
+#for iCal in 2 ; do
+    nIt=1
+    if [ $iter -eq 0 ] && [ $iMc -eq 1 ]; then
+      echo skip iCal $iCal for MC calibration
+      iCal=5
+    fi
+    while [[ $nIt > 0 ]]; do
+	((iter += 1))
+	root -b -q '../ana_trks.C('$nEvt','$iSel','$iCal',"'$cRun'","'$cSet'",'$iSel2','$iTraSetup','$fRange1','$fRange2','$dDeadtime',"'$cCalId'",1,1,'$iCalSet',1,'$iMc')'
+	cp -v tofFindTracks.hst.root ${cRun}_tofFindTracks.hst.root
+	cp -v tofFindTracks.hst.root ${cRun}_tofFindTracks.hst${iter}.root
+	cp -v tofAnaTestBeam.hst.root ${cRun}_TrkAnaTestBeam.hst.root
+	((nIt -= 1))
+    done
+done
+
+iTres=`cat TCalib.res`
+if [[ $iTres = 0 ]]; then
+    echo All tracks lost, stop at iter = $iter
+    return
+fi
+
+((TRMSres=$iTres%1000))
+((iTres -= TRMSres ))
+((Tres   = iTres / 1000)) 
+
+if [[ $Tres = 0 ]]; then
+    Tres=1
+fi
+dTdif=`echo "$dDTres - $Tres" | bc`
+compare_result=`echo "$Tres < $dDTres" | bc`
+
+dTRMSdif=`echo "$dDTRMSres - $TRMSres" | bc`
+compare_RMS=`echo "$TRMSres < $dDTRMSres" | bc`
+
+echo at iter=$iter got TOff = $Tres, compare to $dDTres, dTdif = $dTdif, result = $compare_result, TRMS = $TRMSres, old $dDTRMSres, dif = $dTRMSdif, result = $compare_RMS 
+
+((compare_result += $compare_RMS))
+echo result_summary: $compare_result 
+
+if [[ $compare_result > 0 ]]; then
+  if [[ $Tres = 0 ]]; then
+    Tres=1
+  fi
+  dDTres=$Tres
+  dDTRMSres=$TRMSres
+else
+  dDTres=0
+  rm ../${cRun}_tofFindTracks.hst.root
+  cp -v  tofFindTracks.hst.root  ../${cRun}_tofFindTracks.hst.root
+  cp -v  tofFindTracks.hst.root  ./${cRun}_${cSet}._${iTraSetup}_tofFindTracks.hst.root  # keep a copy 
+  rm ../${cRun}_TrkAnaTestBeam.hst.root
+  cp -v  tofAnaTestBeam.hst.root ../${cRun}_TrkAnaTestBeam.hst.root
+fi
+
+done
+
+cd ..
+#mv -v slurm-${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID}.out ${outdir}/IterTrack_${cRun}_${cSet}.out
+mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/IterTrack_${cRun}_${cSet}.out
+
diff --git a/macro/beamtime/mcbm2021/mMuchPar.par b/macro/beamtime/mcbm2021/mMuchPar.par
new file mode 100644
index 0000000000000000000000000000000000000000..8ca46d5034aeedf884951db2bb2d032ebcbddeb6
--- /dev/null
+++ b/macro/beamtime/mcbm2021/mMuchPar.par
@@ -0,0 +1,825 @@
+##############################################################################
+# Class:   CbmMcbm2018MuchPar
+# Context: For mMUCH testing
+##############################################################################
+[CbmMcbm2018MuchPar]
+//----------------------------------------------------------------------------
+// Total number of MUCH DPBs in system
+NrOfDpbs: Int_t 6
+// Array to hold the unique IDs (equipment ID) for all MUCH DPBs, Array size has to match NrOfDpbs
+DbpIdArray: Int_t \
+  0x18e3 0x18ef 0x1861 0x6601 0x4f19 0x5b7b
+// Array to hold the active flag for all CROBs, [ NbDpb * kuNbCrobPerDpb ] = [ NbDpb * 2 ]
+CrobActiveFlag: Int_t \
+ 1 1 1 1 1 1
+NrOfFebsInGemA: Int_t 24
+nFebsIdsArrayA: Int_t \
+  11   3   8  -1   9   1 \
+  12   5  -1   6  14  15 \
+  10  -1  -1   7   4  13 \
+   0  17   2  16  -1  -1  #Id for the connected FEB Position in GEM Module A
+NrOfFebsInGemB: Int_t 12
+nFebsIdsArrayB: Int_t \
+  15  16  10  12   7   8 \
+  11  13  17  14  -1  -1  #Id for the connected FEB Position in GEM Module B
+ChannelsToPadXA: Int_t \
+  8  6  8  6  8  6  8  5  7  5  7  5  7  5  7  5 \
+  7  4  6  4  6  4  8  4  9  4  9  3  9  3  9  3 \
+  9  3 10  3 10  2 10  2 10  2 10  2 11  2 11  1 \
+ 11  1 11  1 11  1 12  1 12  0 12  0 12  0 12  0 \
+ 13  0 13  6 13  5 13  5 13  5 14  5 14  5 14  4 \
+ 14  4 14  4 15  4 15  4 15  3 15  3 15  3 16  3 \
+ 16  3 16  2 16  2 16  2 17  2 17  2 17  1 17  1 \
+ 17  1 18  1 18  1 18  0 18  0 18  0 19  0 19  0 \
+ \
+ -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 \
+ -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 \
+ -2 -2 -2 -2 17 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 \
+ -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 \
+ -2 19 -2 20 -2 20 -2 20 21 20 21 20 21 20 21 20 \
+ 21 20 21 21 22 21 22 21 22 -1 22 -1 22 -1 22 -1 \
+ 22 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 \
+ -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 \
+ \
+  8  6  8  6  8  6  9  7  9  6  9  7  9  7  9  7 \
+ 10  7 10  7 10  7 10  7 10  8 11  8 11  0 11  0 \
+ 12  0 12 11  6 11  6  4  6  4  6  5  7  5  7  5 \
+  7  4  8  4  8  4  8  4  8  4  8  4  8  3  8  3 \
+  8  3  9  3  9  3  9  3  9  3  9  2  9  2  9  2 \
+  9  2 10  2 10  2 10  2 10  2 10  1 10  1 10  1 \
+ 10  1 11  1 11  1 11  1 11  1 11  0 11  0 11  0 \
+  6  0  6  0  6  0  6  0  5  0  5  0  5  3  5  5 \
+ \
+  5  4  5  4  5  4  5  4  7  4  6  4  6  4  6  3 \
+  6  3  6  3  6  3  6  3  6  3  6  3  6  3  7  3 \
+  7  3  7  2  7  2  7  2  7  2  7  2  7  2  7  2 \
+  8  2  8  2  8  2  8  1  8  1  8  1  8  1  8  1 \
+  8  1  8  1  9  1  9  1  9  1  9  0  9  0  9  0 \
+  4  0  4  0  4  0  4  4  4  4  4  4  4  5  4  5 \
+  4  5  3  5  3  5  3  5  3  3  4  3  5  3  5  3 \
+  5  3  5  3  5  2  5  2  5  2  5  2  5  2  5  2 \
+ \
+ 11  9 11  9 11  9 12 10 12 10 12 10 12 10 12 10 \
+ 12 10 12 10 12 10 13 10 13 10 13 11 13 11 13 11 \
+ 14 11 14 11 14 11 14 12 14 12 15 13 15 13 15 13 \
+ 15 13 15 13 16 14 16 14 16 14 16 14 17 14 17 15 \
+  9 15  9  9  9  8  9  8  9  8  9  8  9  8  9  8 \
+  9  9 -1  8 -1  8 10  8 10  8 10  7 10  7 10  7 \
+ 10  7 10  7 10  7 10  7 11  7 11  7 11  7 11  6 \
+ 11  6 11  6 11  6 11  6 11  6 11  6 12  6 12  6 \
+ \
+ 17 15 17 15 17 16 17 16 17 16 18 16 -1 16 18 17 \
+ 18 17 18 17 18 18 19 15 19 18 19 18 19 18 19 18 \
+ 19 19 20 19 20 19 20 19 20 20 20 20 21 20 21 20 \
+ 21 20 21 21 21 21 22 21 22 21 22 21 22 22 22 22 \
+ 22 22 22 22 22 22 14 22 14 22 14 13 14 13 14 13 \
+ 14 13 14 13 14 12 14 12 14 12 16 13 15 13 15 13 \
+ 15 13 15 13 15 12 15 12 15 12 15 12 16 12 16 15 \
+ 16 16 16 16 16 16 16 16 17 17 17 17 17 17 17 17 \
+ \
+ 19 17 19 17 19 18 19 18 19 18 19 18 19 18 20 18 \
+ 20 18 20 18 20 18 20 18 21 19 21 19 21 19 21 20 \
+ 21 20 22 20 22 20 22 20 22 21 22 21 22 21 16 21 \
+ 16 21 16 22 16 16 16 16 16 16 17 16 17 16 17 16 \
+ 18 17 18 17 18 17 18 17 18 17 18 17 19 17 19 17 \
+ 19 17 19 18 19 18 19 18 19 18 20 18 20 18 20 19 \
+ 20 19 20 19 20 19 21 19 21 20 21 20 21 20 21 20 \
+ 21 20 21 20 22 21 22 21 22 21 22 21 22 21 22 21 \
+ \
+ 12 11 12 11 12 11 12 11 13 11 13 11 13 11 13 12 \
+ 13 12 13 12 13 12 13 12 14 12 14 12 14 12 14 13 \
+ 14 13 14 13 14 13 15 14 15 14 15 14 15 14 15 14 \
+ 15 15 12 15 12 15 12 15 12 15 12 15 12 11 12 11 \
+ 13 12 13 12 13 12 14 13 14 13 14 13 14 13 14 13 \
+ 14 13 15 13 15 13 15 13 15 14 15 14 15 14 15 14 \
+ 16 14 16 14 16 15 16 15 16 15 16 15 17 15 17 16 \
+ 17 16 11 16 -1 16 -1 16 -1 16 -1 17 -1 17 -1 17 \
+ \
+  8  7  8  7  8  7  9  7 -2  7 -2  7 -2  7 -2  8 \
+ -2  8 -2  8  9  8 -2  8 -2  8 -2  8 10  8 10  8 \
+ 10  9 10 10 10 10 10 10 11 10 11 10 11 10  8 11 \
+  8 11  8  7  8  7  8  7  8  7  8  7  8  7  8  8 \
+  8  7  8  7  9  7  9  7  9  7  9  7  9  6  9  6 \
+  9  6 10  6 10  6 10  6 10  6 10  9 10  9 11  9 \
+ 11  9 11  9 11 10 11 10 11 10 12 10 -1 10 -1 10 \
+ -1 11 -1 11 -1 11 -1 11  8 12 -1  6 -1  7 -1  6 \
+ \
+  4  2  4  2 -1  2  4  2  4  1  4  1  3  1  3  1 \
+  3  1  3  1  3  1  3  1  4  1  4  1  4  0  4  0 \
+  4  0  4  0  5  0  5  0  5  0  5  0  5  0  5  0 \
+  5  3  5  3  5  3  5  3  5  3  5  3  6  2  6  2 \
+  6  2  6  2  6  2  6  2  6  2  6  2  6  2  6  2 \
+  6  2  6  2  6  1  7  1  7  1  7  1  7  1  7  1 \
+ -1  1 -1  1 -1  1 -1  1 -1  1 -1  1 -1  0 -1  0 \
+ -1  0 -1  0 -1  0 -1  0 -1  0 -1  0 -1  0 -1  0 \
+ \
+  3  0  3  0  3  2  4  2  4  2  4  2  4  2  4  2 \
+  4  3  4  3  4  3  4  3  4  3  4  3  4  3  5  3 \
+  5  3  5  2  5  2  5  2  5  2  5  2  5  2  5  1 \
+  5  1  5  1  5  1  6  1  6 -1  6  1  6  1  6  1 \
+  3  1  3  1  3  1  3  0  3  0  3  0  3  0  3  0 \
+  2  0  2  0  2  0  3  0  3  0  3  0  3  0  4  2 \
+  4  2  4  2  4  2  4  2  4  2  4  2  4  2  4  2 \
+  4  1  4  1  4  1  5  1  5  1  5  1  5  1  5  1 \
+ \
+  8  6  8  6  8  6  8  6  8  6  9  6  9  6  9  6 \
+  9  6  9  7  9  7  9  7 10  7 10  7 10  8 10  8 \
+ 10  8 10  9 11  9 11  9 11  9 11  9  7 10  7 10 \
+  6 10  7 10  7 10  6 10  6 11  6 11  6 11  6  6 \
+  7  6  7  6  7  5  7  5  7  5  7  5  7  5  8  5 \
+  8  5  8  5  8  5  8  5  8  5  8  5  8 -1  8 -1 \
+  8  4  8  4  8  4  9  4  9  4  9  6  7  6  7  6 \
+  7  7  7  6  7  6  7 -2  7  5  6  5  6  5  6  5 \
+ \
+ 12 11 12 11 12 11 12 11 12 12 13 12 13 12 13 12 \
+ 13 12 10 12 10 12 10 13 11 13 11 13 11 13 11 11 \
+ 10 11 10  9 10  9 10 10 11 10 11 10 11  9 11  9 \
+ 11  9 12 10 12  9 12  9 -1  9 12  9 10 12 12 12 \
+ 13 12 13 12 13 12 13 11 13 12 14 13 14 13 14 13 \
+ 14 13 14 13 14 13 15 13 15 14 15 14 10 14 10 14 \
+ 10 14 11 14 11 15 11  9 11  9 10  9 11  9 -1  8 \
+ 11  8 11  8 10  8 10  8 -1  8  9  9 -1  8 10  9 \
+ \
+ 18 17 18 17 18 17 19 17 19 17 19 17 14 18 14 18 \
+ 15 18 15 18 15 18 15 18 15 18 15 18 15 18 15 19 \
+ 14 19 15 19 15 19 15 14 15 14 16 14 16 14 16 14 \
+ 16 14 16 14 16 14 16 14 16 13 16 13 16 13 16 13 \
+ 15 16 15 17 15 17 16 17 16 17 16 17 16 15 16 15 \
+ 16 15 16 15 16 15 13 16 16 16 16 12 17 12 17 12 \
+ 13 12 13 -1 13 -1 14 -1 14 -1 -1 -1 14 -1 14 -1 \
+ 13 -1 14 -1 14 -1 13 -1 13 -1 12 -1 12 -1 13 -1 \
+ \
+ -2 19 22 -2 -2 19 22 19 20 19 20 20 20 20 21 20 \
+ 21 20 21 20 21 21 21 21 22 21 22 21 22 21 22 21 \
+ 22 22 22 22 22 22 18 22 18 22 18 -2 18 17 18 17 \
+ 18 17 18 17 18 17 19 17 19 18 19 18 19 18 19 18 \
+ 20 19 20 19 20 19 21 19 21 19 21 19 21 19 21 20 \
+ 21 20 21 20 22 20 22 20 22 20 22 20 22 20 22 20 \
+ 22 21 22 21 17 21 17 21 17 21 17 22 17 22 17 22 \
+ 17 22 18 -1 18 17 -1 17 18 18 18 18 18 18 18 18 \
+ \
+ 22 22 -1 22 21 22 22 22 22 22 22 22 22 22 22 21 \
+ 21 21 21 21 21 21 21 21 21 21 21 20 20 20 20 20 \
+ 20 20 20 20 20 20 20 19 18 19 22 19 22 19 21 19 \
+ 22 19 17 19 21 19 22 19 21 19 22 19 22 19 22 18 \
+ 16 18 20 18 22 16 21 18 20 17 22 18 17 18 15 18 \
+ 21 18 20 15 19 18 19 17 18 17 18 17 17 16 17 17 \
+ 16 17 15 17 16 16 14 16 14 15 19 14 20 15 21 16 \
+ 22 16 21 16 20 16 19 15 19 15 20 15 20 15 13 15 \
+ \
+ 12 12 -1 19 -1 20 -1 19 -1 21 -1 20 -1 21 -1 19 \
+ -1 11 -1 21 -1 20 -1 20 -1 19 -1 19 -1 -1 -1 -1 \
+ -1 -1 -1 -1 11 -1 13 -1 15 -1 14 -1 10 10 12 -1 \
+ 13 -1 11 -1 12 -1 11 -1 10 -1 10 -1  9 -1  9  9 \
+ -1 -1 -1 -1 -1 -1 -1  8 -1 -1  8 -1 -1 -1 -1 -1 \
+ -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 \
+ -1  7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  8 -1  8  7 \
+  7  9  6  7  4  6  5  5  6  6  5  6  5  5  4  5 \
+ \
+  5  1 -2  1 -2 -2 -2  0 -2  0 -2  0 -2 -1 -2  0 \
+  4  0  3 -2  3  0  2  0  2  0  2  0  2  0  2 -1 \
+  2  1  2  1  2  2  1  1  2  1  2  1 -1  0 -2  0 \
+ -2  0 -2  0 -2  0 -2  0 -2  0 -2  0 -2 -1 -2 -1 \
+ -2 -1  3 -1  3 -1  3 -1  3 -1  3 -1  3 -1  3 -1 \
+  3 -1  4 -1  4 -1  4 -1  4 -1  4  2  4  2  4  2 \
+  3  2  4  2  2  2  1  1  1  1  1  1  1  1  0  1 \
+  0  0  0  0  2  0  0  0  3  1  4  0  3  0  2  1
+ChannelsToPadYA: Int_t \
+  1  2  2  3  3  4  4  0  0  1  1  2  2  3  3  4 \
+  4  0  0  1  1  2  0  3  4  4  3  0  2  1  1  2 \
+  0  3  4  4  3  0  2  1  1  2  0  3  4  4  3  0 \
+  2  1  1  2  0  3  4  4  3  0  2  1  1  2  0  3 \
+  4  4  3  7  2  5  1  6  0  9  4  8  3  7  2  5 \
+  1  6  0  9  4  8  3  7  2  5  1  6  0  9  4  8 \
+  3  7  2  5  1  6  0  9  4  8  3  7  2  5  1  6 \
+  0  9  4  8  3  7  2  5  1  6  0  9  4  8  3  7 \
+ \
+ -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 \
+ -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 \
+ -2 -2 -2 -2 11 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 \
+ -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 \
+ -2 17 -2 10 -2 11 -2 12 17 13  9 14  8 15  7 16 \
+  6 17  5 10 15 11 16 12 17 -1 14 -1 13 -1 12 -1 \
+ 11 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 \
+ -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 \
+ \
+  7  8  6  9  5  5  9  7  8  6  7  8  6  9  5 14 \
+  9 13  8 12  7 11  6 10  5  9  9  8  8 12  6 11 \
+  9 10  8  7 13  5 12 11 11 10 10 15 15 16 16 17 \
+ 17 12 10 13 11 14 12 17 13 16 14 15 15 10 16 11 \
+ 17 13 10 14 11 17 12 16 13 15 14 10 15 11 16 12 \
+ 17 13 10 14 11 17 12 16 13 15 14 10 15 11 16 12 \
+ 17 13 10 14 11 17 12 16 13 15 14 17 15 18 16 19 \
+ 14 20 17 21 16 16 15 15 10 14 11 13 12 12 13 14 \
+ \
+ 27 24 26 23 25 22 24 21 21 20 18 19 19 18 20 27 \
+ 21 26 22 25 23 24 24 23 25 22 26 21 27 20 18 19 \
+ 19 18 20 27 22 26 23 25 24 24 25 23 26 22 27 21 \
+ 18 20 19 19 20 18 21 27 22 26 23 25 24 24 25 23 \
+ 26 22 27 21 18 20 19 19 20 18 21 27 22 26 23 25 \
+ 34 24 35 23 36 22 37 25 32 26 31 27 30 18 29 19 \
+ 28 20 28 21 29 22 30 23 31 32 33 37 33 36 34 35 \
+ 35 34 36 33 37 33 32 34 31 35 30 36 29 37 28 32 \
+ \
+ 25 27 26 26 27 25 18 18 19 19 20 20 21 21 22 28 \
+ 24 23 26 24 27 25 19 26 21 27 23 18 25 19 27 20 \
+ 19 21 21 22 22 23 24 23 26 25 18 18 20 20 22 22 \
+ 24 24 26 26 18 18 20 20 22 23 24 25 18 27 24 19 \
+ 30 21 31 24 32 36 37 35 36 34 35 33 34 32 29 37 \
+ 28 33 -1 28 -1 29 29 30 30 31 31 28 37 29 36 30 \
+ 35 31 34 32 33 36 32 35 34 34 35 37 36 33 37 30 \
+ 33 31 32 32 31 35 30 36 29 33 28 34 28 29 29 28 \
+ \
+ 19 25 21 27 23 19 25 21 27 23 18 25 -1 26 21 20 \
+ 23 22 24 26 26 19 18 23 19 20 21 22 23 25 25 27 \
+ 27 20 19 22 21 24 22 26 24 18 26 20 18 23 20 25 \
+ 22 27 24 19 26 21 18 23 20 25 21 27 23 19 24 22 \
+ 32 25 30 26 28 27 28 31 29 29 30 29 37 30 36 31 \
+ 35 28 34 37 33 32 32 33 31 34 27 36 28 35 37 34 \
+ 36 33 35 32 34 35 33 36 32 37 31 31 28 30 37 30 \
+ 35 29 33 36 31 34 30 32 29 28 37 36 35 34 33 32 \
+ \
+ 36 31 35 30 34 28 33 29 32 37 31 36 30 35 29 34 \
+ 36 33 34 32 32 31 30 30 29 28 36 29 35 37 33 28 \
+ 31 37 33 35 39 33 38 31 37 28 36 37 35 34 49 32 \
+ 48 30 47 34 46 38 45 39 44 40 38 41 39 42 40 43 \
+ 39 41 40 42 42 49 48 48 46 47 44 46 38 45 40 44 \
+ 42 43 48 38 46 41 45 49 43 47 39 45 41 43 49 39 \
+ 47 41 45 49 43 47 39 44 41 38 42 40 49 42 47 48 \
+ 45 46 43 44 40 38 41 40 42 50 43 48 49 46 48 44 \
+ \
+ 44 44 45 45 46 46 43 47 45 48 46 49 47 43 48 38 \
+ 49 39 43 40 41 41 39 42 45 49 47 48 49 47 43 44 \
+ 41 42 39 40 38 38 39 46 41 48 49 44 47 42 45 40 \
+ 43 38 55 40 54 42 53 48 52 46 61 44 60 55 59 54 \
+ 61 58 59 57 57 56 50 50 52 51 54 52 61 53 59 54 \
+ 57 55 50 60 52 58 54 56 61 51 59 53 57 55 56 60 \
+ 51 58 53 56 55 51 60 53 58 55 56 60 51 58 53 50 \
+ 55 52 67 54 -1 61 -1 59 -1 57 -1 50 -1 52 -1 54 \
+ \
+ 45 43 44 44 43 49 38 42 -2 41 -2 40 -2 39 -2 38 \
+ -2 39 -2 40 47 41 -2 42 -2 49 -2 48 39 47 41 46 \
+ 49 44 47 38 45 40 43 42 39 48 40 46 42 44 61 38 \
+ 60 41 59 61 55 60 54 59 53 58 52 57 51 56 58 50 \
+ 57 52 56 53 50 54 51 55 52 51 54 50 61 56 59 57 \
+ 57 58 50 59 52 60 54 61 61 55 59 53 57 55 50 60 \
+ 52 58 61 56 60 51 59 53 57 55 50 60 -1 58 -1 56 \
+ -1 51 -1 53 -1 58 -1 56 67 51 -1 62 -1 62 -1 63 \
+ \
+ 43 31 42 30 -1 29 40 28 39 28 38 29 44 30 45 31 \
+ 46 32 47 37 48 36 49 35 49 34 48 33 47 33 46 34 \
+ 45 35 44 36 38 37 39 32 40 31 41 30 42 29 43 28 \
+ 49 40 48 41 47 42 46 43 45 39 44 38 38 44 47 45 \
+ 39 46 40 47 41 48 42 49 49 43 48 42 46 41 45 40 \
+ 44 39 43 38 37 44 38 45 45 46 46 47 47 48 48 49 \
+ -1 43 -1 42 -1 41 -1 40 -1 39 -1 38 -1 44 -1 45 \
+ -1 46 -1 47 -1 48 -1 49 -1 43 -1 42 -1 41 -1 40 \
+ \
+ 58 39 57 38 56 56 50 57 51 58 52 59 53 60 54 61 \
+ 55 50 61 51 60 52 59 53 58 54 57 55 56 61 50 60 \
+ 51 59 52 55 53 54 54 53 55 52 61 51 60 50 59 56 \
+ 58 57 57 58 56 59 50 60 51 -1 52 55 53 54 54 53 \
+ 70 52 71 51 72 50 73 50 65 51 64 52 63 53 62 54 \
+ 68 55 69 61 70 60 69 59 68 58 67 57 66 56 62 71 \
+ 63 72 64 73 69 67 68 66 67 65 73 64 72 63 71 62 \
+ 70 68 66 69 65 70 68 71 69 72 70 73 71 67 72 66 \
+ \
+ 72 65 73 64 70 66 65 67 63 73 67 72 70 71 72 70 \
+ 66 69 65 63 64 64 62 65 69 66 71 67 73 66 66 64 \
+ 64 62 62 69 69 71 71 73 73 68 66 63 75 68 74 70 \
+ 74 72 77 67 76 65 75 63 76 68 77 70 78 72 82 81 \
+ 84 80 83 79 82 74 81 75 80 76 79 77 78 78 82 79 \
+ 83 80 84 81 85 85 81 84 80 83 79 82 78 -1 77 -1 \
+ 76 76 75 77 74 78 74 79 75 80 76 85 86 84 87 83 \
+ 88 85 89 87 90 88 91 -2 92 87 91 88 90 89 89 90 \
+ \
+ 64 65 66 64 73 63 71 62 69 62 65 63 67 65 70 67 \
+ 69 72 79 70 78 68 77 66 76 68 77 73 78 72 79 75 \
+ 80 74 81 79 82 78 84 74 84 83 83 75 82 80 81 81 \
+ 80 82 74 76 75 83 76 84 -1 85 77 77 85 79 78 84 \
+ 83 83 85 82 78 81 76 85 74 80 75 80 77 81 78 82 \
+ 84 84 81 79 79 77 75 75 76 74 77 76 88 82 87 85 \
+ 86 83 86 80 87 74 88 88 89 87 89 86 90 89 -1 86 \
+ 91 87 92 88 92 89 90 90 -1 91 92 90 -1 92 91 91 \
+ \
+ 60 61 58 60 56 59 51 58 53 57 55 56 63 50 62 51 \
+ 68 52 69 53 70 54 71 55 72 61 73 59 67 57 66 50 \
+ 67 52 65 54 64 61 63 64 62 65 68 66 69 73 70 72 \
+ 71 71 72 70 73 69 67 68 66 71 65 62 64 63 63 64 \
+ 82 62 81 68 80 69 80 70 81 71 82 72 83 78 84 79 \
+ 85 85 79 84 77 83 89 78 75 76 74 86 80 87 81 88 \
+ 88 89 87 -1 86 -1 86 -1 87 -1 -1 -1 89 -1 90 -1 \
+ 90 -1 91 -1 92 -1 91 -1 92 -1 91 -1 92 -1 93 -1 \
+ \
+ -2 60 46 -2 -2 58 44 57 58 56 57 50 56 51 52 52 \
+ 54 53 61 54 59 51 57 53 56 55 58 60 60 58 61 56 \
+ 54 57 52 59 50 55 73 53 72 51 67 -2 66 67 65 66 \
+ 64 65 63 64 62 63 68 62 69 68 70 69 71 70 72 71 \
+ 66 73 64 67 62 66 69 65 71 64 73 63 66 62 64 68 \
+ 63 69 62 70 63 71 65 72 67 73 72 67 71 65 70 63 \
+ 69 68 68 70 82 72 83 67 84 65 85 62 78 64 76 66 \
+ 74 73 81 -1 83 77 -1 75 78 80 77 82 76 84 75 79 \
+ \
+ 80 81 -1 82 94 83 94 84 85 79 78 77 76 75 74 74 \
+ 75 76 77 78 79 85 84 83 82 81 80 74 75 76 77 78 \
+ 79 85 84 83 82 81 80 74 94 75 92 76 91 77 91 78 \
+ 90 79 94 85 90 84 89 83 89 82 88 81 87 80 86 74 \
+ 94 93 94 92 95 93 95 91 95 92 96 90 93 89 94 88 \
+ 96 87 96 93 95 85 96 91 95 90 96 89 95 92 96 88 \
+ 95 87 95 86 96 90 95 91 94 92 93 93 93 91 93 89 \
+ 93 88 92 87 92 86 92 90 91 89 91 88 90 87 94 86 \
+ \
+ 94 93 -1 90 -1 89 -1 89 -1 88 -1 88 -1 87 -1 88 \
+ -1 93 -1 86 -1 87 -1 86 -1 87 -1 86 -1 -1 -1 -1 \
+ -1 -1 -1 -1 94 -1 95 -1 96 -1 96 -1 94 93 95 -1 \
+ 96 -1 95 -1 96 -1 96 -1 95 -1 96 -1 95 -1 94 93 \
+ -1 -1 -1 -1 -1 -1 -1 93 -1 -1 94 -1 -1 -1 -1 -1 \
+ -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 \
+ -1 93 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 95 -1 96 94 \
+ 96 96 95 95 96 96 95 96 94 92 94 93 93 91 94 92 \
+ \
+ 73 64 -2 61 -2 -2 -2 68 -2 69 -2 70 -2 -1 -2 72 \
+ 75 71 75 -2 74 66 76 65 77 64 78 63 79 62 80 -1 \
+ 81 78 85 80 84 83 85 83 82 82 75 75 -1 76 -2 78 \
+ -2 80 -2 85 -2 83 -2 82 -2 75 -2 74 -2 -1 -2 -1 \
+ -2 -1 92 -1 93 -1 91 -1 90 -1 89 -1 88 -1 87 -1 \
+ 86 -1 86 -1 87 -1 88 -1 89 -1 90 91 91 90 92 89 \
+ 94 88 93 87 94 86 91 92 89 93 87 90 86 88 87 94 \
+ 89 86 91 88 95 90 94 93 95 95 95 95 96 96 96 96
+ChannelsToPadXB: Int_t \
+  8  6  8  6  8  6  9  6  9  6  9  6  9  7  9  7 \
+  9  7 10  7 10  7 10  7 10  8 11  8 11  8 11  5 \
+ 12 10 12 10 12 11 13 11 13 11 13 12 14 12 14 12 \
+ 14 13 14 13 15 13 15 14 15 14 15  5 15  5 16  5 \
+ 16  5 16  5 16  4 16  4 17  4 17  4 17  4 17  4 \
+ 17  3 18  3 18  3 18  3 18  3 18  3 19  2 19  2 \
+ 19  2 19  2 19  2 20  2 20  1 20  1 20  1 20  1 \
+ 21  1 21  1 21  0 21  0 21  0 22  0 22  0 21  0 \
+ \
+17 14 17 15 18 15 18 15 18 15 18 15 18 15 18 16 \
+ 19 16 19 16 19 16 19 16 19 16 19 17 20 17 20 17 \
+ 20 17 20 14 20 14 20 14 21 14 21 14 21 13 21 13 \
+ 21 13 21 13 22 13 22 13 22 12 22 12 22 12 22 12 \
+ 22 12 22 12 22 12 13 12 13 12 13 11 13 11 13 11 \
+ 14 11 14 11 14 10 14 14 15 15 15 15 15 16 16 16 \
+ 16 16 17 17 17 17 17 18 18 18 18 18 19 19 19 19 \
+ 19 20 20 20 20 20 21 21 21 21 21 22 22 22 22 22 \
+ \
+  7  0  7  0  7  6  8  6  8  6  8  6  8  5  8  5 \
+  8  5  9  5  9  5  9  5  9  4  9  4  9  4 10  4 \
+ 10  4 10  3 10  3 10  3 10  3 11  3 11  2 11  2 \
+ 11  2 11  2 11  2 12  1 12  1  7  1  7  1  7  1 \
+  6  6  6  6  6  0  6  0  7  0  7  4  7  4  7  3 \
+  7  3  6  3  8  3  8  3  8  2  8  2  8  2  9  2 \
+  9  2  9  2  9  1  9  1 10  1 10  1 10  1 10  1 \
+  5  0  5  0  5  0  5  0  5  0  4  0  4  0  4  0 \
+ \
+  5  4  5  4  5  4  5  5  6  5  6  4  6  4  6  4 \
+  6  4  6  3  7  3  7  3  7  3  7  3  7  3  7  3 \
+  8  2  8  2  8  2  8  2  8  2  8  2  9  1  9  1 \
+  9  1  9  1  9  1  9  1 10  0 10  0 10  0 10  0 \
+  4  2  4  2  4  2  4  2  3  2  3  2  3  2  3  2 \
+  3  2  3  1  3  1  3  1  3  1  4  1  4  1  4  1 \
+  4  1  4  1  5  0  5  0  5  0  5  0  5  0  5  0 \
+  5  0  5  0  5  0  6  0  6  0  6  0  6  0  6  0 \
+ \
+ 11  8 10  8 10  8 11  8 11  8 11  7 11  7 11  8 \
+ 12  8 12  7 12  8 12  8 12  7 12  7 13  7 13  7 \
+ 13  7 13  7 13  6 13  6 14  6 14  6 14  9 14  9 \
+ 14  9 14  9 15  9 15  9 15  9 15  9 15  9 15 10 \
+ 12 11 12 11 12 11 12 11 13 11 13 11 13 12 13 12 \
+ 13 12 13 12 17 12 10 13 10 13 10 13 10  8 10  8 \
+ 10  8 10  8 10  8 10  8 10  8 10 11 11 11 11 11 \
+ 11 10 11 10 11 10 11 10 11 10 11 10 11 10 11 10 \
+ \
+ 16 14 15 14 16 14 16 14 16 14 16 14 16 14 16 14 \
+ 17 14 17 15 17 15 17 15 17 15 17 15 17 15 18 15 \
+ 18 15 18 15 18 16 18 16 18 16 18 16 19 16 19 16 \
+ 19 16 19 16 19 16 19 17 19 17 20 17 20 17 20 17 \
+ 20 17 20 17 20 17 20 18 21 18 21 18 21 18 21 18 \
+ 21 18 21 18 22 18 22 18 22 19 22 19 22 19 22 19 \
+ 22 19 22 19 22 19 22 19 21 19 21 20 21 20 21 20 \
+ 21 20 21 20 21 20 22 20 22 20 22 20 22 21 22 21 \
+ \
+ 20 19 20 19 20 20 20 20 20 20 21 20 21 16 21 16 \
+ 21 16 21 16 21 16 21 16 21 16 21 16 21 16 21 16 \
+ 22 16 22 16 22 17 22 17 22 17 22 17 22 17 22 17 \
+ 22 17 22 17 22 17 22 17 22 17 22 17 22 18 22 18 \
+ 19 19 19 19 19 19 20 19 20 19 20 19 20 19 20 20 \
+ 20 20 21 20 21 20 21 20 21 20 21 21 21 21 21 21 \
+ 22 21 22 21 22 22 22 22 22 14 22 14 22 14 22 14 \
+ 22 14 22 14 22 14 22 14 22 14 22 14 22 13 22 14 \
+ \
+16 15 16 15 16 15 16 15 17 15 17 15 17 15 17 15 \
+ 17 15 17 16 17 16 17 16 18 16 18 16 18 16 18 16 \
+ 18 17 18 17 19 17 19 18 19 18 19 18 19 18 20 18 \
+ 12 19 12 19 13 19 13 19 13 20 13 11 13 11 13 11 \
+ 13 11 14 11 14 11 14 12 14 11 14 13 14 12 14 12 \
+ 14 12 14 12 14 12 14 12 15 12 15 12 15 12 15 13 \
+ 15 13 15 13 15 14 15 15 18 15 18 15 18 15 18 10 \
+ 18 10 18 10 18 10 18 10 18 10 18 10 19 10 19 10 \
+ \
+ 12  8 12  8 12  8 12  7 12  7 12  7 12  7 12  7 \
+ 12  7 12  7 13  7 13  7 13  6 13  6 13  8 13  6 \
+ 13  6 13  9 13  9 13  9 13  9 14  9 14  9 14  9 \
+ 14  9 14  9 14  9 14  9 14 11 14 12 15 14 15 14 \
+  8  7  8  7  9  7  9  7  9  8  9  8  9  8  9  8 \
+  9  8  9  7  9  7  9  8  9  8  9  8 10  8 10  8 \
+ 10  7 10  7 10  7 10  7 10  7 10  7 10  6 10  6 \
+ 10  6 10  6 11  6 13  6 11  6 11  6 11  6 11  6 \
+ \
+  4  3  4  3  5  3  4  3  4  3  4  3  4  3  4  3 \
+  4  3  4  3  4  2  4  2  3  2  5  2  5  2  5  2 \
+  5  2  5  2  5  2  5  2  5  2  5  1  5  1  6  1 \
+  7  1  6  1  7  1  6  1  6  1  6  1  6  1  6  1 \
+  0  0  0  0  0  0  4  3  4  3  4  3  4  3  4  3 \
+  4  3  4  3  4  3  3  3  3  2  3  2  4  2  4  2 \
+  4  2  4  2  5  2  5  2  5  2  5  2  5  2  5  2 \
+  5  1  5  1  5  1  5  1  5  1  5  1  6  1  6  1 \
+ \
+  1  0  1  0  1  0  1  0  0  0  3  0  3  2  3  2 \
+  3  2  3  2  2  2  2  2  2  1  2  1  2  1  2  1 \
+  2  1  3  1  3  1  3  1  3  1  3  1  3  1  3  1 \
+  3  1  4  0  4  0  4  0  4  0  4  0  4  0  4  0 \
+  0  0  0  0  0  2  0  2  0  2  0  2  0  2  0  1 \
+  0  1  0  1  0  1  0  1  3  1  2  1  2  1  2  1 \
+  3  1  3  1  3  0  3  0  3  0  3  0  3  0  3  0 \
+  3  0  3  0  4  0  4  0  4  0  4  2  4  2  4  2 \
+ \
+  7  6  7  6  7  6  7  6  7  6  7  6  7  6  7  6 \
+  7  6  7  6  7  6  7  6  7  6  8  5  8  5  8  5 \
+  8  5  8  5  8  5  8  5  8  5  8  5  8  5  8  5 \
+  8  5  8  5  9  4  9  4  9  4  9  4  9  4  9  4 \
+  6  5  6  5  6  5  6  5  6  5  7  5  7  5  7  5 \
+  7  5  7  5  7  5  7  4  7  4  7  4  7  4  7  4 \
+  7  6  7  6  7  6  7  6  7  6  7  6  7  6  7  6 \
+  7  6  7  6  8  6  8  6  8  6  8  6  8  6  7  6 \
+ \
+ 11  9 11  9 11  9 11  9 11  9 12  9 12  9 12 10 \
+ 12 10 12 10 12 10 12 11 12 11 12 11 12 11 12 11 \
+ 12 11 12 11 13 11 13  9 13  9 13  9 13  9 13  9 \
+ 13  9 13  9 13  9 13  9 14  9 13  9 13 10 14 10 \
+ 11  8 11  8 11  8 11  8 11  8 11  8 11  8 11  8 \
+ 11  8 11  8 11  8 12 10 12 10 12 10 12 10 12 10 \
+ 12 10 12 10 12 10 10 10 10  9 10  9 10  9 10  9 \
+ 10  9 10  9 10  9 10  9 10  9 11  9 11 10 11  9 \
+ \
+ 16 15 16 15 16 15 16 15 16 15 16 15 16 15 16 15 \
+ 16 15 17 15 17 15 17 15 17 15 17 16 17 16 18 16 \
+ 18 16 18 17 18 17 18 17 18 17 18 17 19 17 19 17 \
+ 19 18 19 18 14 18 14 18 14 18 14 18 14 19 14 19 \
+ 14 12 14 12 14 12 14 13 14 13 14 13 15 13 14 13 \
+ 13 13 13 13 13 13 13 13 14 13 14 13 14 13 14 13 \
+ 14 12 14 12 14 12 14 12 16 12 15 12 15 12 14 12 \
+ 15 12 15 12 15 12 15 13 15 13 15 13 15 13 16 13 \
+ \
+ 20 19 20 19 20 19 20 19 20 19 20 19 20 19 20 20 \
+ 20 20 20 20 21 16 21 16 21 16 21 16 21 16 21 16 \
+ 21 16 21 16 21 16 21 16 21 16 21 17 21 17 22 17 \
+ 22 17 22 17 22 17 22 17 22 17 22 17 22 17 22 17 \
+ 18 15 18 15 18 15 18 15 18 15 19 15 19 15 19 15 \
+ 19 15 19 15 19 15 19 18 20 18 20 18 20 18 20 18 \
+ 20 18 20 19 21 19 21 19 21 19 21 20 21 20 21 20 \
+ 21 20 22 20 22 21 22 21 22 21 22 21 22 17 22 17 \
+ \
+ 22 22 21 21 21 22 22 22 21 22 22 22 22 22 22 22 \
+ 22 22 22 22 21 21 21 21 21 21 21 21 21 21 21 20 \
+ 18 20 19 20 20 20 20 20 21 20 21 20 21 20 20 20 \
+ 20 20 20 20 17 19 19 19 18 19 19 19 19 19 19 19 \
+ 16 19 -1 19 20 19 -1 19 -1 19 -1 18 19 18 18 18 \
+ -1 18 17 15 15 18 16 18 -1 18 20 18 19 18 18 18 \
+ 17 18 16 17 -1 17 15 17 15 17 -1 17 14 14 14 17 \
+ 14 17 13 17 13 16 17 16 16 16 16 16 16 16 15 16 \
+ \
+ 12 18 12 17 13 18 12 17 -1 12 -1 16 -1 18 -1 17 \
+ -1 -1 11 11 -1 -1 -1 -1 -1 -1 -1 -1 -1 15 -1 -1 \
+ 11 14 -1 16 -1 15 -1 16 -1 13 -1 12 -1 10 -1 -1 \
+ -1 11 -1 11 -1 11 -1 11 -1 11 16 11 17 11 13 11 \
+ -1  9 -1 11 -1 -1 -1 -1 -1  8 -1 -1 -1 -1 -1 -1 \
+ -1 -1 -1 -1 -1 -1 -1 -1 -1 14 -1 13 -1 15 -1 14 \
+ -1 13 -1  7 -1 12 -1 10 -1  9 10 11 11 12  9 10 \
+  8 11  7  8 -1  9 10 10 10  9  9  8  9  7  6  6 \
+ \
+  3  0  4  0  4  0  4  0  4  0  4  0  4  0  4  0 \
+  4  3  4  3  4  3  4  3  5  3  5  3  5  3  5  3 \
+  5  3  5  3  5  2  5  2  5  2  5  2  5  2  6  2 \
+  8  2  8  2  8  2  8  2  8  2  8  1  1  1  1  1 \
+  5  1  5  1  4  1  5  1  3  1  6  0  6  0  4  0 \
+  7  1  8  0  7  0  6  1  5  0  3  1  4  0  5  1 \
+  8  2  8  3  7  3  7  3  6  4  6  4  5  2  5  3 \
+  4  2  3  2  4  2 -1  2 -1  2 -1  1 -1  1  1  1
+ChannelsToPadYB: Int_t \
+  0  2  1  3  2  4  5  5  4  1  3  0  2  5  1  4 \
+  0  3  5  2  4  1  2  0  0  5  4  4  2  3  0  0 \
+  4  3  2  1  0  5  4  3  3  1  1  5  5  3  3  1 \
+  2  5  0  2  4  0  3  4  2  1  1  1  0  2  4  3 \
+  3  4  2  5  1  0  0  1  4  2  3  3  2  4  1  5 \
+  0  0  4  1  3  2  2  3  1  4  0  5  4  0  3  1 \
+  2  2  1  3  0  4  4  5  3  0  2  1  1  2  0  3 \
+  5  4  4  5  3  0  2  1  1  3  1  5  0  7  0  6 \
+ \
+  9 11 10  5  5  6  6  7  7  8  8  9  9 10 10  5 \
+  5  6  6  7  7  8  8  9  9 10 10  5  5  6  6  7 \
+  7  8  8 10  9  9 10  8  6  7  7  6  8 11  9 10 \
+ 10  9 11  8  2  7  3  6  4 11  5 10  6  9  7  8 \
+ 10 12  9 13  8 14 16 15 15 16 14 12 13 13 12 14 \
+ 16 15 15 16 14 12 12 13 14 15 12 13 11 15 14 13 \
+ 12 11 15 14 13 12 11 15 14 13 12 11 15 14 13 12 \
+ 11 15 14 13 12 11 16 15 14 13 12 14 15 13 12 11 \
+ \
+  9  4 10  2 11  6  6  7  7  8  8  9  9 11 10 10 \
+ 11  9  6  8  7  7  8  6  9 10 10  9 11  8  6  7 \
+  7  6  8 10  9  9 10  8 11  7  6  6  7 10  8  9 \
+  9  8 10  7 11  6  6 10  7  9  8  8  7  7  6  6 \
+ 15 10 14 11 13 10 12  9 16  8 15 14 14 15 13 11 \
+ 12 12 16 13 16 14 15 15 14 11 13 12 12 13 16 14 \
+ 15 15 14 16 13 11 12 12 16 13 15 14 14 15 13 16 \
+ 12 14 13 15 14 16 15 17 16 18 11 13 12 12 13 11 \
+ \
+ 22 20 21 21 20 22 19 17 17 18 18 19 19 18 20 17 \
+ 21 16 22 22 17 21 18 20 19 19 20 18 21 17 22 16 \
+ 17 22 18 21 19 20 20 19 21 18 22 17 17 22 18 21 \
+ 19 20 20 19 21 18 22 17 17 22 18 21 19 20 20 19 \
+ 28 23 29 24 30 25 31 26 23 27 24 28 25 29 26 30 \
+ 27 31 28 23 29 24 30 25 31 26 27 27 26 28 25 29 \
+ 24 30 23 31 31 23 30 24 29 25 28 26 27 27 26 28 \
+ 25 29 24 30 23 31 26 36 31 35 30 34 29 33 28 32 \
+ \
+ 17 23 22 24 21 25 18 26 19 27 20 23 21 24 22 28 \
+ 17 29 18 25 19 30 20 31 21 26 22 28 17 29 18 27 \
+ 19 30 20 31 21 23 22 24 17 25 18 27 19 31 20 30 \
+ 21 29 22 28 16 27 17 26 18 25 19 24 20 23 21 31 \
+ 29 28 27 27 25 26 23 25 30 24 28 23 26 31 25 30 \
+ 24 28 23 26 26 24 34 31 35 29 33 27 32 42 36 41 \
+ 37 40 38 39 39 38 40 37 41 36 42 29 32 30 33 31 \
+ 34 23 35 24 36 25 37 26 38 27 39 28 40 29 41 30 \
+ \
+ 16 28 22 27 17 26 18 29 19 30 20 31 21 25 22 24 \
+ 16 23 17 31 18 30 19 29 20 28 21 27 22 26 16 25 \
+ 17 24 18 23 19 31 20 30 21 29 22 28 16 27 17 26 \
+ 18 25 19 24 20 23 21 31 22 30 16 29 17 28 18 27 \
+ 19 25 20 24 21 23 22 31 17 30 18 29 19 28 20 27 \
+ 21 26 22 25 16 24 17 23 18 31 19 30 20 29 21 28 \
+ 25 27 24 26 23 25 22 24 29 23 28 31 27 30 26 29 \
+ 25 28 24 27 23 26 30 25 29 24 28 23 27 31 26 30 \
+ \
+ 38 40 39 42 40 33 41 35 42 36 32 37 33 49 34 48 \
+ 35 47 36 46 37 45 38 44 39 43 40 50 41 51 42 52 \
+ 32 53 33 54 34 43 35 44 36 45 37 46 38 47 39 48 \
+ 40 49 41 50 42 51 46 52 45 53 44 54 43 43 31 44 \
+ 51 44 52 45 53 46 43 48 45 49 47 50 49 54 51 44 \
+ 53 46 43 48 45 50 46 52 47 54 49 44 51 48 53 50 \
+ 47 52 49 54 51 48 52 50 53 65 54 63 55 67 56 62 \
+ 57 61 58 60 64 59 63 58 62 57 61 56 60 55 59 55 \
+ \
+ 39 34 40 35 41 36 42 37 32 38 33 39 34 40 35 41 \
+ 36 42 38 32 39 33 41 34 32 35 34 36 36 37 38 38 \
+ 40 37 42 40 32 42 34 33 36 35 38 37 39 39 32 41 \
+ 51 33 52 35 45 37 46 41 47 34 48 54 49 53 50 51 \
+ 54 50 43 49 44 48 45 43 46 52 47 44 48 44 49 45 \
+ 50 46 51 47 52 48 54 49 44 50 46 53 48 54 49 51 \
+ 50 52 52 53 53 53 54 43 45 45 46 47 47 51 48 65 \
+ 49 66 50 67 51 64 52 63 53 62 54 61 43 60 47 59 \
+ \
+ 33 35 34 34 35 33 36 40 37 42 38 41 39 39 40 34 \
+ 41 35 42 36 32 37 33 38 34 37 35 38 36 32 37 42 \
+ 38 41 39 32 40 33 41 34 42 35 32 36 33 37 34 38 \
+ 35 39 36 40 37 41 39 42 41 42 42 32 32 38 33 40 \
+ 53 52 54 51 43 53 44 54 45 43 46 44 47 45 48 46 \
+ 49 47 50 50 51 49 52 48 53 49 54 50 43 51 44 52 \
+ 45 48 46 47 47 46 48 45 49 44 50 43 51 54 52 53 \
+ 53 52 54 51 43 50 43 49 44 48 45 43 46 44 47 46 \
+ \
+ 42 41 41 40 32 39 40 38 39 37 38 36 37 35 36 34 \
+ 35 33 34 32 33 42 32 41 42 40 33 39 34 38 35 37 \
+ 36 36 37 35 38 34 39 33 40 32 41 42 42 41 32 40 \
+ 32 39 33 38 33 37 34 36 35 35 36 34 39 33 40 32 \
+ 42 39 41 38 40 37 50 51 49 50 48 49 47 48 46 47 \
+ 45 46 44 45 43 44 54 43 53 54 52 53 51 52 52 51 \
+ 53 50 54 49 43 48 44 47 45 46 46 45 47 44 48 43 \
+ 49 54 50 53 51 52 52 51 53 50 54 49 45 48 47 47 \
+ \
+ 46 48 45 47 44 46 43 45 49 44 63 43 64 62 65 63 \
+ 66 64 67 65 55 66 56 67 57 55 58 56 59 57 60 58 \
+ 61 59 62 60 61 61 60 62 59 63 58 64 57 65 56 66 \
+ 55 67 67 58 66 59 65 60 64 61 63 62 62 63 61 64 \
+ 65 51 66 50 67 76 68 77 69 78 70 75 57 74 56 68 \
+ 55 69 54 70 53 71 52 72 78 73 68 74 69 75 70 76 \
+ 77 77 76 78 75 71 74 72 73 73 72 74 71 75 70 76 \
+ 69 77 68 78 78 79 77 80 76 81 75 73 74 72 73 71 \
+ \
+ 67 66 66 67 65 65 64 64 63 63 62 62 61 61 60 60 \
+ 59 59 58 58 57 57 56 56 55 55 67 55 66 56 65 57 \
+ 64 58 63 59 62 60 61 61 60 62 59 63 58 64 57 65 \
+ 56 66 55 67 67 55 66 56 65 57 64 58 63 59 62 60 \
+ 72 69 71 70 70 71 69 68 68 72 78 73 77 74 76 75 \
+ 75 76 74 77 73 78 72 68 71 69 70 70 69 71 68 72 \
+ 83 78 84 77 82 76 81 75 80 74 79 73 85 83 86 82 \
+ 87 81 88 80 79 79 80 84 81 85 82 86 83 87 89 88 \
+ \
+ 59 56 58 57 57 58 56 59 55 60 67 61 66 55 65 58 \
+ 64 57 63 56 62 55 61 67 60 66 59 65 58 64 57 63 \
+ 56 62 55 61 67 60 66 72 65 71 64 70 63 69 62 68 \
+ 61 73 60 74 59 75 58 76 64 77 57 78 56 78 66 77 \
+ 78 68 77 69 76 70 75 71 74 72 73 73 72 74 71 75 \
+ 70 76 69 77 68 78 78 76 77 75 76 74 75 73 74 72 \
+ 73 71 72 70 71 69 86 68 87 87 88 86 89 85 85 84 \
+ 84 83 82 82 83 81 81 80 80 79 79 88 80 79 81 89 \
+ \
+ 66 67 65 66 64 65 63 64 62 63 60 62 58 61 56 60 \
+ 55 59 66 58 64 57 62 56 60 55 58 67 56 61 67 59 \
+ 65 57 63 67 61 65 60 63 58 61 56 59 67 57 65 55 \
+ 63 66 62 64 78 62 77 59 76 57 75 55 74 66 73 64 \
+ 72 70 71 69 70 68 69 78 68 77 79 76 79 75 80 74 \
+ 88 73 87 72 86 71 85 70 81 69 82 68 83 80 84 79 \
+ 85 89 86 88 88 87 87 86 79 85 80 84 81 83 89 82 \
+ 82 81 83 80 84 79 85 81 86 82 87 83 88 84 80 89 \
+ \
+ 64 61 63 60 62 59 61 58 60 57 59 56 58 55 57 67 \
+ 56 66 55 65 67 74 66 75 65 73 64 72 63 71 62 70 \
+ 61 76 60 77 59 78 58 69 57 68 56 78 55 77 73 76 \
+ 72 75 71 74 70 73 69 72 68 71 67 70 66 69 65 68 \
+ 72 71 71 72 70 73 69 74 68 75 78 76 77 77 76 78 \
+ 75 70 73 69 71 68 69 78 78 77 76 76 74 75 72 74 \
+ 70 73 68 74 77 72 75 70 74 68 72 77 70 75 69 73 \
+ 68 71 80 69 79 78 78 76 77 73 76 71 75 79 74 80 \
+ \
+ 96 93 96 93 95 92 95 91 94 90 94 89 88 87 86 85 \
+ 84 83 82 81 89 88 87 86 85 84 83 82 81 80 79 89 \
+ 94 88 94 87 94 86 93 85 92 84 91 83 90 82 92 81 \
+ 91 80 90 79 94 89 93 88 93 87 92 86 91 85 90 84 \
+ 94 83 -1 82 95 81 -1 80 -1 79 -1 89 95 88 95 87 \
+ -1 86 95 93 94 85 95 84 -1 83 96 82 96 81 96 80 \
+ 96 79 96 89 -1 88 95 87 96 86 -1 85 94 93 95 83 \
+ 96 82 96 81 94 88 84 86 89 85 87 83 84 82 89 81 \
+ \
+ 94 91 95 92 95 92 96 91 -1 93 -1 92 -1 90 -1 90 \
+ -1 -1 94 93 -1 -1 -1 -1 -1 -1 -1 -1 -1 92 -1 -1 \
+ 95 92 -1 91 -1 91 -1 90 -1 92 -1 92 -1 93 -1 -1 \
+ -1 89 -1 88 -1 87 -1 86 -1 85 93 84 93 83 93 82 \
+ -1 93 -1 92 -1 -1 -1 -1 -1 93 -1 -1 -1 -1 -1 -1 \
+ -1 -1 -1 -1 -1 -1 -1 -1 -1 91 -1 91 -1 90 -1 90 \
+ -1 90 -1 93 -1 91 -1 92 -1 92 94 91 96 90 94 91 \
+ 94 90 94 92 -1 91 95 90 96 90 95 91 96 92 94 93 \
+ \
+ 89 85 79 86 80 84 81 83 82 82 83 87 84 88 85 89 \
+ 86 79 87 80 88 81 89 82 79 83 80 84 81 85 82 86 \
+ 83 87 84 88 85 89 86 88 87 87 88 86 89 85 89 84 \
+ 84 83 85 82 86 81 87 80 88 79 89 89 86 88 85 87 \
+ 90 84 91 83 92 82 92 81 93 80 90 90 91 91 93 92 \
+ 90 93 90 93 91 94 92 94 93 95 94 95 94 96 94 96 \
+ 95 94 96 90 95 91 96 92 95 90 96 91 95 95 96 96 \
+ 95 96 95 93 96 92 -1 91 -1 90 -1 90 -1 91 79 92
+RealX: Double_t \
+  184.654  187.877  191.156  194.492  197.887   201.34  204.855   208.43  212.068  215.769  219.535  223.366  227.265  231.231  235.267  239.373  243.551  247.802  252.127  256.527  261.005   265.56  270.195  274.911  279.709  284.591  289.558  294.612  299.753  304.985  \
+  310.308  315.724  321.234  326.841  332.546   338.35  344.255  350.263  356.376  362.596  368.925  375.364  381.915  388.581  395.363  402.263  409.284  416.427  423.695   431.09  438.614   446.27  454.058  461.983  470.046   478.25  486.597   495.09  503.731  512.523  \
+  521.468  530.569  539.829  549.251  558.837  568.591  578.515  588.612  598.885  609.338  619.973  630.793  641.802  653.004  664.401  675.997  687.795    699.8  712.014  724.441  737.084  749.949  763.038  776.356  789.906  803.692  817.719  831.991  846.512  861.286  \
+  876.319  891.613  907.175  923.008  939.118  955.508  972.185  184.626  187.848  191.127  194.463  197.857   201.31  204.823  208.398  212.035  215.736  219.501  223.332   227.23  231.196  235.231  239.337  243.514  247.764  252.089  256.488  260.965   265.52  270.154  \
+  274.869  279.666  284.547  289.514  294.567  299.708  304.939  310.261  315.676  321.186  326.791  332.495  338.298  344.202   350.21  356.322  362.541  368.869  375.307  381.857  388.522  395.303  402.202  409.222  416.364  423.631  431.025  438.548  446.202  453.989  \
+  461.913  469.975  478.177  486.523  495.015  503.654  512.445  521.389  530.488  539.747  549.168  558.752  568.504  578.427  588.522  598.794  609.245  619.878  630.697  641.705  652.905    664.3  675.894  687.691  699.693  711.905   724.33  736.972  749.835  762.922  \
+  776.237  789.785   803.57  817.595  831.864  846.383  861.155  876.185  891.478  907.037  922.867  938.975  955.363  972.037  184.542  187.762  191.039  194.374  197.766  201.218   204.73  208.303  211.939  215.638  219.401   223.23  227.127  231.091  235.124  239.228  \
+  243.403  247.651  251.973  256.371  260.846  265.398   270.03  274.743  279.539  284.417  289.381  294.432  299.571  304.799  310.119  315.532  321.039  326.642  332.343  338.143  344.045   350.05  356.159  362.376    368.7  375.135  381.683  388.344  395.122  402.018  \
+  409.035  416.174  423.437  430.828  438.347  445.998  453.782  461.702   469.76  477.959  486.301  494.788  503.424  512.211   521.15  530.246  539.501  548.917  558.497  568.245  578.162  588.253   598.52  608.966  619.595  630.409  641.412  652.606  663.996  675.585  \
+  687.376  699.373   711.58  723.999  736.635  749.492  762.573  775.883  789.424  803.202  817.221  831.484  845.996  860.762  875.785   891.07  906.622  922.446  938.546  954.926  971.593  184.401  187.619  190.894  194.226  197.616  201.065  204.574  208.144  211.777  \
+  215.473  219.234   223.06  226.954  230.915  234.945  239.045  243.218  247.462  251.781  256.176  260.647  265.196  269.825  274.534  279.326  284.201  289.161  294.208  299.343  304.567  309.883  315.291  320.794  326.393   332.09  337.886  343.783  349.783  355.888  \
+  362.099  368.419  374.849  381.392  388.048  394.821  401.712  408.723  415.857  423.115    430.5  438.013  445.658  453.436   461.35  469.402  477.595   485.93  494.412  503.041   511.82  520.753  529.842   539.09  548.499  558.072  567.812  577.722  587.805  598.064  \
+  608.502  619.123  629.929  640.923  652.109  663.491  675.071  686.853  698.841  711.038  723.448  736.074  748.921  761.992  775.292  788.823  802.591  816.598  830.851  845.352  860.106  875.118  890.391  905.932  921.743  937.831  954.199  970.853  184.204  187.419  \
+   190.69  194.018  197.405   200.85  204.356  207.922  211.551  215.243      219  222.822  226.711  230.668  234.694   238.79  242.958  247.198  251.513  255.903  260.369  264.913  269.537  274.241  279.028  283.897  288.852  293.894  299.023  304.242  309.552  314.955  \
+  320.452  326.045  331.735  337.525  343.416   349.41  355.508  361.713  368.026  374.449  380.985  387.634    394.4  401.283  408.287  415.413  422.663   430.04  437.546  445.182  452.952  460.858  468.901  477.085  485.412  493.884  502.504  511.274  520.198  529.277  \
+  538.514  547.913  557.476  567.206  577.106  587.178  597.426  607.853  618.462  629.256  640.239  651.413  662.783   674.35   686.12  698.095  710.279  722.676  735.289  748.122  761.179  774.464  787.981  801.734  815.727  829.964   844.45  859.188  874.184  889.441  \
+  904.965   920.76   936.83  953.181  969.817  183.951  187.162  190.428  193.752  197.134  200.574  204.075  207.637  211.261  214.948  218.699  222.517    226.4  230.352  234.372  238.463  242.624  246.859  251.168  255.551  260.012   264.55  269.167  273.865  278.645  \
+  283.508  288.456   293.49  298.613  303.825  309.127  314.523  320.012  325.597   331.28  337.062  342.945   348.93   355.02  361.217  367.521  373.935  380.462  387.102  393.858  400.733  407.727  414.843  422.083   429.45  436.945  444.571  452.331  460.225  468.258  \
+   476.43  484.746  493.206  501.814  510.572  519.484   528.55  537.775  547.161  556.711  566.427  576.313  586.372  596.606  607.019  617.613  628.393   639.36  650.519  661.873  673.425  685.178  697.137  709.304  721.684   734.28  747.095  760.134  773.401    786.9  \
+  800.634  814.607  828.825  843.291  858.009  872.984   888.22  903.723  919.496  935.544  951.872  968.486  183.642  186.848  190.109  193.427  196.803  200.238  203.732  207.288  210.906  214.587  218.332  222.143   226.02  229.965  233.978  238.062  242.217  246.445  \
+  250.746  255.122  259.575  264.105  268.715  273.405  278.177  283.032  287.972  292.998  298.111  303.314  308.608  313.994  319.475  325.051  330.724  336.496  342.369  348.344  354.424   360.61  366.904  373.308  379.823  386.452  393.197   400.06  407.042  414.146  \
+  421.374  428.729  436.212  443.825  451.571  459.452  467.471   475.63  483.932  492.378  500.971  509.715  518.611  527.663  536.872  546.242  555.776  565.476  575.346  585.387  595.604      606  616.576  627.338  638.287  649.427  660.761  672.294  684.028  695.966  \
+  708.113  720.472  733.047  745.841  758.858  772.103  785.578  799.289   813.24  827.433  841.875  856.568  871.518  886.729  902.205  917.952  933.973  950.274  966.859  183.278  186.476  189.731  193.042  196.412   199.84  203.328  206.876  210.487  214.161  217.899  \
+  221.702  225.571  229.508  233.514  237.589  241.736  245.955  250.248  254.615  259.059  263.581  268.181  272.862  277.624  282.469  287.399  292.416  297.519  302.712  307.995  313.371   318.84  324.405  330.067  335.828  341.689  347.652   353.72  359.894  366.175  \
+  372.566  379.068  385.684  392.416  399.265  406.233  413.323  420.537  427.877  435.345  442.943  450.674   458.54  466.543  474.685   482.97    491.4  499.976  508.702  517.581  526.614  535.806  545.157  554.672  564.353  574.203  584.224  594.421  604.796  615.351  \
+  626.091  637.019  648.137  659.449  670.958  682.669  694.584  706.706  719.041   731.59  744.359   757.35  770.569  784.018  797.701  811.624  825.789  840.202  854.866  869.787  884.967  900.413  916.128  932.118  948.386  964.939  182.857  186.048  189.296  192.599  \
+  195.961  199.381  202.861  206.402  210.004  213.669  217.398  221.193  225.053  228.981  232.978  237.044  241.181   245.39  249.673  254.031  258.465  262.976  267.565  272.235  276.987  281.821   286.74  291.744  296.836  302.017  307.288  312.651  318.108   323.66  \
+  329.309  335.057  340.905  346.854  352.908  359.068  365.335  371.711  378.198  384.799  391.515  398.348  405.301  412.375  419.572  426.895  434.346  441.927   449.64  457.487  465.472  473.596  481.862  490.272  498.829  507.535  516.393  525.406  534.576  543.906  \
+  553.399  563.058  572.885  582.883  593.057  603.408  613.939  624.654  635.556  646.649  657.935  669.418  681.102  692.989  705.084   717.39  729.911  742.651  755.612    768.8  782.218  795.871  809.761  823.894  838.274  852.904   867.79  882.936  898.346  914.025  \
+  929.978  946.209  962.724  182.381  185.564  188.802  192.098   195.45  198.862  202.332  205.864  209.457  213.113  216.832  220.616  224.467  228.385  232.371  236.426  240.553  244.751  249.023  253.369  257.791  262.291  266.868  271.526  276.265  281.087  285.993  \
+  290.984  296.063   301.23  306.488  311.837   317.28  322.817  328.451  334.184  340.016  345.951  351.989  358.132  364.383  370.743  377.213  383.797  390.495  397.311  404.245  411.301  418.479  425.783  433.214  440.775  448.468  456.295  464.259  472.362  480.606  \
+  488.995  497.529  506.213  515.048  524.037  533.183  542.489  551.957  561.591  571.392  581.365  591.512  601.836   612.34  623.027  633.901  644.964  656.221  667.674  679.328  691.184  703.248  715.521   728.01  740.716  753.644  766.797  780.181  793.797  807.652  \
+  821.748   836.09  850.683   865.53  880.636  896.006  911.644  927.556  943.744  960.216  181.849  185.023  188.252  191.537   194.88  198.282  201.742  205.263  208.846  212.491    216.2  219.973  223.812  227.719  231.693  235.737  239.851  244.037  248.297   252.63  \
+  257.039  261.526   266.09  270.734  275.459  280.267  285.159  290.136    295.2  300.352  305.594  310.927  316.354  321.876  327.493  333.209  339.025  344.942  350.962  357.088   363.32  369.661  376.113  382.677  389.356  396.152  403.066  410.101  417.259  424.541  \
+  431.951   439.49   447.16  454.965  462.905  470.985  479.205  487.568  496.078  504.736  513.546  522.509  531.628  540.907  550.347  559.953  569.726  579.669  589.787   600.08  610.554   621.21  632.052  643.083  654.307  665.727  677.346  689.168  701.196  713.435  \
+  725.886  738.556  751.446  764.561  777.905  791.482  805.296  819.351  833.652  848.201  863.005  878.068  893.393  908.986   924.85  940.992  957.415  181.261  184.425  187.644  190.919  194.251  197.641  201.091    204.6  208.171  211.805  215.501  219.263  223.089  \
+  226.983  230.945  234.975  239.077  243.249  247.495  251.814  256.209  260.681  265.231   269.86   274.57  279.362  284.238  289.199  294.246  299.382  304.607  309.923  315.332  320.836  326.436  332.133   337.93  343.828  349.829  355.934  362.147  368.467  374.898  \
+  381.442  388.099  394.873  401.764  408.777  415.911   423.17  430.556   438.07  445.716  453.495   461.41  469.463  477.657  485.994  494.476  503.106  511.887  520.821  529.911   539.16   548.57  558.144  567.886  577.797  587.882  598.142  608.582  619.204  630.011  \
+  641.007  652.194  663.577  675.159  686.942  698.932  711.131  723.542   736.17  749.019  762.092  775.393  788.926  802.695  816.705  830.959  845.462  860.218  875.232  890.508   906.05  921.863  937.953  954.323  180.619  183.771  186.979  190.242  193.562  196.941  \
+  200.378  203.875  207.434  211.054  214.738  218.485  222.299  226.179  230.126  234.143  238.229  242.387  246.617  250.922  255.301  259.757  264.291  268.903  273.597  278.372   283.23  288.174  293.203   298.32  303.527  308.825  314.215  319.699  325.279  330.956  \
+  336.732  342.609  348.589  354.673  360.863  367.161  373.569  380.089  386.723  393.473   400.34  407.328  414.437   421.67   429.03  436.518  444.136  451.888  459.775  467.799  475.964  484.271  492.723  501.323  510.073  518.975  528.033  537.249  546.626  556.166  \
+  565.873  575.749  585.798  596.022  606.425  617.009  627.778  638.734  649.882  661.225  672.765  684.507  696.454   708.61  720.977  733.561  746.364   759.39  772.644  786.129   799.85   813.81  828.014  842.465  857.169  872.129  887.351  902.838  918.596  934.628  \
+   950.94  179.921  183.062  186.257  189.507  192.815   196.18  199.604  203.088  206.632  210.239  213.908  217.642   221.44  225.305  229.237  233.238  237.309  241.451  245.665  249.953  254.315  258.754   263.27  267.865   272.54  277.297  282.136  287.061  292.071  \
+  297.168  302.355  307.632  313.001  318.464  324.022  329.678  335.432  341.286  347.243  353.303  359.469  365.743  372.127  378.622   385.23  391.953  398.794  405.754  412.836  420.042  427.373  434.832  442.421  450.143  457.999  465.993  474.126  482.401   490.82  \
+  499.387  508.103  516.971  525.994  535.174  544.515  554.018  563.688  573.526  583.536   593.72  604.083  614.626  625.353  636.268  647.373  658.671  670.167  681.864  693.765  705.873  718.193  730.728  743.481  756.458   769.66  783.093  796.761  810.667  824.816  \
+  839.212  853.859  868.761  883.924  899.351  915.048  931.019  947.268  179.169  182.296  185.478  188.715  192.009   195.36  198.769  202.239  205.768   209.36  213.014  216.732  220.514  224.363  228.279  232.263  236.317  240.441  244.638  248.908  253.252  257.672  \
+  262.169  266.745    271.4  276.137  280.957   285.86  290.849  295.926  301.091  306.346  311.692  317.132  322.667  328.299  334.029  339.859  345.791  351.826  357.966  364.214  370.571  377.038  383.619  390.314  397.127  404.058   411.11  418.285  425.586  433.013  \
+  440.571   448.26  456.084  464.044  472.143  480.384  488.768  497.299  505.978  514.809  523.794  532.936  542.238  551.701   561.33  571.128  581.096  591.238  601.557  612.056  622.738  633.607  644.666  655.917  667.365  679.013  690.864  702.922   715.19  727.672  \
+  740.373  753.295  766.442  779.819  793.429  807.277  821.367  835.702  850.288  865.129  880.228  895.591  911.222  927.126  943.307  178.362  181.475  184.642  187.865  191.144   194.48  197.874  201.328  204.842  208.417  212.054  215.755  219.521  223.352  227.251  \
+  231.217  235.252  239.358  243.536  247.787  252.111  256.511  260.988  265.543  270.178  274.894  279.691  284.573   289.54  294.593  299.735  304.966  310.289  315.704  321.214  326.821  332.525  338.328  344.233  350.241  356.354  362.574  368.902   375.34  381.891  \
+  388.556  395.338  402.238  409.258  416.401  423.669  431.063  438.587  446.242   454.03  461.954  470.017   478.22  486.567  495.059  503.699  512.491  521.435  530.536  539.796  549.217  558.802  568.555  578.479  588.575  598.847  609.299  619.934  630.753  641.762  \
+  652.963  664.359  675.955  687.752  699.756  711.969  724.395  737.038  749.902   762.99  776.307  789.856  803.642  817.668  831.939  846.459  861.232  876.264  891.557  907.118   922.95  939.059  177.501  180.599  183.751  186.958  190.221  193.541  196.919  200.356  \
+  203.853   207.41   211.03  214.714  218.461  222.274  226.153  230.101  234.117  238.203   242.36   246.59  250.894  255.273  259.728  264.261  268.873  273.566  278.341  283.199  288.142  293.171  298.287  303.493   308.79   314.18  319.663  325.242  330.919  336.695  \
+  342.571   348.55  354.633  360.823   367.12  373.528  380.047   386.68  393.429  400.296  407.282  414.391  421.623  428.982  436.469  444.087  451.838  459.724  467.747  475.911  484.217  492.668  501.267  510.016  518.917  527.974  537.189  546.565  556.104   565.81  \
+  575.685  585.733  595.956  606.357   616.94  627.708  638.663   649.81  661.151  672.691  684.431  696.377  708.531  720.897  733.479  746.281  759.306  772.558  786.042  799.761   813.72  827.922  842.372  857.074  872.032  887.252  902.738  918.494  934.524  176.585  \
+  179.667  182.803  185.994   189.24  192.543  195.903  199.323  202.801  206.341  209.942  213.606  217.335  221.128  224.987  228.914  232.909  236.974   241.11  245.318    249.6  253.956  258.389  262.899  267.487  272.155  276.905  281.738  286.656  291.659  296.749  \
+  301.928  307.198   312.56  318.015  323.565  329.213  334.958  340.805  346.753  352.805  358.962  365.227  371.602  378.087  384.686    391.4  398.232  405.182  412.254  419.449   426.77  434.218  441.797  449.508  457.353  465.335  473.457   481.72  490.128  498.682  \
+  507.386  516.241  525.252  534.419  543.746  553.236  562.892  572.717  582.712  592.883   603.23  613.759  624.471   635.37  646.459  657.742  669.222  680.902  692.786  704.877   717.18  729.697  742.433   755.39  768.574  781.989  795.637  809.523  823.652  838.028  \
+  852.654  867.536  882.677  898.083  913.757  929.705  175.616  178.681    181.8  184.973  188.201  191.486  194.828  198.229  201.688  205.209   208.79  212.434  216.142  219.914  223.752  227.658  231.631  235.674  239.787  243.972   248.23  252.563  256.971  261.456  \
+  266.019  270.662  275.386  280.192  285.082  290.058  295.121  300.271  305.512  310.844   316.27   321.79  327.406   333.12  338.934   344.85  350.868  356.992  363.223  369.562  376.012  382.575  389.252  396.046  402.958  409.991  417.147  424.428  431.835  439.372  \
+  447.041  454.843  462.782  470.859  479.077  487.438  495.945  504.601  513.408  522.369  531.486  540.762    550.2  559.803  569.574  579.514  589.629   599.92   610.39  621.044  631.883  642.911  654.132  665.549  677.165  688.984  701.009  713.244  725.692  738.358  \
+  751.245  764.357  777.697   791.27  805.081  819.132  833.429  847.975  862.775  877.833  893.154  908.742  924.603  174.594  177.641  180.741  183.896  187.106  190.371  193.694  197.074  200.514  204.014  207.574  211.197  214.883  218.634   222.45  226.332  230.282  \
+  234.301  238.391  242.551  246.785  251.092  255.474  259.933   264.47  269.086  273.782  278.561  283.422  288.369  293.402  298.523  303.733  309.034  314.428  319.916  325.499   331.18  336.961  342.842  348.825  354.914  361.108   367.41  373.823  380.347  386.986  \
+   393.74  400.612  407.604  414.718  421.956  429.321  436.814  444.438  452.194  460.087  468.117  476.287    484.6  493.058  501.663  510.419  519.327  528.391  537.613  546.997  556.543  566.257   576.14  586.196  596.427  606.836  617.427  628.204  639.168  650.323  \
+  661.674  673.222  684.972  696.927  709.091  721.467  734.059   746.87  759.906  773.169  786.663  800.393  814.362  828.576  843.037  857.751  872.721  887.953  903.451  919.219  173.518  176.546  179.628  182.763  185.953  189.198    192.5   195.86  199.278  202.757  \
+  206.295  209.896  213.559  217.287  221.079  224.937  228.863  232.858  236.922  241.057  245.264  249.545    253.9  258.332   262.84  267.428  272.095  276.844  281.676  286.592  291.594  296.684  301.862   307.13  312.491  317.945  323.494   329.14  334.884  340.729  \
+  346.676  352.727  358.883  365.147   371.52  378.004  384.601  391.314  398.144  405.092  412.163  419.356  426.675  434.122  441.699  449.408  457.252  465.232  473.352  481.614   490.02  498.572  507.274  516.127  525.135  534.301  543.626  553.114  562.768   572.59  \
+  582.584  592.752  603.097  613.623  624.333  635.229  646.316  657.597  669.074  680.751  692.633  704.722  717.021  729.536  742.268  755.223  768.405  781.816  795.461  809.344   823.47  837.842  852.466  867.344  882.482  897.884  913.555  172.389  175.398  178.459  \
+  181.574  184.743  187.968  191.248  194.586  197.982  201.438  204.953  208.531   212.17  215.873  219.641  223.474  227.375  231.343  235.381  239.489  243.669  247.922  252.249  256.651  261.131  265.688  270.325  275.044  279.844  284.728  289.698  294.754  299.898  \
+  305.132  310.458  315.876   321.39  326.999  332.706  338.513  344.421  350.432  356.549  362.772  369.103  375.545    382.1  388.769  395.554  402.458  409.482  416.629    423.9  431.299  438.826  446.485  454.278  462.206  470.273  478.481  486.832  495.329  503.974  \
+   512.77   521.72  530.825   540.09  549.516  559.107  568.866  578.794  588.896  599.174  609.632  620.272  631.098  642.112  653.319  664.722  676.324  688.128  700.138  712.357   724.79   737.44  750.311  763.407   776.73  790.287   804.08  818.114  832.393  846.921  \
+  861.702  876.742  892.044  907.613  171.208  174.196  177.237   180.33  183.477   186.68  189.938  193.253  196.626  200.058  203.549  207.102  210.716  214.394  218.136  221.943  225.817  229.758  233.768  237.848  241.999  246.223   250.52  254.893  259.342  263.868  \
+  268.473  273.159  277.927  282.777  287.713  292.734  297.843  303.042  308.331  313.712  319.188  324.758  330.427  336.194  342.061  348.031  354.106  360.286  366.574  372.972  379.482  386.105  392.844    399.7  406.676  413.774  420.996  428.343  435.819  443.426  \
+  451.165  459.039  467.051  475.203  483.497  491.935  500.521  509.257  518.145  527.188   536.39  545.751  555.277  564.968  574.828  584.861  595.069  605.455  616.022  626.774  637.713  648.843  660.167   671.69  683.413  695.341  707.477  719.824  732.388   745.17  \
+  758.176  771.409  784.872  798.571  812.509  826.689  841.118  855.798  870.735  885.932  901.394
+PadSize: Double_t \
+        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
+        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
+        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0        0  \
+        0        0        0        0        0        0        0  3.22266   3.2789  3.33613  3.39436   3.4536  3.51388   3.5752   3.6376  3.70109  3.76569  3.83141  3.89828  3.96632  4.03555  4.10598  4.17764  4.25056  4.32474  4.40022  4.47702  4.55516  4.63466  4.71555  \
+  4.79785  4.88159  4.96679  5.05348  5.14168  5.23142  5.32272  5.41562  5.51014  5.60631  5.70416  5.80372  5.90501  6.00808  6.11294  6.21963  6.32818  6.43863    6.551  6.66534  6.78167  6.90003  7.02046  7.14299  7.26766  7.39451  7.52356  7.65488  7.78848  7.92441  \
+  8.06272  8.20344  8.34662  8.49229  8.64051  8.79132  8.94475  9.10087  9.25971  9.42132  9.58576  9.75306  9.92328  10.0965  10.2727   10.452  10.6344    10.82  11.0089   11.201  11.3965  11.5954  11.7978  12.0037  12.2132  12.4264  12.6432  12.8639  13.0884  13.3169  \
+  13.5493  13.7858  14.0264  14.2712  14.5202  14.7737  15.0315  15.2939  15.5608  15.8324  16.1087  16.3899  16.6759   16.967  6.44433  6.55681  6.67124  6.78768  6.90615  7.02668  7.14932   7.2741  7.40106  7.53023  7.66166  7.79538  7.93143  8.06986  8.21071  8.35401  \
+  8.49982  8.64817  8.79911  8.95268  9.10893  9.26791  9.42967  9.59425   9.7617  9.93207  10.1054  10.2818  10.4612  10.6438  10.8296  11.0186  11.2109  11.4066  11.6057  11.8082  12.0143   12.224  12.4374  12.6544  12.8753     13.1  13.3286  13.5613   13.798  14.0388  \
+  14.2838  14.5331  14.7868  15.0448  15.3074  15.5746  15.8464   16.123  16.4044  16.6907   16.982  17.2784    17.58  17.8868   18.199  18.5166  18.8398  19.1686  19.5031  19.8435  20.1899  20.5423  20.9008  21.2656  21.6367  22.0144  22.3986  22.7895  23.1873   23.592  \
+  24.0037  24.4227  24.8489  25.2826  25.7239  26.1728  26.6296  27.0944  27.5673  28.0484   28.538  29.0361  29.5428  30.0585  30.5831  31.1169  31.6599  32.2125  32.7747  33.3468  33.9288  9.66404  9.83271  10.0043  10.1789  10.3566  10.5373  10.7213  10.9084  11.0988  \
+  11.2925  11.4896  11.6901  11.8941  12.1017  12.3129  12.5278  12.7465   12.969  13.1953  13.4256  13.6599  13.8983  14.1409  14.3877  14.6388  14.8943  15.1543  15.4188  15.6879  15.9617  16.2403  16.5237  16.8121  17.1055  17.4041  17.7078  18.0169  18.3314  18.6513  \
+  18.9768   19.308   19.645  19.9879  20.3368  20.6917  21.0528  21.4203  21.7941  22.1745  22.5615  22.9553  23.3559  23.7636  24.1783  24.6003  25.0297  25.4665   25.911  26.3632  26.8234  27.2915  27.7679  28.2525  28.7456  29.2473  29.7578  30.2771  30.8056  31.3432  \
+  31.8903  32.4469  33.0132  33.5893  34.1756  34.7721   35.379  35.9964  36.6247  37.2639  37.9143   38.576  39.2493  39.9343  40.6313  41.3405   42.062  42.7961   43.543   44.303  45.0762   45.863  46.6634  47.4779  48.3065  49.1496  50.0074  50.8802  12.8808  13.1056  \
+  13.3344  13.5671  13.8039  14.0448  14.2899  14.5393  14.7931  15.0513   15.314  15.5813  15.8532  16.1299  16.4114  16.6978  16.9893  17.2858  17.5875  17.8945  18.2068  18.5245  18.8479  19.1768  19.5115   19.852  20.1985  20.5511  20.9097  21.2747   21.646  22.0238  \
+  22.4082  22.7993  23.1972  23.6021   24.014  24.4331  24.8596  25.2934  25.7349  26.1841  26.6411   27.106  27.5791  28.0605  28.5502  29.0485  29.5555  30.0713  30.5962  31.1302  31.6735  32.2263  32.7888  33.3611  33.9433  34.5357  35.1385  35.7518  36.3758  37.0106  \
+  37.6566  38.3138  38.9825  39.6629  40.3552  41.0595  41.7761  42.5052  43.2471  44.0019  44.7699  45.5513  46.3463  47.1552  47.9782  48.8156  49.6676  50.5344  51.4164  52.3138  53.2268  54.1558   55.101  56.0627  57.0412  58.0368  59.0497  60.0803  61.1289  62.1958  \
+  63.2813  64.3858  65.5095  66.6529  67.8162  16.0937  16.3745  16.6603  16.9511   17.247   17.548  17.8543  18.1659  18.4829  18.8055  19.1337  19.4677  19.8074  20.1532  20.5049  20.8628  21.2269  21.5974  21.9743  22.3578  22.7481  23.1451   23.549  23.9601  24.3782  \
+  24.8037  25.2366  25.6771  26.1252  26.5812  27.0451  27.5172  27.9974  28.4861  28.9833  29.4891  30.0038  30.5275  31.0603  31.6024  32.1539  32.7151  33.2861  33.8671  34.4581  35.0596  35.6715   36.294  36.9275   37.572  38.2278   38.895  39.5738  40.2645  40.9672  \
+  41.6823  42.4097  43.1499   43.903  44.6693  45.4489  46.2422  47.0492  47.8704  48.7059   49.556  50.4209  51.3009  52.1963  53.1073  54.0342  54.9772  55.9368  56.9131  57.9064   58.917  59.9453  60.9916  62.0561  63.1392  64.2411  65.3624  66.5031  67.6638  68.8448  \
+  70.0464  71.2689  72.5128  73.7784  75.0661  76.3762  77.7092  79.0655  80.4455  81.8495   83.278  84.7315  19.3016  19.6385  19.9812    20.33  20.6848  21.0458  21.4131  21.7869  22.1671   22.554  22.9476  23.3482  23.7557  24.1703  24.5921  25.0213   25.458  25.9024  \
+  26.3544  26.8144  27.2824  27.7586  28.2431   28.736  29.2375  29.7478   30.267  30.7953  31.3328  31.8796   32.436  33.0021  33.5781  34.1642  34.7605  35.3672  35.9844  36.6125  37.2515  37.9016  38.5632  39.2362   39.921  40.6178  41.3267   42.048  42.7818  43.5285  \
+  44.2882  45.0612  45.8477  46.6479   47.462  48.2904  49.1332  49.9908  50.8633   51.751  52.6542  53.5732  54.5082  55.4596  56.4275  57.4124  58.4144  59.4339  60.4713  61.5267  62.6005  63.6931  64.8048  65.9358  67.0866  68.2575  69.4488  70.6609  71.8942   73.149  \
+  74.4257  75.7247  77.0463   78.391  79.7592  81.1513  82.5676  84.0087  85.4749  86.9667  88.4846  90.0289  91.6002   93.199  94.8256  96.4806  98.1645  99.8778  101.621  22.5037  22.8964   23.296  23.7026  24.1163  24.5372  24.9655  25.4012  25.8446  26.2956  26.7546  \
+  27.2215  27.6966    28.18  28.6719  29.1723  29.6814  30.1995  30.7266  31.2628  31.8085  32.3636  32.9285  33.5032  34.0879  34.6829  35.2882  35.9041  36.5308  37.1683   37.817  38.4771  39.1486  39.8319  40.5271  41.2344  41.9541  42.6863  43.4314  44.1894  44.9606  \
+  45.7453  46.5438  47.3561  48.1826  49.0236  49.8792  50.7497  51.6355  52.5367  53.4536  54.3866  55.3358  56.3016  57.2842   58.284  59.3013  60.3363  61.3894  62.4608   63.551  64.6601  65.7887  66.9369  68.1052  69.2938  70.5032  71.7337  72.9857  74.2596  75.5556  \
+  76.8743   78.216  79.5812  80.9701  82.3833  83.8212  85.2841  86.7726  88.2871   89.828  91.3958  92.9909  94.6139  96.2653  97.9454  99.6549  101.394  103.164  104.964  106.796   108.66  110.557  112.486   114.45  116.447   118.48  25.6989  26.1474  26.6038  27.0681  \
+  27.5405  28.0212  28.5102  29.0078  29.5141  30.0292  30.5534  31.0866  31.6292  32.1812  32.7429  33.3143  33.8958  34.4874  35.0893  35.7017  36.3248  36.9588  37.6039  38.2602   38.928  39.6074  40.2987   41.002  41.7176  42.4457  43.1865  43.9403  44.7072  45.4875  \
+  46.2814  47.0892   47.911  48.7472   49.598  50.4637  51.3444  52.2406  53.1523    54.08  55.0239  55.9842  56.9613  57.9555   58.967  59.9962  61.0433  62.1087  63.1927  64.2956  65.4178  66.5596  67.7213  68.9032  70.1058  71.3294  72.5743   73.841  75.1297   76.441  \
+  77.7751  79.1326  80.5137  81.9189  83.3487  84.8034  86.2835  87.7894  89.3216  90.8806  92.4668  94.0806  95.7226  97.3933  99.0931  100.823  102.582  104.373  106.194  108.048  109.934  111.852  113.804  115.791  117.812  119.868   121.96  124.089  126.254  128.458  \
+    130.7  132.981  135.302  28.8862  29.3904  29.9034  30.4253  30.9563  31.4966  32.0463  32.6056  33.1747  33.7537  34.3428  34.9422  35.5521  36.1726  36.8039  37.4463  38.0998  38.7648  39.4414  40.1297  40.8301  41.5428  42.2678  43.0055  43.7561  44.5198  45.2968  \
+  46.0874  46.8918  47.7102  48.5429  49.3901  50.2521  51.1292  52.0216  52.9295  53.8533  54.7932  55.7496  56.7226  57.7126  58.7198  59.7447  60.7874  61.8484  62.9278  64.0261  65.1436  66.2806  67.4374  68.6144  69.8119  71.0304  72.2701  73.5315  74.8148  76.1206  \
+  77.4491  78.8009  80.1762  81.5756  82.9993  84.4479  85.9218  87.4214  88.9472  90.4997  92.0792  93.6863  95.3214  96.9851  98.6778    100.4  102.152  103.935  105.749  107.595  109.473  111.383  113.327  115.305  117.318  119.365  121.449  123.568  125.725  127.919  \
+  130.152  132.424  134.735  137.086  139.479  141.913   144.39   146.91  149.474  152.083  32.0648  32.6245  33.1939  33.7732  34.3627  34.9624  35.5726  36.1935  36.8252  37.4679  38.1218  38.7872  39.4641  40.1529  40.8537  41.5668  42.2922  43.0304  43.7814  44.5455  \
+   45.323   46.114  46.9189  47.7378  48.5709  49.4187  50.2812  51.1588  52.0516  52.9601  53.8844  54.8249  55.7818  56.7554  57.7459  58.7538  59.7792  60.8226  61.8841  62.9642  64.0631  65.1813  66.3189  67.4764   68.654  69.8523  71.0714  72.3119  73.5739  74.8581  \
+  76.1646  77.4939  78.8464  80.2226  81.6227  83.0473  84.4967  85.9715   87.472  88.9986   90.552  92.1324  93.7404  95.3765  97.0411  98.7348  100.458  102.211  103.995   105.81  107.657  109.536  111.448  113.393  115.372  117.386  119.434  121.519   123.64  125.798  \
+  127.993  130.227    132.5  134.813  137.166   139.56  141.995  144.474  146.995  149.561  152.171  154.827  157.529  160.279  163.076  165.922  168.818  35.2336  35.8486  36.4743  37.1109  37.7586  38.4176  39.0881  39.7703  40.4644  41.1707  41.8892  42.6203  43.3642  \
+   44.121  44.8911  45.6746  46.4718  47.2829  48.1081  48.9477   49.802  50.6713  51.5556  52.4555   53.371  54.3025  55.2502  56.2145  57.1957  58.1939  59.2096   60.243  61.2944  62.3642  63.4527  64.5601  65.6869  66.8334  67.9998  69.1867  70.3942  71.6228  72.8729  \
+  74.1447  75.4388  76.7555  78.0951  79.4581  80.8449  82.2559  83.6916  85.1522  86.6384  88.1506  89.6891  91.2544  92.8471  94.4676  96.1164  97.7939  99.5008  101.237  103.004  104.802  106.631  108.492  110.386  112.312  114.273  116.267  118.296  120.361  122.462  \
+  124.599  126.774  128.986  131.238  133.528  135.859   138.23  140.642  143.097  145.595  148.136  150.721  153.352  156.028  158.751  161.522  164.341  167.209  170.128  173.097  176.118  179.192   182.32  185.502  38.3917  39.0618  39.7435  40.4372   41.143   41.861  \
+  42.5917   43.335  44.0914  44.8609  45.6439  46.4405   47.251  48.0757  48.9148  49.7685  50.6372  51.5209  52.4202  53.3351  54.2659  55.2131  56.1767  57.1572  58.1547  59.1697  60.2024  61.2532  62.3222    63.41  64.5167  65.6427  66.7884  67.9541  69.1401  70.3468  \
+  71.5746  72.8238  74.0948   75.388  76.7038  78.0425  79.4046  80.7905  82.2006  83.6352  85.0949  86.5801  88.0912  89.6287   91.193  92.7847  94.4041  96.0517  97.7281  99.4338  101.169  102.935  104.732  106.559  108.419  110.312  112.237  114.196  116.189  118.217  \
+   120.28  122.379  124.515  126.688    128.9  131.149  133.438  135.767  138.137  140.548  143.001  145.497  148.036   150.62  153.248  155.923  158.645  161.413  164.231  167.097  170.013  172.981      176  179.072  182.197  185.377  188.612  191.904  195.254  198.661  \
+  202.129  41.5381  42.2631  43.0007  43.7512  44.5148  45.2918  46.0822  46.8865  47.7049  48.5375  49.3846  50.2465  51.1235  52.0158  52.9236  53.8473  54.7871  55.7433  56.7162  57.7061  58.7133   59.738  60.7807  61.8415  62.9208   64.019  65.1363  66.2732  67.4299  \
+  68.6067  69.8041  71.0225   72.262  73.5232  74.8065  76.1121  77.4405  78.7921  80.1673  81.5664    82.99  84.4385  85.9122  87.4117  88.9373  90.4895  92.0689  93.6758  95.3107  96.9742  98.6668  100.389  102.141  103.924  105.737  107.583  109.461  111.371  113.315  \
+  115.293  117.305  119.352  121.435  123.555  125.711  127.905  130.138  132.409   134.72  137.071  139.463  141.898  144.374  146.894  149.458  152.066   154.72  157.421  160.168  162.964  165.808  168.702  171.646  174.642   177.69  180.791  183.947  187.157  190.424  \
+  193.747  197.129  200.569   204.07  207.632  211.255  214.943  218.694  44.6718  45.4515  46.2448  47.0519  47.8731  48.7087  49.5588  50.4238  51.3038  52.1992  53.1103  54.0372  54.9804    55.94  56.9163  57.9097  58.9204  59.9487   60.995  62.0596  63.1428  64.2448  \
+  65.3661  66.5069  67.6677  68.8487  70.0504   71.273  72.5169  73.7826  75.0703  76.3806  77.7136    79.07    80.45  81.8542  83.2828  84.7363  86.2153    87.72   89.251  90.8087  92.3936  94.0062  95.6469  97.3163  99.0148  100.743  102.501   104.29   106.11  107.962  \
+  109.847  111.764  113.715  115.699  117.719  119.773  121.864   123.99  126.155  128.356  130.597  132.876  135.195  137.555  139.955  142.398  144.883  147.412  149.985  152.603  155.266  157.976  160.733  163.539  166.393  169.297  172.252  175.258  178.317  181.429  \
+  184.596  187.817  191.095  194.431  197.824  201.277   204.79  208.364  212.001  215.701  219.465  223.296  227.193  231.158  235.193   47.792  48.6261  49.4748  50.3383  51.2169  52.1108  53.0203  53.9456  54.8872  55.8451  56.8198  57.8115  58.8205  59.8471  60.8916  \
+  61.9544  63.0357  64.1359  65.2553  66.3942   67.553   68.732  69.9316  71.1521   72.394  73.6575  74.9431  76.2511  77.5819   78.936  80.3137  81.7154  83.1416  84.5927  86.0691  87.5713  89.0997  90.6548   92.237  93.8469  95.4848  97.1513  98.8469  100.572  102.327  \
+  104.113  105.931  107.779   109.66  111.574  113.522  115.503  117.519   119.57  121.657   123.78  125.941  128.139  130.375  132.651  134.966  137.321  139.718  142.157  144.638  147.162  149.731  152.344  155.003  157.708  160.461  163.261  166.111   169.01   171.96  \
+  174.961  178.015  181.122  184.283  187.499  190.771  194.101  197.489  200.936  204.443  208.011  211.641  215.335  219.093  222.917  226.808  230.767  234.794  238.892  243.062  247.304   251.62  50.8975  51.7859  52.6897  53.6093   54.545   55.497  56.4656  57.4511  \
+  58.4538   59.474   60.512  61.5681  62.6427   63.736  64.8484  65.9803  67.1318  68.3035  69.4956  70.7086  71.9426  73.1983  74.4758  75.7757  77.0982  78.4438  79.8129  81.2059  82.6233  84.0653  85.5325  87.0253  88.5442  90.0896   91.662  93.2618  94.8895  96.5456  \
+  98.2307  99.9451  101.689  103.464   105.27  107.107  108.977  110.879  112.814  114.783  116.786  118.825  120.898  123.009  125.155   127.34  129.562  131.824  134.124  136.465  138.847   141.27  143.736  146.245  148.797  151.394  154.036  156.725   159.46  162.243  \
+  165.075  167.956  170.888   173.87  176.905  179.992  183.134   186.33  189.582  192.891  196.258  199.683  203.168  206.714  210.322  213.993  217.727  221.528  225.394  229.328   233.33  237.403  241.546  245.762  250.051  254.416  258.856  263.374  267.971  53.9876  \
+  54.9299  55.8886   56.864  57.8565  58.8663  59.8937   60.939  62.0026  63.0848  64.1858   65.306  66.4458  67.6055  68.7855   69.986  71.2075  72.4503  73.7148  75.0014  76.3104  77.6423  78.9974  80.3761   81.779  83.2063  84.6585  86.1361  87.6394   89.169  90.7253  \
+  92.3088  93.9199  95.5591  97.2269  98.9238   100.65  102.407  104.194  106.013  107.863  109.746  111.661   113.61  115.593   117.61  119.663  121.752  123.877  126.039  128.238  130.477  132.754  135.071  137.428  139.827  142.267   144.75  147.277  149.847  152.462  \
+  155.123  157.831  160.586  163.388   166.24  169.141  172.093  175.097  178.153  181.262  184.426  187.645   190.92  194.252  197.642  201.092  204.602  208.173  211.806  215.503  219.264  223.091  226.984  230.946  234.977  239.078  243.251  247.496  251.816  256.211  \
+  260.683  265.232  269.861  274.571  279.364  284.239  57.0612  58.0571  59.0704  60.1014  61.1504  62.2176  63.3035  64.4084  65.5325  66.6763    67.84   69.024  70.2287  71.4545  72.7016  73.9705  75.2615   76.575  77.9115  79.2713  80.6549  82.0626  83.4948  84.9521  \
+  86.4348  87.9434  89.4783    91.04  92.6289  94.2456  95.8905  97.5641  99.2669  100.999  102.762  104.556  106.381  108.237  110.126  112.048  114.004  115.994  118.018  120.078  122.174  124.306  126.476  128.683  130.929  133.214  135.539  137.905  140.312  142.761  \
+  145.252  147.787  150.367  152.991  155.661  158.378  161.142  163.955  166.816  169.728   172.69  175.704  178.771  181.891  185.066  188.296  191.582  194.926  198.328  201.789  205.311  208.895   212.54   216.25  220.024  223.864  227.772  231.747  235.792  239.907  \
+  244.094  248.354  252.689  257.099  261.587  266.152  270.797  275.524  280.332  285.225  290.203  295.268  300.422  60.1175  61.1667  62.2343  63.3205  64.4256  65.5501  66.6941  67.8581  69.0425  70.2475  71.4736   72.721  73.9902  75.2816  76.5955  77.9324  79.2925  \
+  80.6765  82.0845  83.5172  84.9748  86.4579  87.9669  89.5022  91.0643  92.6537  94.2708  95.9161  97.5902  99.2935  101.026   102.79  104.584  106.409  108.266  110.156  112.078  114.035  116.025   118.05   120.11  122.207  124.339   126.51  128.718  130.964   133.25  \
+  135.576  137.942  140.349  142.799  145.291  147.827  150.407  153.032  155.703  158.421  161.186  163.999  166.861  169.773  172.736  175.751  178.819   181.94  185.115  188.346  191.633  194.978  198.381  201.843  205.366   208.95  212.597  216.308  220.083  223.924  \
+  227.833  231.809  235.855  239.971   244.16  248.421  252.757  257.168  261.657  266.223   270.87  275.597  280.407  285.301  290.281  295.347  300.502  305.747  311.083  316.512  63.1554  64.2577  65.3792  66.5202  67.6812  68.8625  70.0644  71.2872  72.5314  73.7973  \
+  75.0854  76.3958  77.7292  79.0858  80.4661  81.8705  83.2994  84.7533  86.2325  87.7376  89.2689  90.8269  92.4121   94.025  95.6661  97.3358  99.0346  100.763  102.522  104.311  106.132  107.984  109.869  111.786  113.737  115.722  117.742  119.797  121.888  124.015  \
+   126.18  128.382  130.623  132.902  135.222  137.582  139.983  142.427  144.912  147.442  150.015  152.633  155.297  158.008  160.765  163.571  166.426  169.331  172.286  175.293  178.353  181.465  184.633  187.855  191.134   194.47  197.864  201.317  204.831  208.406  \
+  212.043  215.744  219.509  223.341  227.239  231.205   235.24  239.346  243.523  247.773  252.098  256.498  260.974  265.529  270.164  274.879  279.676  284.558  289.524  294.577  299.719   304.95  310.272  315.687  321.197  326.803  332.507  66.1741   67.329  68.5041  \
+  69.6998  70.9163   72.154  73.4133  74.6946  75.9983  77.3247  78.6743  80.0474  81.4445   82.866  84.3122  85.7838   87.281  88.8043  90.3542  91.9312  93.5357  95.1682  96.8292  98.5192  100.239  101.988  103.768  105.579  107.422  109.297  111.204  113.145   115.12  \
+  117.129  119.174  121.254   123.37  125.523  127.714  129.943  132.211  134.518  136.866  139.255  141.685  144.158  146.674  149.234  151.839  154.489  157.185  159.929   162.72   165.56   168.45   171.39  174.381  177.424  180.521  183.672  186.877  190.139  193.458  \
+  196.834  200.269  203.765  207.321   210.94  214.621  218.367  222.178  226.056  230.001  234.016    238.1  242.256  246.484  250.786  255.163  259.616  264.147  268.758  273.448  278.221  283.077  288.017  293.044  298.159  303.363  308.657  314.045  319.526  325.102  \
+  330.777   336.55  342.424    348.4  69.1726  70.3799  71.6083  72.8581  74.1297  75.4235  76.7399  78.0792   79.442  80.8285  82.2392  83.6746   85.135  86.6208  88.1327  89.6709  91.2359  92.8283  94.4484  96.0969  97.7741  99.4806  101.217  102.983  104.781   106.61  \
+   108.47  110.363   112.29  114.249  116.243  118.272  120.337  122.437  124.574  126.748   128.96  131.211  133.501  135.831  138.202  140.614  143.068  145.565  148.106   150.69  153.321  155.996  158.719  161.489  164.308  167.176  170.093  173.062  176.082  179.156  \
+  182.283  185.464  188.701  191.994  195.345  198.755  202.224  205.753  209.344  212.998  216.715  220.498  224.346  228.262  232.246  236.299  240.423   244.62  248.889  253.233  257.653   262.15  266.725   271.38  276.117  280.936  285.839  290.828  295.904  301.068  \
+  306.323  311.669  317.109  322.644  328.275  334.004  339.834  345.765    351.8   357.94  364.187
+######################
diff --git a/macro/beamtime/mcbm2021/mPsdPar.par b/macro/beamtime/mcbm2021/mPsdPar.par
new file mode 100644
index 0000000000000000000000000000000000000000..2ec6e01d92cf01031aa1ed96adf16f9b69b8038a
--- /dev/null
+++ b/macro/beamtime/mcbm2021/mPsdPar.par
@@ -0,0 +1,16 @@
+[CbmMcbm2018PsdPar]
+//----------------------------------------------------------------------------
+NrOfGdpbs: Int_t 1
+GdpbIdArray: Int_t \
+0x193d
+NrOfFeesPerGdpb: Int_t 1
+NrOfChannelsPerFee: Int_t 32
+NrOfGbtx: Int_t 1
+NrOfModules: Int_t 1
+ModuleId: Int_t \
+  1  
+NbMsTot: Int_t 100
+NbMsOverlap: Int_t 1
+SizeMsInNs: Double_t 102400.0
+//SizeMsInNs: Double_t 1638400
+TsDeadtimePeriod: Double_t 62.5
diff --git a/macro/beamtime/mcbm2021/mRichPar.par b/macro/beamtime/mcbm2021/mRichPar.par
new file mode 100644
index 0000000000000000000000000000000000000000..a8e49d09493ae4cb010a15383ed887e282d6828f
--- /dev/null
+++ b/macro/beamtime/mcbm2021/mRichPar.par
@@ -0,0 +1,156 @@
+[CbmMcbm2018RichPar]
+//----------------------------------------------------------------------------
+TRBaddresses: Int_t \
+  0xc000  \
+  0xc001  \
+  0x7000  \
+  0x7001  \
+  0x7010  \
+  0x7011  \
+  0x7020  \
+  0x7021  \
+  0x7030  \
+  0x7031  \
+  0x7040  \
+  0x7041  \
+  0x7050  \
+  0x7051  \
+  0x7060  \
+  0x7061  \
+  0x7070  \
+  0x7071  \
+  0x7080  \
+  0x7081  \
+  0x7100  \
+  0x7101  \
+  0x7110  \
+  0x7111  \
+  0x7120  \
+  0x7121  \
+  0x7130  \
+  0x7131  \
+  0x7140  \
+  0x7141  \
+  0x7150  \
+  0x7151  \
+  0x7160  \
+  0x7161  \
+  0x7170  \
+  0x7171  \
+  0x7180  \
+  0x7181  \
+  0x7200  \
+  0x7201  \
+  0x7210  \
+  0x7211  \
+  0x7220  \
+  0x7221  \
+  0x7230  \
+  0x7231  \
+  0x7240  \
+  0x7241  \
+  0x7250  \
+  0x7251  \
+  0x7260  \
+  0x7261  \
+  0x7270  \
+  0x7271  \
+  0x7280  \
+  0x7281  \
+  0x7300  \
+  0x7301  \
+  0x7310  \
+  0x7311  \
+  0x7320  \
+  0x7321  \
+  0x7330  \
+  0x7331  \
+  0x7340  \
+  0x7341  \
+  0x7350  \
+  0x7351  \
+  0x7360  \
+  0x7361  \
+  0x7370  \
+  0x7371  \
+  0x7380  \
+  0x7381
+
+ToTshifts: Double_t \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  15.05  13.85  14.15  12.05  15.05  12.35  11.35  13.75  13.85  11.95  14.75  16.15  16.35  15.35  8.15  9.55  6.05  3.85  5.65  7.85  8.65  6.85  7.15  7.35  8.05  9.15  7.25  5.85  7.15  5.35  6.95  8.75 \
+  0.00  13.85  13.05  13.25  11.35  14.75  11.75  10.85  13.35  13.25  11.55  13.85  15.75  15.75  14.55  7.65  8.65  5.65  0.00  5.65  7.35  0.00  6.45  6.85  6.75  7.35  8.55  6.35  5.35  6.35  4.65  5.85  8.15 \
+  0.00  14.15  13.15  13.65  11.75  14.65  11.85  10.35  13.35  13.15  11.55  14.15  15.65  15.65  14.65  7.45  8.85  5.75  3.75  0.00  7.55  8.45  6.85  6.75  7.15  7.75  8.85  6.85  5.25  6.55  4.85  6.55  8.25 \
+  0.00  15.95  14.75  15.05  12.85  16.45  12.95  11.85  14.75  14.55  12.85  15.45  16.95  16.85  15.65  9.15  9.05  0.00  4.55  6.65  8.65  9.55  7.45  7.75  8.25  8.85  10.05  8.05  6.45  7.85  6.25  7.75  9.85 \
+  0.00  17.35  16.25  16.35  14.05  18.15  14.55  13.55  16.25  16.05  14.05  17.05  18.85  19.25  17.55  10.15  11.45  7.75  5.55  7.45  9.65  10.75  8.55  9.15  9.65  9.65  11.25  9.15  7.35  8.55  7.15  8.55  10.65 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  17.65  16.15  16.35  14.15  17.65  14.45  13.15  16.05  16.15  13.85  16.35  18.05  18.65  17.05  9.65  10.75  7.85  5.65  7.85  9.55  10.75  8.65  8.85  9.35  9.85  10.65  8.85  7.15  7.85  6.15  8.65  10.65 \
+  0.00  16.35  15.25  15.75  13.25  17.25  13.55  12.55  15.25  15.35  13.55  16.45  17.65  18.25  16.85  9.25  10.55  7.25  4.35  6.85  8.75  9.75  8.35  8.25  8.65  9.35  10.05  8.25  6.85  7.85  6.35  7.85  9.65 \
+  0.00  16.05  14.85  15.35  13.05  16.55  13.45  12.05  14.75  15.05  13.15  15.65  17.35  17.65  16.35  9.15  10.45  7.05  4.65  6.55  8.55  9.55  7.75  8.15  8.05  9.05  10.25  8.25  6.55  7.85  6.15  7.85  9.65 \
+  0.00  15.55  14.55  14.75  12.65  16.15  12.85  11.65  14.35  14.15  12.65  15.35  16.95  17.15  15.85  8.85  9.75  6.75  4.35  6.55  8.55  9.35  7.65  7.75  8.15  9.05  10.05  7.85  6.35  7.55  5.35  7.05  9.05 \
+  0.00  17.15  16.15  16.15  14.05  17.65  14.25  13.35  16.15  16.15  14.35  16.85  18.05  18.85  17.15  10.05  11.15  7.85  5.55  7.55  9.85  10.55  8.75  9.15  9.65  10.05  11.05  8.85  7.35  8.55  7.35  8.85  10.75 \
+  0.00  16.95  15.85  16.15  14.15  17.55  14.05  13.05  15.85  15.85  13.85  16.75  18.35  18.75  17.55  9.85  11.35  7.45  5.05  7.45  9.45  10.75  8.45  8.85  9.35  9.55  10.75  8.85  6.95  8.55  6.65  8.25  10.05 \
+  0.00  16.85  15.95  16.15  14.05  17.55  14.35  12.85  15.65  16.05  14.05  16.65  18.25  18.65  17.35  9.85  11.05  7.65  5.25  7.75  9.55  10.85  8.85  8.85  9.45  10.05  11.05  9.05  7.15  8.65  7.05  8.35  10.35 \
+  0.00  15.75  14.25  14.45  12.65  16.15  13.05  12.05  14.55  14.55  12.85  15.35  16.85  17.45  15.85  8.85  9.85  6.45  4.15  6.35  8.35  8.05  7.55  7.85  8.35  8.65  9.85  7.85  6.35  7.15  5.55  7.75  9.15 \
+  0.00  15.05  13.85  14.15  12.05  15.05  12.55  11.35  13.75  13.85  11.85  14.85  16.35  16.45  15.35  8.35  9.55  6.05  4.05  6.25  8.15  8.95  7.15  6.85  7.65  8.55  9.35  7.55  6.05  6.95  5.35  7.25  8.95 \
+  0.00  14.35  13.35  13.65  11.35  15.05  12.15  10.75  13.55  12.75  11.65  14.45  15.75  15.65  15.25  7.75  8.85  5.75  3.55  5.85  7.35  8.65  6.95  7.15  7.35  8.05  8.75  6.95  5.55  6.55  5.35  6.85  8.05 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  14.75  13.45  14.25  11.85  15.15  12.35  11.05  13.85  13.65  12.05  14.55  16.25  16.35  15.55  7.85  9.55  5.85  3.75  5.85  7.95  8.65  0.00  7.25  7.85  8.25  9.05  7.45  5.85  6.95  5.65  7.05  9.05 \
+  0.00  16.55  15.05  15.75  13.55  16.65  13.35  12.65  15.05  15.35  13.25  16.05  17.55  17.35  16.65  9.15  10.65  7.15  4.55  7.15  8.75  9.65  8.25  8.65  8.85  9.35  10.35  8.55  6.85  8.05  6.65  8.25  10.05 \
+  0.00  14.15  13.05  13.85  11.55  14.75  11.85  10.85  13.25  13.45  11.35  14.05  15.85  16.05  14.85  7.85  8.85  5.85  3.55  5.75  7.55  8.55  7.05  0.00  7.35  7.85  9.05  7.15  5.35  6.55  5.35  6.65  8.65 \
+  0.00  14.55  13.65  14.15  12.35  15.65  12.75  11.55  14.05  14.15  12.05  14.35  16.05  16.35  15.35  8.35  9.15  6.15  4.05  5.85  7.55  8.85  0.00  7.35  7.75  8.25  9.15  7.05  5.75  7.15  5.75  7.35  8.65 \
+  0.00  15.85  14.85  15.05  13.05  16.55  13.25  12.35  15.05  15.05  13.15  16.05  17.35  17.75  16.55  9.25  10.35  6.75  4.65  6.65  8.85  9.45  7.85  8.05  8.55  8.95  10.05  8.25  6.35  7.75  6.25  7.85  9.55 \
+  0.00  16.55  15.25  15.85  13.55  16.95  14.05  12.85  15.35  15.65  13.65  16.35  17.95  18.45  17.05  9.65  10.85  7.45  5.15  7.15  9.35  10.35  8.55  8.55  9.15  9.45  10.65  8.85  6.85  8.15  6.55  8.05  10.15 \
+  0.00  16.55  15.45  15.55  13.65  16.75  14.05  12.75  15.55  15.55  13.75  16.55  17.95  18.35  17.15  9.75  10.55  8.35  5.05  7.75  9.15  10.45  8.65  8.95  9.15  9.75  10.85  8.85  7.05  8.45  6.55  8.35  10.35 \
+  0.00  15.05  13.35  14.15  12.25  15.55  12.35  11.25  14.15  14.05  12.35  14.85  16.15  16.65  15.65  8.25  9.35  5.95  3.55  6.05  8.05  8.65  7.15  7.35  8.05  8.05  9.35  7.15  5.45  6.85  5.25  6.55  8.55 \
+  0.00  16.75  15.55  15.85  13.65  17.55  14.05  12.85  15.65  15.55  13.65  16.55  17.85  18.45  17.45  9.65  10.65  7.65  5.15  7.55  9.45  10.35  8.65  8.65  9.35  10.05  10.85  9.05  7.15  8.55  6.95  8.55  10.55 \
+  0.00  15.65  14.55  15.05  12.75  16.15  12.85  11.75  14.65  14.65  12.85  15.55  17.15  17.45  15.95  8.75  9.85  6.75  4.35  6.65  8.35  9.55  7.95  7.75  8.35  8.95  9.85  8.05  6.55  7.35  6.05  7.35  9.05 \
+  0.00  16.85  15.65  16.05  14.05  17.05  14.25  12.15  15.55  15.65  13.85  16.15  17.55  18.05  16.95  9.55  10.55  7.55  4.75  7.25  9.15  10.35  8.35  8.45  9.15  9.55  10.85  8.75  7.05  8.35  7.05  8.55  10.35 \
+  0.00  15.85  14.75  15.05  13.15  15.85  12.65  12.05  14.75  15.05  12.45  0.00  16.55  17.35  16.05  8.95  9.65  6.85  4.65  6.35  8.15  9.25  7.35  8.15  8.55  9.05  9.65  8.15  6.55  7.35  5.55  7.75  9.65 \
+  0.00  16.85  16.15  16.05  14.15  17.05  14.25  12.75  16.05  15.85  13.95  16.65  18.35  18.15  16.85  9.65  10.55  7.65  5.65  7.55  9.55  10.55  8.85  8.65  9.15  10.05  10.75  9.05  6.85  8.15  6.15  8.65  10.75 \
+  0.00  14.35  13.25  13.85  11.55  15.05  11.85  10.85  13.35  13.35  11.15  14.15  15.65  15.85  14.25  7.65  8.85  5.75  4.05  5.65  7.85  8.65  6.65  7.15  7.55  7.85  8.65  7.05  5.35  6.65  5.05  6.75  8.35 \
+  0.00  14.35  13.15  13.55  11.75  14.75  11.95  10.75  13.05  13.15  11.65  14.25  15.75  15.85  14.55  7.85  8.85  5.75  3.75  5.35  7.15  8.35  6.85  6.85  7.25  7.65  8.65  6.45  5.15  6.55  4.85  6.05  8.35 \
+  0.00  17.15  15.95  16.15  13.85  17.25  14.35  12.85  15.55  15.85  13.55  16.75  18.45  18.85  16.65  10.25  11.15  7.65  5.35  7.35  9.25  10.35  8.25  8.35  9.05  9.65  10.65  8.85  7.15  8.45  5.95  8.65  10.05 \
+  0.00  14.85  13.85  14.25  11.65  15.05  12.05  11.25  13.85  13.85  11.55  14.65  16.05  16.45  15.25  8.45  9.05  6.05  4.15  5.75  7.95  8.75  6.85  7.05  7.45  8.15  9.15  7.05  5.65  6.75  5.35  7.05  8.95 \
+  0.00  17.05  15.85  16.05  14.15  17.55  14.35  13.05  15.55  15.65  13.95  16.65  18.35  18.55  17.05  9.55  10.55  7.35  5.35  7.25  9.35  10.35  8.65  8.75  9.15  9.55  10.75  8.65  7.25  8.75  6.85  8.35  10.55 \
+  0.00  14.15  13.15  13.75  11.55  14.55  11.55  10.55  13.35  12.95  11.45  14.05  15.65  15.65  14.85  7.95  8.75  5.65  3.45  5.65  7.25  8.05  6.45  0.00  7.25  7.65  8.55  6.85  5.15  6.65  5.05  6.55  0.00 \
+  0.00  16.15  15.05  15.55  13.25  16.85  13.55  12.35  15.35  15.15  13.05  15.85  17.95  17.65  16.65  9.35  10.55  7.25  4.85  7.35  9.15  10.05  7.95  8.35  8.85  9.05  10.35  8.25  6.65  8.15  6.55  0.00  9.85 \
+  0.00  15.65  14.55  14.75  13.05  15.95  12.45  11.95  14.25  13.65  12.05  14.65  16.35  16.35  15.25  8.55  9.85  6.85  4.15  5.65  7.55  8.65  7.55  7.15  7.35  8.35  9.15  6.85  6.25  7.05  6.15  7.85  8.35 \
+  0.00  14.75  13.55  14.05  12.05  15.35  12.05  11.15  13.95  13.55  11.65  14.15  15.85  16.15  15.25  8.15  9.45  0.00  3.95  5.85  7.85  8.65  7.05  7.25  7.55  8.35  9.25  7.55  5.75  7.05  5.65  6.95  8.75 \
+  0.00  15.05  13.55  14.35  11.95  15.55  12.05  11.25  13.85  13.75  12.15  14.65  16.35  16.35  15.35  0.00  9.55  5.85  3.55  5.95  7.75  8.85  7.05  7.65  7.65  8.05  9.05  7.55  5.85  7.15  5.65  7.15  9.05 \
+  0.00  16.05  14.65  15.35  13.05  16.75  13.55  12.35  14.85  15.05  12.95  16.05  17.55  17.65  16.45  9.05  10.15  6.85  4.85  6.95  9.15  9.85  7.95  8.15  8.85  8.85  10.05  8.25  6.55  8.05  6.15  7.75  9.65 \
+  0.00  16.65  15.55  15.75  13.75  16.75  13.65  12.65  15.05  15.35  13.35  16.55  17.85  18.35  16.85  9.65  10.75  7.35  5.05  7.25  9.45  10.25  8.65  8.55  9.25  9.85  10.75  8.65  7.15  8.15  6.15  8.05  10.25 \
+  0.00  15.15  13.65  14.15  12.25  15.95  12.65  11.65  14.05  14.45  12.25  14.75  16.15  16.55  15.25  8.45  9.35  6.35  4.25  6.35  8.25  9.45  8.05  8.35  7.95  8.25  10.05  7.45  6.65  7.05  5.05  6.65  8.45 \
+  0.00  16.35  14.15  15.55  12.65  16.45  13.65  11.85  15.05  14.15  12.85  15.35  17.15  17.35  15.85  8.55  9.65  6.55  4.35  6.15  8.65  9.55  7.65  7.55  8.25  9.25  9.75  7.75  6.05  7.05  5.35  6.95  8.85 \
+  0.00  16.65  15.45  15.85  13.65  17.15  14.05  12.85  15.55  15.45  13.85  16.55  17.85  18.35  17.05  9.35  10.55  7.15  5.05  7.05  9.05  10.25  8.15  8.65  9.05  9.55  0.00  8.55  7.05  8.05  6.55  7.85  10.15 \
+  0.00  15.55  14.55  14.85  12.75  16.05  12.95  11.85  14.55  14.75  12.75  15.35  16.85  17.25  15.75  8.85  9.85  6.35  4.25  6.05  8.25  9.35  7.55  7.65  8.05  8.35  9.55  7.65  5.75  7.15  5.55  7.05  8.85 \
+  0.00  17.85  16.75  17.05  14.65  18.05  14.85  13.75  16.65  16.55  14.75  17.05  18.55  19.05  17.55  10.05  11.05  8.35  6.05  8.05  10.35  11.15  9.05  9.65  9.85  10.65  11.35  9.55  7.85  8.55  7.55  9.15  10.05 \
+  0.00  16.05  15.05  15.25  13.55  16.75  13.75  12.35  15.15  15.05  13.35  15.85  17.55  17.85  16.55  9.05  10.15  7.25  4.55  6.85  8.85  9.75  8.05  8.65  8.75  9.25  10.15  8.25  6.35  7.85  6.25  7.55  9.35 \
+  0.00  15.65  14.15  14.45  12.45  15.95  12.85  11.55  14.15  14.15  12.75  15.05  16.65  16.85  15.65  8.85  9.85  6.55  4.35  6.45  8.35  9.35  7.65  7.55  8.05  8.55  9.55  7.75  6.15  7.35  5.65  7.55  9.05 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  14.85  13.05  13.95  11.65  15.05  12.15  11.15  13.85  13.65  12.15  14.65  15.95  16.35  15.15  8.05  9.35  5.95  3.55  3.35  7.55  8.15  6.65  7.25  7.65  7.85  8.75  7.15  5.45  6.85  5.45  6.85  8.75 \
+  0.00  15.25  14.25  14.85  12.55  15.95  12.65  12.05  14.35  14.35  12.55  15.15  16.65  16.85  16.05  8.55  9.75  6.35  -0.15  6.15  8.15  9.15  6.95  7.65  8.15  8.65  9.65  7.25  5.85  7.05  5.65  6.75  9.05 \
+  0.00  14.35  13.15  13.55  11.75  14.65  11.75  10.95  13.05  13.25  11.65  13.85  15.75  16.05  14.65  7.65  8.85  5.75  3.35  0.00  7.15  8.15  6.75  6.55  7.05  7.85  8.85  6.75  5.25  6.55  5.05  6.55  8.25 \
+  0.00  13.45  15.05  15.35  12.95  16.25  13.15  12.05  14.85  14.85  13.05  15.65  17.05  17.35  16.05  9.05  10.15  7.05  4.55  6.85  8.55  9.75  7.75  0.00  8.35  9.05  10.05  8.05  6.35  7.85  6.25  7.65  9.75 \
+  0.00  15.55  14.35  14.35  12.85  15.75  12.65  11.55  14.85  14.15  12.55  15.35  16.55  16.75  15.65  8.95  10.05  6.05  3.75  5.95  7.65  9.05  7.05  7.25  7.55  8.05  9.15  7.55  5.55  6.95  5.45  6.55  8.35 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  16.05  15.05  15.55  13.65  16.75  13.45  12.55  15.55  15.45  13.35  16.15  17.55  18.05  16.65  9.15  10.55  7.15  4.45  7.15  8.65  9.75  8.15  8.25  8.65  9.05  10.35  8.35  6.45  7.95  6.25  7.65  9.65 \
+  0.00  16.65  14.35  15.05  12.65  16.15  13.15  12.35  15.05  14.65  12.85  15.75  17.35  17.35  16.05  8.85  10.05  6.45  4.65  6.55  8.65  9.35  7.95  8.75  8.35  8.85  10.05  8.05  6.05  7.35  5.75  7.35  8.95 \
+  0.00  16.65  15.35  15.85  13.85  16.85  13.15  12.85  14.65  14.85  13.05  15.65  17.25  17.05  16.05  9.05  10.05  6.95  4.65  6.55  8.55  9.85  7.65  8.65  8.25  9.05  10.05  7.75  6.35  7.35  5.65  7.35  9.55 \
+  0.00  16.75  15.35  15.85  13.85  17.35  14.25  12.85  15.85  15.75  13.75  16.65  18.25  18.55  17.15  10.05  11.05  7.05  4.85  6.95  9.05  10.25  8.15  8.55  8.85  9.65  10.55  8.65  6.65  8.05  6.25  8.15  10.05 \
+  0.00  16.85  15.75  16.25  13.85  17.45  13.95  12.85  15.65  15.85  13.65  16.45  17.75  18.35  16.55  9.65  10.85  7.65  5.25  7.35  9.15  10.05  7.95  8.75  9.05  9.55  10.55  8.55  6.75  8.05  5.85  8.45  10.35 \
+  0.00  16.95  15.95  16.05  14.05  17.45  14.35  13.05  15.65  15.85  14.15  16.85  18.35  18.55  17.45  10.05  11.35  7.75  5.15  7.45  9.65  10.55  8.65  8.65  9.15  9.55  10.85  9.25  7.25  8.55  7.15  8.85  10.65 \
+  0.00  16.85  15.55  15.85  13.95  17.15  14.35  13.15  15.75  15.65  13.85  16.65  18.35  18.75  17.55  9.75  10.85  7.35  5.15  7.45  9.35  10.35  8.35  8.65  9.15  9.55  11.05  8.85  7.05  8.35  6.85  8.35  10.05 \
+  0.00  14.75  13.65  13.95  12.15  15.35  12.45  11.35  13.85  13.85  12.05  14.55  15.85  16.35  15.25  8.05  9.55  6.05  3.95  6.05  8.25  9.05  7.35  7.85  8.05  8.45  9.45  7.35  5.85  7.15  5.45  7.25  8.65 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
+
+
+########################
diff --git a/macro/beamtime/mcbm2021/mRichPar_70.par b/macro/beamtime/mcbm2021/mRichPar_70.par
new file mode 100644
index 0000000000000000000000000000000000000000..297b24ade6133e509a2e562a98417bd69538a155
--- /dev/null
+++ b/macro/beamtime/mcbm2021/mRichPar_70.par
@@ -0,0 +1,156 @@
+[CbmMcbm2018RichPar]
+//----------------------------------------------------------------------------
+TRBaddresses: Int_t \
+  0xc000  \
+  0xc001  \
+  0x7000  \
+  0x7001  \
+  0x7010  \
+  0x7011  \
+  0x7020  \
+  0x7021  \
+  0x7030  \
+  0x7031  \
+  0x7040  \
+  0x7041  \
+  0x7050  \
+  0x7051  \
+  0x7060  \
+  0x7061  \
+  0x7070  \
+  0x7071  \
+  0x7080  \
+  0x7081  \
+  0x7100  \
+  0x7101  \
+  0x7110  \
+  0x7111  \
+  0x7120  \
+  0x7121  \
+  0x7130  \
+  0x7131  \
+  0x7140  \
+  0x7141  \
+  0x7150  \
+  0x7151  \
+  0x7160  \
+  0x7161  \
+  0x7170  \
+  0x7171  \
+  0x7180  \
+  0x7181  \
+  0x7200  \
+  0x7201  \
+  0x7210  \
+  0x7211  \
+  0x7220  \
+  0x7221  \
+  0x7230  \
+  0x7231  \
+  0x7240  \
+  0x7241  \
+  0x7250  \
+  0x7251  \
+  0x7260  \
+  0x7261  \
+  0x7270  \
+  0x7271  \
+  0x7280  \
+  0x7281  \
+  0x7300  \
+  0x7301  \
+  0x7310  \
+  0x7311  \
+  0x7320  \
+  0x7321  \
+  0x7330  \
+  0x7331  \
+  0x7340  \
+  0x7341  \
+  0x7350  \
+  0x7351  \
+  0x7360  \
+  0x7361  \
+  0x7370  \
+  0x7371  \
+  0x7380  \
+  0x7381
+
+ToTshifts: Double_t \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  14.65  13.35  13.45  11.65  14.55  12.05  10.95  12.95  13.55  11.65  14.05  15.85  16.05  14.55  7.75  9.25  5.75  3.55  5.35  7.25  8.35  6.55  6.65  7.05  7.75  8.75  6.45  5.55  6.75  4.45  5.95  7.75 \
+  0.00  12.95  12.75  12.65  10.35  14.55  11.45  10.55  12.85  12.65  11.15  13.55  15.15  15.35  13.55  7.35  8.25  5.25  0.00  5.35  6.85  0.00  5.95  6.35  6.35  7.05  8.05  6.05  5.15  5.15  4.15  5.55  6.85 \
+  0.00  13.85  12.55  13.25  11.45  14.45  11.35  10.05  13.05  12.75  11.25  13.65  15.25  15.35  14.25  6.55  8.45  5.45  3.55  0.00  6.85  8.05  6.45  6.45  6.35  7.25  8.55  6.75  4.75  6.05  4.55  6.25  8.05 \
+  0.00  15.55  14.15  13.85  12.45  16.05  12.45  11.05  14.15  13.85  12.05  15.05  16.75  16.65  15.55  8.25  8.55  0.00  4.25  6.15  8.15  9.25  7.05  7.25  7.85  8.45  9.55  7.75  6.15  7.45  5.05  6.55  9.55 \
+  0.00  17.05  15.85  16.05  13.75  17.95  14.35  13.35  16.05  15.75  13.85  16.75  18.35  18.85  17.25  10.05  11.15  7.55  5.05  7.05  9.25  10.45  8.15  8.95  9.05  9.05  10.65  9.05  6.95  8.05  6.75  8.15  10.35 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  17.05  15.55  15.55  13.55  16.85  13.85  12.45  15.75  15.55  13.45  16.05  17.55  18.35  16.65  9.35  10.55  7.55  5.35  7.25  8.95  10.45  8.35  8.45  8.75  9.25  10.45  8.25  6.65  7.65  6.25  7.75  9.65 \
+  0.00  16.05  14.85  15.25  12.85  16.65  12.95  12.25  14.85  15.05  13.05  16.15  17.35  17.95  16.55  9.05  10.35  7.05  4.15  6.45  8.45  9.55  7.75  8.05  8.35  8.75  9.75  7.95  6.45  7.45  6.05  7.65  9.35 \
+  0.00  15.55  14.15  15.05  12.85  16.15  13.05  11.35  14.35  14.65  12.55  15.05  17.05  16.95  15.95  8.65  10.05  6.85  4.35  6.05  8.05  9.15  7.25  7.55  7.75  8.55  10.05  7.65  6.25  7.55  5.55  7.45  9.55 \
+  0.00  15.05  14.25  14.35  12.35  15.85  12.55  11.55  13.95  14.05  12.45  15.05  16.65  16.95  15.85  8.55  9.35  6.25  4.05  6.35  8.35  9.15  7.45  7.45  8.05  8.75  9.65  7.55  5.95  7.05  5.05  6.75  8.75 \
+  0.00  16.45  15.05  15.85  13.55  17.05  13.55  12.65  15.85  15.55  13.45  16.35  17.55  18.55  16.95  9.55  10.35  7.45  5.15  7.05  9.35  10.05  8.35  8.55  8.65  8.95  10.35  8.15  6.55  8.45  6.35  7.75  9.55 \
+  0.00  16.65  15.55  15.85  13.85  17.25  13.95  12.75  15.65  15.45  13.75  16.45  17.95  18.55  17.25  9.55  10.95  7.15  4.85  7.05  9.25  10.45  8.15  8.55  9.15  9.05  10.35  8.35  6.55  8.05  6.35  8.05  9.65 \
+  0.00  16.55  15.65  15.75  13.85  17.25  14.05  12.45  15.35  15.65  13.85  16.55  18.05  18.35  17.05  9.35  10.55  7.35  5.05  7.55  9.25  10.45  8.45  8.65  9.05  9.65  10.55  8.65  7.05  8.55  6.65  8.05  10.05 \
+  0.00  15.15  14.05  14.15  11.95  15.95  12.55  11.25  14.05  13.85  12.35  15.25  15.95  17.15  14.75  8.25  9.25  5.75  3.35  5.45  7.85  6.05  6.55  7.55  8.05  8.45  9.15  7.65  5.95  6.75  5.25  7.45  8.45 \
+  0.00  14.25  13.25  13.15  11.45  14.55  11.85  10.65  13.05  13.25  11.15  14.75  16.05  15.85  14.45  7.65  9.25  5.55  3.35  5.75  7.85  8.55  6.75  6.25  7.25  8.25  8.95  6.85  5.75  6.55  4.55  6.75  7.85 \
+  0.00  13.45  12.85  13.15  10.55  14.55  12.05  10.05  13.05  12.55  10.95  13.55  15.55  15.45  14.55  7.45  8.45  5.05  3.25  5.25  6.85  8.15  6.65  6.65  6.65  7.75  8.45  6.85  4.55  6.05  4.45  5.55  7.55 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  13.65  12.55  13.75  11.15  14.55  11.85  10.85  13.35  13.35  11.85  14.05  16.05  16.05  14.75  7.45  8.75  5.25  3.15  5.45  7.65  8.35  0.00  6.85  7.55  7.95  8.65  6.95  5.45  6.45  4.65  6.05  8.05 \
+  0.00  15.85  13.85  15.35  13.15  15.85  12.55  12.05  14.25  14.85  12.55  15.25  16.75  16.95  16.05  8.35  10.45  6.05  3.65  6.55  8.25  9.35  7.95  8.25  8.55  8.95  9.85  7.95  6.35  7.55  5.85  7.25  9.25 \
+  0.00  13.65  12.55  13.05  11.15  14.05  11.35  10.55  12.75  12.75  10.85  13.65  15.55  15.55  14.05  7.35  8.05  5.65  3.15  5.35  7.05  8.15  6.55  0.00  6.75  7.55  8.55  6.65  5.05  5.75  4.95  6.45  7.55 \
+  0.00  14.25  12.75  13.55  12.05  15.05  11.95  11.15  13.55  13.85  11.75  13.75  15.35  16.05  14.85  8.05  8.85  5.75  3.65  5.55  7.15  8.55  0.00  6.85  7.15  7.55  8.75  6.55  5.55  6.25  4.75  6.25  8.35 \
+  0.00  15.55  14.45  14.75  12.55  16.15  12.95  12.15  14.65  14.75  12.95  15.75  17.05  17.55  16.15  9.05  10.15  6.55  4.35  6.35  8.75  9.35  7.25  7.85  8.15  8.75  9.65  8.05  6.05  7.55  5.85  7.65  9.25 \
+  0.00  16.35  14.85  15.55  13.05  16.65  13.55  12.65  15.05  15.35  13.45  16.25  17.65  18.15  16.65  9.45  10.55  7.05  4.85  6.85  9.05  10.15  8.15  8.35  8.85  9.05  10.55  8.55  6.65  7.95  6.15  7.75  10.05 \
+  0.00  16.25  15.05  15.05  13.25  16.65  13.55  12.45  15.15  15.15  13.45  16.05  17.65  18.05  16.55  9.45  10.25  7.25  4.95  7.05  8.85  10.15  8.15  8.65  8.75  9.35  10.45  8.45  6.85  8.15  6.15  7.85  10.05 \
+  0.00  14.65  13.05  13.65  12.05  15.05  12.05  10.75  13.75  13.85  12.05  14.55  15.75  16.35  15.05  8.05  9.05  5.65  3.15  5.65  7.55  8.45  6.85  6.95  7.45  7.45  8.95  6.85  5.05  6.55  4.85  6.35  8.05 \
+  0.00  16.35  15.05  15.45  13.05  17.15  13.35  12.25  15.15  15.05  13.25  16.05  17.65  18.05  17.05  9.25  10.05  7.35  4.85  7.15  8.95  9.75  8.35  8.25  8.65  9.45  10.35  8.45  6.75  8.25  6.55  7.45  10.15 \
+  0.00  15.05  14.05  14.75  12.45  15.75  12.55  11.45  14.15  14.45  12.65  15.05  16.85  17.15  15.55  8.45  9.55  6.45  4.05  6.05  8.05  9.05  7.45  7.55  8.05  8.55  9.55  7.55  6.15  7.15  5.65  7.05  8.65 \
+  0.00  16.15  14.75  15.05  13.35  16.15  13.55  12.15  14.75  15.05  13.05  15.75  17.25  17.95  16.65  9.25  10.35  7.25  4.05  6.95  8.55  9.75  7.95  7.65  8.85  8.95  10.55  8.15  6.65  7.75  6.45  7.75  9.35 \
+  0.00  15.05  13.95  14.15  12.45  15.35  12.45  11.55  14.05  13.95  12.15  0.00  16.35  16.75  15.55  8.65  9.35  6.15  4.05  5.55  7.65  8.65  6.65  7.35  7.85  8.45  9.05  7.45  5.55  7.05  5.35  6.75  8.65 \
+  0.00  16.05  15.55  15.45  13.45  16.35  13.55  12.35  15.55  15.05  13.15  16.05  17.75  17.85  16.55  9.25  10.15  7.15  5.45  7.05  9.05  10.25  8.55  7.95  8.55  9.35  10.15  8.05  6.05  7.55  6.05  7.75  9.75 \
+  0.00  14.05  12.95  13.25  10.65  14.45  11.55  10.45  12.95  13.05  10.75  13.35  14.85  15.35  13.85  6.85  7.95  5.35  3.55  5.25  7.35  7.95  5.95  6.55  7.05  7.05  7.65  6.45  4.45  5.45  4.05  5.55  7.55 \
+  0.00  14.05  12.85  13.05  11.35  14.45  11.35  10.45  12.25  12.35  11.35  13.95  15.05  15.55  13.45  7.05  8.45  5.45  3.35  4.75  6.55  7.85  6.25  5.95  6.45  7.15  8.15  5.65  4.55  6.05  3.55  5.55  7.85 \
+  0.00  16.55  15.05  15.15  13.05  16.75  13.75  12.05  15.05  15.05  12.95  16.15  17.95  18.15  16.25  9.65  10.55  7.35  4.55  6.35  8.65  9.95  7.75  7.75  8.05  8.95  9.95  8.25  6.45  7.25  5.75  7.55  9.85 \
+  0.00  14.15  13.05  13.95  11.35  14.45  11.45  10.85  13.45  12.95  11.15  13.85  15.75  16.15  14.65  7.95  8.55  5.05  3.65  5.35  7.25  8.35  6.45  6.35  6.75  7.35  8.65  6.55  5.05  6.15  4.45  6.35  8.25 \
+  0.00  16.75  14.85  15.85  13.75  16.75  13.85  12.15  15.15  15.25  13.55  16.45  18.05  18.25  16.55  9.15  10.35  6.45  4.85  6.85  8.65  10.05  8.15  8.35  8.65  8.85  10.55  8.05  7.05  8.35  5.95  7.35  9.45 \
+  0.00  13.75  12.85  13.35  11.35  14.05  11.15  9.95  13.15  12.05  10.85  13.75  15.55  15.15  14.55  7.65  7.75  5.35  3.15  5.05  6.75  7.95  6.05  0.00  6.75  7.05  8.05  6.25  4.75  6.15  4.75  6.25  0.00 \
+  0.00  15.55  14.75  15.25  12.55  16.55  13.25  11.75  14.65  14.65  12.45  15.05  17.25  17.05  15.75  9.05  10.15  6.95  4.55  6.85  8.85  9.55  7.65  7.55  8.65  8.55  10.05  7.85  6.25  7.55  5.25  0.00  9.55 \
+  0.00  15.15  14.05  13.85  11.85  15.05  11.95  10.95  13.85  13.15  11.55  14.25  15.95  16.25  15.05  8.25  9.35  5.85  3.55  5.35  7.15  8.35  6.85  6.55  7.05  7.85  8.85  6.45  5.05  6.55  4.55  6.55  7.95 \
+  0.00  14.55  13.05  13.95  11.45  14.95  11.65  10.45  13.75  13.25  11.55  14.05  15.55  15.75  14.95  7.85  9.15  0.00  3.55  5.55  7.55  8.15  6.45  6.65  7.05  7.85  8.85  7.05  5.55  6.85  5.75  6.75  8.65 \
+  0.00  14.35  13.15  14.05  11.55  15.05  11.55  11.05  13.65  13.25  11.55  14.05  16.05  16.05  15.15  0.00  8.95  5.25  2.65  5.55  7.55  8.25  6.55  7.25  7.15  7.95  8.55  7.05  5.35  6.95  5.05  6.05  8.85 \
+  0.00  15.65  14.45  15.05  12.55  16.45  13.05  12.05  14.35  14.85  12.45  15.85  17.15  17.55  16.05  8.55  9.95  6.55  4.55  6.55  8.95  9.55  7.75  8.05  8.55  8.55  9.75  8.05  6.15  7.55  5.65  7.45  9.25 \
+  0.00  16.35  15.05  15.55  13.45  16.35  13.45  12.45  14.85  15.05  13.05  15.95  17.45  18.15  16.45  9.35  10.25  7.15  4.85  7.05  8.95  10.05  8.45  8.35  8.95  9.55  10.25  8.45  6.85  7.85  5.75  7.55  9.75 \
+  0.00  14.85  13.15  13.85  11.95  15.25  12.25  11.05  13.95  13.85  11.55  14.25  15.85  16.25  14.85  8.15  8.85  5.85  3.95  5.85  8.05  9.05  7.05  7.65  7.65  8.05  9.25  7.15  5.45  6.75  4.85  6.45  8.15 \
+  0.00  14.95  13.95  14.85  12.35  15.75  12.75  11.45  14.35  14.05  12.55  14.75  16.75  16.85  15.45  8.05  9.35  6.15  3.95  5.95  8.25  9.05  7.15  7.15  7.65  8.35  9.35  7.35  5.45  6.75  5.05  6.55  8.65 \
+  0.00  16.45  15.05  15.55  13.35  16.85  13.65  12.55  15.15  15.15  13.55  16.15  17.65  17.85  16.75  8.95  10.35  6.95  4.55  6.75  8.55  9.75  7.85  8.25  8.55  9.25  0.00  8.05  6.75  7.65  6.15  7.45  10.05 \
+  0.00  15.25  14.25  14.45  12.35  15.55  12.65  11.65  14.15  14.45  12.25  15.25  16.55  16.95  15.55  8.75  9.55  6.05  3.95  5.55  7.85  9.05  7.15  7.15  7.85  8.05  9.05  7.35  5.45  6.85  5.25  6.65  8.45 \
+  0.00  17.05  16.05  16.25  14.25  17.35  14.05  13.05  16.05  15.75  14.05  16.55  18.55  18.95  17.45  9.55  10.85  8.05  5.55  7.55  10.05  11.05  8.95  9.45  9.15  10.35  10.65  8.85  7.65  10.05  6.55  8.25  9.75 \
+  0.00  15.85  14.85  15.05  13.25  16.55  13.45  12.05  15.05  14.85  13.25  15.55  17.45  17.75  16.45  8.85  9.85  7.05  4.35  6.55  8.55  9.45  7.75  8.35  8.55  9.05  10.05  7.95  6.05  7.55  6.05  7.15  8.85 \
+  0.00  15.55  13.85  13.95  12.15  15.35  12.65  11.05  14.05  13.65  12.55  14.95  16.25  16.05  15.05  8.65  9.55  6.15  4.05  6.05  7.65  9.05  7.35  6.55  7.55  8.05  8.95  7.05  5.85  7.25  5.35  6.55  7.95 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  14.05  12.65  13.65  11.25  14.55  11.75  10.65  13.45  13.45  11.55  14.25  15.65  16.05  14.55  7.85  8.55  5.05  2.75  3.15  7.15  8.05  6.05  6.65  7.05  7.15  8.45  6.95  4.85  6.05  4.55  5.95  8.55 \
+  0.00  15.05  14.05  14.55  12.25  15.65  12.15  11.65  13.85  14.05  12.05  14.75  16.25  16.65  15.65  7.95  9.25  5.85  0.00  5.85  7.95  8.75  6.65  6.75  7.15  8.25  9.05  6.95  5.15  6.65  5.05  6.35  8.65 \
+  0.00  14.05  12.95  13.15  11.45  14.35  11.45  10.65  12.65  13.05  11.45  13.55  15.35  15.55  14.45  6.95  8.25  5.65  3.15  0.00  7.05  7.75  6.45  6.35  6.65  7.55  8.55  6.45  4.85  6.15  4.85  5.75  7.85 \
+  0.00  12.05  14.45  14.95  12.65  15.75  12.95  11.75  14.35  14.15  12.45  15.15  16.65  16.85  15.75  8.35  9.25  6.75  4.25  6.45  8.05  9.45  7.45  0.00  7.95  8.85  9.75  7.75  6.05  7.65  6.15  7.55  9.55 \
+  0.00  13.45  13.85  14.15  12.45  15.55  12.25  11.35  14.45  13.85  12.25  15.05  16.05  16.55  15.35  8.55  9.55  5.85  3.55  5.65  7.45  8.85  6.75  7.05  7.25  7.65  8.65  7.15  5.25  6.75  5.05  6.15  8.15 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  15.85  14.65  15.05  13.25  16.45  13.25  12.25  15.05  15.05  13.05  15.95  17.35  17.85  16.35  8.85  10.05  6.65  4.25  6.85  8.35  9.65  7.95  7.95  8.35  8.85  9.75  7.85  6.25  7.55  5.85  7.25  9.25 \
+  0.00  15.35  14.15  14.45  12.45  15.55  12.75  11.95  14.65  14.25  12.55  15.45  16.95  17.15  15.55  8.65  9.45  6.05  4.25  6.15  8.15  9.15  7.25  7.45  7.85  8.65  9.65  7.55  5.65  7.15  5.45  7.05  8.55 \
+  0.00  15.35  14.05  15.05  12.95  15.95  12.55  12.05  14.55  14.45  12.55  15.55  16.75  16.85  15.55  8.55  9.65  6.05  4.05  6.25  8.35  9.65  7.35  7.75  8.05  8.45  9.35  7.55  6.05  6.85  5.15  6.85  9.05 \
+  0.00  16.35  15.05  15.35  13.05  16.95  13.95  12.75  15.55  15.55  13.55  16.35  18.05  18.05  16.85  9.65  10.65  6.95  4.55  6.65  8.45  10.05  7.85  8.15  8.65  9.35  10.15  8.05  6.25  7.65  5.75  7.75  9.75 \
+  0.00  16.55  15.45  15.95  13.15  16.95  13.55  12.55  15.25  15.65  12.85  15.85  17.25  17.75  16.35  9.45  10.05  7.45  4.85  6.85  8.25  9.45  6.95  8.55  8.55  8.65  9.85  7.75  5.55  6.95  5.35  7.25  9.25 \
+  0.00  16.05  15.05  15.15  13.55  17.05  14.25  12.55  15.05  15.45  13.45  16.35  18.15  18.05  16.85  9.55  10.65  6.75  5.05  6.85  9.15  9.95  8.45  8.25  8.55  9.05  10.25  8.45  6.75  7.85  6.15  7.95  10.05 \
+  0.00  16.45  15.25  15.75  13.85  17.05  14.15  13.05  15.55  15.55  13.75  16.45  18.35  18.55  17.35  9.55  10.55  7.05  5.05  7.05  9.35  10.15  8.15  8.55  8.95  9.15  10.75  8.65  6.75  8.25  6.55  7.95  10.05 \
+  0.00  14.35  12.85  13.35  11.85  14.75  11.85  11.15  13.55  13.65  11.45  14.45  15.25  15.95  14.65  7.55  9.15  5.85  3.75  5.55  7.85  8.65  6.85  7.55  7.45  7.95  9.25  7.15  5.55  6.45  5.45  7.05  8.35 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 \
+  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
+
+
+########################
diff --git a/macro/beamtime/mcbm2021/mStsPar.par b/macro/beamtime/mcbm2021/mStsPar.par
new file mode 100644
index 0000000000000000000000000000000000000000..4e9941a75f5b32b31e74fe93fb259cb52f1bb83e
--- /dev/null
+++ b/macro/beamtime/mcbm2021/mStsPar.par
@@ -0,0 +1,48 @@
+##############################################################################
+# Class:   CbmMcbm2018StsPar
+# Context: For mSTS testing
+##############################################################################
+[CbmMcbm2018StsPar]
+//----------------------------------------------------------------------------
+// Total number of STS modules in the setup
+NbModules: Int_t 3
+// Type of each module: 0 for connectors on the right, 1 for connectors on the left
+ModuleType: Int_t \
+           0           0           0
+// STS address for the first strip of each module
+// 1 Line per ladder, from above beam to under beam
+ModAddress: Int_t \
+  0x10018002  0x10008002  0x99999999 // addresse matching the current mSTS geometry (PAL, 15/05/2020)
+// Offset of module center in X, in mm (Should be done by geometry for the unpacker!)
+ModCenterPosX: Double_t \
+         0.0        0.0        0.0
+// Offset of module center in Y, in mm (Should be done by geometry for the unpacker!)
+ModCenterPosY: Double_t \
+         0.0        0.0        0.0
+// Total number of STS DPBs in system
+NrOfDpbs: Int_t 1
+// Array to hold the unique IDs (equipment ID) for all STS DPBs, Array size has to match NrOfDpbs
+DbpIdArray: Int_t \
+  0x5c0b
+// Array to hold the active flag for all CROBs, [ NbDpb * kuNbCrobPerDpb ] = [ NbDpb * 1 ]
+CrobActiveFlag: Int_t \
+  1
+// Index of the STS module for each FEB, [ NbDpb * kuNbCrobPerDpb * kuNbFebsPerCrob ] = = [ NbDpb * 1 * 5 ], -1 if inactive
+FebModuleIdx: Int_t \
+  2  0  0  1  1
+// STS module side for each FEB, [ NbDpb * kuNbCrobPerDpb * kuNbFebsPerCrob ], 0 = P, 1 = N, -1 if inactive
+FebModuleSide: Int_t \
+  0  1  0  1  0
+// ADC Gain in e-/ADC bin for each FEB, [ NbDpb * kuNbCrobPerDpb * kuNbFebsPerCrob ]
+FebAdcGain: Double_t \
+     1.0     1.0     1.0     1.0     1.0
+// Base at Cal. Thr. in e- for each FEB, [ NbDpb * kuNbCrobPerDpb * kuNbFebsPerCrob ]
+FebAdcBase: Double_t \
+     1.0     1.0     1.0     1.0     1.0
+// Thr. step in e-/Thr. Unit for each FEB, [ NbDpb * kuNbCrobPerDpb * kuNbFebsPerCrob ]
+FebAdcThrGain: Double_t \
+     0.0     0.0     0.0     0.0     0.0
+// Thr. offset in Units vs Cal. Thr. for each FEB, [ NbDpb * kuNbCrobPerDpb * kuNbFebsPerCrob ]
+FebAdcThrOffs: Int_t \
+     0       0       0       0       0
+#######################
diff --git a/macro/beamtime/mcbm2021/mTofPar2.par b/macro/beamtime/mcbm2021/mTofPar2.par
new file mode 100644
index 0000000000000000000000000000000000000000..103c90d3316b1f887cddf7f813f4d4ce4020cd9b
--- /dev/null
+++ b/macro/beamtime/mcbm2021/mTofPar2.par
@@ -0,0 +1,65 @@
+[CbmMcbm2018TofPar]
+//----------------------------------------------------------------------------
+NrOfGdpbs: Int_t 9
+GdpbIdArray: Int_t \
+0x5b7b 0x55c4 0x18c5 0x5f64 0x18e3 0x181c 0x1922 0x1925 0x1902
+NrOfFeesPerGdpb: Int_t 10
+NrOfGet4PerFee:  Int_t 8
+NrOfChannelsPerGet4: Int_t 4
+NrOfGbtx: Int_t  18
+NrOfModule: Int_t 9
+NrOfRpc: Int_t \
+  1  0  \
+  1  0  \
+  5  5  \
+  2  2  \
+  5  5  \
+  5  5  \
+  5  5  \
+  5  5  \
+  2  0   
+RpcType: Int_t \
+  5 -1 \
+  5 -1 \
+  0  0 \
+  9  9 \
+  0  0 \
+  0  0 \ 
+  0  0 \
+  0  0 \
+  6  0 
+RpcSide: Int_t \
+  0 -1  \
+  1 -1  \
+  0  1  \
+  0  1  \
+  0  1  \
+  0  1  \
+  0  1  \
+  0  1  \
+  0  0  
+ModuleId: Int_t \
+  0  0  \
+  0  0  \
+  3  3  \
+  0  1  \
+  4  4  \
+  0  0  \
+  1  1  \
+  2  2  \
+  0  0  
+NbMsTot: Int_t 100
+NbMsOverlap: Int_t 1
+SizeMsInNs: Double_t 102400.0
+//SizeMsInNs: Double_t 1638400
+StarTriggerDeadtime:  Double_t \
+ 1000.0  1000.0  1000.0  1000.0  1000.0
+StarTriggerDelay: Double_t \
+ 2000.0  2000.0  2000.0  2000.0  2000.0
+//  2000.0  2000.0  2000.0  2000.0  2000.0
+//-23000.0  -23000.0  -23000.0  -23000.0  -23000.0
+StarTriggerWinSize: Double_t \
+ 2000.0  2000.0  2000.0  2000.0  2000.0
+TsDeadtimePeriod: Double_t 62.5
+#######################
+
diff --git a/macro/beamtime/mcbm2021/mTofPar2Stack.par b/macro/beamtime/mcbm2021/mTofPar2Stack.par
new file mode 100644
index 0000000000000000000000000000000000000000..87fa587453aff45af1d16bf1a706d2e73787e842
--- /dev/null
+++ b/macro/beamtime/mcbm2021/mTofPar2Stack.par
@@ -0,0 +1,65 @@
+[CbmMcbm2018TofPar]
+//----------------------------------------------------------------------------
+NrOfGdpbs: Int_t 9
+GdpbIdArray: Int_t \
+0x5b7b 0x55c4 0x18c5 0x5f64 0x1889 0x181c 0x1922 0x1925 0x1902
+NrOfFeesPerGdpb: Int_t 30
+NrOfGet4PerFee:  Int_t 8
+NrOfChannelsPerGet4: Int_t 4
+NrOfGbtx: Int_t  54
+NrOfModule: Int_t 9
+NrOfRpc: Int_t \
+  1  0  0  0  0  0 \
+  1  0  0  0  0  0 \
+  5  0  0  0  0  0 \
+  2  0  0  0  0  0 \
+  5  0  0  0  0  0 \
+  5  0  0  0  0  0 \
+  2  0  0  0  0  0 \
+  5  0  0  0  0  0 \
+  2  0  0  0  0  0 
+RpcType: Int_t \
+  5 -1 -1 -1 -1 -1 \
+  5 -1 -1 -1 -1 -1 \
+  0 -1 -1 -1 -1 -1 \
+  9 -1 -1 -1 -1 -1 \
+  0 -1 -1 -1 -1	-1 \
+  0 -1 -1 -1 -1 -1 \ 
+  9 -1 -1 -1 -1 -1 \
+  0 -1 -1 -1 -1 -1 \
+  6 -1 -1 -1 -1 -1
+RpcSide: Int_t \
+  0  0  0  0  0  0 \
+  1  0  0  0  0  0 \
+  1  0  0  0  0  0 \
+  2  0  0  0  0  0 \
+  1  0  0  0  0  0 \
+  0  0  0  0  0  0 \
+  2  0  0  0  0  0 \
+  0  0  0  0  0  0 \
+  7  0  0  0  0  0
+ModuleId: Int_t \
+  0  0  0  0  0  0 \
+  0  0  0  0  0  0 \
+  3  0  0  0  0  0 \
+  0  0  0  0  0  0 \
+  4  0  0  0  0  0 \
+  3  0  0  0  0  0 \
+  1  0  0  0  0  0 \
+  4  0  0  0  0  0 \
+  0  0  0  0  0  0
+NbMsTot: Int_t 100
+NbMsOverlap: Int_t 1
+SizeMsInNs: Double_t 102400.0
+//SizeMsInNs: Double_t 1638400
+StarTriggerDeadtime:  Double_t \
+ 1000.0  1000.0  1000.0  1000.0  1000.0
+StarTriggerDelay: Double_t \
+ 2000.0  2000.0  2000.0  2000.0  2000.0
+//  2000.0  2000.0  2000.0  2000.0  2000.0
+//-23000.0  -23000.0  -23000.0  -23000.0  -23000.0
+StarTriggerWinSize: Double_t \
+ 2000.0  2000.0  2000.0  2000.0  2000.0
+TsDeadtimePeriod: Double_t 62.5
+#######################
+
diff --git a/macro/beamtime/mcbm2021/pl_all_2D.C b/macro/beamtime/mcbm2021/pl_all_2D.C
new file mode 100644
index 0000000000000000000000000000000000000000..dfdf9888bfd93b2e58516235eb7bd77691b40842
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_2D.C
@@ -0,0 +1,67 @@
+void pl_all_2D(Int_t iOpt = 0, Int_t iNSt = 4) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  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, 7, 0.01, 0.01);
+  //  can->Divide(2,2,0,0);
+  Float_t lsize = 0.07;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH2* h;
+  TH2* h2;
+  const Int_t iType[6]   = {0, 9, 6, 5, 7, 8};
+  const Int_t iSmNum[6]  = {5, 2, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 2, 2, 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 = "AvWalk"; break;
+    case 5: cOpt = "AvLnWalk"; 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 iCanv = 0;
+  // if (h!=NULL) h->Delete();
+
+  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 = Form(
+          "cl_SmT%01d_sm%03d_rpc%03d_%s", iType[iSt], iSm, iRp, cOpt.Data());
+        h = (TH2*) gROOT->FindObjectAny(hname);
+        if (h != NULL) {
+          if (iOpt == 4 || iOpt == 5) { gPad->SetLogz(); }
+          h->Draw("colz");
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+        if (iRp == 10) break;
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_%s.pdf", cOpt.Data()));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_3D.C b/macro/beamtime/mcbm2021/pl_all_3D.C
new file mode 100644
index 0000000000000000000000000000000000000000..b3f87c24d69085a2151db5ce1b6371bd1c944c20
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_3D.C
@@ -0,0 +1,61 @@
+void pl_all_3D(Int_t iOpt = 0, Int_t iSel = 0, Int_t iNSt = 4) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  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;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH3* h;
+  TH2* h2;
+  const Int_t iType[6]   = {0, 9, 6, 5, 7, 8};
+  const Int_t iSmNum[6]  = {5, 1, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 2, 2, 1, 1, 8};
+  TString cOpt;
+
+  switch (iOpt) {
+    case 0: cOpt = "yx"; break;
+
+    case 1:; break;
+
+    default:;
+  }
+
+  Int_t iCanv = 0;
+  // if (h!=NULL) h->Delete();
+
+  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 = Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2",
+                             iType[iSt],
+                             iSm,
+                             iRp,
+                             iSel);
+        h             = (TH3*) gROOT->FindObjectAny(hname);
+        if (h != NULL) {
+          if (iOpt == 4 || iOpt == 5) { gPad->SetLogz(); }
+          h->Project3D(cOpt)->Draw("colz");
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_%s.pdf", cOpt.Data()));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_CluMul.C b/macro/beamtime/mcbm2021/pl_all_CluMul.C
new file mode 100644
index 0000000000000000000000000000000000000000..aac7c6712aed0ca86357848ce7acaa3bde43fbb7
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_CluMul.C
@@ -0,0 +1,51 @@
+void pl_all_CluMul(Int_t iNSt = 6, Double_t MulMax = 100) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  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, 7, 0.01, 0.01);
+  //  can->Divide(2,2,0,0);
+  Float_t lsize = 0.07;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH1* h;
+  TH2* h2;
+  const Int_t iType[6]   = {0, 9, 7, 5, 6, 8};
+  const Int_t iSmNum[6]  = {5, 1, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 2, 1, 1, 2, 8};
+
+  Int_t iCanv = 0;
+  // if (h!=NULL) h->Delete();
+
+  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 =
+          Form("cl_SmT%01d_sm%03d_rpc%03d_Mul", iType[iSt], iSm, iRp);
+        h = (TH1*) gROOT->FindObjectAny(hname);
+        if (h != NULL) {
+          h->GetXaxis()->SetRange(0., MulMax);
+          h->Draw("");
+          gPad->SetLogy();
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+        if (iRp == 10) break;
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_CluMul.pdf"));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_CluPosEvol.C b/macro/beamtime/mcbm2021/pl_all_CluPosEvol.C
new file mode 100644
index 0000000000000000000000000000000000000000..70648848a79d9cc7575dce80ef11c18db4400d9a
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_CluPosEvol.C
@@ -0,0 +1,61 @@
+void pl_all_CluPosEvol(Int_t iNSt = 2, Int_t iTmax = 0) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  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(4,4,0.01,0.01);
+  //  can->Divide(2,2,0,0);
+  Float_t lsize = 0.09;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetStatY(0.5);
+  //gStyle->SetStatX(0.5);
+  gStyle->SetStatW(0.5);
+  gStyle->SetStatH(0.3);
+
+  gStyle->SetOptStat(kFALSE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH1* h;
+  TH2* h2;
+  const Int_t iType[7]   = {0, 5, 6, 2, 9, 8, 1};
+  const Int_t iSmNum[7]  = {5, 1, 1, 2, 3, 3, 3};
+  const Int_t iRpcNum[7] = {5, 1, 2, 1, 2, 1, 3};
+
+  Int_t iCanv = 0;
+  // if (h!=NULL) h->Delete();
+
+  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;
+        gROOT->cd();
+        TString hname =
+          Form("cl_SmT%01d_sm%03d_rpc%03d_PosEvol", iType[iSt], iSm, iRp);
+        h = (TH1*) gROOT->FindObjectAny(hname);
+        if (h != NULL) {
+          can->cd(iCanv + 1);
+          iCanv++;
+          Double_t dLMargin   = 0.35;
+          Double_t dTitOffset = 1.6;
+          gPad->SetLeftMargin(dLMargin);
+          h->UseCurrentStyle();
+          h->GetYaxis()->SetTitleOffset(dTitOffset);
+          if (iTmax > 0) h->GetXaxis()->SetRange(0., iTmax);
+          h->Draw("");
+          //gPad->SetLogy();
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_CluPosEvol.pdf"));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_CluRate.C b/macro/beamtime/mcbm2021/pl_all_CluRate.C
new file mode 100644
index 0000000000000000000000000000000000000000..cb4168726a5917b3b35d3def60f2d49a837f7617
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_CluRate.C
@@ -0,0 +1,101 @@
+void pl_all_CluRate(Int_t iNSt      = 4,
+                    Int_t iOpt      = 0,
+                    Double_t Tstart = 0.,
+                    Double_t Tend   = 800.,
+                    Int_t iMode     = 0) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  can->Divide(2,2);
+  //  TCanvas *can = new TCanvas("can","can",48,55,700,900);
+  TCanvas* can = new TCanvas("can", "can", 48, 56, 900, 900);
+  switch (iMode) {
+    case 0:
+      switch (iNSt) {
+        case 6: can->Divide(5, 7, 0.01, 0.01); break;
+        case 5: can->Divide(5, 6, 0.01, 0.01); break;
+        default: can->Divide(5, 6, 0.01, 0.01); break;
+      }
+      break;
+    case 1:
+      can->Divide(1, 2, 0.01, 0.01);
+      ;
+      break;
+  }
+  //  can->Divide(2,2,0,0);
+  Float_t lsize = 0.06;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+  gStyle->SetPadLeftMargin(0.4);
+  gStyle->SetTitleOffset(1.0, "x");
+  gStyle->SetTitleOffset(1.2, "y");
+  gStyle->SetTitleFontSize(0.03);
+
+
+  TH1* h;
+  TH2* h2;
+  const Int_t iType[6]   = {0, 9, 5, 6, 7, 8};
+  const Int_t iSmNum[6]  = {5, 1, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 2, 1, 2, 1, 8};
+
+  Int_t iCanv = 0;
+  Int_t iCol  = 0;
+  // if (h!=NULL) h->Delete();
+
+  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;
+        gROOT->cd();
+        TString hname = "";
+        switch (iOpt) {
+          case 0:
+            hname =
+              Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iType[iSt], iSm, iRp);
+            break;
+          case 1:
+            hname =
+              Form("cl_SmT%01d_sm%03d_rpc%03d_rate10s", iType[iSt], iSm, iRp);
+            break;
+        }
+        h = (TH1*) gROOT->FindObjectAny(hname);
+        if (h != NULL) {
+          h->GetXaxis()->SetRangeUser(Tstart, Tend);
+          switch (iMode) {
+            case 0:
+              can->cd(iCanv + 1);
+              iCanv++;
+              h->Draw("");
+              //h->UseCurrentStyle();
+              gPad->SetLogy();
+              break;
+            case 1:
+              can->cd(iSt + 1);
+              if (iSm > 0) continue;
+              h->UseCurrentStyle();  // set current defaults
+              h->SetMarkerStyle(20 + iSm);
+              iCol = iRp + 1;
+              if (iCol == 5) iCol++;
+              h->SetLineColor(iCol);
+              h->SetLineStyle(1);
+              h->SetMarkerColor(iCol);
+              if (iSm == 0 && iRp == 0)
+                h->Draw("LPE");
+              else
+                h->Draw("LPEsame");
+              break;
+          }
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_CluRate%d_%d.pdf", iNSt, iOpt));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_CluTimeEvol.C b/macro/beamtime/mcbm2021/pl_all_CluTimeEvol.C
new file mode 100644
index 0000000000000000000000000000000000000000..b186b370e8164234bc55d54560d2fcf24f1ddb96
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_CluTimeEvol.C
@@ -0,0 +1,61 @@
+void pl_all_CluTimeEvol(Int_t iNSt = 2, Int_t iTmax = 0) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  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(4,4,0.01,0.01);
+  //  can->Divide(2,2,0,0);
+  Float_t lsize = 0.09;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetStatY(0.5);
+  //gStyle->SetStatX(0.5);
+  gStyle->SetStatW(0.5);
+  gStyle->SetStatH(0.3);
+
+  gStyle->SetOptStat(kFALSE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH1* h;
+  TH2* h2;
+  const Int_t iType[7]   = {0, 5, 6, 2, 9, 8, 1};
+  const Int_t iSmNum[7]  = {5, 1, 1, 2, 3, 3, 3};
+  const Int_t iRpcNum[7] = {5, 1, 2, 1, 2, 1, 3};
+
+  Int_t iCanv = 0;
+  // if (h!=NULL) h->Delete();
+
+  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;
+        gROOT->cd();
+        TString hname =
+          Form("cl_SmT%01d_sm%03d_rpc%03d_TimeEvol", iType[iSt], iSm, iRp);
+        h = (TH1*) gROOT->FindObjectAny(hname);
+        if (h != NULL) {
+          can->cd(iCanv + 1);
+          iCanv++;
+          Double_t dLMargin   = 0.35;
+          Double_t dTitOffset = 1.6;
+          gPad->SetLeftMargin(dLMargin);
+          h->UseCurrentStyle();
+          h->GetYaxis()->SetTitleOffset(dTitOffset);
+          if (iTmax > 0) h->GetXaxis()->SetRange(0., iTmax);
+          h->Draw("");
+          //gPad->SetLogy();
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_CluTimeEvol.pdf"));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_DTLastHits.C b/macro/beamtime/mcbm2021/pl_all_DTLastHits.C
new file mode 100644
index 0000000000000000000000000000000000000000..185f2e59f585c7ce8949fdfc552f8274f9c550b7
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_DTLastHits.C
@@ -0,0 +1,54 @@
+void pl_all_DTLastHits(Int_t iNSt      = 6,
+                       Double_t Tstart = 1.,
+                       Double_t Tend   = 1000.) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  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, 7, 0.01, 0.01);
+  //  can->Divide(2,2,0,0);
+  Float_t lsize = 0.07;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH1* h;
+  TH2* h2;
+  const Int_t iType[6]   = {0, 9, 7, 5, 6, 8};
+  const Int_t iSmNum[6]  = {5, 1, 1, 1, 1, 0};
+  const Int_t iRpcNum[6] = {5, 2, 1, 1, 2, 8};
+
+
+  Int_t iCanv = 0;
+  // if (h!=NULL) h->Delete();
+
+  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 =
+          Form("cl_SmT%01d_sm%03d_rpc%03d_DTLastHits", iType[iSt], iSm, iRp);
+        h = (TH1*) gROOT->FindObjectAny(hname);
+        if (h != NULL) {
+          h->GetXaxis()->SetRange(Tstart, Tend);
+          h->Draw("");
+          gPad->SetLogy();
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+        if (iRp == 10) break;
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_CluRate.pdf"));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_DigiCor.C b/macro/beamtime/mcbm2021/pl_all_DigiCor.C
new file mode 100644
index 0000000000000000000000000000000000000000..c6fd1c56e4fa6b18b79e1afbc4cb7cf51cac48fb
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_DigiCor.C
@@ -0,0 +1,47 @@
+void pl_all_DigiCor(Int_t iNDet = 4) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  can->Divide(2,2);
+  TCanvas* can = new TCanvas("can", "can", 48, 55, 900, 900);
+  //TCanvas *can = new TCanvas("can","can",48,56,900,700);
+  //can->Divide(4,4,0.01,0.01);
+  //  can->Divide(2,3,0.01,0.01);
+  can->Divide(5, 7, 0.01, 0.01);
+  Float_t lsize = 0.07;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH1* h;
+  TH2* h2;
+  const Int_t iType[6]   = {0, 9, 6, 5, 7, 8};
+  const Int_t iSmNum[6]  = {5, 2, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 2, 2, 1, 2, 8};
+
+  Int_t iCanv = 0;
+  // if (h!=NULL) h->Delete();
+
+  for (Int_t iCh = 0; iCh < iNDet; iCh++) {
+    for (Int_t iSm = 0; iSm < iSmNum[iCh]; iSm++) {
+      for (Int_t iRpc = 0; iRpc < iRpcNum[iCh]; iRpc++) {
+        can->cd(iCanv + 1);
+        iCanv++;
+        gROOT->cd();
+        TString hname =
+          Form("cl_SmT%01d_sm%03d_rpc%03d_DigiCor", iType[iCh], iSm, iRpc);
+        h2 = (TH2*) gROOT->FindObjectAny(hname);
+        if (h2 != NULL) {
+          h2->Draw("colz");
+          //     gPad->SetLogy();
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_DigiCor.pdf"));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_DigiDTFD.C b/macro/beamtime/mcbm2021/pl_all_DigiDTFD.C
new file mode 100644
index 0000000000000000000000000000000000000000..692ed7c5cab3326295d0a3e4d23a143de8e1a013
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_DigiDTFD.C
@@ -0,0 +1,142 @@
+void pl_all_DigiDTFD(Int_t iOpt = 0, Double_t dYmax = 0., Int_t iNDet = 2) {
+  Int_t iOpt1 = iOpt % 10;
+  Int_t iOpt2 = (iOpt - iOpt1) / 10 % 10;
+  Int_t iOpt3 = (iOpt - iOpt2 * 10 - iOpt1) / 100 % 10;
+  Int_t iOpt4 = (iOpt - iOpt3 * 100 - iOpt2 * 10 - iOpt1) / 1000 % 10;
+
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  can->Divide(2,2);
+  TCanvas* can = new TCanvas("can", "can", 48, 55, 900, 900);
+  //TCanvas *can = new TCanvas("can","can",48,56,900,700);
+  //can->Divide(4,4,0.01,0.01);
+  //  can->Divide(2,3,0.01,0.01);
+  //can->Divide(5, 7, 0.01, 0.01);
+  switch (iOpt3) {
+    case 0: can->Divide(5, 7, 0.01, 0.01); break;
+    case 1: can->Divide(5, 4, 0.01, 0.01); break;
+    case 3: can->Divide(1, 4, 0.01, 0.01); break;
+    case 4: can->Divide(1, 1, 0.01, 0.01); break;
+  }
+
+  Float_t lsize = 0.07;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH1* h;
+  TH2* h2;
+  TH1* hTime;
+  TString hnameT;
+
+  const Int_t iType[6]   = {0, 5, 9, 7, 6, 8};
+  const Int_t iSmNum[6]  = {5, 1, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 1, 2, 1, 2, 8};
+
+  Double_t dTime = 0.;
+  Int_t iCanv    = 0;
+
+  Int_t jSmType = 5;
+  Int_t jSm     = 0;
+  Int_t jRp     = 0;
+
+  // if (h!=NULL) h->Delete();
+  Int_t iCol = 1;
+
+  for (Int_t iCh = 0; iCh < iNDet; iCh++) {
+    for (Int_t iSm = 0; iSm < iSmNum[iCh]; iSm++) {
+      if (iOpt3 == 1) {
+        can->cd(iCanv + 1);
+        iCanv++;
+        gROOT->cd();
+        iCol = 1;
+      } else {
+        if (iOpt3 == 4) {
+          iCol = 1;
+          if (iCh != iOpt4) continue;
+        }
+      }
+      for (Int_t iRpc = 0; iRpc < iRpcNum[iCh]; iRpc++) {
+        if (iOpt3 == 0) {
+          can->cd(iCanv + 1);
+          iCanv++;
+          gROOT->cd();
+          iCol = 4;
+        }
+
+        TString hname = "";
+        switch (iOpt1) {
+          case 0:
+            hname =
+              Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTFD", iType[iCh], iSm, iRpc);
+            break;
+
+          case 1:
+            hname = Form(
+              "cl_SmT%01d_sm%03d_rpc%03d_DigiDTMul", iType[iCh], iSm, iRpc);
+            break;
+
+          default:;
+        }
+        iCol++;
+        if (iCol == 5) iCol++;
+        h2 = (TH2*) gROOT->FindObjectAny(hname);
+        TH1D* hx;
+        TH1D* hy;
+        TH1* hp;
+        if (h2 != NULL) {
+          switch (iOpt2) {
+            case 0:
+              h2->Draw("colz");
+              gPad->SetLogz();
+              break;
+            case 1:
+              hp = (TH1*) h2->ProjectionY();
+              hp->SetLineColor(iCol);
+              switch (iOpt3) {
+                case 0: hp->Draw(); break;
+                case 1:
+                case 4:
+                  if (iRpc == 0) {
+                    if (dYmax > 0.) hp->SetMaximum(dYmax);
+                    hp->Draw();
+                  } else
+                    hp->Draw("same");
+              }
+              cout << "plot " << hp->GetName() << " into canv " << iCanv
+                   << " with col " << iCol << endl;
+              //gPad->SetLogy();
+              break;
+
+            case 2:
+              h2->SetMarkerSize(5);
+              h2->ProfileX()->Draw();
+              //gPad->SetLogz();
+              break;
+
+            case 3:
+              for (Int_t iCh = 0; iCh < h2->GetNbinsX(); iCh++) {
+                if (iCh == 0)
+                  h2->ProjectionY(
+                      Form("%s_py%d", h2->GetName(), iCh), iCh + 1, iCh + 1)
+                    ->Draw();
+                else {
+                  h2->ProjectionY(
+                      Form("%s_py%d", h2->GetName(), iCh), iCh + 1, iCh + 1)
+                    ->Draw("same");
+                }
+              }
+              break;
+          }
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_DigiDTFD.pdf"));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_DigiDTLD.C b/macro/beamtime/mcbm2021/pl_all_DigiDTLD.C
new file mode 100644
index 0000000000000000000000000000000000000000..2dfff3c824984a1333dbbcda55087d6bd8b7ae62
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_DigiDTLD.C
@@ -0,0 +1,133 @@
+void pl_all_DigiDTLD(Int_t iNDet = 4, Double_t dDTthr = 2., Int_t iOpt = 0) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  can->Divide(2,2);
+  TCanvas* can = new TCanvas("can", "can", 48, 55, 900, 900);
+  //TCanvas *can = new TCanvas("can","can",48,56,900,700);
+  //can->Divide(4,4,0.01,0.01);
+  //  can->Divide(2,3,0.01,0.01);
+  can->Divide(5, 7, 0.01, 0.01);
+  Float_t lsize = 0.07;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH1* h;
+  TH2* h2;
+  TH1* hTime;
+  TString hnameT;
+
+  const Int_t iType[6]   = {0, 9, 6, 5, 7, 8};
+  const Int_t iSmNum[6]  = {5, 2, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 2, 2, 1, 1, 8};
+
+  Double_t dTime = 0.;
+  Int_t iCanv    = 0;
+
+  Int_t jSmType = 5;
+  Int_t jSm     = 0;
+  Int_t jRp     = 0;
+
+  // if (h!=NULL) h->Delete();
+
+  for (Int_t iCh = 0; iCh < iNDet; iCh++) {
+    for (Int_t iSm = 0; iSm < iSmNum[iCh]; iSm++) {
+      for (Int_t iRpc = 0; iRpc < iRpcNum[iCh]; iRpc++) {
+        can->cd(iCanv + 1);
+        iCanv++;
+        gROOT->cd();
+        TString hname =
+          Form("cl_SmT%01d_sm%03d_rpc%03d_DigiDTLD", iType[iCh], iSm, iRpc);
+        switch (iOpt) {
+          case 0:; break;
+
+          case 1: hname = Form("%s_fdead", hname.Data()); break;
+
+          case 2: hname = Form("%s_py", hname.Data()); break;
+
+          case 3: hname = Form("%s_py_dead", hname.Data()); break;
+
+          default:;
+        }
+
+        h2 = (TH2*) gROOT->FindObjectAny(hname);
+        TH1D* hx;
+        TH1D* hy;
+        TH1D* hy_dead;
+        Double_t dDeadtimeSum = 0.;
+        if (h2 != NULL) {
+          switch (iOpt) {
+            case 0:
+              h2->Draw("colz");
+              gPad->SetLogy();
+              gPad->SetLogz();
+
+              // Determine time duration an data taking
+              hnameT =
+                Form("cl_SmT%01d_sm%03d_rpc%03d_rate", jSmType, jSm, jRp);
+              hTime = (TH1*) gROOT->FindObjectAny(hnameT);
+              for (dTime = 0; dTime < hTime->GetNbinsX(); dTime++)
+                if (hTime->GetBinContent(dTime + 1) == 0) break;
+              cout << "Normalize for a run duration of " << dTime << " s"
+                   << endl;
+
+              // create result histograms
+              hx = h2->ProjectionX(Form("%s_fdead", hname.Data()));
+              hx->GetYaxis()->SetTitle("deadtime fraction");
+              hx->Reset();
+              hy      = h2->ProjectionY(Form("%s_py", hname.Data()));
+              hy_dead = h2->ProjectionY(Form("%s_py_dead", hname.Data()));
+              hy_dead->GetYaxis()->SetTitle("deadtime fraction");
+              hy_dead->Reset();
+              for (Int_t iT = hy->GetNbinsX(); iT > 0; iT--) {
+                dDeadtimeSum +=
+                  hy->GetBinContent(iT) * hy->GetXaxis()->GetBinLowEdge(iT);
+                Double_t dDeadFrac = dDeadtimeSum / h2->GetNbinsX() / dTime;
+                hy_dead->SetBinContent(iT, dDeadFrac);
+              }
+
+              for (Int_t iCh = 0; iCh < h2->GetNbinsX(); iCh++) {
+                TH1D* hCh = h2->ProjectionY(
+                  Form("%s_%d_py", hname.Data(), iCh), iCh + 1, iCh + 1);
+                Double_t dAll      = hCh->GetEntries();
+                Double_t dTAllMean = hCh->GetMean();
+                if (dAll > 0) {
+                  Double_t BL    = hCh->GetXaxis()->FindBin(dDTthr);
+                  Double_t dLate = hCh->Integral(BL, hCh->GetNbinsX(), "");
+                  hCh->GetXaxis()->SetRange(BL, hCh->GetNbinsX());
+                  Double_t dTLateMean = hCh->GetMean();
+                  //Double_t dLateRatio=dLate*dTLateMean/dAll/dTAllMean;
+                  Double_t dLateRatio = dLate * dTLateMean / dTime;
+                  cout << Form("Long DT fraction for %s, ch %d: %6.3f, dTAll "
+                               "%6.3f, dTLate %6.3f",
+                               hname.Data(),
+                               iCh,
+                               dLateRatio,
+                               dTAllMean,
+                               dTLateMean)
+                       << endl;
+                  hx->SetBinContent(iCh + 1, dLateRatio);
+                }
+              }
+              break;
+
+            case 1: h2->Draw(); break;
+
+            case 2:
+            case 3:
+              h2->Draw();
+              gPad->SetLogy();
+              break;
+          }
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_DigiDTLD.pdf"));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_DigiMul.C b/macro/beamtime/mcbm2021/pl_all_DigiMul.C
new file mode 100644
index 0000000000000000000000000000000000000000..45aa3fe3710a4f11eed8fd7cde95dbf7c7a12058
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_DigiMul.C
@@ -0,0 +1,132 @@
+void pl_all_DigiMul(Int_t iNDet = 4, Double_t dDTthr = 2., Int_t iOpt = 0) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  can->Divide(2,2);
+  TCanvas* can = new TCanvas("can", "can", 48, 55, 900, 900);
+  //TCanvas *can = new TCanvas("can","can",48,56,900,700);
+  //can->Divide(4,4,0.01,0.01);
+  //  can->Divide(2,3,0.01,0.01);
+  can->Divide(5, 7, 0.01, 0.01);
+  Float_t lsize = 0.07;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH1* h;
+  TH2* h2;
+  TH1* hTime;
+  TString hnameT;
+
+  const Int_t iType[6]   = {0, 9, 6, 5, 7, 8};
+  const Int_t iSmNum[6]  = {5, 2, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 2, 2, 1, 1, 8};
+
+  Double_t dTime = 0.;
+  Int_t iCanv    = 0;
+
+  Int_t jSmType = 5;
+  Int_t jSm     = 0;
+  Int_t jRp     = 0;
+
+  // if (h!=NULL) h->Delete();
+
+  for (Int_t iCh = 0; iCh < iNDet; iCh++) {
+    for (Int_t iSm = 0; iSm < iSmNum[iCh]; iSm++) {
+      for (Int_t iRpc = 0; iRpc < iRpcNum[iCh]; iRpc++) {
+        can->cd(iCanv + 1);
+        iCanv++;
+        gROOT->cd();
+        TString hname =
+          Form("cl_SmT%01d_sm%03d_rpc%03d_DigiMul", iType[iCh], iSm, iRpc);
+        switch (iOpt) {
+          case 0:; break;
+
+          case 1: hname = Form("%s_fdead", hname.Data()); break;
+
+          case 2: hname = Form("%s_py", hname.Data()); break;
+
+          case 3: hname = Form("%s_py_dead", hname.Data()); break;
+
+          default:;
+        }
+
+        h2 = (TH2*) gROOT->FindObjectAny(hname);
+        TH1D* hx;
+        TH1D* hy;
+        TH1D* hy_dead;
+        Double_t dDeadtimeSum = 0.;
+        if (h2 != NULL) {
+          switch (iOpt) {
+            case 0:
+              h2->Draw("colz");
+              gPad->SetLogz();
+
+              // Determine time duration an data taking
+              hnameT =
+                Form("cl_SmT%01d_sm%03d_rpc%03d_rate", jSmType, jSm, jRp);
+              hTime = (TH1*) gROOT->FindObjectAny(hnameT);
+              for (dTime = 0; dTime < hTime->GetNbinsX(); dTime++)
+                if (hTime->GetBinContent(dTime + 1) == 0) break;
+              cout << "Normalize for a run duration of " << dTime << " s"
+                   << endl;
+
+              // create result histograms
+              hx = h2->ProjectionX(Form("%s_fdead", hname.Data()));
+              hx->GetYaxis()->SetTitle("deadtime fraction");
+              hx->Reset();
+              hy      = h2->ProjectionY(Form("%s_py", hname.Data()));
+              hy_dead = h2->ProjectionY(Form("%s_py_dead", hname.Data()));
+              hy_dead->GetYaxis()->SetTitle("deadtime fraction");
+              hy_dead->Reset();
+              for (Int_t iT = hy->GetNbinsX(); iT > 0; iT--) {
+                dDeadtimeSum +=
+                  hy->GetBinContent(iT) * hy->GetXaxis()->GetBinLowEdge(iT);
+                Double_t dDeadFrac = dDeadtimeSum / h2->GetNbinsX() / dTime;
+                hy_dead->SetBinContent(iT, dDeadFrac);
+              }
+
+              for (Int_t iCh = 0; iCh < h2->GetNbinsX(); iCh++) {
+                TH1D* hCh = h2->ProjectionY(
+                  Form("%s_%d_py", hname.Data(), iCh), iCh + 1, iCh + 1);
+                Double_t dAll      = hCh->GetEntries();
+                Double_t dTAllMean = hCh->GetMean();
+                if (dAll > 0) {
+                  Double_t BL    = hCh->GetXaxis()->FindBin(dDTthr);
+                  Double_t dLate = hCh->Integral(BL, hCh->GetNbinsX(), "");
+                  hCh->GetXaxis()->SetRange(BL, hCh->GetNbinsX());
+                  Double_t dTLateMean = hCh->GetMean();
+                  //Double_t dLateRatio=dLate*dTLateMean/dAll/dTAllMean;
+                  Double_t dLateRatio = dLate * dTLateMean / dTime;
+                  cout << Form("Long DT fraction for %s, ch %d: %6.3f, dTAll "
+                               "%6.3f, dTLate %6.3f",
+                               hname.Data(),
+                               iCh,
+                               dLateRatio,
+                               dTAllMean,
+                               dTLateMean)
+                       << endl;
+                  hx->SetBinContent(iCh + 1, dLateRatio);
+                }
+              }
+              break;
+
+            case 1: h2->Draw(); break;
+
+            case 2:
+            case 3:
+              h2->Draw();
+              gPad->SetLogy();
+              break;
+          }
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_DigiDTLD.pdf"));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_DigiTot.C b/macro/beamtime/mcbm2021/pl_all_DigiTot.C
new file mode 100644
index 0000000000000000000000000000000000000000..0c29855207c257a61bb0394017e0c59e378a6832
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_DigiTot.C
@@ -0,0 +1,46 @@
+void pl_all_DigiTot(Int_t iNDet = 4) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  can->Divide(2,2);
+  TCanvas* can = new TCanvas("can", "can", 48, 55, 900, 900);
+  //TCanvas *can = new TCanvas("can","can",48,56,900,700);
+  //can->Divide(4,4,0.01,0.01);
+  //  can->Divide(2,3,0.01,0.01);
+  can->Divide(5, 7, 0.01, 0.01);
+  Float_t lsize = 0.07;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH1* h;
+  TH2* h2;
+  Int_t iType[6]   = {0, 9, 6, 5, 9, 8};
+  Int_t iNumSm[6]  = {5, 2, 1, 1, 3, 2};
+  Int_t iNumRpc[6] = {5, 2, 2, 1, 2, 1};
+  Int_t iCanv      = 0;
+  // if (h!=NULL) h->Delete();
+
+  for (Int_t iCh = 0; iCh < iNDet; iCh++) {
+    for (Int_t iSm = 0; iSm < iNumSm[iCh]; iSm++) {
+      for (Int_t iRpc = 0; iRpc < iNumRpc[iCh]; iRpc++) {
+        can->cd(iCanv + 1);
+        iCanv++;
+        gROOT->cd();
+        TString hname =
+          Form("hDigiTot_SmT%01d_sm%03d_rpc%03d", iType[iCh], iSm, iRpc);
+        h2 = (TH2*) gROOT->FindObjectAny(hname);
+        if (h2 != NULL) {
+          h2->Draw("colz");
+          //     gPad->SetLogy();
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+      }
+    }
+  }
+  can->SaveAs(Form("pl_all_DigiTot.pdf"));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_Sel2D.C b/macro/beamtime/mcbm2021/pl_all_Sel2D.C
new file mode 100644
index 0000000000000000000000000000000000000000..7eb0725d7efd600ef6729104fbe2ec0bb16c511f
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_Sel2D.C
@@ -0,0 +1,124 @@
+void pl_all_Sel2D(Int_t iOpt  = 0,
+                  Int_t iSel  = 0,
+                  Int_t iOpt2 = 0,
+                  Int_t iNSt  = 4) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  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, 7, 0.01, 0.01);
+  //  can->Divide(2,2,0,0);
+  Float_t lsize = 0.07;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH1* hp;
+  TH2* h;
+  TH2* h2;
+  const Int_t iType[6]   = {0, 9, 6, 5, 6, 8};
+  const Int_t iSmNum[6]  = {5, 2, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 2, 2, 1, 2, 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 = "AvWalk"; break;
+    case 5: cOpt = "DelTof"; break;
+    case 6: cOpt = "dXdY"; break;
+    case 7: cOpt = "TofOff"; break;
+    default:;
+  }
+
+  Int_t iCanv = 0;
+  // if (h!=NULL) h->Delete();
+  TString FitHName[100];
+  Double_t FitIntegral[100];
+  Double_t FitMean[100];
+  Double_t FitWidth[100];
+  Int_t NFit = 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 = Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_%s",
+                             iType[iSt],
+                             iSm,
+                             iRp,
+                             iSel,
+                             cOpt.Data());
+        h             = (TH2*) gROOT->FindObjectAny(hname);
+        if (h != NULL) {
+          h->Draw("colz");
+          gPad->SetLogz();
+
+          if (iOpt2 > 0) switch (iOpt) {
+              case 6: {
+                switch (iOpt2) {
+                  case 1:  // x-projection
+                    hp = h->ProjectionX();
+                    hp->Draw();
+                    break;
+                  case 2:  // y-projection
+                    hp = h->ProjectionY();
+                    hp->Draw();
+                    break;
+                }
+                Double_t dFMean = hp->GetMean();
+                Double_t dFLim  = 2.5 * hp->GetRMS();
+                if (hp->Integral() > 10) {
+                  TFitResultPtr fRes = hp->Fit(
+                    "gaus", "S", "HEsame", dFMean - dFLim, dFMean + dFLim);
+                  FitHName[NFit]    = hp->GetName();
+                  FitIntegral[NFit] = hp->Integral();
+                  FitMean[NFit]     = fRes->Parameter(1);
+                  FitWidth[NFit]    = fRes->Parameter(2);
+                  NFit++;
+                  ;
+                }
+              } break;  // case 6 end
+
+              default:;
+                switch (iOpt2) {
+                  case 1:  // x-projection
+                    hp = h->ProjectionX();
+                    hp->Draw();
+                    break;
+                  case 2:  // y-projection
+                    hp = h->ProjectionY();
+                    hp->Draw();
+                    break;
+                }              
+            }
+
+        } else {
+          cout << "Histogram " << hname << " not existing. " << endl;
+        }
+        if (iRp == 10) break;
+      }
+    }
+  }
+  if (iOpt2 > 0) {
+    for (Int_t iFit = 0; iFit < NFit; iFit++) {
+      cout << "FitRes " << FitHName[iFit] << ", Stat: " << FitIntegral[iFit]
+           << ", Mean " << FitMean[iFit] << ", Width " << FitWidth[iFit]
+           << endl;
+    }
+  }
+
+  can->SaveAs(Form("pl_all_Sel%d_%s.pdf", iSel, cOpt.Data()));
+}
diff --git a/macro/beamtime/mcbm2021/pl_all_Track2D.C b/macro/beamtime/mcbm2021/pl_all_Track2D.C
new file mode 100644
index 0000000000000000000000000000000000000000..564ceb7bf8419c1461dc6e2a2f6a90962410fadc
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_all_Track2D.C
@@ -0,0 +1,122 @@
+void pl_all_Track2D(Int_t iOpt = 1, Int_t iNSt = 4) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  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, 7, 0.01, 0.01);
+  //  can->Divide(2,2,0,0);
+  Float_t lsize = 0.07;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  //gStyle->SetOptStat(kTRUE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+
+  TH2* h;
+  TH2* h2;
+  const Int_t iType[6]   = {0, 9, 6, 5, 7, 8};
+  const Int_t iSmNum[6]  = {5, 2, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 2, 2, 1, 1, 8};
+  TString cOpt;
+
+  switch (iOpt) {
+    case 0: cOpt = "Position"; 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;
+
+  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()));
+}
diff --git a/macro/beamtime/mcbm2021/pl_cmp_CluRate.C b/macro/beamtime/mcbm2021/pl_cmp_CluRate.C
new file mode 100644
index 0000000000000000000000000000000000000000..6f2da6ac17eb0095d1732a68062afea898576b13
--- /dev/null
+++ b/macro/beamtime/mcbm2021/pl_cmp_CluRate.C
@@ -0,0 +1,140 @@
+void pl_cmp_CluRate(Int_t iNSt      = 3,
+                    Long_t iSet     = 900032500,
+                    Int_t iOpt      = 0,
+                    Double_t Tstart = 0.,
+                    Double_t Tend   = 10.,
+                    Int_t iMode     = 1) {
+  //  TCanvas *can = new TCanvas("can22","can22");
+  //  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(2,2,0,0);
+  can->Divide(1, 3, 0.01, 0.01);
+  Float_t lsize = 0.09;
+
+  gPad->SetFillColor(0);
+  gStyle->SetPalette(1);
+  gStyle->SetLabelSize(lsize);
+
+  gStyle->SetOptStat(kFALSE);
+  //gROOT->cd();
+  //gROOT->SetDirLevel(2);
+  gStyle->SetPadLeftMargin(0.4);
+  gStyle->SetTitleOffset(1.0, "x");
+  gStyle->SetTitleOffset(0.8, "y");
+  gStyle->SetTitleFontSize(0.08);
+
+
+  TH1* h[iNSt];
+  TH1* hrat1[iNSt];
+  TH1* hrat2[iNSt];
+
+  TH2* h2;
+  Int_t iType[6]         = {0, 9, 5, 6, 7, 8};
+  const Int_t iSmNum[6]  = {5, 1, 1, 1, 1, 1};
+  const Int_t iRpcNum[6] = {5, 2, 1, 2, 1, 8};
+  Int_t iId_full[iNSt];
+
+  Int_t iCanv = 0;
+  Int_t iCol  = 0;
+  // if (h!=NULL) h->Delete();
+  TLegend* leg = new TLegend(0.78, 0.6, 0.85, 0.9);
+  leg->SetTextSize(0.05);
+
+  Long_t iSet_tmp = iSet;
+
+  can->cd(1);
+  for (Int_t iSt = 0; iSt < iNSt; iSt++) {
+    gROOT->cd();
+    Int_t iId     = iSet_tmp % 1000;
+    iId_full[iSt] = iId;
+    iSet_tmp      = (iSet_tmp - iId) / 1000;
+    Int_t iRp     = iId % 10;
+    iId -= iRp;
+    iId /= 10;
+    Int_t iSm = iId % 10;
+    iId -= iSm;
+    iId /= 10;
+    iType[iSt] = iId;
+
+    TString hname = "";
+    switch (iOpt) {
+      case 0:
+        hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate", iType[iSt], iSm, iRp);
+        break;
+      case 1:
+        hname = Form("cl_SmT%01d_sm%03d_rpc%03d_rate10s", iType[iSt], iSm, iRp);
+        break;
+    }
+    h[iSt] = (TH1*) gROOT->FindObjectAny(hname);
+    if (h[iSt] != NULL) {
+      h[iSt]->GetXaxis()->SetRangeUser(Tstart, Tend);
+      cout << "Draw " << iSt << ": " << hname << endl;
+      leg->AddEntry(h[iSt], Form("%03d", iId_full[iSt]), "p");
+
+      switch (iMode) {
+        case 0:
+          h[iSt]->Draw("");
+          //h->UseCurrentStyle();
+          gPad->SetLogy();
+          break;
+        case 1:
+          h[iSt]->UseCurrentStyle();  // set current defaults
+          h[iSt]->SetMarkerStyle(20 + iSm);
+          h[iSt]->SetTitle("");
+          iCol = iSt + 1;
+          if (iCol == 5) iCol++;
+          h[iSt]->SetLineColor(iCol);
+          h[iSt]->SetLineStyle(1);
+          h[iSt]->SetMarkerColor(iCol);
+          if (iSt == 0)
+            h[iSt]->Draw("LPE");
+          else
+            h[iSt]->Draw("LPEsame");
+          break;
+      }
+    } else {
+      cout << "Histogram " << hname << " not existing. " << endl;
+    }
+  }
+  leg->Draw();
+
+  can->cd(2);
+  Double_t RatMax = 1.5;
+  Double_t RatMin = 0.05;
+  gPad->SetLogy();
+  gPad->SetGridx();
+  gPad->SetGridy();
+  for (Int_t iSt = 1; iSt < iNSt; iSt++) {
+    hrat1[iSt] = (TH1*) h[iSt]->Clone();
+    hrat1[iSt]->Divide(h[iSt], h[0], 1., 1.);
+    hrat1[iSt]->SetYTitle(Form("Ratio to %03d", iId_full[0]));
+    hrat1[iSt]->SetMaximum(RatMax);
+    hrat1[iSt]->SetMinimum(RatMin);
+    if (iSt == 1)
+      hrat1[iSt]->Draw("LPE");
+    else
+      hrat1[iSt]->Draw("LPEsame");
+  }
+
+  can->cd(3);
+  RatMax = 2;
+  RatMin = 0.2;
+  gPad->SetLogy();
+  gPad->SetGridx();
+  gPad->SetGridy();
+  for (Int_t iSt = 2; iSt < iNSt; iSt++) {
+    hrat2[iSt] = (TH1*) h[iSt]->Clone();
+    hrat2[iSt]->Divide(h[iSt], h[1], 1., 1.);
+    hrat2[iSt]->SetYTitle(Form("Ratio to %03d", iId_full[1]));
+    hrat2[iSt]->SetMaximum(RatMax);
+    hrat2[iSt]->SetMinimum(RatMin);
+    gPad->SetLogy();
+    if (iSt == 2)
+      hrat2[iSt]->Draw("LPE");
+    else
+      hrat2[iSt]->Draw("LPEsame");
+  }
+
+  can->SaveAs(Form("pl_cmp_CluRate%ld_%d.pdf", iSet, iOpt));
+}
diff --git a/macro/beamtime/mcbm2021/rootlogon.C b/macro/beamtime/mcbm2021/rootlogon.C
new file mode 100644
index 0000000000000000000000000000000000000000..6bb7af029bad823d1892d3d7da020bd1813b54c8
--- /dev/null
+++ b/macro/beamtime/mcbm2021/rootlogon.C
@@ -0,0 +1,85 @@
+{
+  //}
+  //void rootlogon_nh()
+  //{
+  pTime = new TDatime();
+  cout << " Executing rootlogon.C (nh) at " << pTime->GetDate() << ", "
+       << pTime->GetTime() << endl;
+  gStyle->SetOptStat(111);
+  gStyle->SetLineWidth(2.);
+  gStyle->SetFrameLineWidth(2.);
+  gStyle->SetTitleOffset(1.01, "x");
+  gStyle->SetTitleOffset(0.9, "y");
+  gStyle->SetTitleSize(0.08, "x");  // axis labels
+  gStyle->SetTitleSize(0.08, "y");
+  gStyle->SetHistLineWidth(2.);
+  gStyle->SetPadRightMargin(0.15);
+  gStyle->SetPadLeftMargin(0.2);
+  gStyle->SetPadBottomMargin(0.2);
+  gStyle->SetTitleFontSize(0.07);     // histogram title
+  gStyle->SetLabelSize(0.07, "x");    //numbers
+  gStyle->SetLabelSize(0.07, "y");    //numbers
+  gStyle->SetLabelSize(0.05, "z");    //numbers
+  gStyle->SetLabelOffset(0.02, "x");  //numbers
+  gStyle->SetLabelOffset(0.02, "y");  //numbers
+  gStyle->SetLabelOffset(0.02, "z");  //numbers
+  gStyle->SetTextSize(0.3);
+  gStyle->SetNdivisions(505, "x");
+  gStyle->SetNdivisions(505, "y");
+  gStyle->SetNdivisions(505, "z");
+  gStyle->SetTickLength(0.06, "x");
+  gStyle->SetTickLength(0.03, "y");
+  gStyle->SetTickLength(0.06, "z");
+  gStyle->SetPalette(1, 0);
+  //  gStyle->SetOptDate(23);
+  //  gStyle->SetDateX(0.5);
+  // gStyle->SetDateY(0.5);
+
+  gStyle->SetLineScalePS(1.0);
+
+  gSystem->AddIncludePath(
+    Form("-I%s/include", gSystem->Getenv("FAIRROOTPATH")));
+
+  gSystem->AddIncludePath(Form("-I%s/roclight", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(Form("-I%s/data", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(Form("-I%s/data/tof", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(Form("-I%s/base ", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/hadaq", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/tdc", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/tdc/v1290", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/tdc/vftx", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/tdc/trb", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/tdc/get4", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/scalers", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/scalers/triglog", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/scalers/scalormu", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/scalers/scal2014", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/scalers/orgen", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/unpMoni", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/calib", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/calib/tdc", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/calib/scaler", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/mapping", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/output", gSystem->Getenv("VMCWORKDIR")));
+  gSystem->AddIncludePath(
+    Form("-I%s/beamtime/tof/display", gSystem->Getenv("VMCWORKDIR")));
+}
diff --git a/macro/beamtime/mcbm2021/scan_raw.sh b/macro/beamtime/mcbm2021/scan_raw.sh
new file mode 100755
index 0000000000000000000000000000000000000000..a698ebca5adbc92cdbc849a158c7f1d9732ad876
--- /dev/null
+++ b/macro/beamtime/mcbm2021/scan_raw.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+# shell script to apply clusterizer calibrations
+#SBATCH -J scan_raw
+#SBATCH -D /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+#SBATCH --time=48:00:00
+#SBATCH --mem=2000
+#SBATCH --partition=long
+cRun=$1
+
+iCalSet=$2
+if [[ "$iCalset" = "" ]]; then 
+iCalSet=31041500
+fi
+
+((iTmp  = $iCalSet ))
+((iBRef = $iTmp % 1000))
+((iTmp  = $iTmp - $iBRef))
+((iSet  = $iTmp / 1000))
+((iRef  = $iTmp % 1000000))
+((iRef  = $iRef / 1000))
+((iTmp  = $iTmp - $iRef))
+((iDut  = $iTmp / 1000000))
+
+iSel2=$3
+if [[ "$iSel2" = "" ]]; then 
+iSel2=500
+fi
+
+cCalSet=$iCalSet
+if (( iCalSet<100000000 )); then 
+cCalSet="0"$iCalSet
+fi
+if (( iCalSet<10000000 )); then 
+cCalSet="00"$iCalSet
+fi
+if (( iCalSet<1000000 )); then 
+cCalSet="000"$iCalSet
+fi
+if (( iCalSet<100000 )); then 
+cCalSet="0000"$iCalSet
+fi
+echo cCalSet = $cCalSet
+
+Deadtime=$4
+if [[ ${Deadtime} = "" ]]; then
+Deadtime=50.
+fi
+
+echo scan_raw for $cRun with iDut=$iDut, iRef=$iRef, iSet=$iCalSet, iSel2=$iSel2, iBRef=$iBRef, Deadtime=$Deadtime
+
+if [ -e /lustre/cbm ]; then
+source /lustre/cbm/users/nh/CBM/cbmroot/trunk/build/config.sh 
+wdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+outdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/${cRun}
+else 
+wdir=`pwd`
+outdir=${wdir}/${cRun}
+fi
+
+cd $wdir
+mkdir $cRun
+cd    $cRun 
+mkdir Raw
+cd Raw
+cp    ../../.rootrc .
+cp    ../../rootlogon.C .
+
+root -b -q '../../ana_digi_cal_all.C(-1,0,0,'$iBRef',50,"'$cRun'",'$iCalSet',0,'$iSel2','$Deadtime') '
+
+
+cd ../..
+
+mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/ScanRaw_${cRun}_${iCalSet}_${iSel2}.out
diff --git a/macro/beamtime/mcbm2021/trk_cal_digi.sh b/macro/beamtime/mcbm2021/trk_cal_digi.sh
new file mode 100755
index 0000000000000000000000000000000000000000..2e7e87c26369a4ee0c16d0cd5e7ad153e424f035
--- /dev/null
+++ b/macro/beamtime/mcbm2021/trk_cal_digi.sh
@@ -0,0 +1,257 @@
+#!/bin/bash
+# shell script to apply clusterizer calibrations
+#SBATCH -J trk_cal_digi
+#SBATCH -D /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+##SBATCH --time=8:00:00
+#SBATCH --time=5-24:00:00
+#SBATCH --mem=4000
+#SBATCH --partition=long
+
+trk_cal_digi() {
+cRun=$1
+
+iCalSet=$2
+((iTmp  = $iCalSet ))
+((iBRef = $iTmp % 1000))
+((iTmp  = $iTmp - $iBRef))
+((iSet  = $iTmp / 1000))
+((iRef  = $iTmp % 1000000))
+((iRef  = $iRef / 1000))
+((iTmp  = $iTmp - $iRef))
+((iDut  = $iTmp / 1000000))
+
+iSel2=$3
+cSel2=$iSel2
+if (( iSel2<100 )); then 
+cSel2="0"$iSel2
+fi
+if (( iSel2<10 )); then 
+cSel2="00"$iSel2
+fi
+
+cCalSet=$iCalSet
+if (( iCalSet<100000000 )); then 
+cCalSet="0"$iCalSet
+fi
+if (( iCalSet<10000000 )); then 
+cCalSet="00"$iCalSet
+fi
+if (( iCalSet<1000000 )); then 
+cCalSet="000"$iCalSet
+fi
+if (( iCalSet<100000 )); then 
+cCalSet="0000"$iCalSet
+fi
+echo cCalSet = $cCalSet
+
+Deadtime=$4
+if [[ ${Deadtime} = "" ]]; then
+Deadtime=50.
+fi
+
+CalIdMode=$5
+if [[ ${CalIdMode} = "" ]]; then
+ echo use native calibration file 
+ CalIdMode=${cRun}
+ CalFile=${cRun}_set${cCalSet}_93_1tofClust.hst.root
+else 
+ CalFile=${CalIdMode}_set${cCalSet}_93_1tofClust.hst.root
+ RunFile=${cRun}_set${cCalSet}_93_1tofClust.hst.root
+# rm ${RunFile}
+# ln -s ${CalFile} ${RunFile} 
+ echo use calibrations from  ${CalFile}
+fi
+
+iCalOpt=$6
+if [[ ${iCalOpt} = "" ]]; then
+  iCalOpt=1	
+fi
+
+iTraSetup=$7
+if [[ $iTraSetup = "" ]]; then 
+  iTraSetup=1
+fi
+
+CalIdSet=$8
+if [[ ${CalIdSet} = "" ]]; then
+    echo use native calibration file
+    CalIdSet=$cCalSet
+else
+    CalFile=${CalIdMode}_set${CalIdSet}_93_1tofClust.hst.root    
+fi
+
+echo trk_cal_digi for $cRun with iDut=$iDut, iRef=$iRef, iSet=$iCalSet, iSel2=$iSel2, iBRef=$iBRef, Deadtime=$Deadtime, CalFile=$CalFile
+
+if [ -e /lustre/cbm ]; then
+source /lustre/cbm/users/nh/CBM/cbmroot/trunk/build/config.sh 
+wdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021
+outdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/${cRun}
+else 
+wdir=`pwd`
+outdir=${wdir}/${cRun}
+fi
+
+iter=0;
+
+cd $wdir
+mkdir $cRun
+cd    $cRun 
+cp    ../.rootrc .
+cp    ../rootlogon.C .
+
+echo Execute in `pwd` at shell level $iShLev: ./trk_cal_digi.sh $1 $2 $3 $4 $5 $6 $7 $8
+
+if [[ $iShLev = "" ]]; then 
+  iShLev=0
+  nEvt=200000
+  dDTres=100000
+  dDTRMSres=100000
+  dL0DTRMSres=100000
+# get initial digi calibration 
+  cp -v  ./I*/${CalFile}  .
+# get latest tracker offsets
+# cp -v ../${cRun}_tofFindTracks.hst.root .
+else
+ (( iShLev += 1 ))  
+fi 
+
+rm -v TCalib.res
+nEvtMax=0
+(( nEvtMax = nEvt*10 ))
+
+#frange1 limits DT spectrum range 
+fRange1=1.5
+# frange2 limits chi2
+fRange2=5.0
+TRange2Limit=3.5 
+
+iSel=900041
+iGenCor=3
+cCalSet2=${cCalSet}_$cSel2
+
+case $iCalOpt in
+  1)   # TOff
+  ;;
+  2)   # Walk
+  (( nEvt *= 10 ))
+  (( nEvtMax *= 10 ))
+  ;;
+esac
+  
+iIter=0
+while [[ $dDTres -gt 0 ]]; do
+  nEvt=`echo "scale=0;$nEvt * 1./1." | bc`
+  #nEvt=`echo "scale=0;$nEvt * 1.1/1." | bc`
+  if [ $nEvt -gt $nEvtMax ]; then
+    nEvt=$nEvtMax
+  fi
+
+  fRange2=`echo "$fRange2 * 0.9" | bc`
+  compare_TRange2=`echo "$fRange2 < $TRange2Limit" | bc`
+  if  [[ $compare_TRange2 > 0 ]]; then
+   fRange2=$TRange2Limit
+  fi
+  
+  iCalAct=$iCalOpt
+  echo Enter while loop with Iter $iIter, CalAct $iCalAct in dir `pwd`
+
+  while [[ $iCalAct -gt 0 ]]; do  
+    cd $wdir/$cRun
+    echo Current loop with Iter $iIter, CalAct $iCalAct and CalOpt $iCalOpt
+    if [[ $iCalOpt = 1 ]] || [[ $iCalAct -gt 1 ]]; then 
+      root -b -q '../ana_digi_cal.C('$nEvt',93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+      # update calibration parameter file, will only be active in next iteration 
+      if [[ $iIter = -10 ]] && [[ $iCalOpt = 1 ]]; then  # exploratory option when iIter set to 0 
+        echo Update Calibration file from ana_digi_cal
+        cp -v tofClust_${cRun}_set${cCalSet}.hst.root ../${cRun}_set${cCalSet}_93_1tofClust.hst.root
+        echo 20000 > TOffAvOff.res
+        echo 20000 > TOffAvRMS.res
+      else
+        root -b -q '../ana_trks.C('$nEvt','$iSel','$iGenCor',"'$cRun'","'$cCalSet2'",'$iSel2','$iTraSetup','$fRange1','$fRange2','$Deadtime',"'$CalIdMode'",1,1,'$iCalSet','$iCalAct')'
+      #root -l 'ana_trksi.C(-1,10,1,"385.50.5.0","000014500_020",20,1,1.90,7.60,50,"385.50.5.0",1,1)'
+  
+        cp -v New_${CalFile} ${CalFile}  
+      fi
+      (( iIter   += 1 ))
+    else 
+      cd $wdir
+      # store current status 
+      dLDTres=$dDTres
+      dLDTRMSres=$dDTRMSres
+      iLCalOpt=$iCalOpt
+      echo Store $iIter limits $dLDTres, $dLDTRMSres
+      echo exec in `pwd` at iter $iIter, level $iShLev: trk_cal_digi $1 $2 $3 $4 $5 1 $7
+      trk_cal_digi $1 $2 $3 $4 $5 1 $7
+      # restore old status
+      dL0DTRMSres=$dDTRMSres
+      dLDTRMSres=50000  # prepare for next round 
+      dDTres=$dLDTres
+      dDTRMSres=$dLDTRMSres
+      iCalOpt=$iLCalOpt
+      echo exec1done at $iIter, $iShLev resume old CalOpt $iCalOpt with limits $dDTres, $dDTRMSres, $dL0DTRMSres
+    fi
+    (( iCalAct -= 1 ))
+    echo Continue while loop with Iter $iIter, ShLev $iShLev, CalAct $iCalAct and CalOpt $iCalOpt
+  done
+  
+  cd $wdir/$cRun
+  Tres=`cat TOffAvOff.res`
+  TRMSres=`cat TOffAvRMS.res`
+
+  if [[ $Tres = 0 ]]; then
+    Tres=1
+  fi
+  
+  if [[ $dDTRMSres -eq 50000 ]]; then 
+    TRMSres=5000
+  fi
+  
+  dTdif=`echo "$dDTres - $Tres" | bc`
+  compare_result=`echo "$Tres < $dDTres" | bc`
+
+  dTRMSdif=`echo "$dDTRMSres - $TRMSres" | bc`
+  compare_RMS=`echo "$TRMSres < $dDTRMSres" | bc`
+
+  echo At iter=$iter, ShLev=$iShLev got TOff = $Tres, compare to $dDTres, dTdif = $dTdif, result = $compare_result, TRMS = $TRMSres, old $dDTRMSres, dif = $dTRMSdif, result = $compare_RMS 
+
+  ((compare_result += $compare_RMS))
+  echo CMPR result_summary: $compare_result 
+
+#  if [ $iter = 1 ]; then 
+#    exit 0  # for debugging 
+#  fi
+
+  if [[ $compare_result > 0 ]]; then
+    if [[ $Tres = 0 ]]; then
+      Tres=1
+    fi
+    dDTres=$Tres
+    dDTRMSres=$TRMSres
+    echo Stored $iIter, $iShLev new res values $dDTres, $dDTRMSres
+    (( dDTRMSres -= 1 ))  # next attempt should be at least 1ps better for continuation
+    cp -v New_${CalFile} ${CalFile}  
+    cp -v New_${CalFile} ${CalFile}_$iter  
+  else
+    echo Next iteration $TRMSres -gt $dL0DTRMSres ?
+    if [[ $TRMSres -gt $dL0DTRMSres ]]; then
+      exit 0 
+    fi
+    dDTres=0
+  fi
+  (( iter += 1 ))
+done
+
+(( iShLev -= 1 ))
+cd $wdir/$cRun
+echo Finishing with ShLev $iShLev, Iter = $iIter 
+# generate full statistics CalDigi / Hit file 
+if [[ $iShLev -eq 0 ]]; then
+#  root -b -q '../ana_digi_cal.C(-1,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+  root -b -q '../ana_digi_cal_all.C(1000000,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") '
+  cd $wdir
+  mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/TrkCalDigi_${cRun}_${iCalSet}_${iSel2}_${CalIdMode}.out
+fi
+
+} #end of function body
+
+trk_cal_digi $1 $2 $3 $4 $5 $6 $7 $8
diff --git a/macro/beamtime/mcbm2021/unpack_tsa_mcbm.C b/macro/beamtime/mcbm2021/unpack_tsa_mcbm.C
new file mode 100644
index 0000000000000000000000000000000000000000..606074a90bb0d9ed8090d1d4ed53ac32e3cb0167
--- /dev/null
+++ b/macro/beamtime/mcbm2021/unpack_tsa_mcbm.C
@@ -0,0 +1,650 @@
+/** @file MCBM DATA unpacking
+ ** @author Florian Uhlig <f.uhlig@gsi.de>
+ ** @date 20.06.2016
+ ** Modified by P.-A. Loizeau
+ ** @date 30.01.2019
+ ** ROOT macro to read tsa files which have been produced with the new data transport
+ ** Convert data into cbmroot format.
+ ** Uses CbmMcbm2018Source as source task.
+ */
+// In order to call later Finish, we make this global
+FairRunOnline* run = NULL;
+
+void unpack_tsa_mcbm(TString inFile  = "",
+                     UInt_t uRunId   = 0,
+                     UInt_t nrEvents = 0,
+                     TString outDir  = "data",
+                     TString inDir   = "") {
+  TString srcDir = gSystem->Getenv("VMCWORKDIR");
+
+  // --- Specify number of events to be produced.
+  // --- -1 means run until the end of the input file.
+  Int_t nEvents = -1;
+  // --- Specify output file name (this is just an example)
+  TString runId   = TString::Format("%03u", uRunId);
+  TString outFile = outDir + "/unp_mcbm_" + runId + ".root";
+  TString parFile = outDir + "/unp_mcbm_params_" + runId + ".root";
+
+
+  // --- Set log output levels
+  FairLogger::GetLogger();
+  gLogger->SetLogScreenLevel("INFO");
+  //gLogger->SetLogScreenLevel("DEBUG");
+  gLogger->SetLogVerbosityLevel("MEDIUM");
+  //gLogger->SetLogVerbosityLevel("LOW");
+
+  // --- Define parameter files
+  TList* parFileList = new TList();
+  TString paramDir   = srcDir + "/macro/beamtime/mcbm2021/";
+
+  // --- Load the geometry setup ----
+  // This is currently only required by the TRD
+  std::string geoSetupTag = "mcbm_beam_2021_01";
+  CbmSetup* geoSetup      = CbmSetup::Instance();
+  geoSetup->LoadSetup(geoSetupTag.data());
+
+  TString paramFileSts       = paramDir + "mStsPar.par";
+  TObjString* parStsFileName = new TObjString(paramFileSts);
+  parFileList->Add(parStsFileName);
+
+  TString paramFileMuch       = paramDir + "mMuchPar.par";
+  TObjString* parMuchFileName = new TObjString(paramFileMuch);
+  parFileList->Add(parMuchFileName);
+
+  // ---- Trd ----
+  TString geoTagTrd = "";
+  bool isActiveTrd =
+    (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false;
+  if (!isActiveTrd) {
+    LOG(warning) << Form(
+      "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters "
+      "can not be loaded correctly!",
+      geoSetupTag.data());
+  } else {
+    TString paramFilesTrd(
+      Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data()));
+    std::vector<std::string> paramFilesVecTrd;
+    CbmTrdParManager::GetParFileExtensions(&paramFilesVecTrd);
+    for (auto parIt : paramFilesVecTrd) {
+      parFileList->Add(
+        new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data())));
+    }
+    // Add timeshift calibration, currently only available for run 831 others to come
+    if (uRunId == 831)
+      parFileList->Add(new TObjString(Form(
+        "%s/parameters/trd/mcbm2020_special/CbmMcbm2020TrdTshiftPar_run%d.par",
+        srcDir.Data(),
+        uRunId)));
+  }
+
+  TString paramFileTof = paramDir + "mTofPar.par";
+  /*
+  if (uRunId >= 708 && uRunId < 754)
+    paramFileTof = paramDir + "mTofPar_2Stack.par";
+  else if (uRunId >= 754)
+    paramFileTof = paramDir + "mTofPar_3Stack.par";
+  */
+  TObjString* parTofFileName = new TObjString(paramFileTof);
+  parFileList->Add(parTofFileName);
+
+  TString paramFileRich = paramDir + "mRichPar.par";
+  if (uRunId > 698) paramFileRich = paramDir + "mRichPar_70.par";
+  TObjString* parRichFileName = new TObjString(paramFileRich);
+  parFileList->Add(parRichFileName);
+
+  TString paramFilePsd       = paramDir + "mPsdPar.par";
+  TObjString* parPsdFileName = new TObjString(paramFilePsd);
+  parFileList->Add(parPsdFileName);
+
+  // --- Set debug level
+  gDebug = 0;
+
+  std::cout << std::endl;
+  std::cout << ">>> unpack_tsa: output file is " << outFile << std::endl;
+
+  // ========================================================================
+  // ========================================================================
+  std::cout << std::endl;
+  std::cout << ">>> unpack_tsa: Initialising..." << std::endl;
+
+  CbmMcbm2018UnpackerTaskSts* unpacker_sts = new CbmMcbm2018UnpackerTaskSts();
+  CbmMcbm2018UnpackerTaskMuch* unpacker_much =
+    new CbmMcbm2018UnpackerTaskMuch();
+  CbmMcbm2018UnpackerTaskTrdR* unpacker_trdR =
+    new CbmMcbm2018UnpackerTaskTrdR();
+  CbmMcbm2018UnpackerTaskTof* unpacker_tof = new CbmMcbm2018UnpackerTaskTof();
+  CbmMcbm2018UnpackerTaskRich* unpacker_rich =
+    new CbmMcbm2018UnpackerTaskRich();
+  CbmMcbm2018UnpackerTaskPsd* unpacker_psd = new CbmMcbm2018UnpackerTaskPsd();
+
+  /*
+ * Do not generate plots by default
+  unpacker_sts ->SetMonitorMode();
+  unpacker_much->SetMonitorMode();
+  unpacker_trdR->SetMonitorMode(); // Assume histo server present, not like other unpackers
+  unpacker_tof ->SetMonitorMode();
+  unpacker_rich->SetMonitorMode();
+  unpacker_psd->SetMonitorMode();
+*/
+
+  unpacker_sts->SetIgnoreOverlapMs();
+  unpacker_much->SetIgnoreOverlapMs();
+  //  unpacker_trdR ->SetIgnoreOverlapMs(); /// Default is kTRUE
+  unpacker_tof->SetIgnoreOverlapMs();
+  unpacker_rich->SetIgnoreOverlapMs();
+  unpacker_psd->SetIgnoreOverlapMs();
+
+  /// Starting from first run on Tuesday 28/04/2020, STS uses bin sorter FW
+  if (692 <= uRunId) unpacker_sts->SetBinningFwFlag(kTRUE);
+  /// Starting from first run on Monday 04/05/2020, MUCH uses bin sorter FW
+  if (811 <= uRunId) unpacker_much->SetBinningFwFlag(kTRUE);
+
+  /// FIXME: Disable clang formatting for parameters tuning for now
+  /* clang-format off */
+  //  unpacker_sts ->SetAdcCut( 3 );
+  unpacker_sts ->MaskNoisyChannel(1,768 ,  true );
+  unpacker_sts ->MaskNoisyChannel(1,894 ,  true );
+  unpacker_sts ->MaskNoisyChannel(1,896 ,  true );
+
+  unpacker_sts ->MaskNoisyChannel(2,930 ,  true );
+  unpacker_sts ->MaskNoisyChannel(2,926 ,  true );
+  unpacker_sts ->MaskNoisyChannel(2,892 ,  true );
+
+  unpacker_sts ->MaskNoisyChannel(3,770 ,  true );
+
+  unpacker_tof->SetSeparateArrayT0();
+
+  // ------------------------------ //
+  // Enable Asic type for MUCH data.
+  // fFlag = 0 ==> Asic type 2.0 (20) ---> December 2018 and March 2019 Data
+  // fFlag = 1 ==> Asic type 2.1 (21) ---> December 2019 Data
+  // This is to correct the channel fliping problem in smx 2.1 chip
+  Int_t fFlag = 1;
+  unpacker_much->EnableAsicType(fFlag);
+  // ------------------------------ //
+  /// General System offsets (= offsets between sub-systems)
+  unpacker_sts->SetTimeOffsetNs(-936);   // Run 811-866
+  unpacker_much->SetTimeOffsetNs(-885);  // Run 811-866
+  unpacker_trdR->SetTimeOffsetNs(0);     // Run 811-866
+  unpacker_tof->SetTimeOffsetNs(30);     // Run 811-866
+  unpacker_rich->SetTimeOffsetNs(-310);  // Run 811-866
+  unpacker_psd->SetTimeOffsetNs(-225);   // Run 811-866
+
+  // ----------- ASIC by ASIC STS ----------------
+  // the first 8 Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  0,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  1,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  2,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  3,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  4,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  5,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  6,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  7,       0.0  ); // Unused
+  //
+  unpacker_sts ->SetTimeOffsetNsAsic(8,  -0.360078  );
+  unpacker_sts ->SetTimeOffsetNsAsic(9,  2.73976    );
+  unpacker_sts ->SetTimeOffsetNsAsic(10,  -0.507079  );
+  unpacker_sts ->SetTimeOffsetNsAsic(11,  1.74695    );
+  unpacker_sts ->SetTimeOffsetNsAsic(12,  -0.909864  );
+  unpacker_sts ->SetTimeOffsetNsAsic(13,  -0.255514  );
+  unpacker_sts ->SetTimeOffsetNsAsic(14,  1.44034    );
+  unpacker_sts ->SetTimeOffsetNsAsic(15,  2.64009    );
+  // this side: revert order 23->16
+  unpacker_sts ->SetTimeOffsetNsAsic(23,  -0.442762  );
+  unpacker_sts ->SetTimeOffsetNsAsic(22,  1.76543    );
+  unpacker_sts ->SetTimeOffsetNsAsic(21, -0.94728   );
+  unpacker_sts ->SetTimeOffsetNsAsic(20, -2.18516   );
+  unpacker_sts ->SetTimeOffsetNsAsic(19, -0.68254   );
+  unpacker_sts ->SetTimeOffsetNsAsic(18, -2.32241   );
+  unpacker_sts ->SetTimeOffsetNsAsic(17, -1.53483   );
+  unpacker_sts ->SetTimeOffsetNsAsic(16, -2.12455   );
+  //
+  unpacker_sts ->SetTimeOffsetNsAsic(24, -0.41084   );
+  unpacker_sts ->SetTimeOffsetNsAsic(25, 0.230455   );
+  unpacker_sts ->SetTimeOffsetNsAsic(26, -0.206921  );
+  unpacker_sts ->SetTimeOffsetNsAsic(27, 0.0913657  );
+  unpacker_sts ->SetTimeOffsetNsAsic(28, -0.17252   );
+  unpacker_sts ->SetTimeOffsetNsAsic(29, -0.32990   );
+  unpacker_sts ->SetTimeOffsetNsAsic(30, 1.43535    );
+  unpacker_sts ->SetTimeOffsetNsAsic(31, -0.155741  );
+  // this side: revert order 39->32
+  unpacker_sts ->SetTimeOffsetNsAsic(39, 1.53865    );
+  unpacker_sts ->SetTimeOffsetNsAsic(38, 3.6318     );
+  unpacker_sts ->SetTimeOffsetNsAsic(37, 1.3153     );
+  unpacker_sts ->SetTimeOffsetNsAsic(36, -1.90278   );
+  unpacker_sts ->SetTimeOffsetNsAsic(35, 2.00051    );
+  unpacker_sts ->SetTimeOffsetNsAsic(34, -2.85656   );
+  unpacker_sts ->SetTimeOffsetNsAsic(33, 1.28834    );
+  unpacker_sts ->SetTimeOffsetNsAsic(32, 0.657113   );
+
+  switch (uRunId) {
+    case 707: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1750 ); // Run 707
+      //unpacker_much->SetTimeOffsetNs( -1750 ); // Run 707
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 707, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 707, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 707, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 707, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 707, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 707, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 707, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 707, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 707, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 707, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 707, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 707, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 707, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 707, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 707, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 707, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 707, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 707, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 9590.0);  // Run 707, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 9590.0);  // Run 707, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 9630.0);  // Run 707, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 9590.0);  // Run 707, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 707, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 707, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 0.0);     // Run 707, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 0.0);     // Run 707, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 0.0);     // Run 707, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 707, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 707, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 707, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 707, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 707, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, 7170.0);  // Run 707, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, 7170.0);  // Run 707, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 707, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 707, DPB 5 ASIC 5
+      break;
+    }  // 707
+    case 750: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1750 ); // Run 750
+      //unpacker_much->SetTimeOffsetNs( -1750 ); // Run 750
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 750, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 750, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 750, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 750, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 750, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 750, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 750, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 750, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 750, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 750, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 750, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 750, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 750, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 750, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 750, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 750, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 750, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 750, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 6400.0);  // Run 750, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 6400.0);  // Run 750, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 6400.0);  // Run 750, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 6400.0);  // Run 750, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 750, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 750, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 0.0);     // Run 750, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 0.0);     // Run 750, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 0.0);     // Run 750, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 750, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 750, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 750, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 750, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 750, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, 3170.0);  // Run 750, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, 3170.0);  // Run 750, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 750, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 750, DPB 5 ASIC 5
+      break;
+    }  // 750
+    case 759: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1759 ); // Run 759
+      //unpacker_much->SetTimeOffsetNs( -1759 ); // Run 759
+      unpacker_trdR->SetTimeOffsetNs(190);  // Run 759
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 759, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 759, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 759, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 759, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 759, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 759, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 759, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 759, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 759, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 759, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 759, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 759, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 759, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 759, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 759, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 759, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 759, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 759, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 3200.0);  // Run 759, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 3200.0);  // Run 759, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 3200.0);  // Run 759, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 3200.0);  // Run 759, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 759, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 759, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 3200.0);  // Run 759, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 3200.0);  // Run 759, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 3200.0);  // Run 759, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 759, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 759, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 759, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 759, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 759, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, -30.0);   // Run 759, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, -30.0);   // Run 759, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 759, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 759, DPB 5 ASIC 5
+      break;
+    }  // 759
+    case 760: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1760 ); // Run 760
+      //unpacker_much->SetTimeOffsetNs( -1760 ); // Run 760
+      unpacker_trdR->SetTimeOffsetNs(-75);  // Run 760
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 760, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 760, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 760, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 760, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 760, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 760, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 760, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 760, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 760, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 760, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 760, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 760, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 760, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 760, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 760, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 760, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 760, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 760, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 0.0);     // Run 760, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 0.0);     // Run 760, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 0.0);     // Run 760, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 0.0);     // Run 760, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 760, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 760, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 3160.0);  // Run 760, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 3160.0);  // Run 760, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 3160.0);  // Run 760, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 760, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 760, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 760, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 760, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 760, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, -30.0);   // Run 760, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, -30.0);   // Run 760, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 760, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 760, DPB 5 ASIC 5
+      break;
+    }  // 760
+    case 761: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1761 ); // Run 761
+      //unpacker_much->SetTimeOffsetNs( -1761 ); // Run 761
+      unpacker_trdR->SetTimeOffsetNs(90);  // Run 761
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 761, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 761, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 761, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 761, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 761, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 761, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 761, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 761, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 761, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 761, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 761, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 761, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 761, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 761, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 761, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 761, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 761, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 761, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 3200.0);  // Run 761, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 3200.0);  // Run 761, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 3200.0);  // Run 761, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 3200.0);  // Run 761, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 761, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 761, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 6360.0);  // Run 761, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 6360.0);  // Run 761, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 6360.0);  // Run 761, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 761, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 761, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 761, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 761, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 761, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, 6360.0);  // Run 761, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, 6360.0);  // Run 761, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 761, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 761, DPB 5 ASIC 5
+      break;
+    }  // 761
+    case 762: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1762 ); // Run 762
+      //unpacker_much->SetTimeOffsetNs( -1762 ); // Run 762
+      unpacker_trdR->SetTimeOffsetNs(60);  // Run 762
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 762, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 762, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 762, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 762, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 762, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 762, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 762, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 762, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 762, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 762, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 762, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 762, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 762, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 762, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 762, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 762, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 762, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 762, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 4800.0);  // Run 762, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 4800.0);  // Run 762, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 4800.0);  // Run 762, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 4800.0);  // Run 762, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 762, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 762, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 9550.0);  // Run 762, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 9550.0);  // Run 762, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 9550.0);  // Run 762, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 762, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 762, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 762, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 762, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 762, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, -30.0);   // Run 762, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, -30.0);   // Run 762, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 762, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 762, DPB 5 ASIC 5
+      break;
+    }  // 762
+    case 811: {
+      unpacker_trdR->SetTimeOffsetNs(84.38);
+      break;
+    }  // 811
+    case 812: {
+      unpacker_trdR->SetTimeOffsetNs(165.62);
+      break;
+    }  // 812
+    case 816: {
+      unpacker_trdR->SetTimeOffsetNs(-9.38);
+      break;
+    }  // 816
+    case 819: {
+      unpacker_trdR->SetTimeOffsetNs(-140.62);
+      break;
+    }  // 819
+    case 820: {
+      unpacker_trdR->SetTimeOffsetNs(109.38);
+      break;
+    }  // 820
+    case 821: {
+      unpacker_trdR->SetTimeOffsetNs(-65.62);
+      break;
+    }  // 821
+    case 822: {
+      unpacker_trdR->SetTimeOffsetNs(59.38);
+      break;
+    }  // 822
+    case 824: {
+      unpacker_trdR->SetTimeOffsetNs(-165.62);
+      break;
+    }  // 824
+    case 826: {
+      unpacker_trdR->SetTimeOffsetNs(59.38);
+      break;
+    }  // 826
+    case 827: {
+      unpacker_trdR->SetTimeOffsetNs(-15.62);
+      break;
+    }  // 827
+    case 828: {
+      unpacker_trdR->SetTimeOffsetNs(-109.38);
+      break;
+    }  // 828
+    case 830: {
+      unpacker_trdR->SetTimeOffsetNs(15.62);
+      break;
+    }  // 830
+    case 831: {
+      //         unpacker_trdR->SetTimeOffsetNs(   70.00 );
+      unpacker_trdR->SetTimeOffsetNs(-25.00);
+
+      std::cout << "MUCH: Feb by feb time offset correction......" << std::endl;
+      UInt_t uRun, uNx;
+      Double_t offset;
+      ifstream infile_off(paramDir + "/parameters/time_offset_much.txt");
+      if (!infile_off) {
+        std::cout << "can not open time offset MUCH parameter List" << std::endl;
+        return kFALSE;
+      } // if (!infile_off)
+      while (!infile_off.eof())  {
+        infile_off >> uRun >> uNx >> offset;
+        if(uRun != 831) continue;
+        unpacker_much->SetTimeOffsetNsAsic(uNx, offset);
+      } // while (!infile_off.eof())
+      infile_off.close();
+      std::cout << "masking noisy channels......" << std::endl;
+      UInt_t uChan = 0;
+      ifstream infile_noise(paramDir + "parameters/much_noisy_channel_list.txt");
+      if (!infile_noise) {
+        std::cout << "can not open MUCH noisy channel List" << std::endl;
+        return kFALSE;
+      } // if (!infile_noise)
+      while (!infile_noise.eof())  {
+        infile_noise >> uRun >> uNx >> uChan;
+        if(uRun != 831) continue;
+        unpacker_much->MaskNoisyChannel(uNx, uChan, kTRUE );
+      } // while (!infile_noise.eof())
+      infile_noise.close();
+      break;
+    }  // 831
+    case 836: {
+      unpacker_trdR->SetTimeOffsetNs(-40.62);
+      break;
+    }  // 836
+    default: break;
+  }  // switch( uRunId )
+  /// FIXME: Re-enable clang formatting after parameters tuning
+  /* clang-format on */
+  // --- Source task
+  CbmMcbm2018Source* source = new CbmMcbm2018Source();
+  source->SetWriteOutputFlag(kTRUE);  // For writing TS metadata
+
+  source->SetFileName(inFile);
+
+  source->AddUnpacker(unpacker_sts, 0x10, ECbmModuleId::kSts);    // STS xyter
+  source->AddUnpacker(unpacker_much, 0x50, ECbmModuleId::kMuch);  // MUCH xyter
+  if (isActiveTrd)
+    source->AddUnpacker(unpacker_trdR, 0x40, ECbmModuleId::kTrd);  // Trd
+  source->AddUnpacker(unpacker_tof, 0x60, ECbmModuleId::kTof);     // gDPB TOF
+  source->AddUnpacker(unpacker_tof, 0x90, ECbmModuleId::kTof);     // gDPB T0
+  source->AddUnpacker(unpacker_rich, 0x30, ECbmModuleId::kRich);   // RICH trb
+  source->AddUnpacker(unpacker_psd, 0x80, ECbmModuleId::kPsd);     // PSD
+
+  // --- Event header
+  FairEventHeader* event = new FairEventHeader();
+  event->SetRunId(uRunId);
+
+  // --- RootFileSink
+  // --- Open next outputfile after 4GB
+  FairRootFileSink* sink = new FairRootFileSink(outFile);
+  //  sink->GetOutTree()->SetMaxTreeSize(4294967295LL);
+
+  // --- Run
+  run = new FairRunOnline(source);
+  run->SetSink(sink);
+  run->SetEventHeader(event);
+  run->SetAutoFinish(kFALSE);
+
+
+  // -----   Runtime database   ---------------------------------------------
+  FairRuntimeDb* rtdb       = run->GetRuntimeDb();
+  Bool_t kParameterMerged   = kTRUE;
+  FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged);
+  FairParAsciiFileIo* parIn = new FairParAsciiFileIo();
+  parOut->open(parFile.Data());
+  parIn->open(parFileList, "in");
+  rtdb->setFirstInput(parIn);
+  rtdb->setOutput(parOut);
+
+  run->Init();
+
+  // --- Start run
+  TStopwatch timer;
+  timer.Start();
+  std::cout << ">>> unpack_tsa_mcbm: Starting run..." << std::endl;
+  if (0 == nrEvents) {
+    run->Run(nEvents, 0);  // run until end of input file
+  } else {
+    run->Run(0, nrEvents);  // process  N Events
+  }
+  run->Finish();
+
+  timer.Stop();
+
+  std::cout << "Processed " << std::dec << source->GetTsCount() << " timeslices"
+            << std::endl;
+
+  // --- End-of-run info
+  Double_t rtime = timer.RealTime();
+  Double_t ctime = timer.CpuTime();
+  std::cout << std::endl << std::endl;
+  std::cout << ">>> unpack_tsa_mcbm: Macro finished successfully." << std::endl;
+  std::cout << ">>> unpack_tsa_mcbm: Output file is " << outFile << std::endl;
+  std::cout << ">>> unpack_tsa_mcbm: Real time " << rtime << " s, CPU time "
+            << ctime << " s" << std::endl;
+  std::cout << std::endl;
+
+  /// --- Screen output for automatic tests
+  std::cout << " Test passed" << std::endl;
+  std::cout << " All ok " << std::endl;
+}
diff --git a/macro/beamtime/mcbm2021/unpack_tsa_mcbm_kronos.C b/macro/beamtime/mcbm2021/unpack_tsa_mcbm_kronos.C
new file mode 100644
index 0000000000000000000000000000000000000000..e89b558f14c241adc356c6c8c1497add23341edd
--- /dev/null
+++ b/macro/beamtime/mcbm2021/unpack_tsa_mcbm_kronos.C
@@ -0,0 +1,680 @@
+/** @file MCBM DATA unpacking
+ ** @author Florian Uhlig <f.uhlig@gsi.de>
+ ** @date 20.06.2016
+ ** Modified by P.-A. Loizeau
+ ** @date 30.01.2019
+ ** ROOT macro to read tsa files which have been produced with the new data transport
+ ** Convert data into cbmroot format.
+ ** Uses CbmMcbm2018Source as source task.
+ */
+// In order to call later Finish, we make this global
+FairRunOnline* run = NULL;
+
+void unpack_tsa_mcbm_kronos(UInt_t uRunIdx  = 99999,
+                            UInt_t nrEvents = 0,
+                            TString outDir  = "data") {
+  UInt_t uRunId = 0;
+  if (99999 != uRunIdx) {
+    std::vector<UInt_t> vuListRunId = {
+      946, 948, 949, 950, 951, 952, 707,            //  7 =>  0 -  6
+      744, 750, 759, 760, 761, 762, 799,            //  7 =>  7 - 13
+      811, 812, 816, 817, 819,                      //  5 => 14 - 18
+      820, 821, 822, 824, 826, 827, 828, 829,       //  8 => 19 - 26
+      830, 831, 836,                                //  3 => 27 - 29
+      841, 846, 849,                                //  3 => 30 - 32
+      850, 851, 852, 854, 855, 856, 857, 858, 859,  //  9 => 33 - 41
+      860, 861, 862, 863, 864, 865, 866             //  7 => 42 - 48
+                                                    /*
+ /// With runs < 1 min due to missmatch!
+             811, 812, 816, 817, 818, 819,                     //  6 => 14 - 19
+             820, 821, 822, 824, 826, 827, 828, 829,           //  8 => 20 - 27
+             830, 831, 836, 839,                               //  4 => 28 - 31
+             840, 841, 842, 844, 845, 846, 848, 849,           //  8 => 32 - 39
+             850, 851, 852, 854, 855, 856, 857, 858, 859,      //  9 => 40 - 48
+             860, 861, 862, 863, 864, 865, 866                 //  7 => 49 - 55
+*/
+    };
+    if (vuListRunId.size() <= uRunIdx) {
+      std::cout << "Run index is out of range, not doing anything" << std::endl;
+      return kFALSE;
+    }
+    uRunId = vuListRunId[uRunIdx];
+  }  // if( 99999 != uRunIdx )
+
+  if (uRunId < 692 && 0 != uRunId) return kFALSE;
+
+  TString srcDir = gSystem->Getenv("VMCWORKDIR");
+
+  // --- Specify number of events to be produced.
+  // --- -1 means run until the end of the input file.
+  Int_t nEvents = -1;
+  // --- Specify output file name (this is just an example)
+  TString runId   = TString::Format("%03u", uRunId);
+  TString outFile = outDir + "/unp_mcbm_" + runId + ".root";
+  TString parFile = outDir + "/unp_mcbm_params_" + runId + ".root";
+
+  // --- Set log output levels
+  FairLogger::GetLogger();
+  gLogger->SetLogScreenLevel("INFO");
+  //gLogger->SetLogScreenLevel("DEBUG4");
+  gLogger->SetLogVerbosityLevel("MEDIUM");
+  //gLogger->SetLogVerbosityLevel("LOW");
+
+  // --- Define parameter files
+  TList* parFileList = new TList();
+  TString paramDir   = srcDir + "/macro/beamtime/mcbm2021/";
+
+  // --- Load the geometry setup ----
+  // This is currently only required by the TRD
+  std::string geoSetupTag = "mcbm_beam_2021_01";
+  CbmSetup* geoSetup      = CbmSetup::Instance();
+  geoSetup->LoadSetup(geoSetupTag.data());
+
+  TString paramFileSts       = paramDir + "mStsPar.par";
+  TObjString* parStsFileName = new TObjString(paramFileSts);
+  parFileList->Add(parStsFileName);
+
+  TString paramFileMuch       = paramDir + "mMuchPar.par";
+  TObjString* parMuchFileName = new TObjString(paramFileMuch);
+  parFileList->Add(parMuchFileName);
+
+  // ---- Trd ----
+  TString geoTagTrd = "";
+  bool isActiveTrd =
+    (geoSetup->GetGeoTag(ECbmModuleId::kTrd, geoTagTrd)) ? true : false;
+  if (!isActiveTrd) {
+    LOG(warning) << Form(
+      "TRD - parameter loading - Trd not found in CbmSetup(%s) -> parameters "
+      "can not be loaded correctly!",
+      geoSetupTag.data());
+  } else {
+    TString paramFilesTrd(
+      Form("%s/parameters/trd/trd_%s", srcDir.Data(), geoTagTrd.Data()));
+    std::vector<std::string> paramFilesVecTrd;
+    CbmTrdParManager::GetParFileExtensions(&paramFilesVecTrd);
+    for (auto parIt : paramFilesVecTrd) {
+      parFileList->Add(
+        new TObjString(Form("%s.%s.par", paramFilesTrd.Data(), parIt.data())));
+    }
+    // Add timeshift calibration, currently only available for run 831 others to come
+    if (uRunId == 831)
+      parFileList->Add(new TObjString(Form(
+        "%s/parameters/trd/mcbm2020_special/CbmMcbm2020TrdTshiftPar_run%d.par",
+        srcDir.Data(),
+        uRunId)));
+  }
+
+  TString paramFileTof = paramDir + "mTofPar.par";
+  if (uRunId >= 708 && uRunId < 754)
+    paramFileTof = paramDir + "mTofPar_2Stack.par";
+  else if (uRunId >= 754)
+    paramFileTof = paramDir + "mTofPar_3Stack.par";
+
+  TObjString* parTofFileName = new TObjString(paramFileTof);
+  parFileList->Add(parTofFileName);
+
+  TString paramFileRich = paramDir + "mRichPar.par";
+  if (uRunId > 698) paramFileRich = paramDir + "mRichPar_70.par";
+  TObjString* parRichFileName = new TObjString(paramFileRich);
+  parFileList->Add(parRichFileName);
+
+  TString paramFilePsd       = paramDir + "mPsdPar.par";
+  TObjString* parPsdFileName = new TObjString(paramFilePsd);
+  parFileList->Add(parPsdFileName);
+
+  // --- Set debug level
+  gDebug = 0;
+
+  std::cout << std::endl;
+  std::cout << ">>> unpack_tsa: output file is " << outFile << std::endl;
+
+  // ========================================================================
+  // ========================================================================
+  std::cout << std::endl;
+  std::cout << ">>> unpack_tsa: Initialising..." << std::endl;
+
+  CbmMcbm2018UnpackerTaskSts* unpacker_sts = new CbmMcbm2018UnpackerTaskSts();
+  CbmMcbm2018UnpackerTaskMuch* unpacker_much =
+    new CbmMcbm2018UnpackerTaskMuch();
+  CbmMcbm2018UnpackerTaskTrdR* unpacker_trdR =
+    new CbmMcbm2018UnpackerTaskTrdR();
+  CbmMcbm2018UnpackerTaskTof* unpacker_tof = new CbmMcbm2018UnpackerTaskTof();
+  CbmMcbm2018UnpackerTaskRich* unpacker_rich =
+    new CbmMcbm2018UnpackerTaskRich();
+  CbmMcbm2018UnpackerTaskPsd* unpacker_psd = new CbmMcbm2018UnpackerTaskPsd();
+
+  /*
+ * Do not generate plots by default
+  unpacker_sts ->SetMonitorMode();
+  unpacker_much->SetMonitorMode();
+  unpacker_trdR->SetMonitorMode(); // Assume histo server present, not like other unpackers
+  unpacker_tof ->SetMonitorMode();
+  unpacker_rich->SetMonitorMode();
+  unpacker_psd->SetMonitorMode();
+*/
+
+  unpacker_sts->SetIgnoreOverlapMs();
+  unpacker_much->SetIgnoreOverlapMs();
+  //  unpacker_trdR ->SetIgnoreOverlapMs(); /// Default is kTRUE
+  unpacker_tof->SetIgnoreOverlapMs();
+  unpacker_rich->SetIgnoreOverlapMs();
+  unpacker_psd->SetIgnoreOverlapMs();
+
+  /// Starting from first run on Tuesday 28/04/2020, STS uses bin sorter FW
+  if (692 <= uRunId) unpacker_sts->SetBinningFwFlag(kTRUE);
+  /// Starting from first run on Monday 04/05/2020, MUCH uses bin sorter FW
+  if (811 <= uRunId) unpacker_much->SetBinningFwFlag(kTRUE);
+
+  /// FIXME: Disable clang formatting for parameters tuning for now
+  /* clang-format off */
+  //  unpacker_sts ->SetAdcCut( 3 );
+  unpacker_sts ->MaskNoisyChannel(1,768 ,  true );
+  unpacker_sts ->MaskNoisyChannel(1,894 ,  true );
+  unpacker_sts ->MaskNoisyChannel(1,896 ,  true );
+
+  unpacker_sts ->MaskNoisyChannel(2,930 ,  true );
+  unpacker_sts ->MaskNoisyChannel(2,926 ,  true );
+  unpacker_sts ->MaskNoisyChannel(2,892 ,  true );
+
+  unpacker_sts ->MaskNoisyChannel(3,770 ,  true );
+
+  unpacker_tof->SetSeparateArrayT0();
+
+  // ------------------------------ //
+  // Enable Asic type for MUCH data.
+  // fFlag = 0 ==> Asic type 2.0 (20) ---> December 2018 and March 2019 Data
+  // fFlag = 1 ==> Asic type 2.1 (21) ---> December 2019 Data
+  // This is to correct the channel fliping problem in smx 2.1 chip
+  Int_t fFlag = 1;
+  unpacker_much->EnableAsicType(fFlag);
+  // ------------------------------ //
+
+  /// General System offsets (= offsets between sub-systems)
+  unpacker_sts->SetTimeOffsetNs(-936);   // Run 811-866
+  unpacker_much->SetTimeOffsetNs(-885);  // Run 811-866
+  unpacker_trdR->SetTimeOffsetNs(0);     // Run 811-866
+  unpacker_tof->SetTimeOffsetNs(30);     // Run 811-866
+  unpacker_rich->SetTimeOffsetNs(-310);  // Run 811-866
+  unpacker_psd->SetTimeOffsetNs(-225);   // Run 811-866
+// ----------- ASIC by ASIC STS ----------------
+  // the first 8 Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  0,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  1,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  2,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  3,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  4,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  5,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  6,       0.0  ); // Unused
+  unpacker_sts ->SetTimeOffsetNsAsic(  7,       0.0  ); // Unused
+  //
+  unpacker_sts ->SetTimeOffsetNsAsic(8,  -0.360078  );
+  unpacker_sts ->SetTimeOffsetNsAsic(9,  2.73976    );
+  unpacker_sts ->SetTimeOffsetNsAsic(10,  -0.507079  );
+  unpacker_sts ->SetTimeOffsetNsAsic(11,  1.74695    );
+  unpacker_sts ->SetTimeOffsetNsAsic(12,  -0.909864  );
+  unpacker_sts ->SetTimeOffsetNsAsic(13,  -0.255514  );
+  unpacker_sts ->SetTimeOffsetNsAsic(14,  1.44034    );
+  unpacker_sts ->SetTimeOffsetNsAsic(15,  2.64009    );
+  // this side: revert order 23->16
+  unpacker_sts ->SetTimeOffsetNsAsic(23,  -0.442762  );
+  unpacker_sts ->SetTimeOffsetNsAsic(22,  1.76543    );
+  unpacker_sts ->SetTimeOffsetNsAsic(21, -0.94728   );
+  unpacker_sts ->SetTimeOffsetNsAsic(20, -2.18516   );
+  unpacker_sts ->SetTimeOffsetNsAsic(19, -0.68254   );
+  unpacker_sts ->SetTimeOffsetNsAsic(18, -2.32241   );
+  unpacker_sts ->SetTimeOffsetNsAsic(17, -1.53483   );
+  unpacker_sts ->SetTimeOffsetNsAsic(16, -2.12455   );
+  //
+  unpacker_sts ->SetTimeOffsetNsAsic(24, -0.41084   );
+  unpacker_sts ->SetTimeOffsetNsAsic(25, 0.230455   );
+  unpacker_sts ->SetTimeOffsetNsAsic(26, -0.206921  );
+  unpacker_sts ->SetTimeOffsetNsAsic(27, 0.0913657  );
+  unpacker_sts ->SetTimeOffsetNsAsic(28, -0.17252   );
+  unpacker_sts ->SetTimeOffsetNsAsic(29, -0.32990   );
+  unpacker_sts ->SetTimeOffsetNsAsic(30, 1.43535    );
+  unpacker_sts ->SetTimeOffsetNsAsic(31, -0.155741  );
+  // this side: revert order 39->32
+  unpacker_sts ->SetTimeOffsetNsAsic(39, 1.53865    );
+  unpacker_sts ->SetTimeOffsetNsAsic(38, 3.6318     );
+  unpacker_sts ->SetTimeOffsetNsAsic(37, 1.3153     );
+  unpacker_sts ->SetTimeOffsetNsAsic(36, -1.90278   );
+  unpacker_sts ->SetTimeOffsetNsAsic(35, 2.00051    );
+  unpacker_sts ->SetTimeOffsetNsAsic(34, -2.85656   );
+  unpacker_sts ->SetTimeOffsetNsAsic(33, 1.28834    );
+  unpacker_sts ->SetTimeOffsetNsAsic(32, 0.657113   );
+
+  switch (uRunId) {
+    case 707: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1750 ); // Run 707
+      //unpacker_much->SetTimeOffsetNs( -1750 ); // Run 707
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 707, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 707, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 707, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 707, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 707, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 707, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 707, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 707, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 707, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 707, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 707, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 707, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 707, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 707, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 707, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 707, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 707, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 707, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 9590.0);  // Run 707, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 9590.0);  // Run 707, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 9630.0);  // Run 707, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 9590.0);  // Run 707, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 707, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 707, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 0.0);     // Run 707, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 0.0);     // Run 707, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 0.0);     // Run 707, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 707, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 707, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 707, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 707, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 707, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, 7170.0);  // Run 707, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, 7170.0);  // Run 707, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 707, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 707, DPB 5 ASIC 5
+      break;
+    }  // 707
+    case 750: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1750 ); // Run 750
+      //unpacker_much->SetTimeOffsetNs( -1750 ); // Run 750
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 750, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 750, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 750, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 750, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 750, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 750, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 750, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 750, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 750, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 750, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 750, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 750, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 750, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 750, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 750, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 750, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 750, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 750, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 6400.0);  // Run 750, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 6400.0);  // Run 750, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 6400.0);  // Run 750, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 6400.0);  // Run 750, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 750, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 750, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 0.0);     // Run 750, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 0.0);     // Run 750, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 0.0);     // Run 750, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 750, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 750, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 750, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 750, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 750, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, 3170.0);  // Run 750, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, 3170.0);  // Run 750, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 750, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 750, DPB 5 ASIC 5
+      break;
+    }  // 750
+    case 759: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1759 ); // Run 759
+      //unpacker_much->SetTimeOffsetNs( -1759 ); // Run 759
+      unpacker_trdR->SetTimeOffsetNs(190);  // Run 759
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 759, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 759, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 759, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 759, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 759, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 759, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 759, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 759, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 759, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 759, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 759, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 759, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 759, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 759, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 759, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 759, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 759, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 759, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 3200.0);  // Run 759, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 3200.0);  // Run 759, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 3200.0);  // Run 759, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 3200.0);  // Run 759, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 759, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 759, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 3200.0);  // Run 759, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 3200.0);  // Run 759, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 3200.0);  // Run 759, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 759, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 759, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 759, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 759, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 759, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, -30.0);   // Run 759, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, -30.0);   // Run 759, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 759, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 759, DPB 5 ASIC 5
+      break;
+    }  // 759
+    case 760: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1760 ); // Run 760
+      //unpacker_much->SetTimeOffsetNs( -1760 ); // Run 760
+      unpacker_trdR->SetTimeOffsetNs(-75);  // Run 760
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 760, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 760, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 760, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 760, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 760, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 760, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 760, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 760, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 760, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 760, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 760, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 760, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 760, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 760, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 760, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 760, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 760, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 760, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 0.0);     // Run 760, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 0.0);     // Run 760, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 0.0);     // Run 760, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 0.0);     // Run 760, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 760, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 760, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 3160.0);  // Run 760, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 3160.0);  // Run 760, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 3160.0);  // Run 760, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 760, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 760, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 760, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 760, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 760, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, -30.0);   // Run 760, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, -30.0);   // Run 760, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 760, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 760, DPB 5 ASIC 5
+      break;
+    }  // 760
+    case 761: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1761 ); // Run 761
+      //unpacker_much->SetTimeOffsetNs( -1761 ); // Run 761
+      unpacker_trdR->SetTimeOffsetNs(90);  // Run 761
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 761, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 761, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 761, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 761, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 761, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 761, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 761, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 761, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 761, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 761, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 761, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 761, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 761, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 761, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 761, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 761, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 761, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 761, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 3200.0);  // Run 761, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 3200.0);  // Run 761, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 3200.0);  // Run 761, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 3200.0);  // Run 761, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 761, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 761, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 6360.0);  // Run 761, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 6360.0);  // Run 761, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 6360.0);  // Run 761, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 761, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 761, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 761, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 761, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 761, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, 6360.0);  // Run 761, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, 6360.0);  // Run 761, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 761, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 761, DPB 5 ASIC 5
+      break;
+    }  // 761
+    case 762: {
+      /// General System offsets (= offsets between sub-systems)
+      //unpacker_sts ->SetTimeOffsetNs( -1762 ); // Run 762
+      //unpacker_much->SetTimeOffsetNs( -1762 ); // Run 762
+      unpacker_trdR->SetTimeOffsetNs(60);  // Run 762
+
+      /// ASIC specific offsets (= offsets inside sub-system)
+      unpacker_much->SetTimeOffsetNsAsic(0, 0.0);      // Run 762, DPB 0 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(1, 0.0);      // Run 762, DPB 0 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(2, 0.0);      // Run 762, DPB 0 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(3, 0.0);      // Run 762, DPB 0 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(4, 0.0);      // Run 762, DPB 0 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(5, 0.0);      // Run 762, DPB 0 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(6, 0.0);      // Run 762, DPB 1 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(7, 0.0);      // Run 762, DPB 1 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(8, 0.0);      // Run 762, DPB 1 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(9, 0.0);      // Run 762, DPB 1 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(10, 0.0);     // Run 762, DPB 1 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(11, 0.0);     // Run 762, DPB 1 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(12, 0.0);     // Run 762, DPB 2 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(13, 0.0);     // Run 762, DPB 2 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(14, 0.0);     // Run 762, DPB 2 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(15, 0.0);     // Run 762, DPB 2 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(16, 0.0);     // Run 762, DPB 2 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(17, 0.0);     // Run 762, DPB 2 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(18, 4800.0);  // Run 762, DPB 3 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(19, 4800.0);  // Run 762, DPB 3 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(20, 4800.0);  // Run 762, DPB 3 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(21, 4800.0);  // Run 762, DPB 3 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(22, 0.0);     // Run 762, DPB 3 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(23, 0.0);     // Run 762, DPB 3 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(24, 9550.0);  // Run 762, DPB 4 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(25, 9550.0);  // Run 762, DPB 4 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(26, 9550.0);  // Run 762, DPB 4 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(27, 0.0);     // Run 762, DPB 4 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(28, 0.0);     // Run 762, DPB 4 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(29, 0.0);     // Run 762, DPB 4 ASIC 5
+      unpacker_much->SetTimeOffsetNsAsic(30, 0.0);     // Run 762, DPB 5 ASIC 0
+      unpacker_much->SetTimeOffsetNsAsic(31, 0.0);     // Run 762, DPB 5 ASIC 1
+      unpacker_much->SetTimeOffsetNsAsic(32, -30.0);   // Run 762, DPB 5 ASIC 2
+      unpacker_much->SetTimeOffsetNsAsic(33, -30.0);   // Run 762, DPB 5 ASIC 3
+      unpacker_much->SetTimeOffsetNsAsic(34, 0.0);     // Run 762, DPB 5 ASIC 4
+      unpacker_much->SetTimeOffsetNsAsic(35, 0.0);     // Run 762, DPB 5 ASIC 5
+      break;
+    }  // 762
+    case 811: {
+      unpacker_trdR->SetTimeOffsetNs(84.38);
+      break;
+    }  // 811
+    case 812: {
+      unpacker_trdR->SetTimeOffsetNs(165.62);
+      break;
+    }  // 812
+    case 816: {
+      unpacker_trdR->SetTimeOffsetNs(-9.38);
+      break;
+    }  // 816
+    case 819: {
+      unpacker_trdR->SetTimeOffsetNs(-140.62);
+      break;
+    }  // 819
+    case 820: {
+      unpacker_trdR->SetTimeOffsetNs(109.38);
+      break;
+    }  // 820
+    case 821: {
+      unpacker_trdR->SetTimeOffsetNs(-65.62);
+      break;
+    }  // 821
+    case 822: {
+      unpacker_trdR->SetTimeOffsetNs(59.38);
+      break;
+    }  // 822
+    case 824: {
+      unpacker_trdR->SetTimeOffsetNs(-165.62);
+      break;
+    }  // 824
+    case 826: {
+      unpacker_trdR->SetTimeOffsetNs(59.38);
+      break;
+    }  // 826
+    case 827: {
+      unpacker_trdR->SetTimeOffsetNs(-15.62);
+      break;
+    }  // 827
+    case 828: {
+      unpacker_trdR->SetTimeOffsetNs(-109.38);
+      break;
+    }  // 828
+    case 830: {
+      unpacker_trdR->SetTimeOffsetNs(15.62);
+      break;
+    }  // 830
+    case 831: {
+      //         unpacker_trdR->SetTimeOffsetNs(   70.00 );
+      unpacker_trdR->SetTimeOffsetNs(-25.00);
+
+      std::cout << "MUCH: Feb by feb time offset correction......" << std::endl;
+      UInt_t uRun, uNx;
+      Double_t offset;
+      ifstream infile_off(paramDir + "/parameters/time_offset_much.txt");
+      if (!infile_off) {
+        std::cout << "can not open time offset MUCH parameter List" << std::endl;
+        return kFALSE;
+      } // if (!infile_off)
+      while (!infile_off.eof())  {
+        infile_off >> uRun >> uNx >> offset;
+        if(uRun != 831) continue;
+        unpacker_much->SetTimeOffsetNsAsic(uNx, offset);
+      } // while (!infile_off.eof())
+      infile_off.close();
+      std::cout << "masking noisy channels......" << std::endl;
+      UInt_t uChan = 0;
+      ifstream infile_noise(paramDir + "parameters/much_noisy_channel_list.txt");
+      if (!infile_noise) {
+        std::cout << "can not open MUCH noisy channel List" << std::endl;
+        return kFALSE;
+      } // if (!infile_noise)
+      while (!infile_noise.eof())  {
+        infile_noise >> uRun >> uNx >> uChan;
+        if(uRun != 831) continue;
+        unpacker_much->MaskNoisyChannel(uNx, uChan, kTRUE );
+      } // while (!infile_noise.eof())
+      infile_noise.close();
+      break;
+    }  // 831
+    case 836: {
+      unpacker_trdR->SetTimeOffsetNs(-40.62);
+      break;
+    }  // 836
+    default: break;
+  }  // switch( uRunId )
+  /// FIXME: Re-enable clang formatting after parameters tuning
+  /* clang-format on */
+  // --- Source task
+  CbmMcbm2018Source* source = new CbmMcbm2018Source();
+  source->SetWriteOutputFlag(kTRUE);  // For writing TS metadata
+
+  TString inFile =
+    Form("/lustre/cbm/users/ploizeau/mcbm2021/data/%3u_node8_*.tsa;", uRunId);
+  inFile +=
+    Form("/lustre/cbm/users/ploizeau/mcbm2021/data/%3u_node9_*.tsa;", uRunId);
+  source->SetFileName(inFile);
+
+  source->AddUnpacker(unpacker_sts, 0x10, ECbmModuleId::kSts);    // STS xyter
+  source->AddUnpacker(unpacker_much, 0x50, ECbmModuleId::kMuch);  // MUCH xyter
+  if (isActiveTrd)
+    source->AddUnpacker(unpacker_trdR, 0x40, ECbmModuleId::kTrd);  // Trd
+  source->AddUnpacker(unpacker_tof, 0x60, ECbmModuleId::kTof);     // gDPB TOF
+  source->AddUnpacker(unpacker_tof, 0x90, ECbmModuleId::kTof);     // gDPB T0
+  source->AddUnpacker(unpacker_rich, 0x30, ECbmModuleId::kRich);   // RICH trb
+  source->AddUnpacker(unpacker_psd, 0x80, ECbmModuleId::kPsd);     // PSD
+
+  // --- Event header
+  FairEventHeader* event = new FairEventHeader();
+  event->SetRunId(uRunId);
+
+  // --- RootFileSink
+  // --- Open next outputfile after 4GB
+  FairRootFileSink* sink = new FairRootFileSink(outFile);
+  //  sink->GetOutTree()->SetMaxTreeSize(4294967295LL);
+
+  // --- Run
+  run = new FairRunOnline(source);
+  run->SetSink(sink);
+  run->SetEventHeader(event);
+  run->SetAutoFinish(kFALSE);
+
+
+  // -----   Runtime database   ---------------------------------------------
+  FairRuntimeDb* rtdb       = run->GetRuntimeDb();
+  Bool_t kParameterMerged   = kTRUE;
+  FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged);
+  FairParAsciiFileIo* parIn = new FairParAsciiFileIo();
+  parOut->open(parFile.Data());
+  parIn->open(parFileList, "in");
+  rtdb->setFirstInput(parIn);
+  rtdb->setOutput(parOut);
+
+  run->Init();
+
+  // --- Start run
+  TStopwatch timer;
+  timer.Start();
+  std::cout << ">>> unpack_tsa_mcbm: Starting run..." << std::endl;
+  if (0 == nrEvents) {
+    run->Run(nEvents, 0);  // run until end of input file
+  } else {
+    run->Run(0, nrEvents);  // process  N Events
+  }
+  run->Finish();
+
+  timer.Stop();
+
+  std::cout << "Processed " << std::dec << source->GetTsCount() << " timeslices"
+            << std::endl;
+
+  // --- End-of-run info
+  Double_t rtime = timer.RealTime();
+  Double_t ctime = timer.CpuTime();
+  std::cout << std::endl << std::endl;
+  std::cout << ">>> unpack_tsa_mcbm: Macro finished successfully." << std::endl;
+  std::cout << ">>> unpack_tsa_mcbm: Output file is " << outFile << std::endl;
+  std::cout << ">>> unpack_tsa_mcbm: Real time " << rtime << " s, CPU time "
+            << ctime << " s" << std::endl;
+  std::cout << std::endl;
+
+  /// --- Screen output for automatic tests
+  std::cout << " Test passed" << std::endl;
+  std::cout << " All ok " << std::endl;
+}