Skip to content

Commit c371d64

Browse files
committed
Optional margins for IRFrames selection
1 parent 209f7fe commit c371d64

16 files changed

Lines changed: 59 additions & 14 deletions

File tree

Detectors/Base/include/DetectorsBase/CTFCoderBase.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ class CTFCoderBase
6262
// detector coder need to redefine this method if uses no default version, see comment in the cxx file
6363
virtual void assignDictVersion(CTFDictHeader& h) const;
6464

65+
template <typename SPAN>
66+
void setSelectedIRFrames(const SPAN& sp)
67+
{
68+
mIRFrameSelector.setSelectedIRFrames(sp, mIRFrameSelMarginBwd, mIRFrameSelMarginFwd, true);
69+
}
70+
6571
template <typename CTF>
6672
std::vector<char> readDictionaryFromFile(const std::string& dictPath, bool mayFail = false);
6773

@@ -116,19 +122,22 @@ class CTFCoderBase
116122
void updateTimeDependentParams(o2::framework::ProcessingContext& pc);
117123

118124
o2::utils::IRFrameSelector& getIRFramesSelector() { return mIRFrameSelector; }
125+
size_t getIRFrameSelMarginBwd() const { return mIRFrameSelMarginBwd; }
126+
size_t getIRFrameSelMarginFwd() const { return mIRFrameSelMarginFwd; }
119127

120128
protected:
121129
std::string getPrefix() const { return o2::utils::Str::concat_string(mDet.getName(), "_CTF: "); }
122130

123131
void checkDictVersion(const CTFDictHeader& h) const;
124-
125132
std::vector<std::shared_ptr<void>> mCoders; // encoders/decoders
126133
DetID mDet;
127134
CTFDictHeader mExtHeader; // external dictionary header
128135
o2::utils::IRFrameSelector mIRFrameSelector; // optional IR frames selector
129136
float mMemMarginFactor = 1.0f; // factor for memory allocation in EncodedBlocks
130137
bool mLoadDictFromCCDB{true};
131138
OpType mOpType; // Encoder or Decoder
139+
size_t mIRFrameSelMarginBwd = 0; // margin in BC to add to the IRFrame lower boundary when selection is requested
140+
size_t mIRFrameSelMarginFwd = 0; // margin in BC to add to the IRFrame upper boundary when selection is requested
132141
int mVerbosity = 0;
133142
};
134143

