ATLAS Offline Software
Loading...
Searching...
No Matches
GPUClusterInfoAndMomentsCalculator.cxx
Go to the documentation of this file.
1//
2// Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3//
4// Dear emacs, this is -*- c++ -*-
5//
6
9
10
11using namespace CaloRecGPU;
12using namespace ClusterMomentsCalculator;
13
14GPUClusterInfoAndMomentsCalculator::GPUClusterInfoAndMomentsCalculator(const std::string & type, const std::string & name, const IInterface * parent):
15 base_class(type, name, parent),
16 CaloGPUTimed(this)
17{
18}
19
21{
22 m_options.allocate();
23
24 m_options.m_options->use_abs_energy = m_absOpt;
25 m_options.m_options->use_two_gaussian_noise = m_twoGaussianNoise;
26 m_options.m_options->skip_invalid_clusters = m_skipInvalidClusters;
27 m_options.m_options->min_LAr_quality = m_minBadLArQuality;
28 m_options.m_options->max_axis_angle = m_maxAxisAngle;
29 m_options.m_options->eta_inner_wheel = m_etaInnerWheel;
30 m_options.m_options->min_l_longitudinal = m_minLLongitudinal;
31 m_options.m_options->min_r_lateral = m_minRLateral;
32
33
34 ATH_CHECK( m_kernelSizeOptimizer.retrieve() );
35
36 return StatusCode::SUCCESS;
37}
38
40{
41 m_options.sendToGPU();
43
44 return StatusCode::SUCCESS;
45}
46
47StatusCode GPUClusterInfoAndMomentsCalculator::execute(const EventContext & ctx, const ConstantDataHolder & constant_data,
48 EventDataHolder & event_data, void * /*temporary_buffer*/) const
49{
50 size_t times[num_time_measurements];
51
52 calculateClusterPropertiesAndMoments(event_data, constant_data, m_options, *(m_kernelSizeOptimizer.get()), times, m_measureTimes);
53
55 {
56 record_times(ctx.evt(),
57 times[ 0],
58 times[ 1],
59 times[ 2],
60 times[ 3],
61 times[ 4],
62 times[ 5],
63 times[ 6],
64 times[ 7],
65 times[ 8],
66 times[ 9],
67 times[10]
68 );
69 }
70
71 return StatusCode::SUCCESS;
72}
73
75{
77 {
78 print_times("Isolation_Clusters Isolation_Cells Zeroth_Clusters "
79 "First_Cells First_Clusters Second_Cells Shower_Axis Second_Clusters "
80 "Third_Cells Third_Clusters Finalize_Clusters", num_time_measurements);
81 }
82 return StatusCode::SUCCESS;
83}
84
#define ATH_CHECK
Evaluate an expression and check for errors.
Gaudi::Property< bool > m_measureTimes
If true, times are recorded to the file given by m_timeFileName.
CaloGPUTimed(T *ptr)
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 > &times) const
Gaudi::Property< double > m_etaInnerWheel
Transition from outer to inner wheel in EME2.
Gaudi::Property< double > m_minBadLArQuality
the minimal cell quality in the LAr for declaring a cell bad
Gaudi::Property< double > m_maxAxisAngle
the maximal allowed deviation from the IP-to-ClusterCenter-axis.
ClusterMomentsCalculator::CMCOptionsHolder m_options
Options for the algorithm, held in a GPU-friendly way.
Gaudi::Property< double > m_minRLateral
the minimal in the definition of the Lateral moment
GPUClusterInfoAndMomentsCalculator(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< double > m_minLLongitudinal
the minimal in the definition of the Longitudinal moment
Gaudi::Property< bool > m_absOpt
if set to true use abs E value of cells to calculate cluster moments
Gaudi::Property< bool > m_twoGaussianNoise
if set to true use 2-gaussian noise description for TileCal
virtual StatusCode initialize_CUDA() override
Initialization that invokes CUDA functions.
ServiceHandle< IGPUKernelSizeOptimizerSvc > m_kernelSizeOptimizer
Handle to the CUDA kernel block and grid size optimization service.
Gaudi::Property< bool > m_skipInvalidClusters
If false, do the moment calculation even for invalid clusters (which may waste computation).
virtual StatusCode execute(const EventContext &ctx, const CaloRecGPU::ConstantDataHolder &constant_data, CaloRecGPU::EventDataHolder &event_data, void *temporary_buffer) const override
virtual StatusCode initialize_non_CUDA() override
Initialization that does not invoke CUDA functions.
void calculateClusterPropertiesAndMoments(CaloRecGPU::EventDataHolder &holder, const CaloRecGPU::ConstantDataHolder &instance_data, const CMCOptionsHolder &options, const IGPUKernelSizeOptimizer &optimizer, size_t(&times)[num_time_measurements], const bool synchronize=false, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream={}, const bool defer_instead_of_oversize=false)
void register_kernels(IGPUKernelSizeOptimizer &optimizer)