diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/LookUpTable.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/LookUpTable.h index bc8c7684474f9..244dfd292c5f1 100644 --- a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/LookUpTable.h +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/LookUpTable.h @@ -215,6 +215,19 @@ class LookUpTable ClassDefNV(LookUpTable, 2); }; +//Singleton for LookUpTable +class SingleLUT:public LookUpTable +{ + private: + SingleLUT():LookUpTable(LookUpTable::readTable()) {} + SingleLUT(const SingleLUT&) = delete; + SingleLUT& operator=(SingleLUT&) = delete; + public: + static SingleLUT& Instance() { + static SingleLUT instanceLUT; + return instanceLUT; + } +}; } // namespace ft0 } // namespace o2 #endif diff --git a/Detectors/FIT/FT0/raw/include/FT0Raw/DigitBlockFT0.h b/Detectors/FIT/FT0/raw/include/FT0Raw/DigitBlockFT0.h index cc7bd3cbdb18e..e3b7b590112fc 100644 --- a/Detectors/FIT/FT0/raw/include/FT0Raw/DigitBlockFT0.h +++ b/Detectors/FIT/FT0/raw/include/FT0Raw/DigitBlockFT0.h @@ -53,7 +53,6 @@ class DigitBlockFT0 : public DigitBlockBase void setIntRec(o2::InteractionRecord intRec) { mDigit.mIntRecord = intRec; } Digit mDigit; std::vector mVecChannelData; - static o2::ft0::LookUpTable sLookupTable; static int sEventID; template @@ -61,7 +60,7 @@ class DigitBlockFT0 : public DigitBlockBase { if constexpr (std::is_same::value) { //Filling data from PM for (int iEventData = 0; iEventData < dataBlock.DataBlockWrapper::mNelements; iEventData++) { - mVecChannelData.emplace_back(uint8_t(sLookupTable.getChannel(linkID, dataBlock.DataBlockWrapper::mData[iEventData].channelID)), + mVecChannelData.emplace_back(uint8_t(o2::ft0::SingleLUT::Instance().getChannel(linkID, dataBlock.DataBlockWrapper::mData[iEventData].channelID)), int(dataBlock.DataBlockWrapper::mData[iEventData].time), int(dataBlock.DataBlockWrapper::mData[iEventData].charge), dataBlock.DataBlockWrapper::mData[iEventData].getFlagWord()); @@ -141,8 +140,6 @@ class DigitBlockFT0ext : public DigitBlockBase DigitExt mDigit; std::vector mVecChannelData; std::vector mVecTriggersExt; - - static o2::ft0::LookUpTable sLookupTable; static int sEventID; template @@ -150,7 +147,7 @@ class DigitBlockFT0ext : public DigitBlockBase { if constexpr (std::is_same::value) { //Filling data from PM for (int iEventData = 0; iEventData < dataBlock.DataBlockWrapper::mNelements; iEventData++) { - mVecChannelData.emplace_back(uint8_t(sLookupTable.getChannel(linkID, dataBlock.DataBlockWrapper::mData[iEventData].channelID)), + mVecChannelData.emplace_back(uint8_t(o2::ft0::SingleLUT::Instance().getChannel(linkID, dataBlock.DataBlockWrapper::mData[iEventData].channelID)), int(dataBlock.DataBlockWrapper::mData[iEventData].time), int(dataBlock.DataBlockWrapper::mData[iEventData].charge), dataBlock.DataBlockWrapper::mData[iEventData].getFlagWord()); diff --git a/Detectors/FIT/FT0/raw/src/DigitBlockFT0.cxx b/Detectors/FIT/FT0/raw/src/DigitBlockFT0.cxx index 0fdb98bed5ca1..21f21accbc8ae 100644 --- a/Detectors/FIT/FT0/raw/src/DigitBlockFT0.cxx +++ b/Detectors/FIT/FT0/raw/src/DigitBlockFT0.cxx @@ -12,6 +12,4 @@ using namespace o2::ft0; int DigitBlockFT0::sEventID = 0; -o2::ft0::LookUpTable DigitBlockFT0::sLookupTable = o2::ft0::LookUpTable::readTable(); int DigitBlockFT0ext::sEventID = 0; -o2::ft0::LookUpTable DigitBlockFT0ext::sLookupTable = o2::ft0::LookUpTable::readTable();