@@ -223,6 +232,12 @@ void CTFCoderBase::init(o2::framework::InitContext& ic)
223232
if (ic.options().hasOption("mem-factor")) {
224233
setMemMarginFactor(ic.options().get<float>("mem-factor"));
225234
}
235+
if (ic.options().hasOption("irframe-margin-bwd")) {
236+
mIRFrameSelMarginBwd = ic.options().get<uint32_t>("irframe-margin-bwd");
237+
}
238+
if (ic.options().hasOption("irframe-margin-fwd")) {
239+
mIRFrameSelMarginFwd = ic.options().get<uint32_t>("irframe-margin-fwd");
240+
}
226241
auto dict = ic.options().get<std::string>("ctf-dict");
227242
if (dict.empty() || dict == "ccdb") { // load from CCDB
228243
mLoadDictFromCCDB = true;

Detectors/CPV/workflow/src/EntropyEncoderSpec.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc)
5252
auto triggers = pc.inputs().get<gsl::span<TriggerRecord>>("triggers");
5353
auto clusters = pc.inputs().get<gsl::span<Cluster>>("clusters");
5454
if (mSelIR) {
55-
mCTFCoder.getIRFramesSelector().setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
55+
mCTFCoder.setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
5656
}
5757
auto& buffer = pc.outputs().make<std::vector<o2::ctf::BufferType>>(Output{"CPV", "CTFDATA", 0, Lifetime::Timeframe});
5858
auto iosize = mCTFCoder.encode(buffer, triggers, clusters);
@@ -86,6 +86,8 @@ DataProcessorSpec getEntropyEncoderSpec(bool selIR)
8686
{{"ctfrep"}, "CPV", "CTFENCREP", 0, Lifetime::Timeframe}},
8787
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
8888
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"}},
90+
{"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
8991
{"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}}}};
9092
}
9193

Detectors/CTP/workflow/src/EntropyEncoderSpec.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ DataProcessorSpec getEntropyEncoderSpec(bool selIR)
7878
{{"ctfrep"}, "CTP", "CTFENCREP", 0, Lifetime::Timeframe}},
7979
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
8080
Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
81+
{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
82+
{"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
8183
{"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}}}};
8284
}
8385

Detectors/EMCAL/workflow/src/EntropyEncoderSpec.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc)
5454

5555
auto& buffer = pc.outputs().make<std::vector<o2::ctf::BufferType>>(Output{"EMC", "CTFDATA", 0, Lifetime::Timeframe});
5656
if (mSelIR) {
57-
mCTFCoder.getIRFramesSelector().setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
57+
mCTFCoder.setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
5858
}
5959
auto iosize = mCTFCoder.encode(buffer, triggers, cells);
6060
pc.outputs().snapshot({"ctfrep", 0}, iosize);
@@ -88,6 +88,8 @@ DataProcessorSpec getEntropyEncoderSpec(bool selIR)
8888
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
8989
Options{
9090
{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
91+
{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
92+
{"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
9193
{"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}}}};
9294
}
9395

Detectors/FIT/FDD/workflow/src/EntropyEncoderSpec.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc)
5252
auto digits = pc.inputs().get<gsl::span<o2::fdd::Digit>>("digits");
5353
auto channels = pc.inputs().get<gsl::span<o2::fdd::ChannelData>>("channels");
5454
if (mSelIR) {
55-
mCTFCoder.getIRFramesSelector().setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
55+
mCTFCoder.setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
5656
}
5757
auto& buffer = pc.outputs().make<std::vector<o2::ctf::BufferType>>(Output{"FDD", "CTFDATA", 0, Lifetime::Timeframe});
5858
auto iosize = mCTFCoder.encode(buffer, digits, channels);
@@ -84,6 +84,8 @@ DataProcessorSpec getEntropyEncoderSpec(bool selIR)
8484
Outputs{{"FDD", "CTFDATA", 0, Lifetime::Timeframe}},
8585
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
8686
Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
87+
{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
88+
{"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
8789
{"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}}}};
8890
}
8991

Detectors/FIT/FT0/workflow/src/EntropyEncoderSpec.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc)
5252
auto digits = pc.inputs().get<gsl::span<o2::ft0::Digit>>("digits");
5353
auto channels = pc.inputs().get<gsl::span<o2::ft0::ChannelData>>("channels");
5454
if (mSelIR) {
55-
mCTFCoder.getIRFramesSelector().setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
55+
mCTFCoder.setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
5656
}
5757

5858
auto& buffer = pc.outputs().make<std::vector<o2::ctf::BufferType>>(Output{"FT0", "CTFDATA", 0, Lifetime::Timeframe});
@@ -85,6 +85,8 @@ DataProcessorSpec getEntropyEncoderSpec(bool selIR)
8585
Outputs{{"FT0", "CTFDATA", 0, Lifetime::Timeframe}},
8686
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
8787
Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
88+
{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
89+
{"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
8890
{"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}}}};
8991
}
9092

Detectors/FIT/FV0/workflow/src/EntropyEncoderSpec.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc)
5252
auto digits = pc.inputs().get<gsl::span<o2::fv0::Digit>>("digits");
5353
auto channels = pc.inputs().get<gsl::span<o2::fv0::ChannelData>>("channels");
5454
if (mSelIR) {
55-
mCTFCoder.getIRFramesSelector().setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
55+
mCTFCoder.setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
5656
}
5757

5858
auto& buffer = pc.outputs().make<std::vector<o2::ctf::BufferType>>(Output{"FV0", "CTFDATA", 0, Lifetime::Timeframe});
@@ -87,6 +87,8 @@ DataProcessorSpec getEntropyEncoderSpec(bool selIR)
8787
{{"ctfrep"}, "FV0", "CTFENCREP", 0, Lifetime::Timeframe}},
8888
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
8989
Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
90+
{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
91+
{"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
9092
{"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}}}};
9193
}
9294

Detectors/HMPID/workflow/src/EntropyEncoderSpec.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc)
7070
auto triggers = pc.inputs().get<gsl::span<Trigger>>("triggers");
7171
auto digits = pc.inputs().get<gsl::span<Digit>>("digits");
7272
if (mSelIR) {
73-
mCTFCoder.getIRFramesSelector().setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
73+
mCTFCoder.setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
7474
}
7575
auto& buffer = pc.outputs().make<std::vector<o2::ctf::BufferType>>(Output{"HMP", "CTFDATA", 0, Lifetime::Timeframe});
7676
auto iosize = mCTFCoder.encode(buffer, triggers, digits);
@@ -104,6 +104,8 @@ DataProcessorSpec getEntropyEncoderSpec(bool selIR)
104104
{{"ctfrep"}, "HMP", "CTFENCREP", 0, Lifetime::Timeframe}},
105105
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
106106
Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
107+
{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
108+
{"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
107109
{"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}}}};
108110
}
109111

Detectors/ITSMFT/common/workflow/src/EntropyEncoderSpec.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc)
5151
auto pspan = pc.inputs().get<gsl::span<unsigned char>>("patterns");
5252
auto rofs = pc.inputs().get<gsl::span<o2::itsmft::ROFRecord>>("ROframes");
5353
if (mSelIR) {
54-
mCTFCoder.getIRFramesSelector().setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
54+
mCTFCoder.setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
5555
}
5656
auto& buffer = pc.outputs().make<std::vector<o2::ctf::BufferType>>(Output{mOrigin, "CTFDATA", 0, Lifetime::Timeframe});
5757
auto iosize = mCTFCoder.encode(buffer, rofs, compClusters, pspan, mPattIdConverter, mStrobeLength);
@@ -130,6 +130,8 @@ DataProcessorSpec getEntropyEncoderSpec(o2::header::DataOrigin orig, bool selIR)
130130
{{"ctfrep"}, orig, "CTFENCREP", 0, Lifetime::Timeframe}},
131131
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(orig, selIR)},
132132
Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
133+
{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
134+
{"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
133135
{"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}}}};
134136
}
135137

Detectors/MUON/MCH/Workflow/src/entropy-encoder-workflow.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ DataProcessorSpec getEntropyEncoderSpec(const char* specName, bool selIR)
9898
{{"ctfrep"}, "MCH", "CTFENCREP", 0, Lifetime::Timeframe}},
9999
AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
100100
Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
101+
{"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
102+
{"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
101103
{"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}}}};
102104
}
103105

0 commit comments

Comments
 (0)