diff --git a/macro/geometry/.rootrc b/macro/geometry/.rootrc
new file mode 120000
index 0000000000000000000000000000000000000000..275b3f3ab86a0b4657269d077d25f525c2436aa4
--- /dev/null
+++ b/macro/geometry/.rootrc
@@ -0,0 +1 @@
+../include/.rootrc
\ No newline at end of file
diff --git a/macro/geometry/check_radlen.sh b/macro/geometry/check_radlen.sh
old mode 100644
new mode 100755
index 3c7fbd195419396afe5fc57f9a61aca3b268ace5..003ac609503ee3b0beffde31495c5f5ffc48f00f
--- a/macro/geometry/check_radlen.sh
+++ b/macro/geometry/check_radlen.sh
@@ -4,7 +4,13 @@
 
 echo "Scanning the geometry" $1
 
-root -l -q '$VMCWORKDIR/macro/geometry/scan_geometry.C("'$1'")' 1>tmp
+root -l -b -q '$VMCWORKDIR/macro/geometry/scan_geometry.C("'$1'")' 1>tmp
+ROOT_EXIT=$?;
+
+if [ 0 -ne $ROOT_EXIT ]; then
+  echo "root command failed, nothing more done";
+  exit ${ROOT_EXIT};
+fi;
 
 grep '^M\(at\|ix\)' tmp | \
 sort | \
@@ -17,8 +23,8 @@ SKIP=0;
 OKAY=0;
 
 
-while IFS= read -r line; 
-do 
+while IFS= read -r line;
+do
 
 variables=`echo "$line" | sed -e 's/eff//g' | sed -e 's/index/jndex/g' | sed -e 's/.*A=/ A=/g' | sed -e 's/ / -v /g'`
 
@@ -26,13 +32,14 @@ variables=`echo "$line" | sed -e 's/eff//g' | sed -e 's/index/jndex/g' | sed -e
     -v TOL=0.1 \
     $variables \
     'BEGIN{\
-        if(Z==0){
+        if(Z<1){
         printf "SKIP"; \
         exit 3;
         };
         cal_rad_len=(716.4*A/(Z*(Z+1)*log(287/sqrt(Z)))/rho);\
         #print cal_rad_len;
-        if(((cal_rad_len - radlen)/radlen)**2  <= TOL**2 ){\
+        diff=(cal_rad_len - radlen);\
+        if(diff*diff <= TOL*TOL*radlen*radlen ){\
         printf "OKAY"; exit 1;
         }else{\
         printf "FAIL"; exit 2;
@@ -45,8 +52,8 @@ variables=`echo "$line" | sed -e 's/eff//g' | sed -e 's/index/jndex/g' | sed -e
     if [ $STATUS -eq 3 ]; then SKIP=$((SKIP+1)); fi;
 
     COUNT=$((COUNT+1));
-    
-    echo " \t $line"
+
+    echo -e " \t $line"
 
 done < MATERIALS
 
diff --git a/macro/geometry/scan_geometry.C b/macro/geometry/scan_geometry.C
index 2cac6365cf2d3c157e318f5e75e9337bd8726b3d..d6a23b63f9b92f0894507515aa6322cad897d45b 100644
--- a/macro/geometry/scan_geometry.C
+++ b/macro/geometry/scan_geometry.C
@@ -10,81 +10,72 @@
 
 #include "TCanvas.h"
 #include "TStopwatch.h"
-#endif
+#endif  // !defined(__CLING__)
 
 #include <cstdlib>
 #include <fstream>
 #include <iostream>
 
