Skip to content

Commit dde0975

Browse files
committed
Multiple fixes in HMPID Raw->Digit
Add expired messages mechanism, fix input specs, suppress unneeded inputs
1 parent 6f3b991 commit dde0975

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

Detectors/HMPID/workflow/include/HMPIDWorkflow/DataDecoderSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DataDecoderTask : public framework::Task
4545
ExecutionTimer mExTimer;
4646
};
4747

48-
o2::framework::DataProcessorSpec getDecodingSpec(std::string inputSpec = "TF:HMP/RAWDATA");
48+
o2::framework::DataProcessorSpec getDecodingSpec(bool askSTFDist);
4949
} // end namespace hmpid
5050
} // end namespace o2
5151

Detectors/HMPID/workflow/src/DataDecoderSpec.cxx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "Framework/Task.h"
3838
#include "Framework/WorkflowSpec.h"
3939
#include "Framework/Logger.h"
40+
#include "Framework/InputRecordWalker.h"
4041

4142
#include "Headers/RAWDataHeader.h"
4243
#include "DetectorsRaw/RDHUtils.h"
@@ -159,6 +160,21 @@ void DataDecoderTask::decodeTF(framework::ProcessingContext& pc)
159160

160161
// get the input buffer
161162
auto& inputs = pc.inputs();
163+
164+
// if we see requested data type input with 0xDEADBEEF subspec and 0 payload this means that the "delayed message"
165+
// mechanism created it in absence of real data from upstream. Processor should send empty output to not block the workflow
166+
{
167+
std::vector<InputSpec> dummy{InputSpec{"dummy", ConcreteDataMatcher{"HMP", "RAWDATA", 0xDEADBEEF}}};
168+
for (const auto& ref : InputRecordWalker(inputs, dummy)) {
169+
const auto dh = o2::framework::DataRefUtils::getHeader<o2::header::DataHeader*>(ref);
170+
if (dh->payloadSize == 0) {
171+
LOGP(WARNING, "Found input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : assuming no payload for all links in this TF",
172+
dh->dataOrigin.str, dh->dataDescription.str, dh->subSpecification, dh->tfCounter, dh->firstTForbit, dh->payloadSize);
173+
return;
174+
}
175+
}
176+
}
177+
162178
DPLRawParser parser(inputs, o2::framework::select("TF:HMP/RAWDATA"));
163179
mDeco->mDigits.clear();
164180
for (auto it = parser.begin(), end = parser.end(); it != end; ++it) {
@@ -253,22 +269,21 @@ void DataDecoderTask::decodeRawFile(framework::ProcessingContext& pc)
253269
}
254270

255271
//_________________________________________________________________________________________________
256-
o2::framework::DataProcessorSpec getDecodingSpec(std::string inputSpec)
272+
o2::framework::DataProcessorSpec getDecodingSpec(bool askDISTSTF)
257273
{
258274
std::vector<o2::framework::InputSpec> inputs;
259-
inputs.emplace_back("TF", o2::framework::ConcreteDataTypeMatcher{"HMP", "RAWDATA"}, o2::framework::Lifetime::Timeframe);
260-
inputs.emplace_back("file", o2::framework::ConcreteDataTypeMatcher{"ROUT", "RAWDATA"}, o2::framework::Lifetime::Timeframe);
261-
// inputs.emplace_back("readout", o2::header::gDataOriginHMP, "RAWDATA", 0, Lifetime::Timeframe);
262-
// inputs.emplace_back("readout", o2::header::gDataOriginHMP, "RAWDATA", 0, Lifetime::Timeframe);
263-
// inputs.emplace_back("rawfile", o2::header::gDataOriginHMP, "RAWDATA", 0, Lifetime::Timeframe);
275+
inputs.emplace_back("TF", o2::framework::ConcreteDataTypeMatcher{"HMP", "RAWDATA"}, o2::framework::Lifetime::Optional);
276+
if (askDISTSTF) {
277+
inputs.emplace_back("stdDist", "FLP", "DISTSUBTIMEFRAME", 0, Lifetime::Timeframe);
278+
}
264279

265280
std::vector<o2::framework::OutputSpec> outputs;
266281
outputs.emplace_back("HMP", "DIGITS", 0, o2::framework::Lifetime::Timeframe);
267282
outputs.emplace_back("HMP", "INTRECORDS", 0, o2::framework::Lifetime::Timeframe);
268283

269284
return DataProcessorSpec{
270285
"HMP-RawStreamDecoder",
271-
o2::framework::select(inputSpec.c_str()),
286+
inputs,
272287
outputs,
273288
AlgorithmSpec{adaptFromTask<DataDecoderTask>()},
274289
Options{{"result-file", VariantType::String, "/tmp/hmpRawDecodeResults", {"Base name of the decoding results files."}},

Detectors/HMPID/workflow/src/raw-to-digits-stream-workflow.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
4949
{
5050
std::string keyvaluehelp("Semicolon separated key=value strings ...");
5151
workflowOptions.push_back(o2::framework::ConfigParamSpec{"configKeyValues", o2::framework::VariantType::String, "", {keyvaluehelp}});
52+
workflowOptions.push_back(o2::framework::ConfigParamSpec{"ignore-dist-stf", o2::framework::VariantType::Bool, false, {"do not subscribe to FLP/DISTSUBTIMEFRAME/0 message (no lost TF recovery)"}});
5253
}
5354

5455
#include "Framework/runDataProcessing.h"
@@ -61,7 +62,8 @@ WorkflowSpec defineDataProcessing(const ConfigContext& cx)
6162
{
6263
WorkflowSpec specs;
6364
o2::conf::ConfigurableParam::updateFromString(cx.options().get<std::string>("configKeyValues"));
64-
DataProcessorSpec producer = o2::hmpid::getDecodingSpec();
65+
auto askSTFDist = !cx.options().get<bool>("ignore-dist-stf");
66+
DataProcessorSpec producer = o2::hmpid::getDecodingSpec(askSTFDist);
6567
specs.push_back(producer);
6668
return specs;
6769
}

0 commit comments

Comments
 (0)