Skip to content

Commit ba4bea3

Browse files
committed
dev: ctp config added also to CTF decoder
1 parent 5b3513d commit ba4bea3

File tree

5 files changed

+36
-7
lines changed

5 files changed

+36
-7
lines changed

Detectors/CTP/macro/TestConfig.C

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <CCDB/BasicCCDBManager.h>
1414
#include <DataFormatsCTP/Configuration.h>
1515
#include "CTPWorkflowScalers/ctpCCDBManager.h"
16+
#include "Framework/Logger.h"
1617
#endif
1718
using namespace o2::ctp;
1819

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "DetectorsBase/CTFCoderBase.h"
2626
#include "CTPReconstruction/CTFHelper.h"
2727
#include "CTPReconstruction/RawDataDecoder.h"
28+
#include "DataFormatsCTP/Configuration.h"
2829

2930
class TTree;
3031

@@ -53,6 +54,8 @@ class CTFCoder : public o2::ctf::CTFCoderBase
5354

5455
void createCoders(const std::vector<char>& bufVec, o2::ctf::CTFCoderBase::OpType op) final;
5556
void setDecodeInps(bool decodeinps) { mDecodeInps = decodeinps; }
57+
void setCTPConfig(CTPConfiguration cfg) { mCTPConfig = std::move(cfg); }
58+
bool getDecodeInps() { return mDecodeInps; }
5659
bool canApplyBCShiftInputs(const o2::InteractionRecord& ir) const { return canApplyBCShift(ir, mBCShiftInputs); }
5760

5861
private:
@@ -62,6 +65,7 @@ class CTFCoder : public o2::ctf::CTFCoderBase
6265
void appendToTree(TTree& tree, CTF& ec);
6366
void readFromTree(TTree& tree, int entry, std::vector<CTPDigit>& data, LumiInfo& lumi);
6467
std::vector<CTPDigit> mDataFilt;
68+
CTPConfiguration mCTPConfig;
6569
int mBCShiftInputs = 0;
6670
bool mDecodeInps = false;
6771
};
@@ -215,8 +219,13 @@ o2::ctf::CTFIOSize CTFCoder::decode(const CTF::base& ec, VTRG& data, LumiInfo& l
215219
}
216220
}
217221
if (mDecodeInps) {
222+
uint64_t trgclassmask = 0xffffffffffffffff;
223+
if(mCTPConfig.getRunNumber() != 0) {
224+
trgclassmask = mCTPConfig.getTriggerClassMask();
225+
}
226+
std::cout << "trgclassmask:" << std::hex << trgclassmask << std::dec << std::endl;
218227
o2::pmr::vector<CTPDigit> digits;
219-
o2::ctp::RawDataDecoder::shiftInputs(digitsMap, digits, mFirstTFOrbit);
228+
o2::ctp::RawDataDecoder::shiftInputs(digitsMap, digits, mFirstTFOrbit, trgclassmask);
220229
for (auto const& dig : digits) {
221230
data.emplace_back(dig);
222231
}

Detectors/CTP/reconstruction/src/RawDataDecoder.cxx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,10 @@ int RawDataDecoder::decodeRaw(o2::framework::InputRecord& inputs, std::vector<o2
293293
// std::cout << "last lumi:" << nhb << std::endl;
294294
}
295295
if (mDoDigits & mDecodeInps) {
296-
uint64_t trgclassmask = mCTPConfig.getTriggerClassMask();
296+
uint64_t trgclassmask = 0xffffffffffffffff;
297+
if(mCTPConfig.getRunNumber() != 0) {
298+
trgclassmask = mCTPConfig.getTriggerClassMask();
299+
}
297300
std::cout << "trgclassmask:" << std::hex << trgclassmask << std::dec << std::endl;
298301
shiftInputs(digitsMap, digits, mTFOrbit, trgclassmask);
299302
}
@@ -529,6 +532,7 @@ int RawDataDecoder::shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digit
529532
int nL1 = 0;
530533
int nTwI = 0;
531534
int nTwoI = 0;
535+
int nTwoIlost = 0;
532536
std::map<o2::InteractionRecord, CTPDigit> digitsMapShifted;
533537
auto L0shift = o2::ctp::TriggerOffsetsParam::Instance().LM_L0;
534538
auto L1shift = L0shift + o2::ctp::TriggerOffsetsParam::Instance().L0_L1 + 1;
@@ -600,13 +604,20 @@ int RawDataDecoder::shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digit
600604
if (d.CTPInputMask.count()) {
601605
nTwI++;
602606
} else {
603-
nTwoI++;
607+
if(d.intRecord.bc == (o2::constants::lhc::LHCMaxBunches - L1shift)) { // input can be lost because latency class-l1input = 1
608+
nTwoIlost++;
609+
} else {
610+
LOG(error) << d.intRecord << " " << d.CTPClassMask << " " << d.CTPInputMask;
611+
//std::cout << std::hex << d.CTPClassMask << " " << d.CTPInputMask << std::dec << std::endl;
612+
nTwoI++;
613+
}
604614
}
605615
}
606616
digits.push_back(dig.second);
607617
}
608-
if (nTwoI) { // Trigger class wo Input
618+
if (nTwoI || nTwoIlost) { // Trigger class wo Input
609619
LOG(error) << "LM:" << nLM << " L0:" << nL0 << " L1:" << nL1 << " TwI:" << nTwI << " Trigger classes wo input:" << nTwoI;
620+
LOG(warn) << " Trigger classes wo input from diff latency 1:" << nTwoIlost;
610621
}
611622
return 0;
612623
}

Detectors/CTP/workflow/src/EntropyDecoderSpec.cxx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,20 @@ void EntropyDecoderSpec::run(ProcessingContext& pc)
5757

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

6465
// since the buff is const, we cannot use EncodedBlocks::relocate directly, instead we wrap its data to another flat object
6566
if (buff.size()) {
6667
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+
}
6774
iosize = mCTFCoder.decode(ctfImage, digits, lumi);
6875
}
6976
pc.outputs().snapshot({"ctfrep", 0}, iosize);

Detectors/CTP/workflow/src/RawDecoderSpec.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ void RawDecoderSpec::run(framework::ProcessingContext& ctx)
139139
} else {
140140
if (mDecodeinputs) {
141141
const auto ctpcfg = inputs.get<o2::ctp::CTPConfiguration*>("ctpconfig");
142-
// ctpcfg->printStream(std::cout);
143-
mDecoder.setCTPConfig(*ctpcfg);
142+
if(ctpcfg != nullptr) {
143+
mDecoder.setCTPConfig(*ctpcfg);
144+
}
144145
}
145146
ret = mDecoder.decodeRaw(inputs, filter, mOutputDigits, lumiPointsHBF1);
146147
}

0 commit comments

Comments
 (0)