Skip to content

Commit 52b0ff0

Browse files
committed
Configure TPCFLPCMVSpec output accorging to the triggerPerFlp flag
1 parent 3108ae1 commit 52b0ff0

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

Detectors/TPC/workflow/include/TPCWorkflow/TPCFLPCMVSpec.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,13 @@ namespace o2::tpc
3737
class TPCFLPCMVDevice : public o2::framework::Task
3838
{
3939
public:
40-
TPCFLPCMVDevice(const int lane, const std::vector<uint32_t>& crus, const int nTFsBuffer)
41-
: mLane{lane}, mCRUs{crus}, mNTFsBuffer{nTFsBuffer} {}
40+
TPCFLPCMVDevice(const int lane, const std::vector<uint32_t>& crus, const bool triggerPerFlp, const int nTFsBuffer)
41+
: mLane{lane}, mCRUs{crus}, mTriggerPerFLP{triggerPerFlp}, mNTFsBuffer{nTFsBuffer} {}
4242

4343
void init(o2::framework::InitContext& ic) final
4444
{
4545
mDumpCMVs = ic.options().get<bool>("dump-cmvs-flp");
4646
mEnableTrigger = ic.options().get<bool>("trigger");
47-
mTriggerPerFLP = ic.options().get<bool>("trigger-per-flp");
4847
mTriggerThresholdCMV = ic.options().get<float>("trigger-threshold-cmv");
4948
mTriggerThresholdMeanMax = ic.options().get<float>("trigger-threshold-cmvMeanMax");
5049
mTriggerThresholdMeanMin = ic.options().get<float>("trigger-threshold-cmvMeanMin");
@@ -200,7 +199,7 @@ class TPCFLPCMVDevice : public o2::framework::Task
200199
}
201200
};
202201

203-
o2::framework::DataProcessorSpec getTPCFLPCMVSpec(const int ilane, const std::vector<uint32_t>& crus, const int nTFsBuffer = 1)
202+
o2::framework::DataProcessorSpec getTPCFLPCMVSpec(const int ilane, const std::vector<uint32_t>& crus, const bool triggerPerFlp, const int nTFsBuffer = 1)
204203
{
205204
std::vector<o2::framework::OutputSpec> outputSpecs;
206205
std::vector<o2::framework::InputSpec> inputSpecs;
@@ -217,22 +216,25 @@ o2::framework::DataProcessorSpec getTPCFLPCMVSpec(const int ilane, const std::ve
217216
// Outputs to TPCDistributeCMVSpec
218217
outputSpecs.emplace_back(o2::framework::ConcreteDataMatcher{o2::header::gDataOriginTPC, TPCFLPCMVDevice::getDataDescriptionCMVGroup(), subSpec}, o2::framework::Lifetime::Sporadic);
219218
outputSpecs.emplace_back(o2::framework::ConcreteDataMatcher{o2::header::gDataOriginTPC, TPCFLPCMVDevice::getDataDescriptionCMVOrbitInfo(), subSpec}, o2::framework::Lifetime::Sporadic);
220-
}
221219

222-
// Single per-FLP trigger output, subspec keyed on the first CRU
223-
const header::DataHeader::SubSpecificationType trigSubSpec{crus.front() << 7};
224-
outputSpecs.emplace_back(o2::framework::ConcreteDataMatcher{o2::header::gDataOriginTPC, TPCFLPCMVDevice::getDataDescriptionCMVTrigger(), trigSubSpec}, o2::framework::Lifetime::Timeframe);
220+
if (!triggerPerFlp) {
221+
outputSpecs.emplace_back(o2::framework::ConcreteDataMatcher{o2::header::gDataOriginTPC, TPCFLPCMVDevice::getDataDescriptionCMVTrigger(), subSpec}, o2::framework::Lifetime::Timeframe);
222+
}
223+
}
224+
if (triggerPerFlp) { // Single per-FLP trigger output, subspec keyed on the first CRU
225+
const header::DataHeader::SubSpecificationType trigSubSpec{crus.front() << 7};
226+
outputSpecs.emplace_back(o2::framework::ConcreteDataMatcher{o2::header::gDataOriginTPC, TPCFLPCMVDevice::getDataDescriptionCMVTrigger(), trigSubSpec}, o2::framework::Lifetime::Timeframe);
227+
}
225228

