Skip to content

Commit

Permalink
ITSMFT decoder sends vector<char> with chips status in TF
Browse files Browse the repository at this point in the history
For every TF a vector<char>[NChips] is sent as ITS(MFT)/CHIPSSTATUS/0, for chips with at least 1
hit in the TF the slot is set to 1, otherwise 0.
  • Loading branch information
shahor02 committed Nov 21, 2023
1 parent 214520e commit 89312ea
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ class RawPixelDecoder final : public PixelReader
void collectROFCableData(int iru);
int decodeNextTrigger() final;

template <class DigitContainer, class ROFContainer>
int fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs);
template <class DigitContainer, class ROFContainer, class STATVEC>
int fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs, STATVEC& chipStatus);

template <class STATVEC>
void fillChipsStatus(STATVEC& chipStatus);

template <class CalibContainer>
void fillCalibData(CalibContainer& calib);
Expand Down Expand Up @@ -175,8 +178,8 @@ class RawPixelDecoder final : public PixelReader
///______________________________________________________________
/// Fill decoded digits to global vector
template <class Mapping>
template <class DigitContainer, class ROFContainer>
int RawPixelDecoder<Mapping>::fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs)
template <class DigitContainer, class ROFContainer, class STATVEC>
int RawPixelDecoder<Mapping>::fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs, STATVEC& chipStatus)
{
if (mInteractionRecord.isDummy()) {
return 0; // nothing was decoded
Expand All @@ -186,6 +189,7 @@ int RawPixelDecoder<Mapping>::fillDecodedDigits(DigitContainer& digits, ROFConta
for (unsigned int iru = 0; iru < mRUDecodeVec.size(); iru++) {
for (int ic = 0; ic < mRUDecodeVec[iru].nChipsFired; ic++) {
const auto& chip = mRUDecodeVec[iru].chipsData[ic];
chipStatus[chip.getChipID()] = 1;
for (const auto& hit : mRUDecodeVec[iru].chipsData[ic].getData()) {
digits.emplace_back(chip.getChipID(), hit.getRow(), hit.getCol());
}
Expand All @@ -200,8 +204,8 @@ int RawPixelDecoder<Mapping>::fillDecodedDigits(DigitContainer& digits, ROFConta
///______________________________________________________________
/// Fill decoded digits to global vector
template <>
template <class DigitContainer, class ROFContainer>
int RawPixelDecoder<ChipMappingMFT>::fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs)
template <class DigitContainer, class ROFContainer, class STATVEC>
int RawPixelDecoder<ChipMappingMFT>::fillDecodedDigits(DigitContainer& digits, ROFContainer& rofs, STATVEC& chipStatus)
{
if (mInteractionRecord.isDummy()) {
return 0; // nothing was decoded
Expand All @@ -211,6 +215,7 @@ int RawPixelDecoder<ChipMappingMFT>::fillDecodedDigits(DigitContainer& digits, R
for (auto chipData = mOrderedChipsPtr.rbegin(); chipData != mOrderedChipsPtr.rend(); ++chipData) {
assert(mLastReadChipID < (*chipData)->getChipID());
mLastReadChipID = (*chipData)->getChipID();
chipStatus[mLastReadChipID] = 1;
for (const auto& hit : (*chipData)->getData()) {
digits.emplace_back(mLastReadChipID, hit.getRow(), hit.getCol());
}
Expand All @@ -221,6 +226,23 @@ int RawPixelDecoder<ChipMappingMFT>::fillDecodedDigits(DigitContainer& digits, R
return nFilled;
}

///______________________________________________________________
/// update status for every active chip
template <class Mapping>
template <class STATVEC>
void RawPixelDecoder<Mapping>::fillChipsStatus(STATVEC& chipStatus)
{
if (mInteractionRecord.isDummy()) {
return; // nothing was decoded
}
for (unsigned int iru = 0; iru < mRUDecodeVec.size(); iru++) {
for (int ic = 0; ic < mRUDecodeVec[iru].nChipsFired; ic++) {
const auto& chip = mRUDecodeVec[iru].chipsData[ic];
chipStatus[chip.getChipID()] = 1;
}
}
}

///______________________________________________________________
/// Fill decoded digits to global vector
template <class Mapping>
Expand Down
9 changes: 7 additions & 2 deletions Detectors/ITSMFT/common/workflow/src/STFDecoderSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
std::vector<Digit> digVec;
std::vector<GBTCalibData> calVec;
std::vector<ROFRecord> digROFVec;
auto& chipStatus = pc.outputs().make<std::vector<char>>(Output{orig, "CHIPSSTATUS", 0, Lifetime::Timeframe}, (size_t)Mapping::getNChips());

try {
mDecoder->startNewTF(pc.inputs());
if (mDoDigits) {
Expand Down Expand Up @@ -167,10 +169,12 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
}
lastIR = mDecoder->getInteractionRecord();
if (mDoDigits || mClusterer->getMaxROFDepthToSquash()) { // call before clusterization, since the latter will hide the digits
mDecoder->fillDecodedDigits(digVec, digROFVec); // lot of copying involved
mDecoder->fillDecodedDigits(digVec, digROFVec, chipStatus); // lot of copying involved
if (mDoCalibData) {
mDecoder->fillCalibData(calVec);
}
} else {
mDecoder->fillChipsStatus(chipStatus);
}
if (mDoClusters && !mClusterer->getMaxROFDepthToSquash()) { // !!! THREADS !!!
mClusterer->process(mNThreads, *mDecoder.get(), &clusCompVec, mDoPatterns ? &clusPattVec : nullptr, &clusROFVec);
Expand Down Expand Up @@ -216,7 +220,6 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
mEstNClusPatt = std::max(mEstNClusPatt, size_t(clusPattVec.size() * 1.2));
mEstNROF = std::max(mEstNROF, size_t(clusROFVec.size() * 1.2));
}

auto& linkErrors = pc.outputs().make<std::vector<GBTLinkDecodingStat>>(Output{orig, "LinkErrors", 0, Lifetime::Timeframe});
auto& decErrors = pc.outputs().make<std::vector<ChipError>>(Output{orig, "ChipErrors", 0, Lifetime::Timeframe});
mDecoder->collectDecodingErrors(linkErrors, decErrors);
Expand All @@ -235,6 +238,7 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
}
mTimer.Stop();
auto tfID = pc.services().get<o2::framework::TimingInfo>().tfCounter;

LOG(debug) << mSelfName << " Total time for TF " << tfID << '(' << mTFCounter << ") : CPU: " << mTimer.CpuTime() - timeCPU0 << " Real: " << mTimer.RealTime() - timeReal0;
mTFCounter++;
}
Expand Down Expand Up @@ -364,6 +368,7 @@ DataProcessorSpec getSTFDecoderSpec(const STFDecoderInp& inp)

outputs.emplace_back(inp.origin, "LinkErrors", 0, Lifetime::Timeframe);
outputs.emplace_back(inp.origin, "ChipErrors", 0, Lifetime::Timeframe);
outputs.emplace_back(inp.origin, "CHIPSSTATUS", 0, Lifetime::Timeframe);

if (inp.askSTFDist) {
// request the input FLP/DISTSUBTIMEFRAME/0 that is _guaranteed_ to be present, even if none of our raw data is present.
Expand Down

0 comments on commit 89312ea

Please sign in to comment.