diff --git a/macro/rich/geotest/run_one.py b/macro/rich/geotest/run_one.py
index 143ee7bb80ac6c1df0c5e6475580a7da5d798400..d82951383448502f038b64bac4983b82aa7092a2 100755
--- a/macro/rich/geotest/run_one.py
+++ b/macro/rich/geotest/run_one.py
@@ -16,9 +16,12 @@ def main():
   resultDir = "results_" + runId + "_"+ energy +"/" 
   
   #runId = "0"
-  geoSetup = "sis100_electron"
-  nEvents = 1000
-  testType = "urqmdTest" # urqmdTest or geoTest
+  geoSetup = "sis100_electron_APR21"
+  nEvents = 10
+  testType = "geoTest" # urqmdTest or geoTest
+
+  if testType == "geoTest":
+    urqmdFile = ""
 
   traFile = dataDir + "/tra." + runId + ".root"  
   parFile = dataDir + "/param." + runId + ".root"
@@ -32,9 +35,9 @@ def main():
   recoCmd = ('root -l -b -q run_reco.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(testType, traFile, parFile, digiFile, recoFile, geoSetup, nEvents)
   qaCmd = ('root -l -b -q run_qa.C\(\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",\\"{}\\",{}\)').format(testType, traFile, parFile, digiFile, recoFile, qaFile, geoSetup, resultDir, nEvents)
 
-  # os.system((". /{} -a; {}").format(cbmrootConfigPath, traCmd))
-  # os.system((". /{} -a; {}").format(cbmrootConfigPath, digiCmd))
-  # os.system((". /{} -a; {}").format(cbmrootConfigPath, recoCmd))
+  os.system((". /{} -a; {}").format(cbmrootConfigPath, traCmd))
+  os.system((". /{} -a; {}").format(cbmrootConfigPath, digiCmd))
+  os.system((". /{} -a; {}").format(cbmrootConfigPath, recoCmd))
   os.system((". /{} -a; {}").format(cbmrootConfigPath, qaCmd))
 
 # def make_args():
diff --git a/reco/detectors/rich/CbmRichReconstruction.cxx b/reco/detectors/rich/CbmRichReconstruction.cxx
index 6881b558e7bee7f22b57f552fe33e4b116637380..d13ed49aa18cc19d8f696ab3a1061e80ac2a3db8 100644
--- a/reco/detectors/rich/CbmRichReconstruction.cxx
+++ b/reco/detectors/rich/CbmRichReconstruction.cxx
@@ -30,6 +30,7 @@
 #include "CbmEvent.h"
 #include "CbmGlobalTrack.h"
 #include "CbmRichConverter.h"
+#include "CbmRichGeoManager.h"
 #include "CbmRichRingFitterCOP.h"
 #include "CbmRichRingFitterCircle.h"
 #include "CbmRichRingFitterEllipseMinuit.h"
@@ -92,6 +93,17 @@ InitStatus CbmRichReconstruction::Init()
   fRichRings = new TClonesArray("CbmRichRing", 100);
   manager->Register("RichRing", "RICH", fRichRings, IsOutputBranchPersistent("RichRing"));
 
+  // This was checked for v17a, v21a geometries. The offset was chosen that
+  // the value for v17a is 260 cm and the value for v21a is 220 cm
+  double offset        = 205.7331;
+  fZTrackExtrapolation = CbmRichGeoManager::GetInstance().fGP->fMirrorZ + offset;
+  LOG(info) << "CbmRichReconstruction::Init() fZTrackExtrapolation = " << fZTrackExtrapolation;
+  if (fZTrackExtrapolation < 200. || fZTrackExtrapolation > 300.) {
+    LOG(fatal) << "CbmRichReconstruction::Init() fZTrackExtrapolation = " << fZTrackExtrapolation
+               << " The value of fZTrackExtrapolation is not correct. It must be in the range [200, 300] cm."
+               << " Probably the RICH geometry is not correct or it is not supported.";
+  }
+
   if (fRunExtrapolation) InitExtrapolation();
   if (fRunProjection) InitProjection();
   if (fRunFinder) InitFinder();
diff --git a/reco/detectors/rich/CbmRichReconstruction.h b/reco/detectors/rich/CbmRichReconstruction.h
index 2882828821761983237eef6fc99754ffc2009753..d2b6626b7a4b99c2e7a28843018d047e1ccfe074 100644
--- a/reco/detectors/rich/CbmRichReconstruction.h
+++ b/reco/detectors/rich/CbmRichReconstruction.h
@@ -133,7 +133,8 @@ private:
   string fTrackAssignName   = "closest_distance";
 
   // Z coordinate where STS tracks will be extrapolated.
-  Double_t fZTrackExtrapolation = 260.;
+  // Initialized later using geometry.
+  Double_t fZTrackExtrapolation = -1;  //260.
 
   /**
     * \brief