DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
hdf5libs
include
hdf5libs
test
HDF5TestUtils.hpp
Go to the documentation of this file.
1
10
11
#ifndef HDF5LIBS_TESTUTILITIES_HPP_
12
#define HDF5LIBS_TESTUTILITIES_HPP_
13
14
#include "
hdf5libs/HDF5RawDataFile.hpp
"
15
16
#include <vector>
17
#include <string>
18
#include <filesystem>
19
#include <regex>
20
21
namespace
dunedaq
{
22
23
namespace
hdf5libs
{
24
25
std::vector<std::string>
26
get_files_matching_pattern
(
const
std::string& path,
const
std::string& pattern)
27
{
28
std::regex regex_search_pattern(pattern);
29
std::vector<std::string> file_list;
30
for
(
const
auto
& entry : std::filesystem::directory_iterator(path)) {
31
if
(std::regex_match(entry.path().filename().string(), regex_search_pattern)) {
32
file_list.push_back(entry.path());
33
}
34
}
35
return
file_list;
36
}
37
38
std::vector<std::string>
39
delete_files_matching_pattern
(
const
std::string& path,
const
std::string& pattern)
40
{
41
std::regex regex_search_pattern(pattern);
42
std::vector<std::string> file_list;
43
for
(
const
auto
& entry : std::filesystem::directory_iterator(path)) {
44
if
(std::regex_match(entry.path().filename().string(), regex_search_pattern)) {
45
if
(std::filesystem::remove(entry.path())) {
46
file_list.push_back(entry.path());
47
}
48
}
49
}
50
return
file_list;
51
}
52
53
uint64_t
54
encode_geoid
(
int
det_id,
int
crate_id,
int
slot_id,
int
stream_id)
55
{
56
return
(
static_cast<
uint64_t
>
(stream_id) << 48) | (
static_cast<
uint64_t
>
(slot_id) << 32) |
57
(
static_cast<
uint64_t
>
(crate_id) << 16) | det_id;
58
}
59
60
HDF5SourceIDHandler::source_id_geo_id_map_t
61
create_srcid_geoid_map
()
62
{
63
HDF5SourceIDHandler::source_id_geo_id_map_t
map;
64
65
dunedaq::daqdataformats::SourceID
sid;
66
sid.
subsystem
=
dunedaq::daqdataformats::SourceID::Subsystem::kDetectorReadout
;
67
68
sid.
id
= 0;
69
map[sid].push_back(
encode_geoid
(3, 1, 0, 0));
70
71
sid.
id
= 1;
72
map[sid].push_back(
encode_geoid
(3, 1, 0, 1));
73
74
sid.
id
= 3;
75
map[sid].push_back(
encode_geoid
(3, 1, 1, 0));
76
77
sid.
id
= 4;
78
map[sid].push_back(
encode_geoid
(3, 1, 1, 1));
79
80
sid.
id
= 4;
81
map[sid].push_back(
encode_geoid
(2, 1, 0, 0));
82
83
sid.
id
= 5;
84
map[sid].push_back(
encode_geoid
(2, 1, 0, 1));
85
86
sid.
id
= 6;
87
map[sid].push_back(
encode_geoid
(2, 1, 1, 0));
88
89
sid.
id
= 7;
90
map[sid].push_back(
encode_geoid
(2, 1, 1, 1));
91
92
return
map;
93
}
94
95
}
// namespace hdf5libs
96
97
}
// namespace dunedaq
98
99
#endif
// HDF5LIBS_TESTUTILITIES_HPP_
HDF5RawDataFile.hpp
dunedaq::hdf5libs::HDF5SourceIDHandler::source_id_geo_id_map_t
std::map< daqdataformats::SourceID, std::vector< uint64_t > > source_id_geo_id_map_t
Definition
HDF5SourceIDHandler.hpp:49
dunedaq::hdf5libs
Definition
HDF5FileLayoutParameters.hpp:23
dunedaq::hdf5libs::create_srcid_geoid_map
HDF5SourceIDHandler::source_id_geo_id_map_t create_srcid_geoid_map()
Definition
HDF5TestUtils.hpp:61
dunedaq::hdf5libs::get_files_matching_pattern
std::vector< std::string > get_files_matching_pattern(const std::string &path, const std::string &pattern)
Definition
HDF5TestUtils.hpp:26
dunedaq::hdf5libs::encode_geoid
uint64_t encode_geoid(int det_id, int crate_id, int slot_id, int stream_id)
Definition
HDF5TestUtils.hpp:54
dunedaq::hdf5libs::delete_files_matching_pattern
std::vector< std::string > delete_files_matching_pattern(const std::string &path, const std::string &pattern)
Definition
HDF5TestUtils.hpp:39
dunedaq
Including Qt Headers.
Definition
module.cpp:16
dunedaq::daqdataformats::SourceID
SourceID is a generalized representation of the source of a piece of data in the DAQ....
Definition
SourceID.hpp:32
dunedaq::daqdataformats::SourceID::subsystem
Subsystem subsystem
The general subsystem of the source of the data.
Definition
SourceID.hpp:56
dunedaq::daqdataformats::SourceID::Subsystem::kDetectorReadout
@ kDetectorReadout
Definition
SourceID.hpp:42
dunedaq::daqdataformats::SourceID::id
ID_t id
Unique identifier of the source of the data.
Definition
SourceID.hpp:59
Generated on
for DUNE-DAQ by
1.17.0