Skip to content
Open
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
14 changes: 7 additions & 7 deletions Detectors/Base/include/DetectorsBase/CTFCoderBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class CTFCoderBase
Decoder };

CTFCoderBase() = delete;
CTFCoderBase(int n, DetID det, float memFactor = 1.f) : mCoders(n), mDet(det), mMemMarginFactor(memFactor > 1.f ? memFactor : 1.f) {}
CTFCoderBase(OpType op, int n, DetID det, float memFactor = 1.f) : mOpType(op), mCoders(n), mDet(det), mMemMarginFactor(memFactor > 1.f ? memFactor : 1.f) {}
CTFCoderBase(int n, DetID det, float memFactor = 1.f, const std::string& ctfdictOpt = "none") : mCoders(n), mDet(det), mMemMarginFactor(memFactor > 1.f ? memFactor : 1.f), mDictOpt{ctfdictOpt} {}
CTFCoderBase(OpType op, int n, DetID det, float memFactor = 1.f, const std::string& ctfdictOpt = "none") : mOpType(op), mCoders(n), mDet(det), mMemMarginFactor(memFactor > 1.f ? memFactor : 1.f), mDictOpt{ctfdictOpt} {}
virtual ~CTFCoderBase() = default;

virtual void createCoders(const std::vector<char>& bufVec, o2::ctf::CTFCoderBase::OpType op) = 0;
Expand Down Expand Up @@ -189,6 +189,7 @@ class CTFCoderBase
std::vector<char> loadDictionaryFromTree(TTree* tree);
std::vector<std::any> mCoders; // encoders/decoders
DetID mDet;
std::string mDictOpt{};
std::string mDictBinding{"ctfdict"};
std::string mTrigOffsBinding{"trigoffset"};
CTFDictHeader mExtHeader; // external dictionary header
Expand Down Expand Up @@ -325,13 +326,12 @@ void CTFCoderBase::init(o2::framework::InitContext& ic)
}
}
}
auto dict = ic.options().get<std::string>("ctf-dict");
if (dict.empty() || dict == "ccdb") { // load from CCDB
if (mDictOpt.empty() || mDictOpt == "ccdb") { // load from CCDB
mLoadDictFromCCDB = true;
} else {
if (dict != "none") { // none means per-CTF dictionary will created on the fly
createCodersFromFile<CTF>(dict, mOpType);
LOGP(info, "Loaded {} from {}", mExtHeader.asString(), dict);
if (mDictOpt != "none") { // none means per-CTF dictionary will created on the fly
createCodersFromFile<CTF>(mDictOpt, mOpType);
LOGP(info, "Loaded {} from {}", mExtHeader.asString(), mDictOpt);
} else {
LOGP(info, "Internal per-TF CTF Dict will be created");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace cpv
class CTFCoder final : public o2::ctf::CTFCoderBase
{
public:
CTFCoder(o2::ctf::CTFCoderBase::OpType op) : o2::ctf::CTFCoderBase(op, CTF::getNBlocks(), o2::detectors::DetID::CPV) {}
CTFCoder(o2::ctf::CTFCoderBase::OpType op, const std::string& ctfdictOpt = "none") : o2::ctf::CTFCoderBase(op, CTF::getNBlocks(), 1.f, o2::detectors::DetID::CPV, ctfdictOpt) {}
~CTFCoder() final = default;

/// entropy-encode data to buffer with CTF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace cpv
class EntropyDecoderSpec : public o2::framework::Task
{
public:
EntropyDecoderSpec(int verbosity);
EntropyDecoderSpec(int verbosity, const std::string& ctfdictOpt = "none");
~EntropyDecoderSpec() override = default;
void run(o2::framework::ProcessingContext& pc) final;
void init(o2::framework::InitContext& ic) final;
Expand All @@ -41,7 +41,7 @@ class EntropyDecoderSpec : public o2::framework::Task
};

/// create a processor spec
framework::DataProcessorSpec getEntropyDecoderSpec(int verbosity, unsigned int sspec);
framework::DataProcessorSpec getEntropyDecoderSpec(int verbosity, unsigned int sspec, const std::string& ctfdictOpt);

} // namespace cpv
} // namespace o2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace cpv
class EntropyEncoderSpec : public o2::framework::Task
{
public:
EntropyEncoderSpec(bool selIR = false);
EntropyEncoderSpec(bool selIR = false, const std::string& ctfdictOpt = "none");
~EntropyEncoderSpec() override = default;
void run(o2::framework::ProcessingContext& pc) final;
void init(o2::framework::InitContext& ic) final;
Expand All @@ -42,7 +42,7 @@ class EntropyEncoderSpec : public o2::framework::Task
};

/// create a processor spec
framework::DataProcessorSpec getEntropyEncoderSpec(bool selIR = false);
framework::DataProcessorSpec getEntropyEncoderSpec(bool selIR = false, const std::string& ctfdictOpt = "none");

} // namespace cpv
} // namespace o2
Expand Down
13 changes: 7 additions & 6 deletions Detectors/CPV/workflow/src/EntropyDecoderSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace o2
namespace cpv
{

EntropyDecoderSpec::EntropyDecoderSpec(int verbosity) : mCTFCoder(o2::ctf::CTFCoderBase::OpType::Decoder)
EntropyDecoderSpec::EntropyDecoderSpec(int verbosity, const std::string& ctfdictOpt) : mCTFCoder(o2::ctf::CTFCoderBase::OpType::Decoder, ctfdictOpt)
{
mTimer.Stop();
mTimer.Reset();
Expand Down Expand Up @@ -74,7 +74,7 @@ void EntropyDecoderSpec::endOfStream(EndOfStreamContext& ec)
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
}

DataProcessorSpec getEntropyDecoderSpec(int verbosity, unsigned int sspec)
DataProcessorSpec getEntropyDecoderSpec(int verbosity, unsigned int sspec, const std::string& ctfdictOpt)
{
std::vector<OutputSpec> outputs{
OutputSpec{{"triggers"}, "CPV", "CLUSTERTRIGRECS", 0, Lifetime::Timeframe},
Expand All @@ -83,16 +83,17 @@ DataProcessorSpec getEntropyDecoderSpec(int verbosity, unsigned int sspec)

std::vector<InputSpec> inputs;
inputs.emplace_back("ctf_CPV", "CPV", "CTFDATA", sspec, Lifetime::Timeframe);
inputs.emplace_back("ctfdict_CPV", "CPV", "CTFDICT", 0, Lifetime::Condition, ccdbParamSpec("CPV/Calib/CTFDictionaryTree"));
if (ctfdictOpt.empty() || ctfdictOpt == "ccdb") {
inputs.emplace_back("ctfdict_CPV", "CPV", "CTFDICT", 0, Lifetime::Condition, ccdbParamSpec("CPV/Calib/CTFDictionaryTree"));
}
inputs.emplace_back("trigoffset", "CTP", "Trig_Offset", 0, Lifetime::Condition, ccdbParamSpec("CTP/Config/TriggerOffsets"));

return DataProcessorSpec{
"cpv-entropy-decoder",
inputs,
outputs,
AlgorithmSpec{adaptFromTask<EntropyDecoderSpec>(verbosity)},
Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
{"ans-version", VariantType::String, {"version of ans entropy coder implementation to use"}}}};
AlgorithmSpec{adaptFromTask<EntropyDecoderSpec>(verbosity, ctfdictOpt)},
Options{{"ans-version", VariantType::String, {"version of ans entropy coder implementation to use"}}}};
}

} // namespace cpv
Expand Down
13 changes: 7 additions & 6 deletions Detectors/CPV/workflow/src/EntropyEncoderSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace o2
namespace cpv
{

EntropyEncoderSpec::EntropyEncoderSpec(bool selIR) : mCTFCoder(o2::ctf::CTFCoderBase::OpType::Encoder), mSelIR(selIR)
EntropyEncoderSpec::EntropyEncoderSpec(bool selIR, const std::string& ctfdictOpt) : mCTFCoder(o2::ctf::CTFCoderBase::OpType::Encoder, ctfdictOpt), mSelIR(selIR)
{
mTimer.Stop();
mTimer.Reset();
Expand Down Expand Up @@ -70,12 +70,14 @@ void EntropyEncoderSpec::endOfStream(EndOfStreamContext& ec)
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
}

DataProcessorSpec getEntropyEncoderSpec(bool selIR)
DataProcessorSpec getEntropyEncoderSpec(bool selIR, const std::string& ctfdictOpt)
{
std::vector<InputSpec> inputs;
inputs.emplace_back("triggers", "CPV", "CLUSTERTRIGRECS", 0, Lifetime::Timeframe);
inputs.emplace_back("clusters", "CPV", "CLUSTERS", 0, Lifetime::Timeframe);
inputs.emplace_back("ctfdict", "CPV", "CTFDICT", 0, Lifetime::Condition, ccdbParamSpec("CPV/Calib/CTFDictionaryTree"));
if (ctfdictOpt.empty() || ctfdictOpt == "ccdb") {
inputs.emplace_back("ctfdict", "CPV", "CTFDICT", 0, Lifetime::Condition, ccdbParamSpec("CPV/Calib/CTFDictionaryTree"));
}
if (selIR) {
inputs.emplace_back("selIRFrames", "CTF", "SELIRFRAMES", 0, Lifetime::Timeframe);
}
Expand All @@ -84,9 +86,8 @@ DataProcessorSpec getEntropyEncoderSpec(bool selIR)
inputs,
Outputs{{"CPV", "CTFDATA", 0, Lifetime::Timeframe},
{{"ctfrep"}, "CPV", "CTFENCREP", 0, Lifetime::Timeframe}},
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR, ctfdictOpt)},
Options{{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
{"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
{"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}},
{"ans-version", VariantType::String, {"version of ans entropy coder implementation to use"}}}};
Expand Down
3 changes: 2 additions & 1 deletion Detectors/CPV/workflow/src/entropy-encoder-workflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
// option allowing to set parameters
std::vector<ConfigParamSpec> options{
ConfigParamSpec{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}},
ConfigParamSpec{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
ConfigParamSpec{"select-ir-frames", VariantType::Bool, false, {"Subscribe and filter according to external IR Frames"}}};

std::swap(workflowOptions, options);
Expand All @@ -37,6 +38,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
WorkflowSpec wf;
// Update the (declared) parameters if changed from the command line
o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
wf.emplace_back(o2::cpv::getEntropyEncoderSpec(cfgc.options().get<bool>("select-ir-frames")));
wf.emplace_back(o2::cpv::getEntropyEncoderSpec(cfgc.options().get<bool>("select-ir-frames"), cfgc.options().get<std::string>("ctf-dict")));
return wf;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct CTFReaderInp {
std::string metricChannel{};
std::string fileIRFrames{};
std::string fileRunTimeSpans{};
std::string dictOpt{};
std::vector<int> ctfIDs{};
bool reverseCTFIDs{false};
bool skipSkimmedOutTF = false;
Expand Down
1 change: 0 additions & 1 deletion Detectors/CTF/workflow/src/CTFReaderSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,6 @@ DataProcessorSpec getCTFReaderSpec(const CTFReaderInp& inp)
if (!inp.sup0xccdb) {
outputs.emplace_back(OutputSpec{{"TFDist"}, o2::header::gDataOriginFLP, o2::header::gDataDescriptionDISTSTF, 0xccdb});
}

options.emplace_back(ConfigParamSpec{"select-ctf-ids", VariantType::String, "", {"comma-separated list CTF IDs to inject (from cumulative counter of CTFs seen)"}});
options.emplace_back(ConfigParamSpec{"reverse-select-ctf-ids", VariantType::Bool, false, {"reverse order of to inject CTF IDs"}});
options.emplace_back(ConfigParamSpec{"impose-run-start-timstamp", VariantType::Int64, 0L, {"impose run start time stamp (ms), ignored if 0"}});
Expand Down
34 changes: 18 additions & 16 deletions Detectors/CTF/workflow/src/ctf-reader-workflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
// option allowing to set parameters
std::vector<o2::framework::ConfigParamSpec> options;
options.push_back(ConfigParamSpec{"ctf-input", VariantType::String, "none", {"comma-separated list CTF input files"}});
options.push_back(ConfigParamSpec{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}});
options.push_back(ConfigParamSpec{"onlyDet", VariantType::String, std::string{DetID::ALL}, {"comma-separated list of detectors to accept. Overrides skipDet"}});
options.push_back(ConfigParamSpec{"skipDet", VariantType::String, std::string{DetID::NONE}, {"comma-separate list of detectors to skip"}});
options.push_back(ConfigParamSpec{"loop", VariantType::Int, 0, {"loop N times (infinite for N<0)"}});
Expand Down Expand Up @@ -132,6 +133,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
ctfInput.fileRunTimeSpans = configcontext.options().get<std::string>("run-time-span-file");
ctfInput.skipSkimmedOutTF = configcontext.options().get<bool>("skip-skimmed-out-tf");
ctfInput.invertIRFramesSelection = configcontext.options().get<bool>("invert-irframe-selection");
ctfInput.dictOpt = configcontext.options().get<std::string>("ctf-dict");
int verbosity = configcontext.options().get<int>("ctf-reader-verbosity");

int rateLimitingIPCID = std::stoi(configcontext.options().get<std::string>("timeframes-rate-limit-ipcid"));
Expand Down Expand Up @@ -181,52 +183,52 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)

// add decoders for all allowed detectors.
if (ctfInput.detMask[DetID::ITS]) {
addSpecs(o2::itsmft::getEntropyDecoderSpec(DetID::getDataOrigin(DetID::ITS), verbosity, configcontext.options().get<bool>("its-digits"), ctfInput.subspec));
addSpecs(o2::itsmft::getEntropyDecoderSpec(DetID::getDataOrigin(DetID::ITS), verbosity, configcontext.options().get<bool>("its-digits"), ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::MFT]) {
addSpecs(o2::itsmft::getEntropyDecoderSpec(DetID::getDataOrigin(DetID::MFT), verbosity, configcontext.options().get<bool>("mft-digits"), ctfInput.subspec));
addSpecs(o2::itsmft::getEntropyDecoderSpec(DetID::getDataOrigin(DetID::MFT), verbosity, configcontext.options().get<bool>("mft-digits"), ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::TPC]) {
addSpecs(o2::tpc::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::tpc::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::TRD]) {
addSpecs(o2::trd::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::trd::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::TOF]) {
addSpecs(o2::tof::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::tof::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::FT0]) {
addSpecs(o2::ft0::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::ft0::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::FV0]) {
addSpecs(o2::fv0::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::fv0::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::FDD]) {
addSpecs(o2::fdd::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::fdd::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::MID]) {
addSpecs(o2::mid::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::mid::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::MCH]) {
addSpecs(o2::mch::getEntropyDecoderSpec(verbosity, "mch-entropy-decoder", ctfInput.subspec));
addSpecs(o2::mch::getEntropyDecoderSpec(verbosity, "mch-entropy-decoder", ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::EMC]) {
addSpecs(o2::emcal::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.decSSpecEMC));
addSpecs(o2::emcal::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.decSSpecEMC, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::PHS]) {
addSpecs(o2::phos::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::phos::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::CPV]) {
addSpecs(o2::cpv::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::cpv::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::ZDC]) {
addSpecs(o2::zdc::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::zdc::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::HMP]) {
addSpecs(o2::hmpid::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::hmpid::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}
if (ctfInput.detMask[DetID::CTP]) {
addSpecs(o2::ctp::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
addSpecs(o2::ctp::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
}

bool combine = configcontext.options().get<bool>("combine-devices");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace ctp
class CTFCoder final : public o2::ctf::CTFCoderBase
{
public:
CTFCoder(o2::ctf::CTFCoderBase::OpType op) : o2::ctf::CTFCoderBase(op, CTF::getNBlocks(), o2::detectors::DetID::CTP) {}
CTFCoder(o2::ctf::CTFCoderBase::OpType op, const std::string& ctfdictOpt = "none") : o2::ctf::CTFCoderBase(op, CTF::getNBlocks(), 1.f, o2::detectors::DetID::CTP, ctfdictOpt) {}
~CTFCoder() final = default;

/// entropy-encode data to buffer with CTF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace ctp
class EntropyDecoderSpec : public o2::framework::Task
{
public:
EntropyDecoderSpec(int verbosity);
EntropyDecoderSpec(int verbosity, const std::string& ctfdictOpt = "none");
~EntropyDecoderSpec() override = default;
void run(o2::framework::ProcessingContext& pc) final;
void init(o2::framework::InitContext& ic) final;
Expand All @@ -42,7 +42,7 @@ class EntropyDecoderSpec : public o2::framework::Task
};

/// create a processor spec
framework::DataProcessorSpec getEntropyDecoderSpec(int verbosity, unsigned int sspec);
framework::DataProcessorSpec getEntropyDecoderSpec(int verbosity, unsigned int sspec, const std::string& ctfdictOpt);

} // namespace ctp
} // namespace o2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace ctp
class EntropyEncoderSpec : public o2::framework::Task
{
public:
EntropyEncoderSpec(bool selIR, bool noLumi);
EntropyEncoderSpec(bool selIR, bool noLumi, const std::string& ctfdictOpt = "none");
~EntropyEncoderSpec() override = default;
void run(o2::framework::ProcessingContext& pc) final;
void init(o2::framework::InitContext& ic) final;
Expand All @@ -43,7 +43,7 @@ class EntropyEncoderSpec : public o2::framework::Task
};

/// create a processor spec
framework::DataProcessorSpec getEntropyEncoderSpec(bool selIR = false, bool noLumiInput = false);
framework::DataProcessorSpec getEntropyEncoderSpec(bool selIR = false, bool noLumiInput = false, const std::string& ctfdictOpt = "none");

} // namespace ctp
} // namespace o2
Expand Down
Loading