Skip to content

Commit 72d4024

Browse files
aphecetchedavidrohr
authored andcommitted
MCH: read number of orbits in TF from CCDB
1 parent e4402c9 commit 72d4024

3 files changed

Lines changed: 41 additions & 8 deletions

File tree

Detectors/MUON/MCH/Raw/Decoder/include/MCHRawDecoder/DataDecoder.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,15 @@ class DataDecoder
150150

151151
DataDecoder(SampaChannelHandler channelHandler, RdhHandler rdhHandler,
152152
std::string mapCRUfile, std::string mapFECfile,
153-
bool ds2manu, bool verbose, bool useDummyElecMap, TimeRecoMode timeRecoMode = TimeRecoMode::HBPackets);
153+
bool ds2manu, bool verbose, bool useDummyElecMap,
154+
TimeRecoMode timeRecoMode = TimeRecoMode::HBPackets,
155+
uint32_t nofOrbitsPerTF = 32);
154156

155157
void reset();
156158

159+
/* set the number of orbits that comprise one time frame. */
160+
void setOrbitsInTF(uint32_t nofOrbitsPerTF) { mOrbitsInTF = nofOrbitsPerTF; }
161+
157162
/// Store the value of the first orbit in the TimeFrame to be processed
158163
/// Must be called before processing the TmeFrame buffer
159164
void setFirstOrbitInTF(uint32_t orbit);
@@ -239,7 +244,7 @@ class DataDecoder
239244
std::vector<o2::mch::DecoderError> mErrors; ///< list of decoding errors in the processed buffer
240245
std::vector<o2::mch::HeartBeatPacket> mHBPackets; ///< list of heart-beat packets in the processed buffer
241246

242-
uint32_t mOrbitsInTF{128}; ///< number of orbits in one time frame
247+
uint32_t mOrbitsInTF; ///< number of orbits in one time frame
243248
uint32_t mBcInOrbit; ///< number of bunch crossings in one orbit
244249
uint32_t mFirstOrbitInTF; ///< first orbit in the processed time-frame
245250
uint32_t mSampaTimeOffset{0}; ///< SAMPA BC counter value to be subtracted from the HBPacket BC at the TF start

Detectors/MUON/MCH/Raw/Decoder/src/DataDecoder.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "MCHRawDecoder/DataDecoder.h"
2020

2121
#include "CommonConstants/LHCConstants.h"
22-
#include "DetectorsRaw/HBFUtils.h"
2322
#include "DetectorsRaw/RDHUtils.h"
2423
#include "Framework/Logger.h"
2524
#include "Headers/RAWDataHeader.h"
@@ -242,8 +241,10 @@ bool DataDecoder::TimeFrameStartRecord::check(int32_t orbit, uint32_t bc, int32_
242241

243242
DataDecoder::DataDecoder(SampaChannelHandler channelHandler, RdhHandler rdhHandler,
244243
std::string mapCRUfile, std::string mapFECfile,
245-
bool ds2manu, bool verbose, bool useDummyElecMap, TimeRecoMode timeRecoMode)
246-
: mChannelHandler(channelHandler), mRdhHandler(rdhHandler), mMapCRUfile(mapCRUfile), mMapFECfile(mapFECfile), mDs2manu(ds2manu), mDebug(verbose), mUseDummyElecMap(useDummyElecMap), mTimeRecoMode(timeRecoMode)
244+
bool ds2manu, bool verbose, bool useDummyElecMap,
245+
TimeRecoMode timeRecoMode,
246+
uint32_t nofOrbitsPerTF)
247+
: mChannelHandler(channelHandler), mRdhHandler(rdhHandler), mMapCRUfile(mapCRUfile), mMapFECfile(mapFECfile), mDs2manu(ds2manu), mDebug(verbose), mUseDummyElecMap(useDummyElecMap), mTimeRecoMode(timeRecoMode), mOrbitsInTF(nofOrbitsPerTF)
247248
{
248249
init();
249250
}
@@ -898,7 +899,6 @@ void DataDecoder::init()
898899
initFee2SolarMapper(mMapCRUfile);
899900
initElec2DetMapper(mMapFECfile);
900901

901-
mOrbitsInTF = o2::raw::HBFUtils::Instance().getNOrbitsPerTF();
902902
mBcInOrbit = o2::constants::lhc::LHCMaxBunches;
903903

