Skip to content

Commit 98dd408

Browse files
authored
Common: move mult/cent table producers to getForRun CCDB queries (AliceO2Group#8017)
* Common: move mult/cent table producers to getForRun CCDB queries * Further improvements
1 parent 946ebb1 commit 98dd408

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

Common/TableProducer/centralityTable.cxx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,21 @@ struct CentralityTable {
249249
/* check the previous run number */
250250
auto bc = collision.bc_as<BCsWithTimestampsAndRun2Infos>();
251251
if (bc.runNumber() != mRunNumber) {
252+
mRunNumber = bc.runNumber(); // mark that this run has been attempted already regardless of outcome
252253
LOGF(debug, "timestamp=%llu", bc.timestamp());
253254
TList* callst = nullptr;
254255
if (ccdbConfig.reconstructionPass.value == "") {
255-
callst = ccdb->getForTimeStamp<TList>(ccdbConfig.ccdbPath, bc.timestamp());
256+
callst = ccdb->getForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber());
256257
} else if (ccdbConfig.reconstructionPass.value == "metadata") {
257258
std::map<std::string, std::string> metadata;
258259
metadata["RecoPassName"] = metadataInfo.get("RecoPassName");
259-
callst = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
260+
LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName"));
261+
callst = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber(), metadata);
260262
} else {
261263
std::map<std::string, std::string> metadata;
262264
metadata["RecoPassName"] = ccdbConfig.reconstructionPass.value;
263-
callst = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
265+
LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", ccdbConfig.reconstructionPass.value);
266+
callst = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber(), metadata);
264267
}
265268

266269
Run2V0MInfo.mCalibrationStored = false;
@@ -350,15 +353,11 @@ struct CentralityTable {
350353
LOGF(fatal, "Calibration information from CL1 multiplicity for run %d corrupted", bc.runNumber());
351354
}
352355
}
353-
if (Run2V0MInfo.mCalibrationStored || Run2V0AInfo.mCalibrationStored || Run2SPDTksInfo.mCalibrationStored || Run2SPDClsInfo.mCalibrationStored || Run2CL0Info.mCalibrationStored || Run2CL1Info.mCalibrationStored) {
354-
mRunNumber = bc.runNumber();
355-
}
356356
} else {
357357
if (!ccdbConfig.doNotCrashOnNull) { // default behaviour: crash
358358
LOGF(fatal, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp());
359359
} else { // only if asked: continue filling with non-valid values (105)
360360
LOGF(info, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu, will fill tables with dummy values", bc.runNumber(), bc.timestamp());
361-
mRunNumber = bc.runNumber();
362361
}
363362
}
364363
}
@@ -473,6 +472,7 @@ struct CentralityTable {
473472
/* check the previous run number */
474473
auto bc = collision.template bc_as<BCsWithTimestamps>();
475474
if (bc.runNumber() != mRunNumber) {
475+
mRunNumber = bc.runNumber(); // mark that this run has been attempted already regardless of outcome
476476
LOGF(info, "timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber());
477477
TList* callst = nullptr;
478478
// Check if the ccdb path is a root file
@@ -485,15 +485,17 @@ struct CentralityTable {
485485
}
486486
} else {
487487
if (ccdbConfig.reconstructionPass.value == "") {
488-
callst = ccdb->getForTimeStamp<TList>(ccdbConfig.ccdbPath, bc.timestamp());
488+
callst = ccdb->getForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber());
489489
} else if (ccdbConfig.reconstructionPass.value == "metadata") {
490490
std::map<std::string, std::string> metadata;
491491
metadata["RecoPassName"] = metadataInfo.get("RecoPassName");
492-
callst = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
492+
LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName"));
493+
callst = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber(), metadata);
493494
} else {
494495
std::map<std::string, std::string> metadata;
495496
metadata["RecoPassName"] = ccdbConfig.reconstructionPass.value;
496-
callst = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
497+
LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", ccdbConfig.reconstructionPass.value);
498+
callst = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, bc.runNumber(), metadata);
497499
}
498500
}
499501

@@ -555,13 +557,11 @@ struct CentralityTable {
555557
break;
556558
}
557559
}
558-
mRunNumber = bc.runNumber();
559560
} else {
560561
if (!ccdbConfig.doNotCrashOnNull) { // default behaviour: crash
561562
LOGF(fatal, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp());
562563
} else { // only if asked: continue filling with non-valid values (105)
563564
LOGF(info, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu, will fill tables with dummy values", bc.runNumber(), bc.timestamp());
564-
mRunNumber = bc.runNumber();
565565
}
566566
}
567567
}

Common/TableProducer/multiplicityTable.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,17 @@ struct MultiplicityTable {
379379
if (bc.runNumber() != mRunNumber) {
380380
mRunNumber = bc.runNumber(); // mark this run as at least tried
381381
if (ccdbConfig.reconstructionPass.value == "") {
382-
lCalibObjects = ccdb->getForTimeStamp<TList>(ccdbConfig.ccdbPath, bc.timestamp());
382+
lCalibObjects = ccdb->getForRun<TList>(ccdbConfig.ccdbPath, mRunNumber);
383383
} else if (ccdbConfig.reconstructionPass.value == "metadata") {
384384
std::map<std::string, std::string> metadata;
385385
metadata["RecoPassName"] = metadataInfo.get("RecoPassName");
386-
lCalibObjects = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
386+
LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName"));
387+
lCalibObjects = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, mRunNumber, metadata);
387388
} else {
388389
std::map<std::string, std::string> metadata;
389390
metadata["RecoPassName"] = ccdbConfig.reconstructionPass.value;
390-
lCalibObjects = ccdb->getSpecific<TList>(ccdbConfig.ccdbPath, bc.timestamp(), metadata);
391+
LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", ccdbConfig.reconstructionPass.value);
392+
lCalibObjects = ccdb->getSpecificForRun<TList>(ccdbConfig.ccdbPath, mRunNumber, metadata);
391393
}
392394

393395
if (lCalibObjects) {

0 commit comments

Comments
 (0)