diff --git a/MagneticField/MagFieldConditions/MagFieldConditions/AtlasFieldCacheCondObj.h b/MagneticField/MagFieldConditions/MagFieldConditions/AtlasFieldCacheCondObj.h index f0a75517d5ff6a306631e65d2059a343da05773a..61e5be32d80b329fb1d83330a6713e884437dc26 100644 --- a/MagneticField/MagFieldConditions/MagFieldConditions/AtlasFieldCacheCondObj.h +++ b/MagneticField/MagFieldConditions/MagFieldConditions/AtlasFieldCacheCondObj.h @@ -37,7 +37,7 @@ public: const MagField::AtlasFieldMap* fieldMap() const { return m_fieldMap; } /** set values for field scale and service to be able to build the cache **/ - bool initialize(double solFieldScale, double torFieldScale, + void initialize(double solFieldScale, double torFieldScale, const MagField::AtlasFieldMap* fieldMap); private: diff --git a/MagneticField/MagFieldConditions/src/AtlasFieldCacheCondObj.cxx b/MagneticField/MagFieldConditions/src/AtlasFieldCacheCondObj.cxx index d78140314c8c22c45900b9879d5adb1a5c12d1fd..6539ae91be73ae181b076319799891dafbada432 100644 --- a/MagneticField/MagFieldConditions/src/AtlasFieldCacheCondObj.cxx +++ b/MagneticField/MagFieldConditions/src/AtlasFieldCacheCondObj.cxx @@ -9,7 +9,7 @@ AtlasFieldCacheCondObj::AtlasFieldCacheCondObj() AtlasFieldCacheCondObj::~AtlasFieldCacheCondObj() {} -bool +void AtlasFieldCacheCondObj::initialize(double solFieldScale, double torFieldScale, const MagField::AtlasFieldMap* fieldMap) @@ -18,6 +18,5 @@ AtlasFieldCacheCondObj::initialize(double solFieldScale, m_solFieldScale = solFieldScale; m_torFieldScale = torFieldScale; m_fieldMap = fieldMap; - return (m_fieldMap) != nullptr; // return false if cast failed } diff --git a/MagneticField/MagFieldServices/src/AtlasFieldCacheCondAlg.cxx b/MagneticField/MagFieldServices/src/AtlasFieldCacheCondAlg.cxx index f246e474820c2990639aaa6bb2bc3a61644f6c21..423716477a267d4db65df94900a0ac2447dccb6c 100644 --- a/MagneticField/MagFieldServices/src/AtlasFieldCacheCondAlg.cxx +++ b/MagneticField/MagFieldServices/src/AtlasFieldCacheCondAlg.cxx @@ -116,13 +116,9 @@ MagField::AtlasFieldCacheCondAlg::execute(const EventContext& ctx) const { auto fieldCondObj = std::make_unique<AtlasFieldCacheCondObj>(); // initialize cond obj with current scale factors and the field svc (needed to setup cache) - if (!fieldCondObj->initialize(cache.m_solScaleFactor, - cache.m_torScaleFactor, - fieldMap)) { - ATH_MSG_ERROR("execute: Could not initialize conditions field object with solenoid/toroid currents " - << cache.m_solScaleFactor << "," << cache.m_torScaleFactor); - return StatusCode::FAILURE; - } + fieldCondObj->initialize(cache.m_solScaleFactor, + cache.m_torScaleFactor, + fieldMap); // Record in conditions store the conditions object with scale factors and map pointer for cache if(writeHandle.record(cache.m_condObjOutputRange, std::move(fieldCondObj)).isFailure()) { @@ -134,7 +130,12 @@ MagField::AtlasFieldCacheCondAlg::execute(const EventContext& ctx) const { ATH_MSG_INFO ( "execute: initialized AtlasFieldCacheCondObj and cache with SFs - sol/tor " << cache.m_solScaleFactor << "/" << cache.m_torScaleFactor ); - ATH_MSG_INFO ( "execute: solenoid zone id " << fieldMap->solenoidZoneId()); + if (fieldMap) { + ATH_MSG_INFO ( "execute: solenoid zone id " << fieldMap->solenoidZoneId()); + } + else { + ATH_MSG_INFO ( "execute: no map read (currents == 0"); + } return StatusCode::SUCCESS; } diff --git a/MagneticField/MagFieldServices/src/AtlasFieldMapCondAlg.cxx b/MagneticField/MagFieldServices/src/AtlasFieldMapCondAlg.cxx index 4d15b83660bb8916d3b974b0f050b84291818fe6..fcefb86070bbbe66d4ce786742ad23467596ad53 100644 --- a/MagneticField/MagFieldServices/src/AtlasFieldMapCondAlg.cxx +++ b/MagneticField/MagFieldServices/src/AtlasFieldMapCondAlg.cxx @@ -97,15 +97,20 @@ MagField::AtlasFieldMapCondAlg::execute(const EventContext& ctx) const { ATH_CHECK( updateFieldMap(ctx, cache) ); - - ATH_MSG_INFO ( "execute: solenoid zone id " << cache.m_fieldMap->solenoidZoneId()); + if (cache.m_fieldMap) { + ATH_MSG_INFO ( "execute: solenoid zone id " << cache.m_fieldMap->solenoidZoneId()); + } + else { + ATH_MSG_INFO ( "execute: no map read (currents == 0"); + } + // Save newly created map in conditions object, and record it in the conditions store, with its // own range auto fieldMapCondObj = std::make_unique<AtlasFieldMapCondObj>(); // move ownership of the field map to the fieldMapCondObj - fieldMapCondObj->setFieldMap(std::move(cache.m_fieldMap)); + if (cache.m_fieldMap) fieldMapCondObj->setFieldMap(std::move(cache.m_fieldMap)); if(mapWriteHandle.record(cache.m_mapCondObjOutputRange, std::move(fieldMapCondObj)).isFailure()) { ATH_MSG_ERROR("execute: Could not record AtlasFieldMapCondObj object with " << mapWriteHandle.key() @@ -202,7 +207,7 @@ MagField::AtlasFieldMapCondAlg::updateFieldMap(const EventContext& ctx, Cache& c cache.m_mapCondObjOutputRange = rangeW; ATH_MSG_INFO("updateFieldMap: useMapsFromCOOL == false, using default range " << rangeW); } - + // We allow to set currents via the TagInfoMgr which adds tags to the TagInfo object - only allowed for offline if (m_useMapsFromCOOL) { @@ -235,7 +240,7 @@ MagField::AtlasFieldMapCondAlg::updateFieldMap(const EventContext& ctx, Cache& c ATH_MSG_INFO("updateFieldMap: tagInfoH " << tagInfoH.fullKey() << " is NOT valid. "); } } - + // Select map file according to the value of the currents which indicate which map is 'on' // determine the map to load