16#include "boost/chrono/chrono.hpp"
17#include "boost/chrono/thread_clock.hpp"
25 base_class(
type, name, parent),
34 using PackType =
decltype(
m_options.m_options->valid_sampling_primary);
38 auto get_option_from_string = [](
const std::string &
str,
bool & failed)
72 return CaloCell_ID::Unknown;
77 auto process_sampling = [&get_option_from_string](
const std::vector<std::string> & sampling_names, std::string & invalid_names, PackType & sampling_option)
80 for (
const std::string & samp_name : sampling_names)
83 const PackType sampling = (PackType) get_option_from_string(samp_name, failed);
87 if (invalid_names.size() == 0)
89 invalid_names =
"'" + samp_name +
"'";
93 invalid_names +=
", '" + samp_name +
"'";
98 sampling_option |= ((PackType) 1) << sampling;
103 std::string invalid_names;
107 if (invalid_names.size() > 0)
110 <<
" are not a valid Calorimeter sampling name and will be ignored! "
111 <<
"Valid names are: "
112 <<
"PreSamplerB, EMB1, EMB2, EMB3, "
113 <<
"PreSamplerE, EME1, EME2, EME3, "
114 <<
"HEC0, HEC1, HEC2, HEC3, "
115 <<
"TileBar0, TileBar1, TileBar2, "
116 <<
"TileGap1, TileGap2, TileGap3, "
117 <<
"TileExt0, TileExt1, TileExt2, "
118 <<
"FCAL0, FCAL1, FCAL2." );
121 invalid_names.clear();
125 if (invalid_names.size() > 0)
128 <<
" are not a valid Calorimeter sampling name and will be ignored! "
129 <<
"Valid names are: "
130 <<
"PreSamplerB, EMB1, EMB2, EMB3, "
131 <<
"PreSamplerE, EME1, EME2, EME3, "
132 <<
"HEC0, HEC1, HEC2, HEC3, "
133 <<
"TileBar0, TileBar1, TileBar2, "
134 <<
"TileGap1, TileGap2, TileGap3, "
135 <<
"TileExt0, TileExt1, TileExt2, "
136 <<
"FCAL0, FCAL1, FCAL2." );
139 auto get_neighbour_option_from_string = [](
const std::string &
str,
bool & failed)
173 bool neigh_failed =
false;
197 return StatusCode::SUCCESS;
205 return StatusCode::SUCCESS;
211 using clock_type = boost::chrono::thread_clock;
212 auto time_cast = [](
const auto & before,
const auto & after)
214 return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count();
217 const auto start = clock_type::now();
218 const auto preprocessing_end = clock_type::now();
222 const auto after_neighs = clock_type::now();
226 const auto after_maxima = clock_type::now();
230 const auto after_secondary_maxima = clock_type::now();
234 const auto after_growing = clock_type::now();
238 const auto end = clock_type::now();
243 time_cast(start, preprocessing_end),
244 time_cast(preprocessing_end, after_neighs),
245 time_cast(after_neighs, after_maxima),
246 time_cast(after_maxima, after_secondary_maxima),
247 time_cast(after_secondary_maxima, after_growing),
248 time_cast(after_growing, end)
252 return StatusCode::SUCCESS;
262 print_times(
"Preprocessing Fill_List_of_Intra-Cluster_Neighbours Find_Local_Maxima Find_Secondary_Maxima Splitter_Tag_Propagation Cell_Weighting_And_Finalization", 6);
264 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Contains some helpful macros to help with repetitive code...
#define CRGPU_RECURSIVE_MACRO(...)
Expands recursive macros.
#define CRGPU_CHEAP_STRING_TO_ENUM(VAR, PREFIX, ONE,...)
Checks a string variable, VAR, for matching enum identifiers (ONE and the remaining variadic argument...
Helper class for offline cell identifiers.
Gaudi::Property< bool > m_measureTimes
If true, times are recorded to the file given by m_timeFileName.
void print_times(const std::string &header, const size_t time_size) const
void record_times(const size_t event_num, const std::vector< size_t > ×) const
Holds CPU and GPU versions of the geometry and cell noise information, which are assumed to be consta...
Holds the mutable per-event information (clusters and cells) and provides utilities to convert betwee...
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.
Gaudi::Property< std::vector< std::string > > m_secondarySamplingNames
vector of names of the secondary calorimeter samplings to consider.
Gaudi::Property< bool > m_restrictHECIWandFCalNeighbors
if set to true limit the neighbors in HEC IW and FCal2&3.
TASplitting::TASOptionsHolder m_options
Options for the algorithm, held in a GPU-friendly way.
TopoAutomatonSplitting(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< bool > m_treatL1PredictedCellsAsGood
if set to true treat cells with a dead OTX which can be predicted by L1 trigger info as good instead ...
Gaudi::Property< float > m_emShowerScale
typical EM shower scale to use for distance criteria in shared cells
virtual StatusCode initialize_non_CUDA() override
Initialization that does not invoke CUDA functions.
Gaudi::Property< bool > m_absOpt
if set to true, splitter only looks at absolute value of Energy in order to identify potential seed c...
Gaudi::Property< float > m_minEnergy
local maxima need at least this energy content
ServiceHandle< IGPUKernelSizeOptimizerSvc > m_kernelSizeOptimizer
Handle to the CUDA kernel block and grid size optimization service.
Gaudi::Property< bool > m_shareBorderCells
share cells at the border between two local maxima
virtual StatusCode initialize_CUDA() override
Initialization that invokes CUDA functions.
virtual StatusCode execute(const EventContext &ctx, const CaloRecGPU::ConstantDataHolder &constant_data, CaloRecGPU::EventDataHolder &event_data, void *temporary_buffer) const override
virtual StatusCode finalize() override
Gaudi::Property< std::string > m_neighborOptionString
type of neighbor relations to use.
Gaudi::Property< bool > m_restrictPSNeighbors
if set to true limit the neighbors in presampler Barrel and Endcap.
Gaudi::Property< std::vector< std::string > > m_samplingNames
vector of names of the calorimeter samplings to consider for seeds.
Gaudi::Property< int > m_nCells
local maxima need at least this number of neighbors to become seeds
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
void cellWeightingAndFinalization(CaloRecGPU::EventDataHolder &holder, const CaloRecGPU::ConstantDataHolder &instance_data, const TASOptionsHolder &options, const IGPUKernelSizeOptimizer &optimizer, const bool synchronize=false, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use={})
void fillNeighbours(CaloRecGPU::EventDataHolder &holder, const CaloRecGPU::ConstantDataHolder &instance_data, const TASOptionsHolder &options, const IGPUKernelSizeOptimizer &optimizer, const bool synchronize=false, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use={})
void splitClusterGrowing(CaloRecGPU::EventDataHolder &holder, const CaloRecGPU::ConstantDataHolder &instance_data, const TASOptionsHolder &options, const IGPUKernelSizeOptimizer &optimizer, const bool synchronize=false, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use={})
void register_kernels(IGPUKernelSizeOptimizer &optimizer)
void findLocalMaxima(CaloRecGPU::EventDataHolder &holder, const CaloRecGPU::ConstantDataHolder &instance_data, const TASOptionsHolder &options, const IGPUKernelSizeOptimizer &optimizer, const bool synchronize=false, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use={})
void excludeSecondaryMaxima(CaloRecGPU::EventDataHolder &holder, const CaloRecGPU::ConstantDataHolder &instance_data, const TASOptionsHolder &options, const IGPUKernelSizeOptimizer &optimizer, const bool synchronize=false, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream_to_use={})