904904
mTimeFrameStartRecords.resize(sReadoutChipsNum);

Detectors/MUON/MCH/Workflow/src/DataDecoderSpec.cxx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "DetectorsRaw/RDHUtils.h"
4040
#include "DPLUtils/DPLRawParser.h"
4141
#include "CommonConstants/LHCConstants.h"
42+
#include "DetectorsBase/GRPGeomHelper.h"
4243
#include "DetectorsRaw/HBFUtils.h"
4344

4445
#include "DataFormatsMCH/Digit.h"
@@ -70,7 +71,9 @@ using RDH = o2::header::RDHAny;
7071
class DataDecoderTask
7172
{
7273
public:
73-
DataDecoderTask(std::string spec) : mInputSpec(spec) {}
74+
DataDecoderTask(std::string spec,
75+
std::shared_ptr<base::GRPGeomRequest> request) : mInputSpec(spec),
76+
mCcdbRequest(request) {}
7477

7578
//_________________________________________________________________________________________________
7679
void init(framework::InitContext& ic)
@@ -98,13 +101,26 @@ class DataDecoderTask
98101
mDecoder = new DataDecoder(channelHandler, rdhHandler, mapCRUfile, mapFECfile, ds2manu, mDebug,
99102
useDummyElecMap, timeRecoMode);
100103

104+
if (mCcdbRequest) {
105+
base::GRPGeomHelper::instance().setRequest(mCcdbRequest);
106+
}
107+
101108
auto stop = [this]() {
102109
LOG(info) << "mch-data-decoder: decoding duration = " << mTimeDecoding.count() * 1000 / mTFcount << " us / TF";
103110
LOG(info) << "mch-data-decoder: ROF finder duration = " << mTimeROFFinder.count() * 1000 / mTFcount << " us / TF";
104111
};
105112
ic.services().get<CallbackService>().set<CallbackService::Id::Stop>(stop);
106113
}
107114

115+
void finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
116+
{
117+
if (mCcdbRequest) {
118+
base::GRPGeomHelper::instance().finaliseCCDB(matcher, obj);
119+
uint32_t n = base::GRPGeomHelper::instance().getNHBFPerTF();
120+
LOGP(info, "Setting number of orbits per TF to {}", n);
121+
mDecoder->setOrbitsInTF(n);
122+
}
123+
}
108124
//_________________________________________________________________________________________________
109125
// the decodeTF() function processes the messages generated by the (sub)TimeFrame builder
110126
void decodeTF(framework::ProcessingContext& pc)
@@ -213,6 +229,10 @@ class DataDecoderTask
213229
return;
214230
}
215231

232+
if (mCcdbRequest) {
233+
base::GRPGeomHelper::instance().checkUpdates(pc);
234+
}
235+
216236
static int32_t deltaMax = 0;
217237

218238
auto createBuffer = [&](auto& vec, size_t& size) {
@@ -323,6 +343,7 @@ class DataDecoderTask
323343

324344
std::chrono::duration<double, std::milli> mTimeDecoding{}; ///< timer
325345
std::chrono::duration<double, std::milli> mTimeROFFinder{}; ///< timer
346+
std::shared_ptr<base::GRPGeomRequest> mCcdbRequest;
326347
};
327348

328349
//_________________________________________________________________________________________________
@@ -340,7 +361,14 @@ o2::framework::DataProcessorSpec getDecodingSpec(const char* specName, std::stri
340361
// to be present, even if none of our raw data is present.
341362
inputs.emplace_back("stfDist", "FLP", "DISTSUBTIMEFRAME", 0, o2::framework::Lifetime::Timeframe);
342363
}
343-
o2::mch::raw::DataDecoderTask task(inputSpec);
364+
auto ccdbRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
365+
true, // GRPECS=true
366+
false, // GRPLHCIF
367+
false, // GRPMagField
368+
false, // askMatLUT
369+
o2::base::GRPGeomRequest::None, // geometry
370+
inputs);
371+
o2::mch::raw::DataDecoderTask task(inputSpec, ccdbRequest);
344372
return DataProcessorSpec{
345373
specName,
346374
inputs,

0 commit comments

Comments
 (0)