ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Athena::RootOutputStreamTool Class Reference

This is the AthenaRoot version of AthenaServices/AthenaOutputStreamTool. More...

#include <RootOutputStreamTool.h>

Inheritance diagram for Athena::RootOutputStreamTool:
Collaboration diagram for Athena::RootOutputStreamTool:

Public Types

typedef std::pair< std::string, std::string > TypeKeyPair
 Stream out objects. More...
 
typedef std::vector< TypeKeyPairTypeKeyPairs
 
typedef std::vector< DataObject * > DataObjectVec
 Stream out a vector of objects Must convert to DataObject, e.g. More...
 

Public Member Functions

 RootOutputStreamTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard AlgTool Constructor. More...
 
virtual ~RootOutputStreamTool ()
 Destructor. More...
 
StatusCode initialize ()
 Gaudi AlgTool Interface method implementations: More...
 
StatusCode finalize ()
 
StatusCode connectServices (const std::string &dataStore, const std::string &cnvSvc, bool extendProvenenceRecord)
 Specify which data store and conversion service to use and whether to extend provenence Only use if one wants to override jobOptions. More...
 
StatusCode connectOutput (const std::string &outputName)
 Connect to the output stream Must connectOutput BEFORE streaming Only specify "outputName" if one wants to override jobOptions. More...
 
StatusCode commitOutput (bool doCommit=false)
 Commit the output stream after having streamed out objects Must commitOutput AFTER streaming. More...
 
StatusCode finalizeOutput ()
 Finalize the output stream after the last commit, e.g. More...
 
StatusCode streamObjects (const IAthenaOutputStreamTool::TypeKeyPairs &typeKeys, const std::string &outputName="")
 Stream out objects. More...
 
StatusCode streamObjects (const IAthenaOutputStreamTool::DataObjectVec &dataObjects, const std::string &outputName="")
 Stream out a vector of objects Must convert to DataObject, e.g. More...
 
StatusCode fillObjectRefs (const IAthenaOutputStreamTool::DataObjectVec &dataObjects)
 Fill refs of an object - done as second iteration over objects, after streamObject. More...
 
StatusCode getInputItemList (SG::IFolder *m_p2BWrittenFromTool)
 Get ItemList from the OutputStreamTool (e.g. all input objects) More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Gaudi boilerplate. More...
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

 RootOutputStreamTool ()
 Default constructor: More...
 
 RootOutputStreamTool (const RootOutputStreamTool &)
 
RootOutputStreamTooloperator= (const RootOutputStreamTool &)
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ServiceHandle< ::StoreGateSvcm_storeSvc
 ServiceHandle to the data store service. More...
 
ServiceHandle< ::IConversionSvc > m_conversionSvc
 ServiceHandle to the data conversion service. More...
 
ServiceHandle< ::IClassIDSvc > m_clidSvc
 ServiceHandle to clid service. More...
 
std::string m_outputName
 Name of the output file. More...
 
std::string m_treeName
 Name of the output tuple. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

This is the AthenaRoot version of AthenaServices/AthenaOutputStreamTool.

Definition at line 33 of file RootOutputStreamTool.h.

Member Typedef Documentation

◆ DataObjectVec

typedef std::vector< DataObject* > IAthenaOutputStreamTool::DataObjectVec
inherited

Stream out a vector of objects Must convert to DataObject, e.g.


#include "AthenaKernel/StorableConversions.h" T* obj = xxx; DataObject* dataObject = SG::asStorable(obj);

Definition at line 107 of file IAthenaOutputStreamTool.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

◆ TypeKeyPair

typedef std::pair<std::string, std::string> IAthenaOutputStreamTool::TypeKeyPair
inherited

Stream out objects.

Provide vector of typeName/key pairs. If key is empty, assumes only one object and this will fail if there is more than one

Definition at line 98 of file IAthenaOutputStreamTool.h.

◆ TypeKeyPairs

