Skip to content

Commit c8834de

Browse files
committed
Promote --ctf-dict from process to workflow level option
1 parent 9e910d6 commit c8834de

File tree

95 files changed

+378
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+378
-358
lines changed

Detectors/Base/include/DetectorsBase/CTFCoderBase.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class CTFCoderBase
5858
Decoder };
5959

6060
CTFCoderBase() = delete;
61-
CTFCoderBase(int n, DetID det, float memFactor = 1.f) : mCoders(n), mDet(det), mMemMarginFactor(memFactor > 1.f ? memFactor : 1.f) {}
62-
CTFCoderBase(OpType op, int n, DetID det, float memFactor = 1.f) : mOpType(op), mCoders(n), mDet(det), mMemMarginFactor(memFactor > 1.f ? memFactor : 1.f) {}
61+
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} {}
62+
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} {}
6363
virtual ~CTFCoderBase() = default;
6464

6565
virtual void createCoders(const std::vector<char>& bufVec, o2::ctf::CTFCoderBase::OpType op) = 0;
@@ -189,6 +189,7 @@ class CTFCoderBase
189189
std::vector<char> loadDictionaryFromTree(TTree* tree);
190190
std::vector<std::any> mCoders; // encoders/decoders
191191
DetID mDet;
192+
std::string mDictOpt{};
192193
std::string mDictBinding{"ctfdict"};
193194
std::string mTrigOffsBinding{"trigoffset"};
194195
CTFDictHeader mExtHeader; // external dictionary header
@@ -325,13 +326,12 @@ void CTFCoderBase::init(o2::framework::InitContext& ic)
325326
}
326327
}
327328
}
328-
auto dict = ic.options().get<std::string>("ctf-dict");
329-
if (dict.empty() || dict == "ccdb") { // load from CCDB
329+
if (mDictOpt.empty() || mDictOpt == "ccdb") { // load from CCDB
330330
mLoadDictFromCCDB = true;
331331
} else {
332-
if (dict != "none") { // none means per-CTF dictionary will created on the fly
333-
createCodersFromFile<CTF>(dict, mOpType);
334-
LOGP(info, "Loaded {} from {}", mExtHeader.asString(), dict);
332+
if (mDictOpt != "none") { // none means per-CTF dictionary will created on the fly
333+
createCodersFromFile<CTF>(mDictOpt, mOpType);
334+
LOGP(info, "Loaded {} from {}", mExtHeader.asString(), mDictOpt);
335335
} else {
336336
LOGP(info, "Internal per-TF CTF Dict will be created");
337337
}

Detectors/CPV/reconstruction/include/CPVReconstruction/CTFCoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace cpv
3535
class CTFCoder final : public o2::ctf::CTFCoderBase
3636
{
3737
public:
38-
CTFCoder(o2::ctf::CTFCoderBase::OpType op) : o2::ctf::CTFCoderBase(op, CTF::getNBlocks(), o2::detectors::DetID::CPV) {}
38+
CTFCoder(o2::ctf::CTFCoderBase::OpType op, const std::string& ctfdictOpt = "none") : o2::ctf::CTFCoderBase(op, CTF::getNBlocks(), 1.f, o2::detectors::DetID::CPV, ctfdictOpt) {}
3939
~CTFCoder() final = default;
4040

4141
/// entropy-encode data to buffer with CTF

Detectors/CPV/workflow/include/CPVWorkflow/EntropyDecoderSpec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace cpv
2828
class EntropyDecoderSpec : public o2::framework::Task
2929
{
3030
public:
31-
EntropyDecoderSpec(int verbosity);
31+
EntropyDecoderSpec(int verbosity, const std::string& ctfdictOpt = "none");
3232
~EntropyDecoderSpec() override = default;
3333
void run(o2::framework::ProcessingContext& pc) final;
3434
void init(o2::framework::InitContext& ic) final;
@@ -41,7 +41,7 @@ class EntropyDecoderSpec : public o2::framework::Task
4141
};
4242

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

4646
} // namespace cpv
4747
} // namespace o2

Detectors/CPV/workflow/include/CPVWorkflow/EntropyEncoderSpec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace cpv
2828
class EntropyEncoderSpec : public o2::framework::Task
2929
{
3030
public:
31-
EntropyEncoderSpec(bool selIR = false);
31+
EntropyEncoderSpec(bool selIR = false, const std::string& ctfdictOpt = "none");
3232
~EntropyEncoderSpec() override = default;
3333
void run(o2::framework::ProcessingContext& pc) final;
3434
void init(o2::framework::InitContext& ic) final;
@@ -42,7 +42,7 @@ class EntropyEncoderSpec : public o2::framework::Task
4242
};
4343

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

4747
} // namespace cpv
4848
} // namespace o2

