From 1b28728c09ef9a96bb67268a9cd68bf0cf01d0cc Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Thu, 29 Oct 2020 12:32:17 +0100 Subject: [PATCH] Convert old to new tof adressing scheme Add code which automatically converts the old tof address scheme to the new one for the the CbmTofDigi data class. Since for some of the varibales less bits than before are available a check was added which catches such cases and stop the execution with an error message in such cases. This is unfortunately not yet possible for CbmTofPoint and CbmTofHit. For both data classes the address is a member of the base class and it was not possible to change the value of the base class member in the same way. When reading any old versions of both classes the macro execution is stopped immediately with an error message. --- core/data/DataLinkDef.h | 48 +++++++++++++++++++++++++++++++++++++ core/data/tof/CbmTofDigi.h | 2 +- core/data/tof/CbmTofHit.h | 2 +- core/data/tof/CbmTofPoint.h | 2 +- 4 files changed, 51 insertions(+), 3 deletions(-) diff --git a/core/data/DataLinkDef.h b/core/data/DataLinkDef.h index f7d571708f..bb8f3bc87f 100644 --- a/core/data/DataLinkDef.h +++ b/core/data/DataLinkDef.h @@ -119,4 +119,52 @@ #pragma link C++ class CbmDigiVector < CbmPsdDigi> + ; #pragma link C++ class vector < CbmEventStore> + ; +#pragma read sourceClass="CbmTofDigi" version="[1-2]" targetClass="CbmTofDigi" \ + source="UInt_t fuAddress" target="fuAddress" \ + include="Logger.h" \ + code="{ UInt_t system = (onfile.fuAddress >> 0) & ((1 << 4) - 1); \ + UInt_t smId = (onfile.fuAddress >> 4) & ((1 << 8) - 1); \ + UInt_t smType = (onfile.fuAddress >> 12) & ((1 << 4) - 1); \ + UInt_t rpcId = (onfile.fuAddress >> 16) & ((1 << 7) - 1); \ + UInt_t chSide = (onfile.fuAddress >> 23) & ((1 << 1) - 1); \ + UInt_t chId = (onfile.fuAddress >> 24) & ((1 << 8) - 1); \ + if ( smId > 127 || rpcId > 63 || chId > 63 ) { \ + LOG(error) << \"You are trying to read an outdated version of CbmTofDigi\"; \ + LOG(error) << \"where the unique tof address can't be converted\"; \ + LOG(error) << \"automatically to the new tof addressing scheme.\"; \ + LOG(fatal) << \"Stop execution.\"; \ + } \ + UInt_t rpcType = 0; \ + fuAddress = (system & ((1 << 4) - 1)) \ + + ((smId & ((1 << 7) - 1)) << 4) \ + + ((smType & ((1 << 4) - 1)) << 11) \ + + ((chSide & ((1 << 1) - 1)) << 21) \ + + ((rpcId & ((1 << 6) - 1)) << 15) \ + + ((chId & ((1 << 6) - 1)) << 22) \ + + ((rpcType & ((1 << 4) - 1)) << 28); \ + }" + +#pragma read sourceClass="CbmTofHit" version="[1-4]" targetClass="CbmTofHit" \ + source="" target="" \ + include="Logger.h" \ + code="{ \ + LOG(error); \ + LOG(error) << \"You are trying to read an outdated version of CbmTofHit\"; \ + LOG(error) << \"where the unique tof address can't be converted\"; \ + LOG(error) << \"automatically to the new tof addressing scheme.\"; \ + LOG(error); \ + LOG(fatal) << \"Stop execution.\"; \ + }" + +#pragma read sourceClass="CbmTofPoint" version="[1-3]" targetClass="CbmTofPoint" \ + source="" target="" \ + include="Logger.h" \ + code="{ \ + LOG(error); \ + LOG(error) << \"You are trying to read an outdated version of CbmTofPoint\"; \ + LOG(error) << \"where the unique tof address can't be converted\"; \ + LOG(error) << \"automatically to the new tof addressing scheme.\"; \ + LOG(error); \ + LOG(fatal) << \"Stop execution.\"; \ + }" #endif diff --git a/core/data/tof/CbmTofDigi.h b/core/data/tof/CbmTofDigi.h index 920a192fb0..ca696db90b 100644 --- a/core/data/tof/CbmTofDigi.h +++ b/core/data/tof/CbmTofDigi.h @@ -170,6 +170,6 @@ private: ar& fdTot; } - ClassDefNV(CbmTofDigi, 2); + ClassDefNV(CbmTofDigi, 3); }; #endif // CBMTOFDIGI_H diff --git a/core/data/tof/CbmTofHit.h b/core/data/tof/CbmTofHit.h index 6613ad4e8b..11e82480fc 100644 --- a/core/data/tof/CbmTofHit.h +++ b/core/data/tof/CbmTofHit.h @@ -125,7 +125,7 @@ private: ar& fChannel; } - ClassDef(CbmTofHit, 4) + ClassDef(CbmTofHit, 5) }; #endif diff --git a/core/data/tof/CbmTofPoint.h b/core/data/tof/CbmTofPoint.h index 9ae7af4c4a..86c1929f42 100644 --- a/core/data/tof/CbmTofPoint.h +++ b/core/data/tof/CbmTofPoint.h @@ -131,7 +131,7 @@ private: UShort_t fGapMask; /// Set of gaps traversed - ClassDef(CbmTofPoint, 3) + ClassDef(CbmTofPoint, 4) }; -- GitLab