20#include "boost/chrono/chrono.hpp"
21#include "boost/chrono/thread_clock.hpp"
26 base_class(
type, name, parent),
39 auto get_option_from_string = [](
const std::string &
str,
bool & failed)
72 bool size_failed =
false;
82 return StatusCode::FAILURE;
85 return StatusCode::SUCCESS;
93 using clock_type = boost::chrono::thread_clock;
94 auto time_cast = [](
const auto & before,
const auto & after)
96 return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count();
99 cluster_container->
clear();
101 const auto start = clock_type::now();
104 if ( !cell_collection.
isValid() )
106 ATH_MSG_ERROR(
" Cannot retrieve CaloCellContainer: " << cell_collection.
name() );
107 return StatusCode::FAILURE;
113 const auto after_send = clock_type::now();
115 size_t extra_times[5];
117 ed.exportClusters(cluster_container,
118 cell_collection_link,
126 const auto after_export = clock_type::now();
128 for (
auto && cluster : *cluster_container)
133 const auto after_size = clock_type::now();
138 time_cast(start, after_send),
144 time_cast(after_export, after_size)
148 return StatusCode::SUCCESS;
158 print_times(
"Transfer_from_GPU Cell_Link_Creation Cell_Adding Sorting Filling_Collection Moments Cluster_Size", 7);
160 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition of CaloDetDescrManager.
Helpers for checking error return status codes and reporting 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...
const CaloCell_ID * m_calo_id
Pointer to Calo ID Helper.
xAOD::CaloCluster::ClusterSize m_clusterSize
BasicGPUToAthenaImporter(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize() override
virtual StatusCode finalize() override
Gaudi::Property< std::string > m_clusterSizeString
Cluster size. Should be set accordingly to the threshold.
virtual StatusCode convert(const EventContext &ctx, const CaloRecGPU::ConstantDataHolder &constant_data, CaloRecGPU::EventDataHolder &event_data, xAOD::CaloClusterContainer *cluster_collection) const override
Gaudi::Property< std::vector< int > > m_missingCellsToFill
Cell indices to fill as disabled cells (useful if the cell vector is always missing the same cells).
Gaudi::Property< bool > m_saveUncalibrated
if set to true, the uncalibrated state is saved when importing the clusters.
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
vector of names of the cell containers to use as input.
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...
Object reference supporting deferred reading from StoreGate.
void clear()
Erase all the elements in the collection.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const std::string & name() const
Return the StoreGate ID for the referenced object.
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
static MomentsOptionsArray all()