|
ATLAS Offline Software
|
Go to the documentation of this file.
11 #include <unordered_map>
17 m_constantDataSaved(false)
19 declareInterface<CaloClusterGPUProcessor> (
this);
26 std::lock_guard<std::mutex> lock_guard(
m_mutex);
33 return StatusCode::FAILURE;
47 return StatusCode::FAILURE;
50 return StatusCode::SUCCESS;
57 std::unordered_map<int, int> tag_map;
61 std::vector<int> cluster_order(
clusters->number);
63 std::iota(cluster_order.begin(), cluster_order.end(), 0);
65 std::sort(cluster_order.begin(), cluster_order.end(), [&](
const int a,
const int b)
67 if (clusters->seedCellID[a] < 0)
81 int real_cluster_numbers =
clusters->number;
83 for (
size_t i = 0;
i < cluster_order.size(); ++
i)
85 const int this_id = cluster_order[
i];
86 if (
clusters->seedCellID[this_id] < 0)
88 tag_map[this_id] = -1;
89 --real_cluster_numbers;
99 clusters->number = real_cluster_numbers;
101 for (
int i = 0;
i < temp_clusters->number; ++
i)
103 clusters->clusterEnergy[
i] = temp_clusters->clusterEnergy[cluster_order[
i]];
104 clusters->clusterEt[
i] = temp_clusters->clusterEt[cluster_order[
i]];
105 clusters->clusterEta[
i] = temp_clusters->clusterEta[cluster_order[
i]];
106 clusters->clusterPhi[
i] = temp_clusters->clusterPhi[cluster_order[
i]];
107 clusters->seedCellID[
i] = temp_clusters->seedCellID[cluster_order[
i]];
111 size_t shared_count = 0;
114 if (!cell_info->is_valid(
i))
118 const ClusterTag this_tag = cell_state->clusterTag[
i];
121 cell_state->clusterTag[
i] = ClusterTag::make_invalid_tag();
126 const int new_idx = tag_map[old_idx];
128 const int new_idx2 = old_idx2 >= 0 ? tag_map[old_idx2] : -1;
129 if (new_idx < 0 && new_idx2 < 0)
131 cell_state->clusterTag[
i] = ClusterTag::make_invalid_tag();
133 else if (new_idx < 0)
135 cell_state->clusterTag[
i] = ClusterTag::make_tag(new_idx2);
137 else if (new_idx2 < 0)
139 cell_state->clusterTag[
i] = ClusterTag::make_tag(new_idx);
155 m_filePrefix, m_fileSuffix, m_numWidth);
159 return StatusCode::FAILURE;
162 return StatusCode::SUCCESS;
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
virtual StatusCode execute(const EventContext &ctx, const CaloRecGPU::ConstantDataHolder &constant_data, CaloRecGPU::EventDataHolder &event_data, void *temporary_buffer) const override
Process the clusters on GPU.
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...
::StatusCode StatusCode
StatusCode definition for legacy code.
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
CaloGPUOutput(const std::string &type, const std::string &name, const IInterface *parent)
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)
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.