typedef std::vector< TypeKeyPair > IAthenaOutputStreamTool::TypeKeyPairs
inherited

Definition at line 99 of file IAthenaOutputStreamTool.h.

Constructor & Destructor Documentation

◆ RootOutputStreamTool() [1/3]

Athena::RootOutputStreamTool::RootOutputStreamTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Standard AlgTool Constructor.

Definition at line 33 of file RootOutputStreamTool.cxx.

33  :
35  m_storeSvc("StoreGateSvc", name),
36  m_conversionSvc("Athena::RootCnvSvc/AthenaRootCnvSvc", name),
37  m_clidSvc("ClassIDSvc", name) {
38  // Declare IAthenaOutputStreamTool interface
39  declareInterface<IAthenaOutputStreamTool>(this);
40  // Properties
41  declareProperty("Store", m_storeSvc, "Store from which to stream out event data");
42  declareProperty("TreeName", m_treeName = "CollectionTree", "Name of the output event tree");
43  declareProperty("OutputFile", m_outputName, "Name of the output file");
44 }

◆ ~RootOutputStreamTool()

Athena::RootOutputStreamTool::~RootOutputStreamTool ( )
virtual

Destructor.

Definition at line 46 of file RootOutputStreamTool.cxx.

46  {
47 }

◆ RootOutputStreamTool() [2/3]

Athena::RootOutputStreamTool::RootOutputStreamTool ( )
private

Default constructor:

◆ RootOutputStreamTool() [3/3]

Athena::RootOutputStreamTool::RootOutputStreamTool ( const RootOutputStreamTool )
private

Member Function Documentation

◆ commitOutput()

StatusCode Athena::RootOutputStreamTool::commitOutput ( bool  doCommit = false)
virtual

Commit the output stream after having streamed out objects Must commitOutput AFTER streaming.

Implements IAthenaOutputStreamTool.

Definition at line 112 of file RootOutputStreamTool.cxx.

112  {
113  ATH_MSG_VERBOSE("commitOutput");
114  if (m_outputName.empty()) {
115  ATH_MSG_ERROR("Unable to commit, no output connected.");
116  return StatusCode::FAILURE;
117  }
118  // Connect the output file to the service
119  if (!m_conversionSvc->commitOutput(m_outputName, false).isSuccess()) {
120  ATH_MSG_ERROR("Unable to commit output " << m_outputName);
121  return StatusCode::FAILURE;
122  } else {
123  ATH_MSG_DEBUG("Committed: " << m_outputName);
124  }
125  m_outputName.clear();
126  return StatusCode::SUCCESS;
127 }

◆ connectOutput()

StatusCode Athena::RootOutputStreamTool::connectOutput ( const std::string &  outputName)
virtual

Connect to the output stream Must connectOutput BEFORE streaming Only specify "outputName" if one wants to override jobOptions.

Implements IAthenaOutputStreamTool.

Definition at line 94 of file RootOutputStreamTool.cxx.

94  {
95  ATH_MSG_VERBOSE("connectOutput outputName = [" << outputName <<"]");
96  // Set output file name property
97  if (!outputName.empty()) {
99  } else {
100  return StatusCode::FAILURE;
101  }
102  // Connect the output file to the service
103  if (!m_conversionSvc->connectOutput(m_outputName + "(" + m_treeName + ")", "recreate").isSuccess()) {
104  ATH_MSG_ERROR("Unable to connect output " << m_outputName);
105  return StatusCode::FAILURE;
106  } else {
107  ATH_MSG_DEBUG("Connected to " << m_outputName);
108  }
109  return StatusCode::SUCCESS;
110 }

◆ connectServices()

StatusCode Athena::RootOutputStreamTool::connectServices ( const std::string &  dataStore,
const std::string &  cnvSvc,
bool  extendProvenenceRecord 
)
virtual

Specify which data store and conversion service to use and whether to extend provenence Only use if one wants to override jobOptions.

