diff --git a/benchmarks/rich/src/RawHitAnalysis.cc b/benchmarks/rich/src/RawHitAnalysis.cc
index d55ac99d7819489c6a408e537e15d2ca7455cd5f..36419835884fdb2b90c96cbfa3098676d0c13fd7 100644
--- a/benchmarks/rich/src/RawHitAnalysis.cc
+++ b/benchmarks/rich/src/RawHitAnalysis.cc
@@ -2,6 +2,7 @@
 // Subject to the terms in the LICENSE file found in the top-level directory.
 
 #include "RawHitAnalysis.h"
+#include <edm4eic/EDM4eicVersion.h>
 
 namespace benchmarks {
 
@@ -65,11 +66,18 @@ namespace benchmarks {
 
     // loop over hits with associations (no noise)
     for(const auto& assoc : assocs) {
-      for(const auto& hit : assoc.getSimHits()) {
-        auto wavelength = Tools::GetPhotonWavelength(hit, m_log);
-        if(wavelength>=0)
-          m_phot_spectrum->Fill(wavelength);
-      }
+#if EDM4EIC_VERSION_MAJOR >= 6
+      auto hit = assoc.getSimHit();
+#else
+    for(const auto& hit : assoc.getSimHits()) {
+#endif
+      auto wavelength = Tools::GetPhotonWavelength(hit, m_log);
+      if(wavelength>=0)
+        m_phot_spectrum->Fill(wavelength);
+#if EDM4EIC_VERSION_MAJOR >= 6
+#else
+    }
+#endif
     }
   }