Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FT0 LUT prepared as Singleton for DigitBlockFT0 usage #5192

Merged
merged 2 commits into from Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -215,6 +215,21 @@ 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
7 changes: 2 additions & 5 deletions Detectors/FIT/FT0/raw/include/FT0Raw/DigitBlockFT0.h
Expand Up @@ -53,15 +53,14 @@ class DigitBlockFT0 : public DigitBlockBase<DigitBlockFT0>
void setIntRec(o2::InteractionRecord intRec) { mDigit.mIntRecord = intRec; }
Digit mDigit;
std::vector<ChannelData> mVecChannelData;
static o2::ft0::LookUpTable sLookupTable;
static int sEventID;

template <class DataBlockType>
void processDigits(DataBlockType& dataBlock, int linkID)
{
if constexpr (std::is_same<DataBlockType, DataBlockPM>::value) { //Filling data from PM
for (int iEventData = 0; iEventData < dataBlock.DataBlockWrapper<RawDataPM>::mNelements; iEventData++) {
mVecChannelData.emplace_back(uint8_t(sLookupTable.getChannel(linkID, dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].channelID)),
mVecChannelData.emplace_back(uint8_t(o2::ft0::SingleLUT::Instance().getChannel(linkID, dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].channelID)),
int(dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].time),
int(dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].charge),
dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].getFlagWord());
Expand Down Expand Up @@ -141,16 +140,14 @@ class DigitBlockFT0ext : public DigitBlockBase<DigitBlockFT0ext>
DigitExt mDigit;
std::vector<ChannelData> mVecChannelData;
std::vector<TriggersExt> mVecTriggersExt;

static o2::ft0::LookUpTable sLookupTable;
static int sEventID;

template <class DataBlockType>
void processDigits(DataBlockType& dataBlock, int linkID)
{
if constexpr (std::is_same<DataBlockType, DataBlockPM>::value) { //Filling data from PM
for (int iEventData = 0; iEventData < dataBlock.DataBlockWrapper<RawDataPM>::mNelements; iEventData++) {
mVecChannelData.emplace_back(uint8_t(sLookupTable.getChannel(linkID, dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].channelID)),
mVecChannelData.emplace_back(uint8_t(o2::ft0::SingleLUT::Instance().getChannel(linkID, dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].channelID)),
int(dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].time),
int(dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].charge),
dataBlock.DataBlockWrapper<RawDataPM>::mData[iEventData].getFlagWord());
Expand Down
2 changes: 0 additions & 2 deletions Detectors/FIT/FT0/raw/src/DigitBlockFT0.cxx
Expand Up @@ -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();