ATLAS Offline Software
AthenaHDFStreamTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ATHENAHDFSTREAMTOOL_H
6 #define ATHENAHDFSTREAMTOOL_H
7 
13 #include "GaudiKernel/ServiceHandle.h"
16 
17 #include <string>
18 
19 // Forward declarations.
20 class IIncidentSvc;
21 
22 namespace H5 {
23  class H5File;
24  class Group;
25 }
26 
30 /* To use this tool to
31  * write data to HDF5 add the following jobOption fragment:
32  *
33  * from AthenaCommon.AppMgr import ServiceMgr as svcMgr
34  * import AthenaPoolCnvSvc.AthenaPool
35  * from AthenaIPCTools.AthenaIPCToolsConf import AthenaHDFStreamTool
36  * svcMgr.AthenaPoolCnvSvc.OutputStreamingTool += [ AthenaHDFStreamTool("OutputStreamingTool") ]
37  * svcMgr.AthenaPoolCnvSvc.MakeStreamingToolClient = 1
38  * svcMgr.AthenaPoolCnvSvc.ParallelCompression=False
39  *
40  * To read it back use:
41  * from AthenaCommon.AppMgr import ServiceMgr as svcMgr
42  * import AthenaPoolCnvSvc.ReadAthenaPool
43  * from AthenaIPCTools.AthenaIPCToolsConf import AthenaHDFStreamTool
44  * svcMgr.EventSelector.SharedMemoryTool = AthenaHDFStreamTool("EventStreamingTool")
45  * svcMgr.EventSelector.MakeStreamingToolClient = -1
46  * svcMgr.AthenaPoolCnvSvc.InputStreamingTool = AthenaHDFStreamTool("InputStreamingTool")
47  * svcMgr.AthenaPoolCnvSvc.MakeStreamingToolClient = 1
48  * svcMgr.AthenaPoolCnvSvc.StreamingTechnology = 1025
49  *
50  **/
51 
52 // Mark class as not thread-safe: Initial demonstrator/prototype not used in production workflows
54 public:
56  AthenaHDFStreamTool(const std::string& type, const std::string& name, const IInterface* parent);
58  virtual ~AthenaHDFStreamTool();
59 
63 
64  StatusCode makeServer(int num, const std::string& streamPortSuffix);
65  bool isServer() const;
66  StatusCode makeClient(int num, std::string& streamPortSuffix);
67  bool isClient() const;
68 
69  StatusCode putEvent ATLAS_NOT_THREAD_SAFE (long eventNumber, const void* source, std::size_t nbytes, unsigned int status) const;
70  StatusCode getLockedEvent(void** target, unsigned int& status) const;
71  StatusCode lockEvent(long eventNumber) const;
72 
73  StatusCode putObject(const void* source, std::size_t nbytes, int num = 0);
74  StatusCode getObject(void** target, std::size_t& nbytes, int num = 0);
75  StatusCode clearObject(const char** tokenString, int& num);
76  StatusCode lockObject(const char* tokenString, int num = 0);
77 
78 private:
79  H5::H5File* m_file;
81  mutable std::string m_token;
82  mutable char* m_read_data;
83  mutable std::size_t m_read_size;
84  mutable std::size_t m_read_position;
85  mutable long long unsigned int m_event_iter;
86  bool m_isClient;
88 };
89 
90 #endif
IAthenaIPCTool::isServer
virtual bool isServer() const =0
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
IAthenaIPCTool::makeClient
virtual StatusCode makeClient(int num, std::string &streamPortSuffix)=0
initialize
void initialize()
Definition: run_EoverP.cxx:894
AthenaHDFStreamTool::m_read_size
std::size_t m_read_size
Definition: AthenaHDFStreamTool.h:83
AthenaHDFStreamTool::m_read_position
std::size_t m_read_position
Definition: AthenaHDFStreamTool.h:84
AthenaHDFStreamTool::m_token
std::string m_token
Definition: AthenaHDFStreamTool.h:81
IAthenaIPCTool
Definition: IAthenaIPCTool.h:15
AthenaHDFStreamTool::ATLAS_NOT_THREAD_SAFE
StatusCode putEvent ATLAS_NOT_THREAD_SAFE(long eventNumber, const void *source, std::size_t nbytes, unsigned int status) const
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
IAthenaIPCTool::putObject
virtual StatusCode putObject(const void *source, size_t nbytes, int num=0)=0
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthenaHDFStreamTool::m_read_data
char * m_read_data
Definition: AthenaHDFStreamTool.h:82
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
IAthenaIPCTool::isClient
virtual bool isClient() const =0
IAthenaIPCTool::lockEvent
virtual StatusCode lockEvent(long eventNumber) const =0
H5
HDF5 Traits.
Definition: AthenaHDFStreamTool.h:22
AthenaHDFStreamTool::m_event_iter
long long unsigned int m_event_iter
Definition: AthenaHDFStreamTool.h:85
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
IAthenaIPCTool::clearObject
virtual StatusCode clearObject(const char **tokenString, int &num)=0
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
IAthenaIPCTool::getObject
virtual StatusCode getObject(void **target, size_t &nbytes, int num=0)=0
IAthenaIPCTool::lockObject
virtual StatusCode lockObject(const char *tokenString, int num=0)=0
AthenaHDFStreamTool
This class provides the IPCTool for HDF Stream objects.
Definition: AthenaHDFStreamTool.h:53
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthenaHDFStreamTool::m_file
H5::H5File * m_file
Definition: AthenaHDFStreamTool.h:79
merge.status
status
Definition: merge.py:17
COOLRates.target
target
Definition: COOLRates.py:1106
AthAlgTool
Definition: AthAlgTool.h:26
IAthenaIPCTool::makeServer
virtual StatusCode makeServer(int num, const std::string &streamPortSuffix)=0
AthenaHDFStreamTool::m_isClient
bool m_isClient
Definition: AthenaHDFStreamTool.h:86
AthenaHDFStreamTool::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Definition: AthenaHDFStreamTool.h:87
IAthenaIPCTool.h
IAthenaIPCTool::getLockedEvent
virtual StatusCode getLockedEvent(void **target, unsigned int &status) const =0
AthenaHDFStreamTool::m_group
H5::Group * m_group
Definition: AthenaHDFStreamTool.h:80
ServiceHandle< IIncidentSvc >