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
22 changes: 12 additions & 10 deletions Detectors/TPC/workflow/include/TPCWorkflow/TPCFLPCMVSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ namespace o2::tpc
class TPCFLPCMVDevice : public o2::framework::Task
{
public:
TPCFLPCMVDevice(const int lane, const std::vector<uint32_t>& crus, const int nTFsBuffer)
: mLane{lane}, mCRUs{crus}, mNTFsBuffer{nTFsBuffer} {}
TPCFLPCMVDevice(const int lane, const std::vector<uint32_t>& crus, const bool triggerPerFlp, const int nTFsBuffer)
: mLane{lane}, mCRUs{crus}, mTriggerPerFLP{triggerPerFlp}, mNTFsBuffer{nTFsBuffer} {}

void init(o2::framework::InitContext& ic) final
{
mDumpCMVs = ic.options().get<bool>("dump-cmvs-flp");
mEnableTrigger = ic.options().get<bool>("trigger");
mTriggerPerFLP = ic.options().get<bool>("trigger-per-flp");
mTriggerThresholdCMV = ic.options().get<float>("trigger-threshold-cmv");
mTriggerThresholdMeanMax = ic.options().get<float>("trigger-threshold-cmvMeanMax");
mTriggerThresholdMeanMin = ic.options().get<float>("trigger-threshold-cmvMeanMin");
Expand Down Expand Up @@ -200,7 +199,7 @@ class TPCFLPCMVDevice : public o2::framework::Task
}
};

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

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

const auto id = fmt::format("tpc-flp-cmv-{:02}", ilane);
return o2::framework::DataProcessorSpec{
id.data(),
inputSpecs,
outputSpecs,
o2::framework::AlgorithmSpec{o2::framework::adaptFromTask<TPCFLPCMVDevice>(ilane, crus, nTFsBuffer)},
o2::framework::AlgorithmSpec{o2::framework::adaptFromTask<TPCFLPCMVDevice>(ilane, crus, triggerPerFlp, nTFsBuffer)},
o2::framework::Options{
{"dump-cmvs-flp", o2::framework::VariantType::Bool, false, {"Dump CMVs to file"}},
{"trigger", o2::framework::VariantType::Bool, false, {"Enable CMV trigger evaluation"}},
{"trigger-per-flp", o2::framework::VariantType::Bool, false, {"Aggregate triggers of CRUs on FLP to a single trigger"}},
{"trigger-threshold-cmv", o2::framework::VariantType::Float, -10.f, {"CMV threshold: sequence starts when value drops below this (ADC units)"}},
{"trigger-threshold-cmvMeanMax", o2::framework::VariantType::Float, -40.f, {"Upper bound on trigger-sequence mean CMV value"}},
{"trigger-threshold-cmvMeanMin", o2::framework::VariantType::Float, -80.f, {"Lower bound on trigger-sequence mean CMV value"}},
Expand Down
6 changes: 4 additions & 2 deletions Detectors/TPC/workflow/src/tpc-flp-cmv.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
{"time-lanes", VariantType::Int, 1, {"Number of parallel processing lanes (timeframes are split per device)"}},
{"crus", VariantType::String, cruDefault.c_str(), {"List of CRUs, comma separated ranges, e.g. 0-3,7,9-15"}},
{"n-TFs-buffer", VariantType::Int, 1, {"Buffer n-TFs before sending output"}},
{"trigger-per-flp", VariantType::Bool, false, {"Aggregate triggers of CRUs on FLP to a single trigger"}},
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}}};

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

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

return workflow;
}
}