ATLAS Offline Software
AthenaOutputStreamTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ATHENAOUTPUTSTREAMTOOL_H
6 #define ATHENAOUTPUTSTREAMTOOL_H
7 
12 #include "GaudiKernel/ServiceHandle.h"
13 
16 
17 #include <string>
18 
19 class IClassIDSvc;
20 class IDecisionSvc;
21 class IConversionSvc;
22 class StoreGateSvc;
23 class DataHeader;
24 namespace SG {
25  class IFolder;
26 }
27 
31 class AthenaOutputStreamTool : public extends<::AthAlgTool, IAthenaOutputStreamTool> {
32 public:
34  AthenaOutputStreamTool(const std::string& type,
35  const std::string& name,
36  const IInterface* parent);
38  virtual ~AthenaOutputStreamTool();
39 
43 
47  StatusCode connectServices(const std::string& dataStore,
48  const std::string& cnvSvc,
49  bool extendProvenenceRecord);
50 
54  StatusCode connectOutput(const std::string& outputName = "");
55 
58  StatusCode commitOutput(bool doCommit = false);
59 
63 
67  typedef std::pair<std::string, std::string> TypeKeyPair;
68  typedef std::vector<TypeKeyPair> TypeKeyPairs;
69  virtual StatusCode streamObjects(const TypeKeyPairs& typeKeys, const std::string& outputName = "");
70 
76  typedef std::vector<DataObject*> DataObjectVec;
77  virtual StatusCode streamObjects(const DataObjectVec& dataObjects, const std::string& outputName = "");
78 
79  virtual StatusCode getInputItemList(SG::IFolder* m_p2BWrittenFromTool);
80 
81 private:
83  virtual StatusCode connectServices();
84 
85 private:
86  StringProperty m_outputName{ this, "OutputFile", "", "name of the output db name"};
87  StringProperty m_dataHeaderKey{ this, "DataHeaderKey", "", "name of the data header key: defaults to tool name"};
88  StringProperty m_processTag{ this, "ProcessingTag", "", "tag of processing stage: defaults to SG key of DataHeader (Stream name)"};
89  StringProperty m_outputCollection{ this, "OutputCollection", "", "custom container name prefix for DataHeader: default = "" (will result in \"POOLContainer_\")"};
90  StringProperty m_containerPrefix{ this, "PoolContainerPrefix", "", "prefix for top level POOL container: default = \"CollectionTree\""};
91  StringProperty m_containerNameHint{ this, "TopLevelContainerName", "0", "naming hint policy for top level POOL container: default = \"0\""};
92  StringProperty m_metaDataOutputCollection{ this, "MetaDataOutputCollection", "", "custom container name prefix for MetaDataHeader: default = "" (will result in \"MetaDataHdr\")"};
93  StringProperty m_metaDataContainerPrefix{ this, "MetaDataPoolContainerPrefix", "", "prefix for top level MetaData container: default = "" (will result in \"MetaData\")"};
94  StringProperty m_branchNameHint{ this, "SubLevelBranchName", "0", "naming hint policy for POOL branching: default = \"0\"" };
95  std::string m_outputAttributes{""};
96  std::string m_metaDataOutputAttributes{""};
97  SG::ReadHandleKey<AthenaAttributeList> m_attrListKey{this, "AttributeListKey", "", "optional key for AttributeList to be written as part of the DataHeader: default = \"\""};
98  //SG::WriteHandleKey<AthenaAttributeList> m_attrListWrite{this, "AttributeListWrite", "", "optional key for AttributeList to be written as part of the DataHeader: default = <AttributeListKey>+\"Decisions\""};
99  std::string m_attrListWrite{""};
100 
101  ServiceHandle<StoreGateSvc> m_store{ this, "Store", "StoreGateSvc/DetectorStore", "Pointer to the data store"};
115  bool m_extend;
116 
118  std::set<std::string> m_skippedItems;
119 };
120 
121 #endif
AthenaOutputStreamTool::finalizeOutput
StatusCode finalizeOutput()
Finalize the output stream after the last commit, e.g.
Definition: AthenaOutputStreamTool.cxx:337
AthenaOutputStreamTool::streamObjects
virtual StatusCode streamObjects(const TypeKeyPairs &typeKeys, const std::string &outputName="")
Definition: AthenaOutputStreamTool.cxx:348
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
AthenaOutputStreamTool::m_extend
bool m_extend
Flag to extend attribute list with stream flags from DecisionSvc.
Definition: AthenaOutputStreamTool.h:115
AthenaOutputStreamTool::m_dataHeader
DataHeader * m_dataHeader
Current DataHeader for streamed objects.
Definition: AthenaOutputStreamTool.h:109
AthenaOutputStreamTool::m_skippedItems
std::set< std::string > m_skippedItems
set of skipped item keys, because of missing CLID
Definition: AthenaOutputStreamTool.h:118
AthenaOutputStreamTool::m_metaDataContainerPrefix
StringProperty m_metaDataContainerPrefix
Definition: AthenaOutputStreamTool.h:93
AthenaOutputStreamTool::finalize
StatusCode finalize()
Definition: AthenaOutputStreamTool.cxx:128
AthenaOutputStreamTool::m_processTag
StringProperty m_processTag
Definition: AthenaOutputStreamTool.h:88
SG::ReadHandleKey< AthenaAttributeList >
AthenaOutputStreamTool::connectServices
virtual StatusCode connectServices()
Do the real connection to services.
Definition: AthenaOutputStreamTool.cxx:163
SG::IFolder
a run-time configurable list of data objects
Definition: SGIFolder.h:24
IAthenaOutputStreamTool.h
Interface to an output stream tool.
AthenaOutputStreamTool::m_containerNameHint
StringProperty m_containerNameHint
Definition: AthenaOutputStreamTool.h:91
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
IDecisionSvc
This class defines a protocol to register boolean decisions and.
Definition: IDecisionSvc.h:32
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition: DataHeader.h:124
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthenaOutputStreamTool::m_dataHeaderKey
StringProperty m_dataHeaderKey
Definition: AthenaOutputStreamTool.h:87
AthAlgTool.h
AthenaOutputStreamTool::getInputItemList
virtual StatusCode getInputItemList(SG::IFolder *m_p2BWrittenFromTool)
Definition: AthenaOutputStreamTool.cxx:520
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthenaOutputStreamTool::AthenaOutputStreamTool
AthenaOutputStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard AlgTool Constructor.
Definition: AthenaOutputStreamTool.cxx:43
AthenaOutputStreamTool::m_containerPrefix
StringProperty m_containerPrefix
Definition: AthenaOutputStreamTool.h:90
AthenaOutputStreamTool::TypeKeyPairs
std::vector< TypeKeyPair > TypeKeyPairs
Definition: AthenaOutputStreamTool.h:68
AthenaOutputStreamTool::m_branchNameHint
StringProperty m_branchNameHint
Definition: AthenaOutputStreamTool.h:94
AthenaOutputStreamTool::m_outputCollection
StringProperty m_outputCollection
Definition: AthenaOutputStreamTool.h:89
AthenaOutputStreamTool::m_conversionSvc
ServiceHandle< IConversionSvc > m_conversionSvc
Keep reference to the data conversion service.
Definition: AthenaOutputStreamTool.h:103
AthenaOutputStreamTool::DataObjectVec
std::vector< DataObject * > DataObjectVec
Stream out a vector of objects Must convert to DataObject, e.g.
Definition: AthenaOutputStreamTool.h:76
AthenaOutputStreamTool::m_metaDataOutputCollection
StringProperty m_metaDataOutputCollection
Definition: AthenaOutputStreamTool.h:92
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AthenaOutputStreamTool::m_metaDataOutputAttributes
std::string m_metaDataOutputAttributes
Definition: AthenaOutputStreamTool.h:96
lumiFormat.outputName
string outputName
Definition: lumiFormat.py:65
AthenaOutputStreamTool::m_outputAttributes
std::string m_outputAttributes
Definition: AthenaOutputStreamTool.h:95
AthenaOutputStreamTool::initialize
StatusCode initialize()
AthAlgTool Interface method implementations:
Definition: AthenaOutputStreamTool.cxx:62
AthenaOutputStreamTool::m_attrListKey
SG::ReadHandleKey< AthenaAttributeList > m_attrListKey
Definition: AthenaOutputStreamTool.h:97
AthenaOutputStreamTool::m_extendProvenanceRecord
bool m_extendProvenanceRecord
Flag as to whether to extend provenance via the DataHeader.
Definition: AthenaOutputStreamTool.h:113
AthenaOutputStreamTool::connectOutput
StatusCode connectOutput(const std::string &outputName="")
Connect to the output stream Must connectOutput BEFORE streaming Only specify "outputName" if one wan...
Definition: AthenaOutputStreamTool.cxx:172
AthenaOutputStreamTool::TypeKeyPair
std::pair< std::string, std::string > TypeKeyPair
Stream out objects.
Definition: AthenaOutputStreamTool.h:67
AthenaOutputStreamTool::m_store
ServiceHandle< StoreGateSvc > m_store
Definition: AthenaOutputStreamTool.h:101
AthenaOutputStreamTool::m_connectionOpen
bool m_connectionOpen
Flag to tell whether connectOutput has been called.
Definition: AthenaOutputStreamTool.h:111
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthenaOutputStreamTool::m_clidSvc
ServiceHandle< IClassIDSvc > m_clidSvc
Ref to ClassIDSvc to convert type name to clid.
Definition: AthenaOutputStreamTool.h:105
AthenaOutputStreamTool::m_decSvc
ServiceHandle< IDecisionSvc > m_decSvc
Ref to DecisionSvc.
Definition: AthenaOutputStreamTool.h:107
AthenaOutputStreamTool
This is the implementation of IAthenaOutputStreamTool.
Definition: AthenaOutputStreamTool.h:31
AthenaOutputStreamTool::m_attrListWrite
std::string m_attrListWrite
Definition: AthenaOutputStreamTool.h:99
AthenaOutputStreamTool::commitOutput
StatusCode commitOutput(bool doCommit=false)
Commit the output stream after having streamed out objects Must commitOutput AFTER streaming.
Definition: AthenaOutputStreamTool.cxx:325
AthenaOutputStreamTool::~AthenaOutputStreamTool
virtual ~AthenaOutputStreamTool()
Destructor.
Definition: AthenaOutputStreamTool.cxx:59
ServiceHandle< StoreGateSvc >
AthenaOutputStreamTool::m_outputName
StringProperty m_outputName
Definition: AthenaOutputStreamTool.h:86