HDF5Utils.h
Go to the documentation of this file.
1 #ifndef HDF5Utils_h
2 #define HDF5Utils_h
3 
4 //#include "artdaq-core/Data/Fragment.hh"
5 
6 #include <hdf5.h>
7 #include <deque>
8 #include <map>
9 #include <memory>
10 #include <string>
11 
12 
13 
14 #include "daqdataformats/Fragment.hpp"
17 
18 namespace dune {
19 namespace HDF5Utils {
20 
21 using dunedaq::daqdataformats::Fragment;
22 using dunedaq::daqdataformats::FragmentHeader;
23 typedef std::vector<raw::RawDigit> RawDigits;
24 typedef std::vector<raw::RDTimeStamp> RDTimeStamps;
25 
26 struct HDFFileInfo {
27  hid_t filePtr;
28  size_t bytesWritten;
30  int runNumber;
32 };
33 
34 struct HeaderInfo {
35  int magicWord = 0;
36  int version = 0;
37  uint64_t trigNum = 0;
38  uint64_t trigTimestamp = 0;
39  uint64_t nReq = 0;
40  int runNum = 0;
41  int errBits = 0;
42  short triggerType = 0;
43 };
44 
45 uint64_t formatTrigTimeStamp (uint64_t trigTimeStamp);
46 typedef std::unique_ptr<HDFFileInfo> HDFFileInfoPtr;
47 HDFFileInfoPtr openFile(const std::string& fileName);
48 void closeFile(HDFFileInfoPtr hdfFileInfoPtr);
49 std::deque<std::string> getTopLevelGroupNames(HDFFileInfoPtr& hdfFileInfoPtr);
50 std::deque<std::string> getMidLevelGroupNames(hid_t gid);
51 bool attrExists(hid_t object, const std::string& attrname);
52 hid_t getGroupFromPath(hid_t fd, const std::string &path);
53 
54 void getHeaderInfo(hid_t the_group, const std::string & det_type,
55  HeaderInfo & info);
56 
57 typedef std::vector<Fragment> Fragments;
58 //typedef std::map<std::string, std::unique_ptr<Fragments>> FragmentListsByType;
59 
60 
61 }
62 }
63 
64 #endif
std::unique_ptr< HDFFileInfo > HDFFileInfoPtr
Definition: HDF5Utils.h:46
std::string string
Definition: nybbler.cc:12
std::vector< raw::RawDigit > RawDigits
Definition: HDF5Utils.h:23
std::deque< std::string > getMidLevelGroupNames(hid_t grp)
Definition: HDF5Utils.cc:43
std::vector< raw::RDTimeStamp > RDTimeStamps
Definition: HDF5Utils.h:24
std::deque< std::string > getTopLevelGroupNames(HDFFileInfoPtr &hdfFileInfoPtr)
Definition: HDF5Utils.cc:36
bool attrExists(hid_t object, const std::string &attrname)
Definition: HDF5Utils.cc:71
hid_t getGroupFromPath(hid_t fd, const std::string &path)
Definition: HDF5Utils.cc:91
void getHeaderInfo(hid_t the_group, const std::string &det_type, HeaderInfo &info)
Definition: HDF5Utils.cc:96
uint64_t formatTrigTimeStamp(uint64_t trigTimeStamp)
Definition: HDF5Utils.cc:58
HDFFileInfoPtr openFile(const std::string &fileName)
Definition: HDF5Utils.cc:12
std::vector< Fragment > Fragments
Definition: HDF5Utils.h:57
void closeFile(HDFFileInfoPtr hdfFileInfoPtr)
Definition: HDF5Utils.cc:31