Detectors/CPV/workflow/src/EntropyDecoderSpec.cxx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace o2
2525
namespace cpv
2626
{
2727

28-
EntropyDecoderSpec::EntropyDecoderSpec(int verbosity) : mCTFCoder(o2::ctf::CTFCoderBase::OpType::Decoder)
28+
EntropyDecoderSpec::EntropyDecoderSpec(int verbosity, const std::string& ctfdictOpt) : mCTFCoder(o2::ctf::CTFCoderBase::OpType::Decoder, ctfdictOpt)
2929
{
3030
mTimer.Stop();
3131
mTimer.Reset();
@@ -74,7 +74,7 @@ void EntropyDecoderSpec::endOfStream(EndOfStreamContext& ec)
7474
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
7575
}
7676

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

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

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

9899
} // namespace cpv

Detectors/CPV/workflow/src/EntropyEncoderSpec.cxx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace o2
2626
namespace cpv
2727
{
2828

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

73-
DataProcessorSpec getEntropyEncoderSpec(bool selIR)
73+
DataProcessorSpec getEntropyEncoderSpec(bool selIR, const std::string& ctfdictOpt)
7474
{
7575
std::vector<InputSpec> inputs;
7676
inputs.emplace_back("triggers", "CPV", "CLUSTERTRIGRECS", 0, Lifetime::Timeframe);
7777
inputs.emplace_back("clusters", "CPV", "CLUSTERS", 0, Lifetime::Timeframe);
78-
inputs.emplace_back("ctfdict", "CPV", "CTFDICT", 0, Lifetime::Condition, ccdbParamSpec("CPV/Calib/CTFDictionaryTree"));
78+
if (ctfdictOpt.empty() || ctfdictOpt == "ccdb") {
79+
inputs.emplace_back("ctfdict", "CPV", "CTFDICT", 0, Lifetime::Condition, ccdbParamSpec("CPV/Calib/CTFDictionaryTree"));
80+
}
7981
if (selIR) {
8082
inputs.emplace_back("selIRFrames", "CTF", "SELIRFRAMES", 0, Lifetime::Timeframe);
8183
}
@@ -84,9 +86,8 @@ DataProcessorSpec getEntropyEncoderSpec(bool selIR)
8486
inputs,
8587
Outputs{{"CPV", "CTFDATA", 0, Lifetime::Timeframe},
8688
{{"ctfrep"}, "CPV", "CTFENCREP", 0, Lifetime::Timeframe}},
87-
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
88-
Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
89-
{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
89+
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR, ctfdictOpt)},
90+
Options{{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
9091
{"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
9192
{"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}},
9293
{"ans-version", VariantType::String, {"version of ans entropy coder implementation to use"}}}};

Detectors/CPV/workflow/src/entropy-encoder-workflow.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
2323
// option allowing to set parameters
2424
std::vector<ConfigParamSpec> options{
2525
ConfigParamSpec{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}},
26+
ConfigParamSpec{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
2627
ConfigParamSpec{"select-ir-frames", VariantType::Bool, false, {"Subscribe and filter according to external IR Frames"}}};
2728

2829
std::swap(workflowOptions, options);
@@ -37,6 +38,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
3738
WorkflowSpec wf;
3839
// Update the (declared) parameters if changed from the command line
3940
o2::conf::ConfigurableParam::updateFromString(cfgc.options().get<std::string>("configKeyValues"));
40-
wf.emplace_back(o2::cpv::getEntropyEncoderSpec(cfgc.options().get<bool>("select-ir-frames")));
41+
wf.emplace_back(o2::cpv::getEntropyEncoderSpec(cfgc.options().get<bool>("select-ir-frames"), cfgc.options().get<std::string>("ctf-dict")));
4142
return wf;
4243
}

Detectors/CTF/workflow/include/CTFWorkflow/CTFReaderSpec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct CTFReaderInp {
3232
std::string metricChannel{};
3333
std::string fileIRFrames{};
3434
std::string fileRunTimeSpans{};
35+
std::string dictOpt{};
3536
std::vector<int> ctfIDs{};
3637
bool reverseCTFIDs{false};
3738
bool skipSkimmedOutTF = false;

Detectors/CTF/workflow/src/CTFReaderSpec.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,6 @@ DataProcessorSpec getCTFReaderSpec(const CTFReaderInp& inp)
645645
if (!inp.sup0xccdb) {
646646
outputs.emplace_back(OutputSpec{{"TFDist"}, o2::header::gDataOriginFLP, o2::header::gDataDescriptionDISTSTF, 0xccdb});
647647
}
648-
649648
options.emplace_back(ConfigParamSpec{"select-ctf-ids", VariantType::String, "", {"comma-separated list CTF IDs to inject (from cumulative counter of CTFs seen)"}});
650649
options.emplace_back(ConfigParamSpec{"reverse-select-ctf-ids", VariantType::Bool, false, {"reverse order of to inject CTF IDs"}});
651650
options.emplace_back(ConfigParamSpec{"impose-run-start-timstamp", VariantType::Int64, 0L, {"impose run start time stamp (ms), ignored if 0"}});

Detectors/CTF/workflow/src/ctf-reader-workflow.cxx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
5252
// option allowing to set parameters
5353
std::vector<o2::framework::ConfigParamSpec> options;
5454
options.push_back(ConfigParamSpec{"ctf-input", VariantType::String, "none", {"comma-separated list CTF input files"}});
55+
options.push_back(ConfigParamSpec{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}});
5556
options.push_back(ConfigParamSpec{"onlyDet", VariantType::String, std::string{DetID::ALL}, {"comma-separated list of detectors to accept. Overrides skipDet"}});
5657
options.push_back(ConfigParamSpec{"skipDet", VariantType::String, std::string{DetID::NONE}, {"comma-separate list of detectors to skip"}});
5758
options.push_back(ConfigParamSpec{"loop", VariantType::Int, 0, {"loop N times (infinite for N<0)"}});
@@ -132,6 +133,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
132133
ctfInput.fileRunTimeSpans = configcontext.options().get<std::string>("run-time-span-file");
133134
ctfInput.skipSkimmedOutTF = configcontext.options().get<bool>("skip-skimmed-out-tf");
134135
ctfInput.invertIRFramesSelection = configcontext.options().get<bool>("invert-irframe-selection");
136+
ctfInput.dictOpt = configcontext.options().get<std::string>("ctf-dict");
135137
int verbosity = configcontext.options().get<int>("ctf-reader-verbosity");
136138

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

182184
// add decoders for all allowed detectors.
183185
if (ctfInput.detMask[DetID::ITS]) {
184-
addSpecs(o2::itsmft::getEntropyDecoderSpec(DetID::getDataOrigin(DetID::ITS), verbosity, configcontext.options().get<bool>("its-digits"), ctfInput.subspec));
186+
addSpecs(o2::itsmft::getEntropyDecoderSpec(DetID::getDataOrigin(DetID::ITS), verbosity, configcontext.options().get<bool>("its-digits"), ctfInput.subspec, ctfInput.dictOpt));
185187
}
186188
if (ctfInput.detMask[DetID::MFT]) {
187-
addSpecs(o2::itsmft::getEntropyDecoderSpec(DetID::getDataOrigin(DetID::MFT), verbosity, configcontext.options().get<bool>("mft-digits"), ctfInput.subspec));
189+
addSpecs(o2::itsmft::getEntropyDecoderSpec(DetID::getDataOrigin(DetID::MFT), verbosity, configcontext.options().get<bool>("mft-digits"), ctfInput.subspec, ctfInput.dictOpt));
188190
}
189191
if (ctfInput.detMask[DetID::TPC]) {
190-
addSpecs(o2::tpc::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
192+
addSpecs(o2::tpc::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
191193
}
192194
if (ctfInput.detMask[DetID::TRD]) {
193-
addSpecs(o2::trd::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
195+
addSpecs(o2::trd::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
194196
}
195197
if (ctfInput.detMask[DetID::TOF]) {
196-
addSpecs(o2::tof::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
198+
addSpecs(o2::tof::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
197199
}
198200
if (ctfInput.detMask[DetID::FT0]) {
199-
addSpecs(o2::ft0::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
201+
addSpecs(o2::ft0::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
200202
}
201203
if (ctfInput.detMask[DetID::FV0]) {
202-
addSpecs(o2::fv0::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
204+
addSpecs(o2::fv0::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
203205
}
204206
if (ctfInput.detMask[DetID::FDD]) {
205-
addSpecs(o2::fdd::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
207+
addSpecs(o2::fdd::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
206208
}
207209
if (ctfInput.detMask[DetID::MID]) {
208-
addSpecs(o2::mid::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
210+
addSpecs(o2::mid::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
209211
}
210212
if (ctfInput.detMask[DetID::MCH]) {
211-
addSpecs(o2::mch::getEntropyDecoderSpec(verbosity, "mch-entropy-decoder", ctfInput.subspec));
213+
addSpecs(o2::mch::getEntropyDecoderSpec(verbosity, "mch-entropy-decoder", ctfInput.subspec, ctfInput.dictOpt));
212214
}
213215
if (ctfInput.detMask[DetID::EMC]) {
214-
addSpecs(o2::emcal::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.decSSpecEMC));
216+
addSpecs(o2::emcal::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.decSSpecEMC, ctfInput.dictOpt));
215217
}
216218
if (ctfInput.detMask[DetID::PHS]) {
217-
addSpecs(o2::phos::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
219+
addSpecs(o2::phos::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
218220
}
219221
if (ctfInput.detMask[DetID::CPV]) {
220-
addSpecs(o2::cpv::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
222+
addSpecs(o2::cpv::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
221223
}
222224
if (ctfInput.detMask[DetID::ZDC]) {
223-
addSpecs(o2::zdc::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
225+
addSpecs(o2::zdc::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
224226
}
225227
if (ctfInput.detMask[DetID::HMP]) {
226-
addSpecs(o2::hmpid::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
228+
addSpecs(o2::hmpid::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
227229
}
228230
if (ctfInput.detMask[DetID::CTP]) {
229-
addSpecs(o2::ctp::getEntropyDecoderSpec(verbosity, ctfInput.subspec));
231+
addSpecs(o2::ctp::getEntropyDecoderSpec(verbosity, ctfInput.subspec, ctfInput.dictOpt));
230232
}
231233

232234
bool combine = configcontext.options().get<bool>("combine-devices");

0 commit comments

Comments
 (0)