Skip to content

Commit c9517f4

Browse files
committed
ITS: set BCData properly for ROFs
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent e302f5e commit c9517f4

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

Detectors/ITSMFT/ITS/tracking/src/TrackingInterface.cxx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ void ITSTrackingInterface::initialise()
8686

8787
void ITSTrackingInterface::run(framework::ProcessingContext& pc)
8888
{
89+
const auto& par = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance();
8990
if (static bool doneOnce{false}; !doneOnce) {
9091
doneOnce = true;
9192

@@ -94,7 +95,6 @@ void ITSTrackingInterface::run(framework::ProcessingContext& pc)
9495
const int nOrbitsPerTF = o2::base::GRPGeomHelper::getNHBFPerTF();
9596
TimeFrameN::ROFOverlapTableN rofTable;
9697
TimeFrameN::ROFVertexLookupTableN vtxTable;
97-
const auto& par = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance();
9898
const auto& trackParams = mTracker->getParameters();
9999
for (int iLayer = 0; iLayer < NLayers; ++iLayer) {
100100
const unsigned int nROFsPerOrbit = o2::constants::lhc::LHCMaxBunches / par.getROFLengthInBC(iLayer);
@@ -307,14 +307,38 @@ void ITSTrackingInterface::run(framework::ProcessingContext& pc)
307307
// the number of ROFs does not necessarily reflect the actual ROFs
308308
// due to possible delay of other layers, however it is guaranteed to be >=0
309309
// tracks are guaranteed to be sorted here by their lower edge
310-
// NOTE: we are not setting the BCData of these ROFs (should we?)
310+
const auto firstTForbit = pc.services().get<o2::framework::TimingInfo>().firstTForbit;
311+
const auto& clock = mTimeFrame->getROFOverlapTableView().getClock();
311312
const auto& clockLayer = mTimeFrame->getROFOverlapTableView().getClockLayer();
313+
auto setBCData = [&](auto& rofs) {
314+
for (size_t iROF{0}; iROF < rofs.size(); ++iROF) { // set BC data
315+
auto& rof = rofs[iROF];
316+
int orb = (iROF * par.getROFLengthInBC(clock) / o2::constants::lhc::LHCMaxBunches) + firstTForbit;
317+
int bc = (iROF * par.getROFLengthInBC(clock) % o2::constants::lhc::LHCMaxBunches) + par.getROFDelayInBC(clock);
318+
o2::InteractionRecord ir(bc, orb);
319+
rof.setBCData(ir);
320+
rof.setROFrame(iROF);
321+
rof.setNEntries(0);
322+
rof.setFirstEntry(-1);
323+
}
324+
};
312325
int highestROF{0};
313326
{
314327
for (const auto& trc : tracks) {
315328
highestROF = std::max(highestROF, (int)clockLayer.getROF(trc.getTimeStamp().lower()));
316329
}
317330
allTrackROFs.resize(highestROF);
331+
setBCData(allTrackROFs);
332+
for (int iROF{0}; iROF < highestROF; ++iROF) { // set BC data
333+
auto& rof = allTrackROFs[iROF];
334+
int orb = (iROF * par.getROFLengthInBC(clock) / o2::constants::lhc::LHCMaxBunches) + firstTForbit;
335+
int bc = (iROF * par.getROFLengthInBC(clock) % o2::constants::lhc::LHCMaxBunches) + par.getROFDelayInBC(clock);
336+
o2::InteractionRecord ir(bc, orb);
337+
rof.setBCData(ir);
338+
rof.setROFrame(iROF);
339+
rof.setNEntries(0);
340+
rof.setFirstEntry(-1);
341+
}
318342
std::vector<int> rofEntries(highestROF + 1, 0);
319343
for (unsigned int iTrk{0}; iTrk < tracks.size(); ++iTrk) {
320344
auto& trc{tracks[iTrk]};
@@ -345,6 +369,7 @@ void ITSTrackingInterface::run(framework::ProcessingContext& pc)
345369
highestROF = std::max(highestROF, (int)clockLayer.getROF(vtx.getTimeStamp().lower()));
346370
}
347371
vertROFvec.resize(highestROF);
372+
setBCData(vertROFvec);
348373
std::vector<int> rofEntries(highestROF + 1, 0);
349374
for (const auto& vtx : vertices) {
350375
auto rof = clockLayer.getROF(vtx.getTimeStamp().lower());

0 commit comments

Comments
 (0)