-#define NODE_DEPTH 25
-
-TGeoNode* node[NODE_DEPTH];
-TGeoMedium* med;
-
-TGeoManager* gman;
-TGeoVolume* top;
-
-//const char* seekstr1 = "cable";
-const char* seekstr2 = "cable";
-
-void scan_geometry(const char* fileName = "test.geo.root")
+void scan_geometry(std::string fileName = "test.geo.root", uint32_t uMaxNodeDepth = 25)
 {
-
   TString myName = "scan_and_graph";
 
-  TFile file(fileName, "READ");
+  std::vector<TGeoNode*> node(uMaxNodeDepth, nullptr);
+  TGeoMedium* med = nullptr;
+  TGeoVolume* top = nullptr;
+
+  TFile file(fileName.c_str(), "READ");
   if (!file.IsOpen()) {
-    std::cerr << "Was a root geo file supplied?" << endl;
+    std::cerr << "Was a root geo file supplied?" << std::endl;
     exit(1);
   };
+  gROOT->cd();
 
   file.GetListOfKeys()->Print();
   file.GetSize();
 
-  char geo_tag[100];
-  strcpy(geo_tag, basename(fileName));
-  char* ptr = strstr(geo_tag, ".geo.root");
-  *(ptr)    = '\0';
+  std::string geo_tag = fileName.substr(fileName.find_last_of('/') + 1);
+  geo_tag             = geo_tag.substr(0, geo_tag.find_first_of('.'));
+  std::cout << "geo tag extracted from file name is: " << geo_tag << std::endl;
+  file.GetObject("FAIRGeom", gGeoManager);
+
+  if (gGeoManager != nullptr) { top = gGeoManager->GetTopVolume(); };
+  gROOT->cd();
 
-  gman = (TGeoManager*) file.Get("FAIRGeom");
-  if (gman != NULL) { top = gman->GetTopVolume(); };
+  if (top == nullptr) file.GetObject(geo_tag.c_str(), top);
+  if (top == nullptr) file.GetObject("FAIRGeom", top);
+  if (top == nullptr) file.GetObject("top", top);
+  if (top == nullptr) file.GetObject("TOP", top);
+  if (top == nullptr) file.GetObject("Top", top);
+  if (top == nullptr) file.GetObject("geometryFromGDML", top);
 
-  if (top == NULL) top = (TGeoVolume*) file.Get(geo_tag);
-  if (top == NULL) top = (TGeoVolume*) file.Get("FAIRGeom");
-  if (top == NULL) top = (TGeoVolume*) file.Get("top");
-  if (top == NULL) top = (TGeoVolume*) file.Get("TOP");
-  if (top == NULL) top = (TGeoVolume*) file.Get("Top");
-  if (top == NULL) top = (TGeoVolume*) file.Get("geometryFromGDML");
+  gROOT->cd();
 
-  if (top == NULL) {
-    std::cerr << "No Top Volume found. Is the TGeoManager or Top Volume unusally named" << endl;
+  if (top == nullptr) {
+    std::cerr << "No Top Volume found. Is the TGeoManager or Top Volume unusally named" << std::endl;
     exit(1);
   }
 
-  FILE* graph = fopen("geo.gv", "w+");
-  fprintf(graph, "digraph D {\n");
-
   TObjArray* nodes = top->GetNodes();
+  if (nodes == nullptr) {
+    std::cerr << "Could not get the Nodes." << std::endl;
+    exit(1);
+  }
   nodes->Print();
+  gROOT->cd();
 
-  int i_array[NODE_DEPTH], num_array[NODE_DEPTH], j;
-  for (int i = 0; i < NODE_DEPTH; i++)
-    i_array[i] = 0;
-  for (int i = 0; i < NODE_DEPTH; i++)
-    num_array[i] = 0;
-
-  //TGeoNode* node[NODE_DEPTH];
-  //TGeoMedium* med;
-
-  j            = 0;
-  i_array[0]   = 0;
+  std::vector<int32_t> i_array(uMaxNodeDepth, 0);
+  std::vector<int32_t> num_array(uMaxNodeDepth + 2, 0);
+  int32_t j    = 0;
   num_array[0] = nodes->GetEntries();
 
   std::cout << "\n" << endl;
 
+  FILE* graph = fopen("geo.gv", "w+");
+  fprintf(graph, "digraph D {\n");
 
   int k = 0;
-  while (num_array[0] != 0) {
+  while (num_array[0] != 0 && 0 <= j) {
 
     k++;  // Only used for stop.
           //if(k==3)break;
@@ -96,7 +87,7 @@ void scan_geometry(const char* fileName = "test.geo.root")
 
     i_array[j]++;  // Update number.
     std::cout << "Node: \t";
-    for (int i = 0; i < j + 1; i++)
+    for (int i = 0; i < j + 1 && i < uMaxNodeDepth; i++)
       printf("%d/%d \t", i_array[i], num_array[i]);
     printf("\n");
 
@@ -118,27 +109,32 @@ void scan_geometry(const char* fileName = "test.geo.root")
     std::cout << "Number of daughters: " << num_array[j + 1];
     std::cout << endl << endl << endl;
 
-    if (num_array[j + 1] > 0) {
+    if (j + 1 < uMaxNodeDepth && num_array[j + 1] > 0) {
       j++;
       num_array[j + 2] = 0;
     };
 
-    while (i_array[j] == num_array[j]) {
+    while (0 <= j && i_array[j] == num_array[j]) {
       num_array[j] = 0;
       i_array[j]   = 0;  // Reset the counter before falling back.
       j--;
     };
 
-    if (j >= NODE_DEPTH) {
-      std::cerr << "Maximum depth of " << NODE_DEPTH << " exceeded. Increase NODE_DEPTH in header of macro," << endl;
-      exit(NODE_DEPTH);
+    if (0 <= j && j >= uMaxNodeDepth) {
+      std::cerr << "Maximum depth of " << uMaxNodeDepth << " exceeded (" << j
+                << "). Increase uMaxNodeDepth which is the second parameter of the macro" << std::endl;
+      exit(uMaxNodeDepth);
     };
   };
 
   fprintf(graph, "}\n");
   fclose(graph);
 
+  gROOT->cd();
+  file.Close();
+
+  RemoveGeoManager();
 
   printf("Processed %d nodes.\n", k);
-  std::cout << "Program Ends" << endl;
+  std::cout << "Program Ends" << std::endl;
 }  // End of macro
diff --git a/macro/mcbm/CMakeLists.txt b/macro/mcbm/CMakeLists.txt
index 8207fc647d3cb8e9e609d1c2a95ce1a4250056f4..313fbf7a8db63be136ce2b9a8ae2a0826a04100a 100644
--- a/macro/mcbm/CMakeLists.txt
+++ b/macro/mcbm/CMakeLists.txt
@@ -11,6 +11,10 @@ GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/mcbm/mcbm_qa.C)
 Set(MACRO_DIR ${CMAKE_CURRENT_BINARY_DIR})
 GENERATE_CBM_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/geometry/check_media.C ${MACRO_DIR})
 
+GENERATE_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/geometry/check_radlen.sh ${MACRO_DIR})
+
+# ============================================================================
+
 # disable dev tests - GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/mcbm/mcbm_mc_dev.C)
 # disable dev tests - GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/mcbm/mcbm_reco_dev.C)
 
@@ -141,13 +145,23 @@ ForEach(setup IN LISTS cbm_setup)
           FIXTURES_SETUP ${fixture_mcbm_overlap}
   )
 
+  # --- Test check_radlen.sh
+  set(testname mcbm_radlen_${setup})
+  add_test(${testname} ${MACRO_DIR}/check_radlen.sh data/${setup}_test.geo.root )
+  Set(fixture_mcbm_radlen fixture_radlen_${setup})
+  set_tests_properties(${testname} PROPERTIES
+        TIMEOUT 100
+        FIXTURES_REQUIRED ${fixture_mcbm_overlap}
+        FIXTURES_SETUP ${fixture_mcbm_radlen}
+  )
+
   If(NOT ${CBM_TEST_MODEL} MATCHES Experimental)
     Set(testname mcbm_check_media_${setup})
     Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/mcbm/check_media.sh \"data/${setup}_test\")
     Set_Tests_Properties(${testname} PROPERTIES
             TIMEOUT "60"
             PASS_REGULAR_EXPRESSION "Test Passed;All ok"
-            FIXTURES_REQUIRED ${fixture_mcbm_overlap}
+            FIXTURES_REQUIRED ${fixture_mcbm_radlen}
     )
   EndIf()
 
diff --git a/macro/run/CMakeLists.txt b/macro/run/CMakeLists.txt
index aa64e1b4c5731bd8f760c99c094db7e3bab6de2a..fb485d1f53ff793dc1a28aceb2fd0c2b5ce05f60 100644
--- a/macro/run/CMakeLists.txt
+++ b/macro/run/CMakeLists.txt
@@ -6,6 +6,9 @@ GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_tra_beam.C)
 GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_digi.C)
 GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_reco.C)
 GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_qa.C)
+
+Set(MACRO_DIR ${CMAKE_CURRENT_BINARY_DIR})
+GENERATE_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/geometry/check_radlen.sh ${MACRO_DIR})
 # ============================================================================
 
 
@@ -173,6 +176,18 @@ foreach(setup IN LISTS cbm_setup)
  	RESOURCE_LOCK collParDb_${setup}
   )
 
+  # --- Test check_radlen.sh
+  # --- Transport run with collision events, using run_tra_file.C
+  set(testname check_${sname}_radlen)
+  add_test(${testname} ${MACRO_DIR}/check_radlen.sh
+        data/${sname}_coll.geo.root )
+  set_tests_properties(${testname} PROPERTIES
+        TIMEOUT ${timeOutTime}
+        FIXTURES_REQUIRED "fixt_digi_ev_${setup};fixt_digi_ts_${setup}"
+        # FIXTURES_SETUP fixt_tra_coll_${setup}
+        RESOURCE_LOCK collParDb_${setup}
+  )
+
   # --- Test run_reco_ev_ideal
   # --- Event-by-event reconstruction from event-based simulation
   # --- Ideal raw event builder