Commit 630c64cf authored by R D Schaffer's avatar R D Schaffer
Browse files

fixes to allow setting map current to zero and then not reading in the map

parent e2b08657
......@@ -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:
......
......@@ -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
}
......@@ -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;
}
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment