From 618e6fc631488818854c4afe809bbe3b6cdc2ece Mon Sep 17 00:00:00 2001
From: Adrian Weber <adrian.a.weber@physik.uni-giessen.de>
Date: Mon, 7 Feb 2022 12:28:51 +0100
Subject: [PATCH] add check of data format version.

---
 reco/detectors/rich/unpack/CbmRichUnpackAlgo2022.cxx | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/reco/detectors/rich/unpack/CbmRichUnpackAlgo2022.cxx b/reco/detectors/rich/unpack/CbmRichUnpackAlgo2022.cxx
index 177f14b730..ca4e143092 100644
--- a/reco/detectors/rich/unpack/CbmRichUnpackAlgo2022.cxx
+++ b/reco/detectors/rich/unpack/CbmRichUnpackAlgo2022.cxx
@@ -25,6 +25,12 @@ bool CbmRichUnpackAlgo2022::unpack(const fles::Timeslice* ts, std::uint16_t icom
   const fles::MicrosliceView mv            = ts->get_microslice(icomp, imslice);
   const fles::MicrosliceDescriptor& msDesc = mv.desc();
 
+  // Check the version number of the MS to identify wrong unpacker for data
+  if (msDesc.sys_ver != 0x3) {
+    LOG(fatal) << "CbmRichUnpackAlgo2022: System Version of the microslice is not compatible with this unpacker!";
+    return false;
+  }
+
   // Clear CbmTime of MS. Used to get time offset of subtriggers to MS start
   fCbmTimeMS = 0;
 
-- 
GitLab