Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions Common/TableProducer/trackPropagation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "CommonUtils/NameConf.h"
#include "CCDB/CcdbApi.h"
#include "DataFormatsParameters/GRPObject.h"
#include "DataFormatsParameters/GRPMagField.h"
#include "CCDB/BasicCCDBManager.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/runDataProcessing.h"
Expand Down Expand Up @@ -61,13 +62,16 @@ struct TrackPropagation {

const o2::dataformats::MeanVertexObject* mVtx = nullptr;
o2::parameters::GRPObject* grpo = nullptr;
o2::parameters::GRPMagField* grpmag = nullptr;
o2::base::MatLayerCylSet* lut = nullptr;

Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Configurable<std::string> lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"};
Configurable<std::string> geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
Configurable<std::string> grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"};
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
Configurable<std::string> mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"};
Configurable<bool> checkGRPObject{"checkGRPObject", false, "Flag to check the CCDB for GRPObject before asking for the GRPMagField"};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, why not simply making it empty by default and use it if not?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I want to have the feature that the CCDB will not be checked and will get directly the new structure.
This is because the old GRP structure will be translated to the new one


void init(o2::framework::InitContext& initContext)
{
Expand All @@ -93,16 +97,34 @@ struct TrackPropagation {
if (!o2::base::GeometryManager::isGeometryLoaded()) {
ccdb->get<TGeoManager>(geoPath);
}
if (checkGRPObject) {
ccdb->setFatalWhenNull(false);
}
}

void initCCDB(aod::BCsWithTimestamps::iterator const& bc)
{
if (runNumber == bc.runNumber()) {
return;
}
grpo = ccdb->getForTimeStamp<o2::parameters::GRPObject>(grpPath, bc.timestamp());
LOGF(info, "Setting magnetic field to %d kG for run %d from its GRP CCDB object", grpo->getNominalL3Field(), bc.runNumber());
o2::base::Propagator::initFieldFromGRP(grpo);
if (checkGRPObject) {
grpo = ccdb->getForTimeStamp<o2::parameters::GRPObject>(grpPath, bc.timestamp());
if (!grpo) {
grpmag = ccdb->getForTimeStamp<o2::parameters::GRPMagField>(grpmagPath, bc.timestamp());
if (!grpmag) {
LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << bc.timestamp();
}
LOGF(info, "Setting magnetic field to current %d A for run %d from its GRPMagField CCDB object", grpmag->getL3Current(), bc.runNumber());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use the "detail" level for log by default, unless you really care about having the message during real production.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, however this is the same level of info that was present before, this is also important information that should be printed once per run i.e. once per job ideally

o2::base::Propagator::initFieldFromGRP(grpmag);
} else {
LOGF(info, "Setting magnetic field to %d kG for run %d from its GRP CCDB object", grpo->getNominalL3Field(), bc.runNumber());
o2::base::Propagator::initFieldFromGRP(grpo);
}
} else {
grpmag = ccdb->getForTimeStamp<o2::parameters::GRPMagField>(grpmagPath, bc.timestamp());
LOG(info) << "Setting magnetic field to current " << grpmag->getL3Current() << " A for run " << bc.runNumber() << " from its GRPMagField CCDB object";
o2::base::Propagator::initFieldFromGRP(grpmag);
}
o2::base::Propagator::Instance()->setMatLUT(lut);
mVtx = ccdb->getForTimeStamp<o2::dataformats::MeanVertexObject>(mVtxPath, bc.timestamp());
runNumber = bc.runNumber();
Expand Down