ATLAS Offline Software
SGAccessAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "SGTools/DataProxy.h"
6 #include "SGTools/SGIFolder.h"
8 
9 #include "SGAccessAlg.h"
10 
11 SGAccessAlg::SGAccessAlg(const std::string& name, ISvcLocator* isl) :
12  AthAlgorithm(name, isl),
13  m_targetStore("StoreGateSvc",name),
14  m_toLoad("SG::Folder/ToLoad", this)
15 {
16  declareProperty("TargetStore",
18  "the store containing the items to be loaded");
19  declareProperty("ToLoad",
20  m_toLoad,
21  "the SG::IFolder with a list of items to be loaded");
22 }
23 
25 {}
26 
29 {
30  StatusCode sc;
31  ATH_MSG_VERBOSE("Initializing " << name());
32 
33  (sc=m_targetStore.retrieve()).isSuccess() &&
34  (sc=m_toLoad.retrieve()).isSuccess();
35  return sc;
36 }
37 
40 {
41  ATH_MSG_DEBUG("In execute");
44 
45  while (i != iEnd) {
46  ATH_MSG_DEBUG("loading [" << i->id() << "#" << i->key() << "]...");
47  //find proxy matching folder item and access its contents
48  SG::DataProxy* p = m_targetStore->proxy(i->id(), i->key());
49  if (0 != p) {
50  DataObject *dobj = p->accessData();
51  ATH_MSG_VERBOSE("loaded data object "
52  << p->clID()
53  << '/' << p->name()
54  << " @" << dobj);
55  if (0 == dobj) {
56  ATH_MSG_INFO("problem loading data object ["
57  << i->id() << "#" << i->key() << "]!");
58  }
59  }
60  ++i;
61  }
62  return StatusCode::SUCCESS;
63 }
SGAccessAlg::m_targetStore
ServiceHandle< StoreGateSvc > m_targetStore
property: the store containing the object in ItemsToLoad
Definition: SGAccessAlg.h:45
SGIFolder.h
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
SG::IFolder::const_iterator
ItemList::const_iterator const_iterator
Definition: SGIFolder.h:32
SGAccessAlg::execute
StatusCode execute()
loads the ItemsToLoad once per event
Definition: SGAccessAlg.cxx:39
SGAccessAlg::m_toLoad
ToolHandle< SG::IFolder > m_toLoad
property: this is a private Folder called ToLoad.
Definition: SGAccessAlg.h:49
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SGAccessAlg::initialize
StatusCode initialize()
Definition: SGAccessAlg.cxx:28
SGAccessAlg.h
an algorithm that loads data objects listed in a SG::Folder
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SGAccessAlg::SGAccessAlg
SGAccessAlg(const std::string &name, ISvcLocator *)
Definition: SGAccessAlg.cxx:11
AthAlgorithm
Definition: AthAlgorithm.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SGAccessAlg::~SGAccessAlg
~SGAccessAlg()
Definition: SGAccessAlg.cxx:24
SG::DataProxy
Definition: DataProxy.h:44
StoreGateSvc.h
DataProxy.h