ATLAS Offline Software
RootNtupleOutputStream.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef ATHENAROOTCOMPS_ROOTNTUPLEOUTPUTSTREAM_H
8 #define ATHENAROOTCOMPS_ROOTNTUPLEOUTPUTSTREAM_H
9 
10 // STL include files
11 #include <memory>
12 #include <map>
13 #include <set>
14 #include <vector>
15 #include <string>
16 
17 // fwk includes
18 #include "GaudiKernel/IDataSelector.h"
19 #include "GaudiKernel/ClassID.h"
20 #include "GaudiKernel/ServiceHandle.h"
21 #include "GaudiKernel/ToolHandle.h"
22 #include "GaudiKernel/IIncidentListener.h"
24 
25 // forward declarations
26 template <class ConcreteAlgorithm> class AlgFactory;
27 class IClassIDSvc;
28 class StoreGateSvc;
30 class IAthenaOutputTool;
31 
32 namespace SG {
33  class DataProxy;
34  class IFolder;
35  class FolderItem;
36 }
37 
38 namespace Athena {
39 
47  : virtual public IIncidentListener,
48  public FilteredAlgorithm
49 {
51 
52 public:
53  typedef std::vector<SG::DataProxy*> Items;
54 
55 protected:
58  ServiceHandle<StoreGateSvc> m_dataStore;
59 
61  std::string m_persName;
63  StringProperty m_writingTool;
65  std::string m_outputName;
67  StringProperty m_processTag;
68 
69  typedef ServiceHandle<IClassIDSvc> IClassIDSvc_t;
71 
73  StringArrayProperty m_itemList;
75  IDataSelector m_objects;
82  std::vector<unsigned int> m_exemptPersToPers;
91 
96 
98  std::vector<SG::FolderItem> m_selection;
99 
101  ToolHandle<IAthenaOutputStreamTool> m_streamer;
103  ToolHandleArray<IAthenaOutputTool> m_helperTools;
104 
105 public:
106  typedef std::vector<std::pair<std::string, std::string> > TypeKeyPairs;
107 
109  RootNtupleOutputStream(const std::string& name, ISvcLocator* pSvcLocator);
111  virtual ~RootNtupleOutputStream();
112 
114 
115  virtual StatusCode initialize();
116  virtual StatusCode finalize();
117  virtual StatusCode execute();
119  virtual StatusCode write();
121 
122 private:
124  void clearSelection();
126  void collectAllObjects();
128  IDataSelector* selectedObjects() {
129  return &m_objects;
130  }
132  void handle(const Incident& incident);
133 };
134 
135 } //> ns Athena
136 
137 #endif // ATHENAROOTCOMPS_ROOTNTUPLEOUTPUTSTREAM_H
Athena::RootNtupleOutputStream::m_streamer
ToolHandle< IAthenaOutputStreamTool > m_streamer
pointer to AthenaOutputStreamTool
Definition: RootNtupleOutputStream.h:101
Athena::RootNtupleOutputStream::selectedObjects
IDataSelector * selectedObjects()
Return the list of selected objects.
Definition: RootNtupleOutputStream.h:128
FilteredAlgorithm
algorithm that marks for write data objects in SG
Definition: FilteredAlgorithm.h:33
FilteredAlgorithm.h
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Athena::RootNtupleOutputStream::m_writeOnFinalize
bool m_writeOnFinalize
set to true to trigger streaming of data on finalize()
Definition: RootNtupleOutputStream.h:88
Athena::RootNtupleOutputStream::collectAllObjects
void collectAllObjects()
Collect data objects for output streamer list.
Definition: RootNtupleOutputStream.cxx:296
IAthenaOutputStreamTool
This is a tool that allows streaming out of DataObjects. This has been factorized out from AthenaOutp...
Definition: IAthenaOutputStreamTool.h:69
Athena::RootNtupleOutputStream::m_exemptPersToPers
std::vector< unsigned int > m_exemptPersToPers
Definition: RootNtupleOutputStream.h:82
Athena::RootNtupleOutputStream::m_writeOnExecute
bool m_writeOnExecute
set to true to trigger streaming of data on execute()
Definition: RootNtupleOutputStream.h:86
Athena::RootNtupleOutputStream::TypeKeyPairs
std::vector< std::pair< std::string, std::string > > TypeKeyPairs
Definition: RootNtupleOutputStream.h:106
Athena::RootNtupleOutputStream::m_events
int m_events
Number of events written to this output stream.
Definition: RootNtupleOutputStream.h:77
Athena::RootNtupleOutputStream::m_dynamicItemList
bool m_dynamicItemList
dynamic output itemlist: if enabled rediscover object list to be written out at each event otherwise:...
Definition: RootNtupleOutputStream.h:95
Athena::RootNtupleOutputStream::clearSelection
void clearSelection()
Clear list of selected objects.
Definition: RootNtupleOutputStream.cxx:287
Athena::RootNtupleOutputStream::Items
std::vector< SG::DataProxy * > Items
Definition: RootNtupleOutputStream.h:53
Athena::RootNtupleOutputStream::m_objects
IDataSelector m_objects
Collection of objects beeing selected.
Definition: RootNtupleOutputStream.h:75
Athena::RootNtupleOutputStream::handle
void handle(const Incident &incident)
Incident service handle listening for MetaDataStop.
Definition: RootNtupleOutputStream.cxx:152
Athena::RootNtupleOutputStream::execute
virtual StatusCode execute()
Definition: RootNtupleOutputStream.cxx:212
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
Athena::RootNtupleOutputStream::m_writingTool
StringProperty m_writingTool
Name of the OutputStreamTool used for writing.
Definition: RootNtupleOutputStream.h:63
Athena::RootNtupleOutputStream::finalize
virtual StatusCode finalize()
Definition: RootNtupleOutputStream.cxx:187
Athena::RootNtupleOutputStream::m_itemList
StringArrayProperty m_itemList
Vector of item names.
Definition: RootNtupleOutputStream.h:73
Athena::RootNtupleOutputStream
algorithm that marks for write data objects in SG
Definition: RootNtupleOutputStream.h:49
Athena::RootNtupleOutputStream::m_forceRead
bool m_forceRead
set to true to force read of data objects in item list
Definition: RootNtupleOutputStream.h:79
Athena
Some weak symbol referencing magic...
Definition: AthLegacySequence.h:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Athena::RootNtupleOutputStream::m_persName
std::string m_persName
Name of the persistency service capable to write data from the store.
Definition: RootNtupleOutputStream.h:61
DataProxy
DataProxy provides the registry services for StoreGate.
Definition: DataProxy.h:32
Athena::RootNtupleOutputStream::write
virtual StatusCode write()
Stream the data.
Definition: RootNtupleOutputStream.cxx:246
Athena::RootNtupleOutputStream::m_itemListFromTool
bool m_itemListFromTool
set to write out everything from input DataHeader
Definition: RootNtupleOutputStream.h:90
Athena::RootNtupleOutputStream::m_persToPers
bool m_persToPers
set to true to allow data objects being copied persistent to persistent (without SG retrieve).
Definition: RootNtupleOutputStream.h:81
IAthenaOutputTool
This class provides the interface for AthenaOutputTool classes used by AthenaOutputStream.
Definition: IAthenaOutputTool.h:20
Athena::RootNtupleOutputStream::m_dataStore
ServiceHandle< StoreGateSvc > m_dataStore
handle to the StoreGateSvc store where the data we want to write out resides
Definition: RootNtupleOutputStream.h:58
Athena::RootNtupleOutputStream::m_helperTools
ToolHandleArray< IAthenaOutputTool > m_helperTools
vector of AlgTools that that are executed by this stream
Definition: RootNtupleOutputStream.h:103
Athena::RootNtupleOutputStream::m_selection
std::vector< SG::FolderItem > m_selection
list of selected proxies.
Definition: RootNtupleOutputStream.h:98
Athena::RootNtupleOutputStream::initialize
virtual StatusCode initialize()
Definition: RootNtupleOutputStream.cxx:70
Athena::RootNtupleOutputStream::m_pCLIDSvc
IClassIDSvc_t m_pCLIDSvc
Definition: RootNtupleOutputStream.h:70
AlgFactory
Definition: RootNtupleOutputStream.h:26
Athena::RootNtupleOutputStream::m_processTag
StringProperty m_processTag
tag of processing stage:
Definition: RootNtupleOutputStream.h:67
Athena::RootNtupleOutputStream::m_provideDef
bool m_provideDef
set to true to allow defaults being provided for non-existent data objects.
Definition: RootNtupleOutputStream.h:84
Athena::RootNtupleOutputStream::m_outputName
std::string m_outputName
Name of the output file.
Definition: RootNtupleOutputStream.h:65
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
ServiceHandle
Definition: ClusterMakerTool.h:37