Implements IAthenaOutputStreamTool.

Definition at line 80 of file RootOutputStreamTool.cxx.

80  {
81  ATH_MSG_VERBOSE("connectServices dataStore = " << dataStore << ", cnvSvc = " << cnvSvc << ", extendProv = " << extendProvenenceRecord);
82  // Release the old data store service
83  if (m_storeSvc != 0) {
84  if (!m_storeSvc.release().isSuccess()) {
85  ATH_MSG_WARNING("Could not release " << m_storeSvc.type() << " store.");
86  }
87  }
88  m_storeSvc = ServiceHandle<StoreGateSvc>(dataStore, this->name());
89  // Get the data store service
90  ATH_CHECK(m_storeSvc.retrieve());
91  return StatusCode::SUCCESS;
92 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ fillObjectRefs()

StatusCode Athena::RootOutputStreamTool::fillObjectRefs ( const IAthenaOutputStreamTool::DataObjectVec dataObjects)

Fill refs of an object - done as second iteration over objects, after streamObject.

Definition at line 223 of file RootOutputStreamTool.cxx.

223  {
224  ATH_MSG_VERBOSE("fillObjectRefs");
225  return StatusCode::SUCCESS;
226 }

◆ finalize()

StatusCode Athena::RootOutputStreamTool::finalize ( )

Definition at line 62 of file RootOutputStreamTool.cxx.

62  {
63  // Release the data store service
64  if (m_storeSvc != 0) {
65  if (!m_storeSvc.release().isSuccess()) {
66  ATH_MSG_WARNING("Could not release " << m_storeSvc.type() << " store.");
67  }
68  }
69  // Release the conversion service
70  if (!m_conversionSvc.release().isSuccess()) {
71  ATH_MSG_WARNING("Cannot release conversion service.");
72  }
73  // Release the ClassID service
74  if (!m_clidSvc.release().isSuccess()) {
75  ATH_MSG_WARNING("Cannot release ClassID service.");
76  }
78 }

◆ finalizeOutput()

StatusCode Athena::RootOutputStreamTool::finalizeOutput ( )
virtual

Finalize the output stream after the last commit, e.g.

in finalize

Implements IAthenaOutputStreamTool.

Definition at line 129 of file RootOutputStreamTool.cxx.

129  {
130  ATH_MSG_VERBOSE("finalizeOutput");
131  return StatusCode::SUCCESS;
132 }

◆ getInputItemList()

StatusCode Athena::RootOutputStreamTool::getInputItemList ( SG::IFolder m_p2BWrittenFromTool)
virtual

Get ItemList from the OutputStreamTool (e.g. all input objects)

Implements IAthenaOutputStreamTool.

Definition at line 228 of file RootOutputStreamTool.cxx.

228  {
229  ATH_MSG_VERBOSE("getInputItemList");
230  return StatusCode::SUCCESS;
231 }

◆ initialize()

StatusCode Athena::RootOutputStreamTool::initialize ( )

Gaudi AlgTool Interface method implementations:

Definition at line 49 of file RootOutputStreamTool.cxx.

49  {
50  ATH_MSG_INFO("Initializing " << name());
51  if (!::AthAlgTool::initialize().isSuccess()) {
52  ATH_MSG_FATAL("Cannot initialize AlgTool base class.");
53  return StatusCode::FAILURE;
54  }
55  // Get the ClassID service
56  ATH_CHECK(m_clidSvc.retrieve());
57  // Get the conversion service
58  ATH_CHECK(m_conversionSvc.retrieve());
59  return StatusCode::SUCCESS;
60 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & IAthenaOutputStreamTool::interfaceID ( )
inlinestaticinherited

Gaudi boilerplate.

Definition at line 119 of file IAthenaOutputStreamTool.h.

119  {
120  static const InterfaceID IID("IAthenaOutputStreamTool", 1, 0);
121  return IID;
122 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ operator=()

RootOutputStreamTool& Athena::RootOutputStreamTool::operator= ( const RootOutputStreamTool )
private

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ streamObjects() [1/2]

StatusCode Athena::RootOutputStreamTool::streamObjects ( const IAthenaOutputStreamTool::DataObjectVec dataObjects,
const std::string &  outputName = "" 
)
virtual

Stream out a vector of objects Must convert to DataObject, e.g.

#include "AthenaKernel/StorableConversions.h" T* obj = xxx; DataObject* dataObject = SG::asStorable(obj);

Implements IAthenaOutputStreamTool.

Definition at line 173 of file RootOutputStreamTool.cxx.

174  {
175  ATH_MSG_VERBOSE("streamObjects(dobjs)");
176  if (m_outputName.empty()) {
177  ATH_MSG_ERROR("Unable to commit, no output connected.");
178  return StatusCode::FAILURE;
179  }
180  ATH_MSG_VERBOSE("streaming out... [" << m_conversionSvc.typeAndName() << "]");
181  std::set<DataObject*> written;
182  for (std::vector<DataObject*>::const_iterator doIter = dataObjects.begin(), doLast = dataObjects.end();
183  doIter != doLast; ++doIter) {
184  ATH_MSG_VERBOSE(" --> [" << (*doIter)->clID() << "/" << (*doIter)->name() << "]...");
185  // Do not stream out same object twice
186  if (written.find(*doIter) != written.end()) {
187  // Print warning and skip
188  ATH_MSG_DEBUG("Trying to write DataObject twice (clid/key): " << (*doIter)->clID() << ", " << (*doIter)->name());
189  ATH_MSG_DEBUG(" Skipping this one.");
190  } else {
191  written.insert(*doIter);
192  // Write object
193  IOpaqueAddress* addr = 0;
194  if ((m_conversionSvc->createRep(*doIter, addr)).isSuccess()) {
195  IRegistry* ireg = (*doIter)->registry();
196  // FIXME: that's a wild hack to handle RootBranchAddress's stickyness.
197  // if the transient address already has a RootBranchAddress (ie: it was
198  // read from a d3pd-file) calling setAddress will invalidate the
199  // previous RBA which will screw things up the next time around.
200  // The real fix would probably involve changing a bit the logic either
201  // in convsvc::createRep above, or -rather- have the side effect of
202  // properly setting up the RootConnection (in createRep) be explicitly
203  // written somewhere. (here?)
204  if (dynamic_cast<RootBranchAddress*>(ireg->address())) {
205  delete addr; addr = 0;
206  } else {
207  ireg->setAddress(addr);
208  }
209  // SG::DataProxy* proxy = dynamic_cast<SG::DataProxy*>((*doIter)->registry());
210  // if (!proxy) {
211  // ATH_MSG_WARNING("Could cast DataObject "
212  // << (*doIter)->clID() << " " << (*doIter)->name());
213  // }
214  } else {
215  ATH_MSG_ERROR("Could not create Rep for DataObject (clid/key): " << (*doIter)->clID() << ", " << (*doIter)->name());
216  return StatusCode::FAILURE;
217  }
218  }
219  }
220  return StatusCode::SUCCESS;
221 }

◆ streamObjects() [2/2]

StatusCode Athena::RootOutputStreamTool::streamObjects ( const IAthenaOutputStreamTool::TypeKeyPairs typeKeys,
const std::string &  outputName = "" 
)
virtual

Stream out objects.

Provide vector of typeName/key pairs. If key is empty, assumes only one object and this will fail if there is more than one

Implements IAthenaOutputStreamTool.

Definition at line 134 of file RootOutputStreamTool.cxx.

134  {
135  ATH_MSG_VERBOSE("streamObjects(type/keys)...");
136  // Now iterate over the type/key pairs and stream out each object
137  std::vector<DataObject*> dataObjects;
138  dataObjects.reserve(typeKeys.size());
139  for (IAthenaOutputStreamTool::TypeKeyPairs::const_iterator first = typeKeys.begin(), last = typeKeys.end();
140  first != last; ++first) {
141  const std::string& type = (*first).first;
142  const std::string& key = (*first).second;
143  // Find the clid for type name from the classIDSvc
144  CLID clid = 0;
145  if (!m_clidSvc->getIDOfTypeName(type, clid).isSuccess()) {
146  ATH_MSG_ERROR("Could not get clid for typeName " << type);
147  return StatusCode::FAILURE;
148  }
149  DataObject* dObj = 0;
150  // Two options: no key or explicit key
151  if (key.empty()) {
152  ATH_MSG_DEBUG("Get data object with no key");
153  // Get DataObject without key
154  dObj = m_storeSvc->accessData(clid);
155  } else {
156  ATH_MSG_DEBUG("Get data object with key");
157  // Get DataObjects with key
158  dObj = m_storeSvc->accessData(clid, key);
159  }
160  if (dObj == 0) {
161  // No object - print warning and continue with next object
162  ATH_MSG_WARNING("No object found for type " << type << " key " << key);
163  continue;
164  } else {
165  ATH_MSG_DEBUG("Found object for type " << type << " key " << key);
166  }
167  // Save the dObj
168  dataObjects.push_back(dObj);
169  }
170  return this->streamObjects(dataObjects, outputName);
171 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_clidSvc

ServiceHandle< ::IClassIDSvc> Athena::RootOutputStreamTool::m_clidSvc
private

ServiceHandle to clid service.

Definition at line 93 of file RootOutputStreamTool.h.

◆ m_conversionSvc

ServiceHandle< ::IConversionSvc> Athena::RootOutputStreamTool::m_conversionSvc
private

ServiceHandle to the data conversion service.

Definition at line 91 of file RootOutputStreamTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_outputName

std::string Athena::RootOutputStreamTool::m_outputName
private

Name of the output file.

Definition at line 96 of file RootOutputStreamTool.h.

◆ m_storeSvc

ServiceHandle< ::StoreGateSvc> Athena::RootOutputStreamTool::m_storeSvc
private

ServiceHandle to the data store service.

Definition at line 89 of file RootOutputStreamTool.h.

◆ m_treeName

std::string Athena::RootOutputStreamTool::m_treeName
private

Name of the output tuple.

Definition at line 99 of file RootOutputStreamTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
initialize
void initialize()
Definition: run_EoverP.cxx:894
Athena::RootOutputStreamTool::m_outputName
std::string m_outputName
Name of the output file.
Definition: RootOutputStreamTool.h:96
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
Athena::RootOutputStreamTool::m_storeSvc
ServiceHandle< ::StoreGateSvc > m_storeSvc
ServiceHandle to the data store service.
Definition: RootOutputStreamTool.h:89
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Athena::RootOutputStreamTool::m_clidSvc
ServiceHandle< ::IClassIDSvc > m_clidSvc
ServiceHandle to clid service.
Definition: RootOutputStreamTool.h:93
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
lumiFormat.outputName
string outputName
Definition: lumiFormat.py:71
Athena::RootOutputStreamTool::streamObjects
StatusCode streamObjects(const IAthenaOutputStreamTool::TypeKeyPairs &typeKeys, const std::string &outputName="")
Stream out objects.
Definition: RootOutputStreamTool.cxx:134
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DeMoScan.first
bool first
Definition: DeMoScan.py:534
Athena::RootOutputStreamTool::m_treeName
std::string m_treeName
Name of the output tuple.
Definition: RootOutputStreamTool.h:99
Athena::RootOutputStreamTool::m_conversionSvc
ServiceHandle< ::IConversionSvc > m_conversionSvc
ServiceHandle to the data conversion service.
Definition: RootOutputStreamTool.h:91
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
ServiceHandle< StoreGateSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37