Skip to content

Commit 9add62c

Browse files
ddobrigkalibuild
andauthored
[Common] Adjust CCDB loading to capture Run 2 GRPObject for MagField (#13384)
Co-authored-by: ALICE Builder <alibuild@users.noreply.github.com>
1 parent 4e0bbc7 commit 9add62c

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

Common/TableProducer/propagationServiceRun2.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ struct propagationServiceRun2 {
9191
ccdb->setCaching(true);
9292
ccdb->setLocalObjectValidityChecking();
9393
ccdb->setURL(ccdburl.value);
94+
ccdb->setFatalWhenNull(false);
9495

9596
// task-specific
9697
strangenessBuilderModule.init(baseOpts, v0BuilderOpts, cascadeBuilderOpts, preSelectOpts, histos, initContext);

Common/Tools/StandardCCDBLoader.h

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <DataFormatsCalibration/MeanVertexObject.h>
2020
#include <DataFormatsParameters/GRPMagField.h>
21+
#include <DataFormatsParameters/GRPObject.h>
2122
#include <DetectorsBase/MatLayerCylSet.h>
2223
#include <DetectorsBase/Propagator.h>
2324
#include <Framework/Configurable.h>
@@ -43,6 +44,7 @@ struct StandardCCDBLoaderConfigurables : o2::framework::ConfigurableGroup {
4344
o2::framework::Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
4445
o2::framework::Configurable<std::string> lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"};
4546
o2::framework::Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
47+
o2::framework::Configurable<std::string> grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"};
4648
o2::framework::Configurable<std::string> mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"};
4749
};
4850

@@ -81,25 +83,36 @@ class StandardCCDBLoader
8183
return;
8284
}
8385

86+
grpmag = ccdb->template getForRun<o2::parameters::GRPMagField>(cGroup.grpmagPath.value, currentRunNumber);
87+
if (grpmag) {
88+
LOG(info) << "Setting global propagator magnetic field to current " << grpmag->getL3Current() << " A for run " << currentRunNumber << " from its GRPMagField CCDB object";
89+
o2::base::Propagator::initFieldFromGRP(grpmag);
90+
} else {
91+
LOGF(info, "GRPMagField object returned nullptr, will attempt alternate method");
92+
93+
o2::parameters::GRPObject* grpo = 0x0;
94+
grpo = ccdb->template getForRun<o2::parameters::GRPObject>(cGroup.grpPath.value, currentRunNumber);
95+
if (!grpo) {
96+
LOG(fatal) << "Alternate path failed! Got nullptr from CCDB for path " << cGroup.grpPath << " of object GRPObject for run " << currentRunNumber;
97+
}
98+
o2::base::Propagator::initFieldFromGRP(grpo);
99+
}
100+
if (getMeanVertex) {
101+
// only try this if explicitly requested
102+
mMeanVtx = ccdb->template getForRun<o2::dataformats::MeanVertexObject>(cGroup.mVtxPath.value, currentRunNumber);
103+
} else {
104+
mMeanVtx = nullptr;
105+
}
106+
84107
// load matLUT for this timestamp
85108
if (!lut) {
86109
LOG(info) << "Loading material look-up table for timestamp: " << currentRunNumber;
87110
lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->template getForRun<o2::base::MatLayerCylSet>(cGroup.lutPath.value, currentRunNumber));
88111
} else {
89112
LOG(info) << "Material look-up table already in place. Not reloading.";
90113
}
91-
92-
grpmag = ccdb->template getForRun<o2::parameters::GRPMagField>(cGroup.grpmagPath.value, currentRunNumber);
93-
LOG(info) << "Setting global propagator magnetic field to current " << grpmag->getL3Current() << " A for run " << currentRunNumber << " from its GRPMagField CCDB object";
94-
o2::base::Propagator::initFieldFromGRP(grpmag);
95114
LOG(info) << "Setting global propagator material propagation LUT";
96115
o2::base::Propagator::Instance()->setMatLUT(lut);
97-
if (getMeanVertex) {
98-
// only try this if explicitly requested
99-
mMeanVtx = ccdb->template getForRun<o2::dataformats::MeanVertexObject>(cGroup.mVtxPath.value, currentRunNumber);
100-
} else {
101-
mMeanVtx = nullptr;
102-
}
103116

104117
runNumber = currentRunNumber;
105118
}

0 commit comments

Comments
 (0)