Skip to content

Commit

Permalink
Improve AggregatedRunInfo: prioritize use of CTP/Calib/FirstRunOrbit
Browse files Browse the repository at this point in the history
use CTP/Calib/FirstRunOrbit when available. Otherwise fallback to
RunInformation.
  • Loading branch information
sawenzel committed Oct 9, 2024
1 parent 015c38a commit 75428c7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions DataFormats/Parameters/src/AggregatedRunInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,22 @@ o2::parameters::AggregatedRunInfo AggregatedRunInfo::buildAggregatedRunInfo(o2::
// adjust to the nearest TF edge to satisfy condition (orbitSOR % nOrbitsPerTF == 0)
orbitSOR = orbitSOR / nOrbitsPerTF * nOrbitsPerTF;

// fetch SOR directly from CTP entry on CCDB
bool oldFatalState = ccdb.getFatalWhenNull();
ccdb.setFatalWhenNull(false);
auto ctp_first_run_orbit = ccdb.getForTimeStamp<std::vector<int64_t>>("CTP/Calib/FirstRunOrbit", run_mid_timestamp);
ccdb.setFatalWhenNull(oldFatalState);
if (ctp_first_run_orbit) {
// if we have CTP first run orbit available, we should probably use it
int64_t ctp_orbitSOR = int64_t(((*ctp_first_run_orbit)[0] - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS);
ctp_orbitSOR = int64_t(ctp_orbitSOR / nOrbitsPerTF * nOrbitsPerTF); // align to timeframe boundary

// overwrite orbitSOR
orbitSOR = ctp_orbitSOR;

// overwrite SOR (otherwise inconsistent)
sor = (*ctp_first_run_orbit)[0] / 1000;
}

return AggregatedRunInfo{runnumber, sor, eor, nOrbitsPerTF, tsOrbitReset, orbitSOR, orbitEOR};
}

0 comments on commit 75428c7

Please sign in to comment.