Skip to content

Commit 9b124fd

Browse files
author
Prottay Das
committed
updated table with SOR time
1 parent 1388606 commit 9b124fd

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

PWGLF/TableProducer/Common/zdcvector.cxx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ struct zdcvector {
113113
Configurable<bool> storeZdcTime{"storeZdcTime", true, "Store timestamp and time from first event of run"};
114114

115115
RCTFlagsChecker rctChecker;
116-
std::unordered_map<int, uint64_t> runStartTime;
117116

118117
void init(o2::framework::InitContext&)
119118
{
@@ -177,6 +176,8 @@ struct zdcvector {
177176
TH2D* gainprofile = nullptr;
178177
TProfile* gainprofilevxy = nullptr;
179178

179+
int runNumberForSOR = -1;
180+
uint64_t sorTimestamp = 0;
180181
// int lastRunNumberTimeRec = -999;
181182
// for time since start of run
182183
// int runForStartTime = -999;
@@ -230,14 +231,23 @@ struct zdcvector {
230231
auto bc = collision.foundBC_as<BCsRun3>();
231232
const uint64_t timestampzdc = bc.timestamp(); // in milliseconds
232233

234+
if (currentRunNumber != runNumberForSOR) {
235+
236+
auto runDuration = ccdb->getRunDuration(currentRunNumber, true);
237+
sorTimestamp = static_cast<uint64_t>(runDuration.first);
238+
runNumberForSOR = currentRunNumber;
239+
240+
LOGF(info,
241+
"Run %d: SOR timestamp = %llu ms",
242+
currentRunNumber,
243+
static_cast<unsigned long long>(sorTimestamp));
244+
}
245+
233246
float timeInMinutes = 0.f;
234247

235-
auto itStart = runStartTime.find(currentRunNumber);
236-
if (itStart == runStartTime.end()) {
237-
runStartTime[currentRunNumber] = timestampzdc;
238-
timeInMinutes = 0.f;
239-
} else {
240-
timeInMinutes = static_cast<float>(timestampzdc - itStart->second) / 60000.f;
248+
if (timestampzdc >= sorTimestamp && sorTimestamp > 0) {
249+
timeInMinutes =
250+
static_cast<float>(timestampzdc - sorTimestamp) / 60000.f;
241251
}
242252

243253
// Helper to keep your early-return structure unchanged.

0 commit comments

Comments
 (0)