|
ATLAS Offline Software
|
#include <StandaloneDataIO.h>
|
static ErrorState | prepare_folder_for_output (const std::filesystem::path &folder, const bool output_errors=true) |
|
static std::string | build_filename (const std::string &prefix, const std::string &text, const std::string &suffix, const std::string &ext) |
|
static std::string | build_filename (const std::string &prefix, const size_t event_number, const std::string &suffix, const std::string &ext, const unsigned int num_width=9) |
|
static ErrorState | save_constants_to_folder (const std::filesystem::path &folder, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::GeometryArr > &geo, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellNoiseArr > &noise, const std::string &prefix="", const std::string &suffix="", const bool output_errors=true) |
|
static ErrorState | save_event_to_folder (const size_t event_number, const std::filesystem::path &folder, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellInfoArr > &cell_info, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellStateArr > &cell_state, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::ClusterInfoArr > &clusters, const std::string &prefix="", const std::string &suffix="", const unsigned int num_width=9, const bool output_errors=true) |
|
static ErrorState | save_cell_state_to_folder (const size_t event_number, const std::filesystem::path &folder, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellStateArr > &cell_state, const std::string &prefix="", const std::string &suffix="", const unsigned int num_width=9, const bool output_errors=true) |
|
static ErrorState | save_cell_info_to_folder (const size_t event_number, const std::filesystem::path &folder, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellInfoArr > &cell_info, const std::string &prefix="", const std::string &suffix="", const unsigned int num_width=9, const bool output_errors=true) |
|
static ErrorState | save_clusters_to_folder (const size_t event_number, const std::filesystem::path &folder, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::ClusterInfoArr > &clusters, const std::string &prefix="", const std::string &suffix="", const unsigned int num_width=9, const bool output_errors=true) |
|
template<class F > |
static FolderLoad | load_folder_filter (F &&filter_function, const std::filesystem::path &folder, int max_events=-1, const FolderLoadOptions &flo=FolderLoadOptions::None(), const bool output_messages=true) |
|
static FolderLoad | load_folder (const std::filesystem::path &folder, int max_events=-1, const FolderLoadOptions &flo=FolderLoadOptions::None(), const bool output_messages=true) |
|
Definition at line 22 of file StandaloneDataIO.h.
◆ ErrorState
Enumerator |
---|
OK | |
ReadError | |
WriteError | |
Definition at line 24 of file StandaloneDataIO.h.
26 OK = 0, ReadError, WriteError
◆ build_filename() [1/2]
static std::string StandaloneDataIO::build_filename |
( |
const std::string & |
prefix, |
|
|
const size_t |
event_number, |
|
|
const std::string & |
suffix, |
|
|
const std::string & |
ext, |
|
|
const unsigned int |
num_width = 9 |
|
) |
| |
|
inlinestatic |
Definition at line 282 of file StandaloneDataIO.h.
288 std::ostringstream event_ID_format;
289 event_ID_format << std::setfill(
'0') << std::setw(num_width) << event_number;
290 const std::string event_ID = event_ID_format.str();
◆ build_filename() [2/2]
static std::string StandaloneDataIO::build_filename |
( |
const std::string & |
prefix, |
|
|
const std::string & |
text, |
|
|
const std::string & |
suffix, |
|
|
const std::string & |
ext |
|
) |
| |
|
inlinestatic |
◆ create_or_check_folder()
static bool StandaloneDataIO::create_or_check_folder |
( |
const std::filesystem::path & |
folder, |
|
|
const bool |
output_errors = true |
|
) |
| |
|
inlinestaticprotected |
Definition at line 238 of file StandaloneDataIO.h.
242 if (!std::filesystem::create_directory(
folder))
246 std::cout <<
"ERROR: folder '" <<
folder <<
"' could not be created." << std::endl;
251 else if (!std::filesystem::is_directory(
folder))
255 std::cout <<
"ERROR: folder '" <<
folder <<
"' is not a valid folder." << std::endl;
◆ load_folder()
◆ load_folder_filter()
- Parameters
-
filter_function | receives a std::string (the filename), returns true if the file should be filtered out. |
Definition at line 489 of file StandaloneDataIO.h.
498 if (!std::filesystem::is_directory(
folder))
502 std::cout <<
"ERROR: '" <<
folder <<
"' is not a valid folder." << std::endl;
506 std::set<std::string> read_one_part_of_v1_cells;
511 ret.geometry.size() > 0 && ret.noise.size() > 0 )
524 auto check_error = [&](
const ErrorState & es,
const std::string &
str)
532 std::cout <<
"ERROR: '" <<
file <<
"' is not a valid " <<
str <<
" file (" << (
int) es <<
")." << std::endl;
537 auto output_loading_message = [&](
const std::string &
str)
541 std::cout <<
"Loaded " <<
str <<
" from '" <<
file <<
"'." << std::endl;
545 if (
file.extension() ==
".geometry")
547 if (!flo.load_geometry)
556 ret.geometry[
filename] = std::move(tempgeo);
557 output_loading_message(
"geometry");
559 else if (
file.extension() ==
".cellstate")
561 if (!flo.load_cell_state || !can_load_events)
570 ret.cell_state[
filename] = std::move(tempcellstate);
571 output_loading_message(
"cell state");
572 if ((ret.cluster_info.count(
filename) > 0 || !flo.load_cluster_info) &&
573 (ret.cell_info.count(
filename) > 0 || !flo.load_cell_info))
578 else if (
file.extension() ==
".cellinfo")
580 if (!flo.load_cell_info || !can_load_events)
589 ret.cell_info[
filename] = std::move(tempcellinfo);
590 output_loading_message(
"cell info");
591 if ((ret.cluster_info.count(
filename) > 0 || !flo.load_cluster_info) &&
592 (ret.cell_state.count(
filename) > 0 || !flo.load_cell_state))
597 else if (
file.extension() ==
".clusterinfo")
599 if (!flo.load_cluster_info || !can_load_events)
608 ret.cluster_info[
filename] = std::move(tempclu);
609 output_loading_message(
"cluster info");
610 if ((ret.cell_state.count(
filename) > 0 || !flo.load_cell_state) &&
611 (ret.cell_info.count(
filename) > 0 || !flo.load_cell_info))
616 else if (
file.extension() ==
".noise")
627 ret.noise[
filename] = std::move(tempnois);
628 output_loading_message(
"noise");
◆ prepare_folder_for_output()
static ErrorState StandaloneDataIO::prepare_folder_for_output |
( |
const std::filesystem::path & |
folder, |
|
|
const bool |
output_errors = true |
|
) |
| |
|
inlinestatic |
◆ report_error()
static void StandaloneDataIO::report_error |
( |
const std::filesystem::path & |
file, |
|
|
const std::string & |
kind, |
|
|
const bool |
really_report = false |
|
) |
| |
|
inlinestaticprotected |
Definition at line 31 of file StandaloneDataIO.h.
35 std::cerr <<
"ERROR: when " << kind <<
" from '" <<
file <<
"'." << std::endl;
◆ save_cell_info_to_folder()
Definition at line 391 of file StandaloneDataIO.h.
404 std::ostringstream event_ID_format;
405 event_ID_format << std::setfill(
'0') << std::setw(num_width) << event_number;
406 const std::string event_ID = event_ID_format.str();
◆ save_cell_state_to_folder()
Definition at line 362 of file StandaloneDataIO.h.
375 std::ostringstream event_ID_format;
376 event_ID_format << std::setfill(
'0') << std::setw(num_width) << event_number;
377 const std::string event_ID = event_ID_format.str();
◆ save_clusters_to_folder()
Definition at line 420 of file StandaloneDataIO.h.
433 std::ostringstream event_ID_format;
434 event_ID_format << std::setfill(
'0') << std::setw(num_width) << event_number;
435 const std::string event_ID = event_ID_format.str();
◆ save_constants_to_folder()
◆ save_event_to_folder()
Definition at line 323 of file StandaloneDataIO.h.
338 std::ostringstream event_ID_format;
339 event_ID_format << std::setfill(
'0') << std::setw(num_width) << event_number;
340 const std::string event_ID = event_ID_format.str();
The documentation for this struct was generated from the following file:
static std::string build_filename(const std::string &prefix, const std::string &text, const std::string &suffix, const std::string &ext)
path
python interpreter configuration --------------------------------------—
Holds one objects of type \T in memory context Context.
static FolderLoad load_folder_filter(F &&filter_function, const std::filesystem::path &folder, int max_events=-1, const FolderLoadOptions &flo=FolderLoadOptions::None(), const bool output_messages=true)
static bool create_or_check_folder(const std::filesystem::path &folder, const bool output_errors=true)