 |
ATLAS Offline Software
|
Standard tool to output the GPU data representation to the non-standard file format that we have been using for plotting and validation purposes.
More...
#include <CaloGPUOutput.h>
|
Gaudi::Property< std::string > | m_savePath {this, "SavePath", "./saved_clusters", "Path to where the files should be saved"} |
| The path specifying the folder to which the files should be saved. More...
|
|
Gaudi::Property< std::string > | m_filePrefix {this, "FilePrefix", "", "Prefix of the saved files"} |
| The prefix of the saved files. More...
|
|
Gaudi::Property< std::string > | m_fileSuffix {this, "FileSuffix", "", "Suffix of the saved files"} |
| The suffix of the saved files. More...
|
|
Gaudi::Property< unsigned int > | m_numWidth {this, "NumberWidth", 9, "The number of digits to reserve for the events"} |
| The number of digits to reserve for the events. More...
|
|
Gaudi::Property< bool > | m_sortedAndCutClusters {this, "UseSortedAndCutClusters", true, "Sort the clusters by transverse energy, apply a cut and ensure contiguous tags"} |
| If true , sort the clusters by transverse energy and compactify the tags to ensure sequentiality. More...
|
|
Gaudi::Property< bool > | m_onlyCellInfo {this, "OnlyOutputCellInfo", false, "Only output cell info"} |
| If true , only output cell info (useful for reducing disk usage when running the full standalone version of the algorithms). More...
|
|
std::atomic< bool > | m_constantDataSaved |
| A flag to signal that the constant data has been adequately saved. More...
|
|
std::mutex | m_mutex |
| This mutex is locked when saving the constant data on the first event to ensure thread safety. More...
|
|
Standard tool to output the GPU data representation to the non-standard file format that we have been using for plotting and validation purposes.
- Author
- Nuno Fernandes nuno..nosp@m.dos..nosp@m.santo.nosp@m.s.fe.nosp@m.rnand.nosp@m.es@c.nosp@m.ern.c.nosp@m.h
- Date
- 30 May 2022 There are likely more elegant/general/generic/portable solutions, some of which might even avoid Root too, but our workflow was built around this one...
Definition at line 27 of file CaloGPUOutput.h.
◆ CaloGPUOutput()
CaloGPUOutput::CaloGPUOutput |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~CaloGPUOutput()
virtual CaloGPUOutput::~CaloGPUOutput |
( |
| ) |
|
|
virtualdefault |
◆ execute()
Definition at line 21 of file CaloGPUOutput.cxx.
25 std::lock_guard<std::mutex> lock_guard(
m_mutex);
32 return StatusCode::FAILURE;
46 return StatusCode::FAILURE;
49 return StatusCode::SUCCESS;
56 std::unordered_map<int, int> tag_map;
60 std::vector<int> cluster_order(
clusters->number);
62 std::iota(cluster_order.begin(), cluster_order.end(), 0);
64 std::sort(cluster_order.begin(), cluster_order.end(), [&](
const int a,
const int b)
66 if (clusters->seedCellID[a] < 0)
80 int real_cluster_numbers =
clusters->number;
82 for (
size_t i = 0;
i < cluster_order.size(); ++
i)
84 const int this_id = cluster_order[
i];
85 if (
clusters->seedCellID[this_id] < 0)
87 tag_map[this_id] = -1;
88 --real_cluster_numbers;
98 clusters->number = real_cluster_numbers;
100 for (
int i = 0;
i < temp_clusters->number; ++
i)
102 clusters->clusterEnergy[
i] = temp_clusters->clusterEnergy[cluster_order[
i]];
103 clusters->clusterEt[
i] = temp_clusters->clusterEt[cluster_order[
i]];
104 clusters->clusterEta[
i] = temp_clusters->clusterEta[cluster_order[
i]];
105 clusters->clusterPhi[
i] = temp_clusters->clusterPhi[cluster_order[
i]];
106 clusters->seedCellID[
i] = temp_clusters->seedCellID[cluster_order[
i]];
110 size_t shared_count = 0;
113 if (!cell_info->is_valid(
i))
117 const ClusterTag this_tag = cell_state->clusterTag[
i];
120 cell_state->clusterTag[
i] = ClusterTag::make_invalid_tag();
125 const int new_idx = tag_map[old_idx];
127 const int new_idx2 = old_idx2 >= 0 ? tag_map[old_idx2] : -1;
128 if (new_idx < 0 && new_idx2 < 0)
130 cell_state->clusterTag[
i] = ClusterTag::make_invalid_tag();
132 else if (new_idx < 0)
134 cell_state->clusterTag[
i] = ClusterTag::make_tag(new_idx2);
136 else if (new_idx2 < 0)
138 cell_state->clusterTag[
i] = ClusterTag::make_tag(new_idx);
158 return StatusCode::FAILURE;
161 return StatusCode::SUCCESS;
◆ m_constantDataSaved
std::atomic<bool> CaloGPUOutput::m_constantDataSaved |
|
mutableprivate |
A flag to signal that the constant data has been adequately saved.
This is required for everything to work properly in a multi-threaded context...
Definition at line 79 of file CaloGPUOutput.h.
◆ m_filePrefix
Gaudi::Property<std::string> CaloGPUOutput::m_filePrefix {this, "FilePrefix", "", "Prefix of the saved files"} |
|
private |
The prefix of the saved files.
Empty string by default.
Definition at line 53 of file CaloGPUOutput.h.
◆ m_fileSuffix
Gaudi::Property<std::string> CaloGPUOutput::m_fileSuffix {this, "FileSuffix", "", "Suffix of the saved files"} |
|
private |
The suffix of the saved files.
Empty string by default.
Definition at line 58 of file CaloGPUOutput.h.
◆ m_mutex
std::mutex CaloGPUOutput::m_mutex |
|
mutableprivate |
This mutex is locked when saving the constant data on the first event to ensure thread safety.
Otherwise, it's unused.
Definition at line 84 of file CaloGPUOutput.h.
◆ m_numWidth
Gaudi::Property<unsigned int> CaloGPUOutput::m_numWidth {this, "NumberWidth", 9, "The number of digits to reserve for the events"} |
|
private |
The number of digits to reserve for the events.
9 by default.
Definition at line 63 of file CaloGPUOutput.h.
◆ m_onlyCellInfo
Gaudi::Property<bool> CaloGPUOutput::m_onlyCellInfo {this, "OnlyOutputCellInfo", false, "Only output cell info"} |
|
private |
If true
, only output cell info (useful for reducing disk usage when running the full standalone version of the algorithms).
Definition at line 73 of file CaloGPUOutput.h.
◆ m_savePath
Gaudi::Property<std::string> CaloGPUOutput::m_savePath {this, "SavePath", "./saved_clusters", "Path to where the files should be saved"} |
|
private |
The path specifying the folder to which the files should be saved.
Default
./saved_clusters
Definition at line 48 of file CaloGPUOutput.h.
◆ m_sortedAndCutClusters
Gaudi::Property<bool> CaloGPUOutput::m_sortedAndCutClusters {this, "UseSortedAndCutClusters", true, "Sort the clusters by transverse energy, apply a cut and ensure contiguous tags"} |
|
private |
If true
, sort the clusters by transverse energy and compactify the tags to ensure sequentiality.
Definition at line 68 of file CaloGPUOutput.h.
The documentation for this class was generated from the following files:
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)
constexpr int32_t secondary_cluster_index() const
constexpr bool is_shared_between_clusters() const
Holds one objects of type \T in memory context Context.
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::CellStateArr > m_cell_state_dev
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::ClusterInfoArr > m_clusters_dev
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)
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::CellInfoArr > m_cell_info_dev
constexpr int32_t cluster_index() const
Gaudi::Property< bool > m_onlyCellInfo
If true, only output cell info (useful for reducing disk usage when running the full standalone versi...
Gaudi::Property< unsigned int > m_numWidth
The number of digits to reserve for the events.
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::CellNoiseArr > m_cell_noise_dev
Gaudi::Property< std::string > m_savePath
The path specifying the folder to which the files should be saved.
CaloRecGPU::Helpers::CUDA_object< CaloRecGPU::GeometryArr > m_geometry_dev
Gaudi::Property< std::string > m_filePrefix
The prefix of the saved files.
constexpr bool is_part_of_cluster() const
std::mutex m_mutex
This mutex is locked when saving the constant data on the first event to ensure thread safety.
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)
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
std::atomic< bool > m_constantDataSaved
A flag to signal that the constant data has been adequately saved.
Gaudi::Property< std::string > m_fileSuffix
The suffix of the saved files.
constexpr int32_t secondary_cluster_weight() const
Gaudi::Property< bool > m_sortedAndCutClusters
If true, sort the clusters by transverse energy and compactify the tags to ensure sequentiality.