Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class STFDecoder : public Task
bool mUseClusterDictionary = true;
bool mVerifyDecoder = false;
bool mDumpFrom1stPipeline = false;
bool mRunEnsureContinuousROF = true;
bool mDisableRectifyContinuousROF = false;
int mDumpOnError = 0;
int mNThreads = 1;
int mVerbosity = 0;
Expand Down
42 changes: 37 additions & 5 deletions Detectors/ITSMFT/common/workflow/src/STFDecoderSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ STFDecoder<Mapping>::STFDecoder(const STFDecoderInp& inp, std::shared_ptr<o2::ba
template <class Mapping>
void STFDecoder<Mapping>::init(InitContext& ic)
{
int lane = ic.services().get<const o2::framework::DeviceSpec>().inputTimesliceId;
o2::base::GRPGeomHelper::instance().setRequest(mGGCCDBRequest);
try {
auto v0 = o2::utils::Str::tokenize(mInputSpec, ':');
Expand Down Expand Up @@ -137,6 +138,31 @@ void STFDecoder<Mapping>::init(InitContext& ic)
LOG(error) << "non-std::exception was thrown in decoder configuration";
throw;
}
if (mDoCalibData) {
std::string warnMsg;
bool enforceEnsureContinuousROFinCalib = ic.options().get<bool>("enforce-continuous-rof-with-calib");
if (ic.options().get<bool>("enforce-continuous-rof-with-calib")) {
warnMsg = "Calibration data requested but the ensureContinuousROF is explicitly enforced!";
} else {
mRunEnsureContinuousROF = false;
warnMsg = "Calibration data requested, disabling ensureContinuousROF!";
}
if (lane == 0) {
LOGP(alarm, "{}", warnMsg);
} else {
LOGP(info, "{}", warnMsg);
}
}

mDisableRectifyContinuousROF = ic.options().get<bool>("disable-rectify-continuous-rof");
if (mDisableRectifyContinuousROF && mRunEnsureContinuousROF) {
std::string warnMsg = "Rectification of clusters/digits is explicitly disabled after the ensureContinuousROF!";
if (lane == 0) {
LOGP(alarm, "{}", warnMsg);
} else {
LOGP(info, "{}", warnMsg);
}
}

if (mDoClusters) {
mClusterer = std::make_unique<Clusterer>();
Expand Down Expand Up @@ -258,8 +284,8 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
}
}
if (mDoDigits) {
std::vector<o2::itsmft::ROFRecord> expDigRofVec(nROFsTF);
if (ensureContinuousROF(digROFVec, expDigRofVec, iLayer, nROFsTF, "digits")) {
std::vector<o2::itsmft::ROFRecord> expDigRofVec;
if (ensureContinuousROF(digROFVec, expDigRofVec, iLayer, nROFsTF, "digits") && !mDisableRectifyContinuousROF) {
auto oldNDig = digVec.size();
rectifyDigits(expDigRofVec, digVec);
LOGP(warn, "Rectified {} digits out of original {} on layer {} following ensureContinuousROF", digVec.size(), oldNDig, iLayer);
Expand All @@ -271,12 +297,12 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
pc.outputs().snapshot(Output{orig, "GBTCALIB", iLayer}, calVec);
mEstNCalib[iLayer] = std::max(mEstNCalib[iLayer], size_t(calVec.size() * 1.2));
}
LOG(debug) << mSelfName << " Decoded " << digVec.size() << " Digits in " << digROFVec.size() << " ROFs" << ((mDoStaggering) ? std::format(" on layer {}", iLayer) : "");
LOG(debug) << mSelfName << " Decoded " << digVec.size() << " Digits in " << expDigRofVec.size() << " ROFs" << ((mDoStaggering) ? std::format(" on layer {}", iLayer) : "");
}

if (mDoClusters) { // we are not obliged to create vectors which are not requested, but other devices might not know the options of this one
std::vector<o2::itsmft::ROFRecord> expClusRofVec(nROFsTF);
if (ensureContinuousROF(clusROFVec, expClusRofVec, iLayer, nROFsTF, "clusters")) {
std::vector<o2::itsmft::ROFRecord> expClusRofVec;
if (ensureContinuousROF(clusROFVec, expClusRofVec, iLayer, nROFsTF, "clusters") && !mDisableRectifyContinuousROF) {
auto oldNClus = clusCompVec.size(), oldNPatt = clusPattVec.size();
rectifyClusters(expClusRofVec, clusCompVec, clusPattVec);
LOGP(warn, "Rectified {} clusters and {} patterns out of original {} and {} on layer {} following ensureContinuousROF", clusCompVec.size(), clusPattVec.size(), oldNClus, oldNPatt, iLayer);
Expand Down Expand Up @@ -426,6 +452,10 @@ void STFDecoder<Mapping>::reset()
template <class Mapping>
bool STFDecoder<Mapping>::ensureContinuousROF(const std::vector<ROFRecord>& rofVec, std::vector<ROFRecord>& expROFVec, int lr, int nROFsTF, const char* name)
{
if (!mRunEnsureContinuousROF) {
expROFVec = rofVec;
return false;
}
const auto& par = AlpideParam::Instance();
// ensure that the rof output is continuous
// we will preserve the digits/clusters as they are but the stray ROFs will be removed (leaving their clusters/digits unaddressed).
Expand Down Expand Up @@ -621,6 +651,8 @@ DataProcessorSpec getSTFDecoderSpec(const STFDecoderInp& inp)
{"unmute-extra-lanes", VariantType::Bool, false, {"allow extra lanes to be as verbose as 1st one"}},
{"allow-empty-rofs", VariantType::Bool, false, {"record ROFs w/o any hit"}},
{"ignore-noise-map", VariantType::Bool, false, {"do not mask pixels flagged in the noise map"}},
{"enforce-continuous-rof-with-calib", VariantType::Bool, false, {"enforce ensureContinuousROF call even when calibration data is requested (not recommended)"}},
{"disable-rectify-continuous-rof", VariantType::Bool, false, {"do not rectify clusters and digits after ensureContinuousROF (not recommended)"}},
{"accept-rof-rampup-data", VariantType::Bool, false, {"do not discard data during ROF ramp up"}},
{"rof-length-error-freq", VariantType::Float, 60.f, {"do not report ROF length error more frequently than this value, disable if negative"}},
{"ignore-cluster-dictionary", VariantType::Bool, false, {"do not use cluster dictionary, always store explicit patterns"}}}};
Expand Down
Loading