Skip to content

Commit 446b3bf

Browse files
Setting manually magnetic field in AnalysisMuonSelection if not available in ccdb
1 parent d32c1e2 commit 446b3bf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

PWGDQ/Tasks/dqEfficiency_withAssoc.cxx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ struct AnalysisMuonSelection {
768768
Configurable<std::string> fConfigCcdbUrl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
769769
Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
770770
Configurable<int64_t> fConfigNoLaterThan{"ccdb-no-later-than", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
771+
Configurable<float> fConfigMagField{"cfgMagField", 5.0f, "Manually set magnetic field"};
771772
Configurable<std::string> fConfigGeoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
772773

773774
Configurable<std::string> fConfigMCSignals{"cfgMuonMCSignals", "", "Comma separated list of MC signals"};
@@ -879,14 +880,15 @@ struct AnalysisMuonSelection {
879880
void runMuonSelection(ReducedMuonsAssoc const& assocs, TEvents const& events, TMuons const& muons, ReducedMCEvents const& /*eventsMC*/, ReducedMCTracks const& muonsMC)
880881
{
881882
if (events.size() > 0 && fCurrentRun != events.begin().runNumber()) {
882-
/*o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp<o2::parameters::GRPMagField>(grpmagPath, events.begin().timestamp());
883+
o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp<o2::parameters::GRPMagField>(grpmagPath, events.begin().timestamp());
883884
if (grpmag != nullptr) {
884885
o2::base::Propagator::initFieldFromGRP(grpmag);
885886
VarManager::SetMagneticField(grpmag->getNominalL3Field());
886887
} else {
887-
LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp());
888-
}*/
889-
VarManager::SetMagneticField(5.0);
888+
//LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", events.begin().timestamp());
889+
// If the magnetic field is not found it is configured by had by the user
890+
VarManager::SetMagneticField(fConfigMagField.value);
891+
}
890892
fCurrentRun = events.begin().runNumber();
891893
}
892894

0 commit comments

Comments
 (0)