226229
const auto id = fmt::format("tpc-flp-cmv-{:02}", ilane);
227230
return o2::framework::DataProcessorSpec{
228231
id.data(),
229232
inputSpecs,
230233
outputSpecs,
231-
o2::framework::AlgorithmSpec{o2::framework::adaptFromTask<TPCFLPCMVDevice>(ilane, crus, nTFsBuffer)},
234+
o2::framework::AlgorithmSpec{o2::framework::adaptFromTask<TPCFLPCMVDevice>(ilane, crus, triggerPerFlp, nTFsBuffer)},
232235
o2::framework::Options{
233236
{"dump-cmvs-flp", o2::framework::VariantType::Bool, false, {"Dump CMVs to file"}},
234237
{"trigger", o2::framework::VariantType::Bool, false, {"Enable CMV trigger evaluation"}},
235-
{"trigger-per-flp", o2::framework::VariantType::Bool, false, {"Aggregate triggers of CRUs on FLP to a single trigger"}},
236238
{"trigger-threshold-cmv", o2::framework::VariantType::Float, -10.f, {"CMV threshold: sequence starts when value drops below this (ADC units)"}},
237239
{"trigger-threshold-cmvMeanMax", o2::framework::VariantType::Float, -40.f, {"Upper bound on trigger-sequence mean CMV value"}},
238240
{"trigger-threshold-cmvMeanMin", o2::framework::VariantType::Float, -80.f, {"Lower bound on trigger-sequence mean CMV value"}},

Detectors/TPC/workflow/src/tpc-flp-cmv.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
3232
{"time-lanes", VariantType::Int, 1, {"Number of parallel processing lanes (timeframes are split per device)"}},
3333
{"crus", VariantType::String, cruDefault.c_str(), {"List of CRUs, comma separated ranges, e.g. 0-3,7,9-15"}},
3434
{"n-TFs-buffer", VariantType::Int, 1, {"Buffer n-TFs before sending output"}},
35+
{"trigger-per-flp", VariantType::Bool, false, {"Aggregate triggers of CRUs on FLP to a single trigger"}},
3536
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}}};
3637

3738
std::swap(workflowOptions, options);
@@ -48,6 +49,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config)
4849
const auto nLanes = std::min(static_cast<unsigned long>(config.options().get<int>("lanes")), nCRUs);
4950
const auto time_lanes = static_cast<unsigned int>(config.options().get<int>("time-lanes"));
5051
const auto crusPerLane = nCRUs / nLanes + ((nCRUs % nLanes) != 0);
52+
const bool triggerPerFLP = config.options().get<bool>("trigger-per-flp");
5153
const int nTFsBuffer = config.options().get<int>("n-TFs-buffer");
5254

5355
o2::conf::ConfigurableParam::updateFromFile(config.options().get<std::string>("configFile"));
@@ -65,8 +67,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config)
6567
}
6668
const auto last = std::min(tpcCRUs.end(), first + crusPerLane);
6769
const std::vector<uint32_t> rangeCRUs(first, last);
68-
workflow.emplace_back(timePipeline(getTPCFLPCMVSpec(ilane, rangeCRUs, nTFsBuffer), time_lanes));
70+
workflow.emplace_back(timePipeline(getTPCFLPCMVSpec(ilane, rangeCRUs, triggerPerFLP, nTFsBuffer), time_lanes));
6971
}
7072

7173
return workflow;
72-
}
74+
}

0 commit comments

Comments
 (0)