Skip to content

Commit a25a55c

Browse files
author
afurs
committed
FT0 LUT prepared as Singleton for DigitBlockFT0 usage
1 parent 545d8a9 commit a25a55c

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/LookUpTable.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,19 @@ class LookUpTable
215215
ClassDefNV(LookUpTable, 2);
216216
};
217217

218+
//Singleton for LookUpTable
219+
class SingleLUT:public LookUpTable
220+
{
221+
private:
222+
SingleLUT():LookUpTable(LookUpTable::readTable()) {}
223+
SingleLUT(const SingleLUT&) = delete;
224+
SingleLUT& operator=(SingleLUT&) = delete;
225+
public:
226+
static SingleLUT& Instance() {
227+
static SingleLUT instanceLUT;
228+
return instanceLUT;
229+
}
230+
};
218231
} // namespace ft0
219232
} // namespace o2
220233
#endif

Detectors/FIT/FT0/raw/include/FT0Raw/DigitBlockFT0.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,14 @@ class DigitBlockFT0 : public DigitBlockBase<DigitBlockFT0>
5353
void setIntRec(o2::InteractionRecord intRec) { mDigit.mIntRecord = intRec; }
5454
Digit mDigit;
5555
std::vector<ChannelData> mVecChannelData;
56-
static o2::ft0::LookUpTable sLookupTable;
5756
static int sEventID;
5857

5958
template <class DataBlockType>
6059
void processDigits(DataBlockType& dataBlock, int linkID)
6160
{
6261
if constexpr (std::is_same<DataBlockType, DataBlockPM>::value) { //Filling data from PM
6362
for (int iEventData = 0; iEventData < dataBlock.DataBlockWrapper<RawDataPM>::mNelements; iEventData++) {
64-
mVecChannelData.emplace_back(uint8_t(sLookupTable.getChannel(linkID, dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].channelID)),
63+
mVecChannelData.emplace_back(uint8_t(o2::ft0::SingleLUT::Instance().getChannel(linkID, dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].channelID)),
6564
int(dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].time),
6665
int(dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].charge),
6766
dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].getFlagWord());
@@ -141,16 +140,14 @@ class DigitBlockFT0ext : public DigitBlockBase<DigitBlockFT0ext>
141140
DigitExt mDigit;
142141
std::vector<ChannelData> mVecChannelData;
143142
std::vector<TriggersExt> mVecTriggersExt;
144-
145-
static o2::ft0::LookUpTable sLookupTable;
146143
static int sEventID;
147144

148145
template <class DataBlockType>
149146
void processDigits(DataBlockType& dataBlock, int linkID)
150147
{
151148
if constexpr (std::is_same<DataBlockType, DataBlockPM>::value) { //Filling data from PM
152149
for (int iEventData = 0; iEventData < dataBlock.DataBlockWrapper<RawDataPM>::mNelements; iEventData++) {
153-
mVecChannelData.emplace_back(uint8_t(sLookupTable.getChannel(linkID, dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].channelID)),
150+
mVecChannelData.emplace_back(uint8_t(o2::ft0::SingleLUT::Instance().getChannel(linkID, dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].channelID)),
154151
int(dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].time),
155152
int(dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].charge),
156153
dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].getFlagWord());

Detectors/FIT/FT0/raw/src/DigitBlockFT0.cxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,4 @@
1212
using namespace o2::ft0;
1313

1414
int DigitBlockFT0::sEventID = 0;
15-
o2::ft0::LookUpTable DigitBlockFT0::sLookupTable = o2::ft0::LookUpTable::readTable();
1615
int DigitBlockFT0ext::sEventID = 0;
17-
o2::ft0::LookUpTable DigitBlockFT0ext::sLookupTable = o2::ft0::LookUpTable::readTable();

0 commit comments

Comments
 (0)