ATLAS Offline Software
SGDeleteAlg.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 "SGDeleteAlg.h"
10 
11 using namespace std;
12 using namespace SG;
13 
14 SGDeleteAlg::SGDeleteAlg(const std::string& name, ISvcLocator* isl) :
15  AthAlgorithm(name, isl),
16  m_targetStore("StoreGateSvc",name),
17  m_toDelete("SG::Folder/ToDelete", this)
18 {
19  declareProperty("TargetStore", m_targetStore,
20  "the store containing the items to be deleted");
21  declareProperty("ToDelete", m_toDelete,
22  "the SG::IFolder with a list of items to be deleted");
23 }
24 
26 {}
27 
30  StatusCode sc;
31  ATH_MSG_VERBOSE("Initializing " << name());
32  (sc=m_targetStore.retrieve()).isSuccess() &&
33  (sc=m_toDelete.retrieve()).isSuccess();
34  return sc;
35 }
36 
39 {
40  ATH_MSG_DEBUG("In execute");
43 
44  while (i != iEnd) {
45  //find proxy matching folder item and reset (delete) its contents
46  DataProxy* p2d(m_targetStore->proxy(i->id(), i->key()));
47  if (0 != p2d) {
48  m_targetStore->clearProxyPayload(p2d);
49  ATH_MSG_VERBOSE("cleared data object "
50  << p2d->clID()
51  << '/' << p2d->name());
52  }
53  ++i;
54  }
55  return StatusCode::SUCCESS;
56 }
SGIFolder.h
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SGDeleteAlg::SGDeleteAlg
SGDeleteAlg(const std::string &name, ISvcLocator *)
Definition: SGDeleteAlg.cxx:14
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:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SGDeleteAlg::~SGDeleteAlg
~SGDeleteAlg()
Definition: SGDeleteAlg.cxx:25
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SGDeleteAlg::m_targetStore
ServiceHandle< StoreGateSvc > m_targetStore
property: the store containing the object in ItemsToDelete
Definition: SGDeleteAlg.h:46
SGDeleteAlg::execute
StatusCode execute()
reset the ItemsToDelete once per event
Definition: SGDeleteAlg.cxx:38
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
SGDeleteAlg::m_toDelete
ToolHandle< SG::IFolder > m_toDelete
property: this is a private Folder called ToDelete.
Definition: SGDeleteAlg.h:50
SG::DataProxy::clID
CLID clID() const
Retrieve clid.
AthAlgorithm
Definition: AthAlgorithm.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SG::DataProxy::name
virtual const name_type & name() const override final
Retrieve data object key == string.
SGDeleteAlg.h
an algorithm that resets the data objects listed in a SG::Folder
SG::DataProxy
Definition: DataProxy.h:44
SGDeleteAlg::initialize
StatusCode initialize()
Definition: SGDeleteAlg.cxx:29
StoreGateSvc.h
DataProxy.h