Skip to content

Commit f8c8b97

Browse files
committed
dev: config done only if run changed
1 parent c425e86 commit f8c8b97

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

Detectors/CTP/reconstruction/include/CTPReconstruction/CTFCoder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class CTFCoder : public o2::ctf::CTFCoderBase
5656
void setDecodeInps(bool decodeinps) { mDecodeInps = decodeinps; }
5757
void setCTPConfig(CTPConfiguration cfg) { mCTPConfig = std::move(cfg); }
5858
bool getDecodeInps() { return mDecodeInps; }
59+
CTPConfiguration& getCTPConfig() { return mCTPConfig; }
5960
bool canApplyBCShiftInputs(const o2::InteractionRecord& ir) const { return canApplyBCShift(ir, mBCShiftInputs); }
6061

6162
private:

Detectors/CTP/reconstruction/include/CTPReconstruction/RawDataDecoder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class RawDataDecoder
5050
std::vector<uint32_t>& getTFOrbits() { return mTFOrbits; }
5151
int getErrorIR() { return mErrorIR; }
5252
int getErrorTCR() { return mErrorTCR; }
53+
CTPConfiguration& getCTPConfig() { return mCTPConfig; }
5354
int init();
5455
static int shiftNew(const o2::InteractionRecord& irin, uint32_t TFOrbit, std::bitset<48>& inpmask, int64_t shift, int level, std::map<o2::InteractionRecord, CTPDigit>& digmap);
5556
static int shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digitsMap, o2::pmr::vector<CTPDigit>& digits, uint32_t TFOrbit, uint64_t trgclassmask = 0xffffffffffffffff);

Detectors/CTP/workflow/include/CTPWorkflow/EntropyDecoderSpec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class EntropyDecoderSpec : public o2::framework::Task
3434
void init(o2::framework::InitContext& ic) final;
3535
void endOfStream(o2::framework::EndOfStreamContext& ec) final;
3636
void finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj) final;
37+
void updateTimeDependentParams(framework::ProcessingContext& pc);
3738

3839
private:
3940
o2::ctp::CTFCoder mCTFCoder;

Detectors/CTP/workflow/src/EntropyDecoderSpec.cxx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,14 @@ void EntropyDecoderSpec::run(ProcessingContext& pc)
5555
mTimer.Start(false);
5656
o2::ctf::CTFIOSize iosize;
5757

58-
mCTFCoder.updateTimeDependentParams(pc, true);
58+
updateTimeDependentParams(pc);
5959
auto buff = pc.inputs().get<gsl::span<o2::ctf::BufferType>>("ctf_CTP");
60-
61-
const auto ctpcfg = pc.inputs().get<o2::ctp::CTPConfiguration*>("ctpconfig");
6260
auto& digits = pc.outputs().make<std::vector<CTPDigit>>(OutputRef{"digits"});
6361
auto& lumi = pc.outputs().make<LumiInfo>(OutputRef{"CTPLumi"});
6462

6563
// since the buff is const, we cannot use EncodedBlocks::relocate directly, instead we wrap its data to another flat object
6664
if (buff.size()) {
6765
const auto ctfImage = o2::ctp::CTF::getImage(buff.data());
68-
if (mCTFCoder.getDecodeInps()) {
69-
const auto ctpcfg = pc.inputs().get<o2::ctp::CTPConfiguration*>("ctpconfig");
70-
if (ctpcfg != nullptr) {
71-
mCTFCoder.setCTPConfig(*ctpcfg);
72-
}
73-
}
7466
iosize = mCTFCoder.decode(ctfImage, digits, lumi);
7567
}
7668
pc.outputs().snapshot({"ctfrep", 0}, iosize);
@@ -83,6 +75,20 @@ void EntropyDecoderSpec::endOfStream(EndOfStreamContext& ec)
8375
LOGF(info, "CTP Entropy Decoding total timing: Cpu: %.3e Real: %.3e s in %d slots",
8476
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
8577
}
78+
void EntropyDecoderSpec::updateTimeDependentParams(framework::ProcessingContext& pc)
79+
{
80+
mCTFCoder.updateTimeDependentParams(pc, true);
81+
if (pc.services().get<o2::framework::TimingInfo>().globalRunNumberChanged) {
82+
const auto ctpcfg = pc.inputs().get<o2::ctp::CTPConfiguration*>("ctpconfig");
83+
if (mCTFCoder.getDecodeInps()) {
84+
const auto ctpcfg = pc.inputs().get<o2::ctp::CTPConfiguration*>("ctpconfig");
85+
if (ctpcfg != nullptr) {
86+
mCTFCoder.setCTPConfig(*ctpcfg);
87+
LOG(info) << "ctpconfig for run done:" << mCTFCoder.getCTPConfig().getRunNumber();
88+
}
89+
}
90+
}
91+
}
8692

8793
DataProcessorSpec getEntropyDecoderSpec(int verbosity, unsigned int sspec)
8894
{

Detectors/CTP/workflow/src/RawDecoderSpec.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,6 @@ void RawDecoderSpec::run(framework::ProcessingContext& ctx)
137137
if (fatal_flag) {
138138
ret = mDecoder.decodeRawFatal(inputs, filter);
139139
} else {
140-
if (mDecodeinputs) {
141-
const auto ctpcfg = inputs.get<o2::ctp::CTPConfiguration*>("ctpconfig");
142-
if (ctpcfg != nullptr) {
143-
mDecoder.setCTPConfig(*ctpcfg);
144-
}
145-
}
146-
const auto& trigOffsParam = o2::ctp::TriggerOffsetsParam::Instance();
147140
ret = mDecoder.decodeRaw(inputs, filter, mOutputDigits, lumiPointsHBF1);
148141
}
149142
if (ret == 1) {
@@ -237,5 +230,12 @@ void RawDecoderSpec::updateTimeDependentParams(framework::ProcessingContext& pc)
237230
pc.inputs().get<o2::ctp::TriggerOffsetsParam*>("trigoffset");
238231
const auto& trigOffsParam = o2::ctp::TriggerOffsetsParam::Instance();
239232
LOG(info) << "updateing TroggerOffsetsParam: inputs L0_L1:" << trigOffsParam.L0_L1 << " classes L0_L1:" << trigOffsParam.L0_L1_classes;
233+
if (mDecodeinputs) {
234+
const auto ctpcfg = pc.inputs().get<o2::ctp::CTPConfiguration*>("ctpconfig");
235+
if (ctpcfg != nullptr) {
236+
mDecoder.setCTPConfig(*ctpcfg);
237+
LOG(info) << "ctpconfig for run done:" << mDecoder.getCTPConfig().getRunNumber();
238+
}
239+
}
240240
}
241241
}

0 commit comments

Comments
 (0)