Skip to content

Commit 0d156ca

Browse files
authored
Use TimingInfo instead of DataHeader and DataProcessingHeader (AliceO2Group#9374)
In order to extract current TF timing information use pc.services().get<o2::framework::TimingInfo>() instead of accessing DataHeader and DataProcessingHeader of particular input (e.g. via pc.inputs().getFirstValid(true)) Co-authored-by: shahoian <ruben.shahoyan@cern.ch>
1 parent acf837f commit 0d156ca

125 files changed

Lines changed: 202 additions & 236 deletions

File tree

Some content is hidden

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

DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <fmt/format.h>
1717
#include <chrono>
18+
#include "Framework/TimingInfo.h"
1819
#include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h"
1920
#include "CommonDataFormat/TimeStamp.h"
2021
#include "CommonDataFormat/IRFrame.h"
@@ -548,8 +549,7 @@ void RecoContainer::collectData(ProcessingContext& pc, const DataRequest& reques
548549
{
549550
auto& reqMap = requests.requestMap;
550551

551-
const auto* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(pc.inputs().getFirstValid(true));
552-
startIR = {0, dh->firstTForbit};
552+
startIR = {0, pc.services().get<o2::framework::TimingInfo>().firstTForbit};
553553

554554
auto req = reqMap.find("trackITS");
555555
if (req != reqMap.end()) {

DataFormats/Headers/include/Headers/DataHeaderHelpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct fmt::formatter<o2::header::DataHeader> {
7676
fmt::format(" sub spec. : {}\n", (long long unsigned int)h.subSpecification) +
7777
fmt::format(" header size : {}\n", h.headerSize) +
7878
fmt::format(" payloadSize : {}\n", (long long unsigned int)h.payloadSize) +
79-
fmt::format(" firstTFOrbit : {}\n", h.firstTForbit) +
79+
fmt::format(" firstTForbit : {}\n", h.firstTForbit) +
8080
fmt::format(" tfCounter : {}\n", h.tfCounter) +
8181
fmt::format(" runNumber : {}\n", h.runNumber);
8282
return format_to(ctx.out(), "{}", res);

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
12731273
auto caloCellsTRGTableCursor = caloCellsTRGTableBuilder.cursor<o2::aod::CaloTriggers>();
12741274
auto originCursor = originTableBuilder.cursor<o2::aod::Origins>();
12751275

1276-
const auto* dh = o2::header::get<o2::header::DataHeader*>(pc.inputs().getFirstValid(true).header);
1276+
const auto& tinfo = pc.services().get<o2::framework::TimingInfo>();
12771277

12781278
std::unique_ptr<o2::steer::MCKinematicsReader> mcReader;
12791279
if (mUseMC) {
@@ -1286,10 +1286,10 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
12861286
}
12871287

12881288
uint64_t tfNumber;
1289-
const int runNumber = (mRunNumber == -1) ? int(dh->runNumber) : mRunNumber;
1289+
const int runNumber = (mRunNumber == -1) ? int(tinfo.runNumber) : mRunNumber;
12901290
if (mTFNumber == -1L) {
12911291
// TODO has to use absolute time of TF
1292-
tfNumber = uint64_t(dh->firstTForbit) + (uint64_t(dh->runNumber) << 32); // getTFNumber(mStartIR, runNumber);
1292+
tfNumber = uint64_t(tinfo.firstTForbit) + (uint64_t(tinfo.runNumber) << 32); // getTFNumber(mStartIR, runNumber);
12931293
} else {
12941294
tfNumber = mTFNumber;
12951295
}

Detectors/AOD/src/aod-producer-workflow.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
7979
}
8080
}
8181

82-
// configure dpl timer to inject correct firstTFOrbit: start from the 1st orbit of TF containing 1st sampled orbit
82+
// configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
8383
o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
8484

8585
return std::move(specs);

Detectors/Align/Workflow/src/barrel-alignment-workflow.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
103103
if (!disableRootOut) {
104104
}
105105

106-
// configure dpl timer to inject correct firstTFOrbit: start from the 1st orbit of TF containing 1st sampled orbit
106+
// configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
107107
o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
108108

109109
return std::move(specs);

Detectors/Base/src/TFIDInfoHelper.cxx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "Framework/ProcessingContext.h"
1313
#include "Framework/InputRecord.h"
1414
#include "Framework/DataRefUtils.h"
15+
#include "Framework/TimingInfo.h"
1516
#include "Framework/DataProcessingHeader.h"
1617
#include "Headers/DataHeader.h"
1718
#include "DetectorsBase/TFIDInfoHelper.h"
@@ -20,19 +21,17 @@ using namespace o2::framework;
2021

2122
void o2::base::TFIDInfoHelper::fillTFIDInfo(ProcessingContext& pc, o2::dataformats::TFIDInfo& ti)
2223
{
23-
const auto ref = pc.inputs().getFirstValid(true);
24-
const auto* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(ref);
25-
const auto* dph = DataRefUtils::getHeader<DataProcessingHeader*>(ref);
24+
const auto& tinfo = pc.services().get<o2::framework::TimingInfo>();
2625
static int errCount = 0;
27-
if (dh->firstTForbit == -1U || dph->creation == -1) {
26+
if (tinfo.firstTForbit == -1U || tinfo.creation == -1) {
2827
if (errCount++ < 5) {
29-
LOGP(warn, "Ignoring gummy input with orbit {} and creation time {} in fillTFIDInfo", dh->firstTForbit, dph->creation);
28+
LOGP(warn, "Ignoring gummy input with orbit {} and creation time {} in fillTFIDInfo", tinfo.firstTForbit, tinfo.creation);
3029
}
3130
return;
3231
}
33-
ti.firstTForbit = dh->firstTForbit;
34-
ti.tfCounter = dh->tfCounter;
35-
ti.runNumber = dh->runNumber;
36-
ti.startTime = dph->startTime;
37-
ti.creation = dph->creation;
32+
ti.firstTForbit = tinfo.firstTForbit;
33+
ti.tfCounter = tinfo.tfCounter;
34+
ti.runNumber = tinfo.runNumber;
35+
ti.startTime = tinfo.timeslice;
36+
ti.creation = tinfo.creation;
3837
}

Detectors/CPV/workflow/src/RawToDigitConverterSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void RawToDigitConverterSpec::run(framework::ProcessingContext& ctx)
284284
// Loop over BCs, sort digits with increasing digit ID and write to output containers
285285
mOutputDigits.clear();
286286
mOutputTriggerRecords.clear();
287-
const auto tfOrbitFirst = o2::framework::DataRefUtils::getHeader<o2::header::DataHeader*>(ctx.inputs().getFirstValid(true))->firstTForbit;
287+
const auto tfOrbitFirst = ctx.services().get<o2::framework::TimingInfo>().firstTForbit;
288288
const auto& ctpOffsets = o2::ctp::TriggerOffsetsParam::Instance();
289289
for (auto [bc, digits] : digitBuffer) {
290290
if (bc.differenceInBC({0, tfOrbitFirst}) < ctpOffsets.LM_L0) {

Detectors/CPV/workflow/src/cpv-reco-workflow.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext co
8989
cfgc.options().get<std::string>("input-type"),
9090
cfgc.options().get<std::string>("output-type"));
9191

92-
// configure dpl timer to inject correct firstTFOrbit: start from the 1st orbit of TF containing 1st sampled orbit
92+
// configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
9393
o2::raw::HBFUtilsInitializer hbfIni(cfgc, wf);
9494

9595
return wf;

Detectors/CTF/workflow/src/CTFReaderSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void CTFReaderSpec::processTF(ProcessingContext& pc)
249249
LOG(info) << ctfHeader;
250250

251251
auto& timingInfo = pc.services().get<o2::framework::TimingInfo>();
252-
timingInfo.firstTFOrbit = ctfHeader.firstTForbit;
252+
timingInfo.firstTForbit = ctfHeader.firstTForbit;
253253
timingInfo.creation = ctfHeader.creationTime;
254254
timingInfo.tfCounter = ctfHeader.tfCounter;
255255
timingInfo.runNumber = ctfHeader.run;

Detectors/CTF/workflow/src/CTFWriterSpec.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ void CTFWriterSpec::run(ProcessingContext& pc)
390390
prepareTFTreeAndFile();
391391
}
392392
// create header
393-
CTFHeader header{mTimingInfo.runNumber, mTimingInfo.creation, mTimingInfo.firstTFOrbit, mTimingInfo.tfCounter};
393+
CTFHeader header{mTimingInfo.runNumber, mTimingInfo.creation, mTimingInfo.firstTForbit, mTimingInfo.tfCounter};
394394
size_t szCTF = 0;
395395
mSizeReport = "";
396396
szCTF += processDet<o2::itsmft::CTF>(pc, DetID::ITS, header, mCTFTreeOut.get());
@@ -419,7 +419,7 @@ void CTFWriterSpec::run(ProcessingContext& pc)
419419
szCTF += appendToTree(*mCTFTreeOut.get(), "CTFHeader", header);
420420
mAccCTFSize += szCTF;
421421
mCTFTreeOut->SetEntries(++mNAccCTF);
422-
mTFOrbits.push_back(mTimingInfo.firstTFOrbit);
422+
mTFOrbits.push_back(mTimingInfo.firstTForbit);
423423
LOG(info) << "TF#" << mNCTF << ": wrote CTF{" << header << "} of size " << szCTF << " to " << mCurrentCTFFileNameFull << " in " << mTimer.CpuTime() - cput << " s";
424424
if (mNAccCTF > 1) {
425425
LOG(info) << "Current CTF tree has " << mNAccCTF << " entries with total size of " << mAccCTFSize << " bytes";
@@ -500,7 +500,7 @@ void CTFWriterSpec::prepareTFTreeAndFile()
500500
LOGP(info, "Created {} directory for CTFs output", ctfDir);
501501
}
502502
}
503-
mCurrentCTFFileName = o2::base::NameConf::getCTFFileName(mTimingInfo.runNumber, mTimingInfo.firstTFOrbit, mTimingInfo.tfCounter, mHostName);
503+
mCurrentCTFFileName = o2::base::NameConf::getCTFFileName(mTimingInfo.runNumber, mTimingInfo.firstTForbit, mTimingInfo.tfCounter, mHostName);
504504
mCurrentCTFFileNameFull = fmt::format("{}{}", ctfDir, mCurrentCTFFileName);
505505
mCTFFileOut.reset(TFile::Open(fmt::format("{}{}", mCurrentCTFFileNameFull, TMPFileEnding).c_str(), "recreate")); // to prevent premature external usage, use temporary name
506506
mCTFTreeOut = std::make_unique<TTree>(std::string(o2::base::NameConf::CTFTREENAME).c_str(), "O2 CTF tree");
@@ -608,7 +608,7 @@ void CTFWriterSpec::createLockFile(int level)
608608
{
609609
// create lock file for the CTF to be written to the storage of given level
610610
while (1) {
611-
mLockFileName = fmt::format("{}/ctfs{}-{}_{}_{}_{}.lock", LOCKFileDir, level, o2::utils::Str::getRandomString(8), mTimingInfo.runNumber, mTimingInfo.firstTFOrbit, mTimingInfo.tfCounter);
611+
mLockFileName = fmt::format("{}/ctfs{}-{}_{}_{}_{}.lock", LOCKFileDir, level, o2::utils::Str::getRandomString(8), mTimingInfo.runNumber, mTimingInfo.firstTForbit, mTimingInfo.tfCounter);
612612
if (!std::filesystem::exists(mLockFileName)) {
613613
break;
614614
}

0 commit comments

Comments
 (0)