diff --git a/Control/StoreGate/StoreGate/ReadCondHandle.h b/Control/StoreGate/StoreGate/ReadCondHandle.h index 48fb8bdb139507dad19ee9c6ec1f462eae5499f8..e4204c08fb16f32664956a29706d5d14954720f5 100644 --- a/Control/StoreGate/StoreGate/ReadCondHandle.h +++ b/Control/StoreGate/StoreGate/ReadCondHandle.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef STOREGATE_READCONDHANDLE_H @@ -27,6 +27,17 @@ namespace SG { + + /** + * @brief Report a conditions container lookup failure. + * @param cc The conditions container. + * @param eid The time for which to search. + * @param The key corresponding to the conditions container. + */ + void ReadCondHandleNotFound (const CondContBase& cc, + const EventIDBase& eid, + const std::string& key); + template <typename T> class ReadCondHandle { @@ -162,14 +173,7 @@ namespace SG { if (m_obj != 0) return true; if ( ATH_UNLIKELY(!m_cc->find(m_eid, m_obj, &m_range)) ) { - std::ostringstream ost; - m_cc->list(ost); - MsgStream msg(Athena::getMessageSvc(), "ReadCondHandle"); - msg << MSG::ERROR - << "ReadCondHandle: could not find current EventTime " - << m_eid << " for key " << m_hkey.objKey() << "\n" - << ost.str() - << endmsg; + ReadCondHandleNotFound (*m_cc, m_eid, m_hkey.objKey()); m_obj = nullptr; return false; } @@ -212,14 +216,7 @@ namespace SG { // pointer_type obj(0); const_pointer_type cobj(0); if (! (m_cc->find(eid, cobj) ) ) { - std::ostringstream ost; - m_cc->list(ost); - MsgStream msg(Athena::getMessageSvc(), "ReadCondHandle"); - msg << MSG::ERROR - << "ReadCondHandle::retrieve() could not find EventTime " - << eid << " for key " << m_hkey.objKey() << "\n" - << ost.str() - << endmsg; + ReadCondHandleNotFound (*m_cc, eid, m_hkey.objKey()); return nullptr; } diff --git a/Control/StoreGate/src/ReadCondHandle.cxx b/Control/StoreGate/src/ReadCondHandle.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d8b91911523ff92d418e973d1bdb9ac61761715d --- /dev/null +++ b/Control/StoreGate/src/ReadCondHandle.cxx @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +/** + * @file StoreGate/src/ReadCondHandle.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Oct, 2020 + * @brief Out-of-line implementations for ReadCondHandle. + */ + +#include "StoreGate/ReadCondHandle.h" + + +namespace SG { + + +/** + * @brief Report a conditions container lookup failure. + * @param cc The conditions container. + * @param eid The time for which to search. + * @param The key corresponding to the conditions container. + */ +void ReadCondHandleNotFound (const CondContBase& cc, + const EventIDBase& eid, + const std::string& key) +{ + std::ostringstream ost; + cc.list(ost); + MsgStream msg(Athena::getMessageSvc(), "ReadCondHandle"); + msg << MSG::ERROR + << "ReadCondHandle::retrieve() could not find EventTime " + << eid << " for key " << key << "\n" + << ost.str() + << endmsg; +} + + +} // namespace SG