Skip to content

Commit 4196497

Browse files
authored
Remove hacks to extract TF 1st orbit (#5709)
1 parent 90912b9 commit 4196497

File tree

5 files changed

+12
-65
lines changed

5 files changed

+12
-65
lines changed

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,12 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
457457

458458
findMinMaxBc(ft0RecPoints, primVertices, mcRecords);
459459

460-
// TODO: determine the beginning of a TF in case when there are no reconstructed vertices
460+
const auto* dh = o2::header::get<o2::header::DataHeader*>(pc.inputs().getByPos(0).header);
461+
o2::InteractionRecord startIR = {0, dh->firstTForbit};
462+
461463
uint64_t firstVtxGlBC = minGlBC;
462-
uint64_t startBCofTF = 0;
463-
if (primVertices.empty()) {
464-
auto startIRofTF = o2::raw::HBFUtils::Instance().getFirstIRofTF(primVertices[0].getIRMin());
465-
startBCofTF = startIRofTF.orbit * o2::constants::lhc::LHCMaxBunches + startIRofTF.bc;
466-
firstVtxGlBC = std::round(startBCofTF + primVertices[0].getTimeStamp().getTimeStamp() / o2::constants::lhc::LHCBunchSpacingMS);
467-
}
464+
uint64_t startBCofTF = startIR.toLong();
465+
firstVtxGlBC = std::round(startBCofTF + primVertices[0].getTimeStamp().getTimeStamp() / o2::constants::lhc::LHCBunchSpacingMS);
468466

469467
uint64_t tfNumber;
470468
int runNumber = 244918; // TODO: get real run number

Detectors/GlobalTracking/src/RecoContainer.cxx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ void RecoContainer::collectData(ProcessingContext& pc, const DataRequest& reques
172172
{
173173
auto& reqMap = requests.requestMap;
174174

175-
/// RS FIXME: this will not work until the framework does not propagate the dh->firstTForbit
176175
const auto* dh = o2::header::get<o2::header::DataHeader*>(pc.inputs().getByPos(0).header);
177176
startIR = {0, dh->firstTForbit};
178177

@@ -231,11 +230,6 @@ void RecoContainer::addITSTracks(ProcessingContext& pc, bool mc)
231230
if (mc) {
232231
tracksMCPool.registerContainer(pc.inputs().get<gsl::span<o2::MCCompLabel>>("trackITSMCTR"), GTrackID::ITS);
233232
}
234-
//RSTODO: below is a hack, to remove once the framework will start propagating the header.firstTForbit
235-
const auto tracksITSROF = getITSTracksROFRecords<o2::itsmft::ROFRecord>();
236-
if (tracksITSROF.size()) {
237-
startIR = o2::raw::HBFUtils::Instance().getFirstIRofTF(tracksITSROF[0].getBCData());
238-
}
239233
}
240234

241235
//____________________________________________________________

Detectors/GlobalTrackingWorkflow/src/TPCITSMatchingSpec.cxx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,9 @@ void TPCITSMatchingDPL::run(ProcessingContext& pc)
160160
mMatching.setFITInfoInp(fitInfo);
161161
}
162162

163-
const auto* dh = o2::header::get<o2::header::DataHeader*>(pc.inputs().get("trackITSROF").header);
163+
const auto* dh = o2::header::get<o2::header::DataHeader*>(pc.inputs().getByPos(0).header);
164164
mMatching.setStartIR({0, dh->firstTForbit});
165165

166-
//RSTODO: below is a hack, to remove once the framework will start propagating the header.firstTForbit
167-
if (tracksITSROF.size()) {
168-
mMatching.setStartIR(o2::raw::HBFUtils::Instance().getFirstIRofTF(tracksITSROF[0].getBCData()));
169-
}
170-
171166
mMatching.run();
172167

173168
pc.outputs().snapshot(Output{"GLO", "TPCITS", 0, Lifetime::Timeframe}, mMatching.getMatchedTracks());

Detectors/TOF/workflow/src/CompressedDecodingTask.cxx

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,6 @@ void CompressedDecodingTask::postData(ProcessingContext& pc)
109109
DigitHeader& digitH = mDecoder.getDigitHeader();
110110
pc.outputs().snapshot(Output{o2::header::gDataOriginTOF, "DIGITHEADER", 0, Lifetime::Timeframe}, digitH);
111111

112-
// RS this is a hack to be removed once we have correct propagation of the firstTForbit by the framework
113-
auto setFirstTFOrbit = [&](const Output& spec, uint32_t orb) {
114-
auto* hd = pc.outputs().findMessageHeader(spec);
115-
if (!hd) {
116-
throw std::runtime_error(o2::utils::concat_string("failed to find output message header for ", spec.origin.str, "/", spec.description.str, "/", std::to_string(spec.subSpec)));
117-
}
118-
hd->firstTForbit = orb;
119-
};
120-
121-
setFirstTFOrbit(Output{o2::header::gDataOriginTOF, "DIGITS", 0, Lifetime::Timeframe}, mInitOrbit);
122-
setFirstTFOrbit(Output{o2::header::gDataOriginTOF, "READOUTWINDOW", 0, Lifetime::Timeframe}, mInitOrbit);
123-
124112
mDecoder.clear();
125113

126114
mNTF++;
@@ -132,13 +120,10 @@ void CompressedDecodingTask::run(ProcessingContext& pc)
132120
{
133121
mTimer.Start(false);
134122

135-
if (pc.inputs().getNofParts(0) && !mConetMode && 0) { // it doesn't work
136-
//RS set the 1st orbit of the TF from the O2 header, relying on rdhHandler is not good (in fact, the RDH might be eliminated in the derived data)
137-
const auto* dh = o2::header::get<o2::header::DataHeader*>(pc.inputs().getByPos(0).header);
138-
mInitOrbit = dh->firstTForbit;
139-
}
140-
141-
// mDecoder.setFirstIR({0, mInitOrbit});
123+
//RS set the 1st orbit of the TF from the O2 header, relying on rdhHandler is not good (in fact, the RDH might be eliminated in the derived data)
124+
const auto* dh = o2::header::get<o2::header::DataHeader*>(pc.inputs().getByPos(0).header);
125+
mInitOrbit = dh->firstTForbit;
126+
mDecoder.setFirstIR({0, mInitOrbit});
142127

143128
/** loop over inputs routes **/
144129
for (auto iit = pc.inputs().begin(), iend = pc.inputs().end(); iit != iend; ++iit) {
@@ -178,16 +163,6 @@ void CompressedDecodingTask::headerHandler(const CrateHeader_t* crateHeader, con
178163
{
179164
if (mConetMode) {
180165
LOG(DEBUG) << "Crate found" << crateHeader->drmID;
181-
182-
mInitOrbit = crateOrbit->orbitID;
183-
if (mCurrentOrbit > 0) {
184-
mInitOrbit = mCurrentOrbit;
185-
}
186-
187-
if (mNCrateOpenTF == 0) {
188-
mDecoder.setFirstIR({0, mInitOrbit});
189-
}
190-
191166
mNCrateOpenTF++;
192167
}
193168
}
@@ -350,10 +325,6 @@ void CompressedDecodingTask::rdhHandler(const o2::header::RAWDataHeader* rdh)
350325
const auto& rdhr = *rdh;
351326
// set first orbtìt here (to be check in future), please not remove this!!!
352327
mCurrentOrbit = RDHUtils::getHeartBeatOrbit(rdhr);
353-
if (mNCrateOpenTF == 0) {
354-
mInitOrbit = mCurrentOrbit;
355-
mDecoder.setFirstIR({0, mInitOrbit});
356-
}
357328

358329
// rdh close
359330
if (RDHUtils::getStop(rdhr) && RDHUtils::getHeartBeatOrbit(rdhr) == o2::raw::HBFUtils::Instance().getNOrbitsPerTF() - 1 + mInitOrbit) {

Detectors/TOF/workflow/src/TOFClusterizerSpec.cxx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,8 @@ class TOFDPLClustererTask
7777
auto digits = pc.inputs().get<gsl::span<o2::tof::Digit>>("tofdigits");
7878
auto row = pc.inputs().get<std::vector<o2::tof::ReadoutWindowData>*>("readoutwin");
7979

80-
//auto header = o2::header::get<o2::header::DataHeader*>(pc.inputs().get("tofdigits").header);
81-
82-
if (row->size() > 0) {
83-
mClusterer.setFirstOrbit(row->at(0).mFirstIR.orbit);
84-
}
85-
86-
//RSTODO: below is a hack, to remove once the framework will start propagating the header.firstTForbit
87-
//Here I extract the orbit/BC from the abs.BC, since the triggerer orbit/bunch are not set. Then why they are needed?
88-
// if (digits.size()) {
89-
// auto bcabs = digits[0].getBC();
90-
// auto ir0 = o2::raw::HBFUtils::Instance().getFirstIRofTF({uint16_t(bcabs % Geo::BC_IN_ORBIT), uint32_t(bcabs / Geo::BC_IN_ORBIT)});
91-
// mClusterer.setFirstOrbit(ir0.orbit);
92-
// }
80+
const auto* dh = o2::header::get<o2::header::DataHeader*>(pc.inputs().getByPos(0).header);
81+
mClusterer.setFirstOrbit(dh->firstTForbit);
9382

9483
auto labelvector = std::make_shared<std::vector<o2::dataformats::MCTruthContainer<o2::MCCompLabel>>>();
9584
if (mUseMC) {

0 commit comments

Comments
 (0)