Skip to content

Commit 9b389d8

Browse files
authored
[Common] Improve CCDB access pattern (#12263)
1 parent 9b3211a commit 9b389d8

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Common/Tasks/centralityStudy.cxx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct centralityStudy {
4747
Service<o2::ccdb::BasicCCDBManager> ccdb;
4848
ctpRateFetcher mRateFetcher;
4949
int mRunNumber;
50+
uint64_t startOfRunTimestamp;
5051

5152
// Configurables
5253
Configurable<bool> do2DPlots{"do2DPlots", true, "0 - no, 1 - yes"};
@@ -256,8 +257,8 @@ struct centralityStudy {
256257

257258
if (doTimeStudies) {
258259
ccdb->setURL(ccdbURL);
259-
ccdb->setCaching(true);
260-
ccdb->setLocalObjectValidityChecking();
260+
// ccdb->setCaching(true);
261+
// ccdb->setLocalObjectValidityChecking();
261262
ccdb->setFatalWhenNull(false);
262263
if (doTimeStudyFV0AOuterVsFT0A3d) {
263264
histos.add((histPath + "h3dFV0AVsTime").c_str(), "", {kTH3F, {{axisDeltaTimestamp, axisMultCoarseFV0A, axisMultCoarseFV0A}}});
@@ -273,6 +274,13 @@ struct centralityStudy {
273274
}
274275

275276
mRunNumber = collision.multRunNumber();
277+
278+
LOGF(info, "Setting up for run: %i", mRunNumber);
279+
280+
// only get object when switching runs
281+
o2::parameters::GRPECSObject* grpo = ccdb->getForRun<o2::parameters::GRPECSObject>(pathGRPECSObject, mRunNumber);
282+
startOfRunTimestamp = grpo->getTimeStart();
283+
276284
histPath = std::format("Run_{}/", mRunNumber);
277285

278286
if (doprocessCollisions || doprocessCollisionsWithCentrality) {
@@ -351,6 +359,7 @@ struct centralityStudy {
351359
// process this collisions
352360
{
353361
initRun(collision);
362+
354363
histos.fill(HIST("hCollisionSelection"), 0); // all collisions
355364
getHist(TH1, histPath + "hCollisionSelection")->Fill(0);
356365

@@ -567,11 +576,9 @@ struct centralityStudy {
567576
}
568577

569578
if (doTimeStudies && collision.has_multBC()) {
570-
initRun(collision);
571579
auto multbc = collision.template multBC_as<aod::MultBCs>();
572580
uint64_t bcTimestamp = multbc.timestamp();
573-
o2::parameters::GRPECSObject* grpo = ccdb->getForTimeStamp<o2::parameters::GRPECSObject>(pathGRPECSObject, bcTimestamp);
574-
uint64_t startOfRunTimestamp = grpo->getTimeStart();
581+
575582
float hoursAfterStartOfRun = static_cast<float>(bcTimestamp - startOfRunTimestamp) / 3600000.0;
576583

577584
getHist(TH2, histPath + "hFT0AVsTime")->Fill(hoursAfterStartOfRun, collision.multFT0A());

0 commit comments

Comments
 (0)