ATLAS Offline Software
Loading...
Searching...
No Matches
ForceLoadCondObj.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// ForceLoadCondObj.cxx
6
8#include "GaudiKernel/IClassIDSvc.h"
9#include "GaudiKernel/MsgStream.h"
11
12
14
16 ATH_MSG_DEBUG ("in initialize()" );
17 ATH_CHECK( p_clidsvc.retrieve() );
18 return StatusCode::SUCCESS;
19}
20
21StatusCode ForceLoadCondObj::execute(const EventContext&) const {
22 //Loop through objects
23 for (unsigned int iobj=0;iobj<m_objectList.size();++iobj) {
24 // if object name contains a '#', it represents a specific typename#key
25 std::string::size_type ihash=m_objectList[iobj].find_first_of('#');
26 if (ihash==std::string::npos) {
27 ATH_MSG_ERROR ( "Expected syntax 'object#key' for property ObjectList, got" << m_objectList[iobj] );
28 return StatusCode::FAILURE;
29 }
30 std::string::size_type ihash2=m_objectList[iobj].find_first_of('#',ihash+1);
31 if (ihash2 != std::string::npos) ihash2-=(1+ihash);
32 const std::string objName=m_objectList[iobj].substr(0,ihash);
33 const std::string objKey=m_objectList[iobj].substr(ihash+1,ihash2);
34
35 ATH_MSG_INFO ( "Retrieving object " << objName << ", key " << objKey );
36
37 CLID clid;
38 ATH_CHECK( p_clidsvc->getIDOfTypeName(objName,clid) );
39
40 SG::DataProxy* proxy=detStore()->proxy(clid,objKey);
41
42 if (!proxy) {
43 ATH_MSG_ERROR ( "Could not find proxy for object of type " << objName << " with key " << objKey );
44 return StatusCode::FAILURE;
45 }
46
47 if (proxy->accessData()!=nullptr) { //This should trigger the conversion
48 ATH_MSG_INFO ( "Sucessfully retrieved object of type " << objName << " with key " << objKey );
49 }
50 }
51 return StatusCode::SUCCESS;
52}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
uint32_t CLID
The Class ID type.
const ServiceHandle< StoreGateSvc > & detStore() const
virtual ~ForceLoadCondObj()
ServiceHandle< IClassIDSvc > p_clidsvc
StringArrayProperty m_objectList
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override