Skip to content
Snippets Groups Projects
Commit 55c340e4 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

MagFieldServices: remove redundant regHandle calls

Remove redundant `regHandle` calls and some minor code cleanup.
parent 5e9af3c7
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
# Declare the package name:
atlas_subdir( MagFieldServices )
......@@ -12,7 +12,7 @@ atlas_add_component( MagFieldServices
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaPoolUtilities CxxUtils EventInfoMgtLib GaudiKernel MagFieldConditions MagFieldElements MagFieldInterfaces PathResolver StoreGateLib )
LINK_LIBRARIES ${CLHEP_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps AthenaPoolUtilities EventInfoMgtLib GaudiKernel MagFieldConditions MagFieldElements MagFieldInterfaces PathResolver StoreGateLib )
# Install files from the package:
atlas_install_headers( MagFieldServices )
......
......@@ -12,12 +12,9 @@
// FrameWork includes
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "GaudiKernel/ICondSvc.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
// #include "MagFieldInterfaces/IMTMagFieldSvc.h"
#include "MagFieldConditions/AtlasFieldCacheCondObj.h"
#include "MagFieldConditions/AtlasFieldMapCondObj.h"
......@@ -122,10 +119,6 @@ private:
"UseToroCurrent",
20400.,
"Set actual toroid current (A)" };
ServiceHandle<ICondSvc> m_condSvc{ this,
"CondSvc",
"CondSvc",
"conditions service" };
};
}
......
......@@ -12,12 +12,9 @@
// FrameWork includes
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "GaudiKernel/ICondSvc.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
// #include "MagFieldInterfaces/IMTMagFieldSvc.h"
#include "MagFieldConditions/AtlasFieldMapCondObj.h"
namespace MagField {
......@@ -158,10 +155,6 @@ private:
"Name of the COOL folder containing magnet currents"
};
ServiceHandle<ICondSvc> m_condSvc{ this,
"CondSvc",
"CondSvc",
"conditions service" };
};
}
......
......@@ -34,10 +34,6 @@ MagField::AtlasFieldCacheCondAlg::~AtlasFieldCacheCondAlg() = default;
StatusCode
MagField::AtlasFieldCacheCondAlg::initialize()
{
// CondSvc
ATH_CHECK(m_condSvc.retrieve());
// Read Handle for the current
ATH_CHECK(m_currInputKey.initialize(m_useDCS));
......@@ -47,20 +43,11 @@ MagField::AtlasFieldCacheCondAlg::initialize()
// Output handle for scale factors/cache
ATH_CHECK(m_condObjOutputKey.initialize());
// Register write handle for scale factors/cache
if (m_condSvc->regHandle(this, m_condObjOutputKey).isFailure()) {
ATH_MSG_ERROR("Unable to register WriteCondHandle "
<< m_condObjOutputKey.fullKey() << " with CondSvc");
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Initialize: Key " << m_condObjOutputKey.fullKey()
<< " has been succesfully registered ");
ATH_MSG_INFO("Initialize: Key " << m_condObjOutputKey.fullKey()
<< " has been succesfully registered ");
if (m_useDCS) {
ATH_MSG_INFO("Initialize: Will update current from conditions"); //
} else {
ATH_MSG_INFO("Initialize: Will update current from parameters");
}
ATH_MSG_INFO("Initialize: Will update current from " <<
(m_useDCS ? "conditions" : "parameters"));
ATH_MSG_INFO("Initialize: useDCS, useSoleCurrent, useToroCurrent. "
<< (int)m_useDCS << ", " << m_useSoleCurrent << ", "
......
......@@ -40,10 +40,6 @@ MagField::AtlasFieldMapCondAlg::~AtlasFieldMapCondAlg() = default;
StatusCode
MagField::AtlasFieldMapCondAlg::initialize()
{
// CondSvc
ATH_CHECK(m_condSvc.retrieve());
// Read Handle for the map
ATH_CHECK(m_mapsInputKey.initialize(m_useMapsFromCOOL));
......@@ -53,20 +49,11 @@ MagField::AtlasFieldMapCondAlg::initialize()
// Output handle for the field map
ATH_CHECK(m_mapCondObjOutputKey.initialize());
// Register write handles for scale factors/cache and the field map
if (m_condSvc->regHandle(this, m_mapCondObjOutputKey).isFailure()) {
ATH_MSG_ERROR("Unable to register WriteCondHandle "
<< m_mapCondObjOutputKey.fullKey() << " with CondSvc");
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Initialize: Key " << m_mapCondObjOutputKey.fullKey()
<< " has been succesfully registered ");
ATH_MSG_INFO("Initialize: Key " << m_mapCondObjOutputKey.fullKey()
<< " has been succesfully registered ");
if (m_useMapsFromCOOL) {
ATH_MSG_INFO("Initialize: Will update the field map from conditions");
} else {
ATH_MSG_INFO("Initialize: Will update the field map from jobOpt file name");
}
ATH_MSG_INFO("Initialize: Will update the field map from " <<
(m_useMapsFromCOOL ? "conditions" : "jobOpt file name") );
// Load these dictionaries now, so we don't need to try to do so
// while multiple threads are running.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment