![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
17 #include "boost/chrono/chrono.hpp"
18 #include "boost/chrono/thread_clock.hpp"
26 declareInterface<ICaloClusterGPUInputTransformer> (
this);
39 return StatusCode::SUCCESS;
47 using clock_type = boost::chrono::thread_clock;
48 auto time_cast = [](
const auto & before,
const auto & after)
50 return boost::chrono::duration_cast<boost::chrono::microseconds>(after - before).count();
58 if ( !cell_collection.
isValid() )
60 ATH_MSG_ERROR(
" Cannot retrieve CaloCellContainer: " << cell_collection.
name() );
61 return StatusCode::FAILURE;
70 auto export_cell = [&](
const CaloCell *
cell,
const int cell_index)
73 const unsigned int gain = GainConversion::from_standard_gain(
cell->gain());
117 export_cell(
cell, cell_index);
124 ATH_MSG_DEBUG(
"Taking remediated fast path on event " << ctx.evt());
126 size_t missing_cell_count = 0;
134 ed.
m_cell_info->gain[cell_index] = GainConversion::invalid_gain();
135 ++missing_cell_count;
140 export_cell(
cell, cell_index);
151 for (
int cell_index = 0; cell_index <
NCaloCells; ++cell_index)
153 ed.
m_cell_info->gain[cell_index] = GainConversion::invalid_gain();
161 const int cell_index =
cell->caloDDE()->calo_hash();
164 export_cell(
cell, cell_index);
195 if (cluster_collection->
size() > 0)
200 ed.
m_cell_state->clusterTag[
i] = ClusterTag::make_invalid_tag();
203 const auto cluster_end = cluster_collection->
end();
204 auto cluster_iter = cluster_collection->
begin();
206 for (
int cluster_number = 0; cluster_iter != cluster_end; ++cluster_iter, ++cluster_number )
211 ed.
m_clusters->clusterEnergy[cluster_number] = cluster->
e();
212 ed.
m_clusters->clusterEt[cluster_number] = cluster->
et();
218 ed.
m_clusters->seedCellID[cluster_number] = seed_cell_index;
220 for (
auto it = cell_links->
begin();
it != cell_links->
end(); ++
it)
224 const int cell_ID =
m_calo_id->calo_cell_hash(
it->ID());
228 std::memcpy(&weight_as_int, &
weight,
sizeof(
float));
233 if (weight_as_int == 0)
249 ed.
m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, weight_as_int, 0);
253 ed.
m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number);
263 const int max_cluster = cluster_number > other_index ? cluster_number : other_index;
264 const int min_cluster = cluster_number > other_index ? other_index : cluster_number;
265 ed.
m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(max_cluster, weight_as_int, min_cluster);
269 ed.
m_cell_state->clusterTag[cell_ID] = ClusterTag::make_tag(other_index, weight_as_int, cluster_number);
284 const bool has_cluster_info = cluster_collection->
size() > 0;
293 time_cast(
start, post_cells),
294 time_cast(post_cells, post_clusters),
295 time_cast(post_clusters, post_send)
299 return StatusCode::SUCCESS;
311 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
virtual double phi() const
The azimuthal angle ( ) of the particle.
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).
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version)
Const iterator class for DataVector/DataList.
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
vector of names of the cell containers to use as input.
const std::string & name() const
Return the StoreGate ID for the referenced object.
const_iterator begin() const
const begin method
bool isOrdered() const
tell wether container is ordered
Gaudi::Property< bool > m_considerSharedCells
If true, into account the possibility of a cell being shared between clusters.
Base class to provide some basic common infrastructure for timing measurements...
Definition of CaloDetDescrManager.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode finalize() override
BasicEventDataGPUExporter(const std::string &type, const std::string &name, const IInterface *parent)
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
constexpr int32_t cluster_index() const
uint8_t qual2(void) const
get quality of second PMT (data member)
Description of a calorimeter cluster.
const CaloCell_ID * m_calo_id
Pointer to Calo ID Helper.
virtual double eta() const
The pseudorapidity ( ) of the particle.
constexpr static bool is_tile(const int cell)
::StatusCode StatusCode
StatusCode definition for legacy code.
void print_times(const std::string &header, const size_t time_size) const
uint8_t qbit1(void) const
get quality bits of first PMT (data member)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Gaudi::Property< bool > m_keepCPUData
If true, do not delete the CPU version of the GPU-friendly data representation.
Helpers for checking error return status codes and reporting errors.
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
const_iterator end() const
const end method
constexpr bool is_part_of_cluster() const
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
virtual StatusCode convert(const EventContext &ctx, const CaloRecGPU::ConstantDataHolder &constant_data, const xAOD::CaloClusterContainer *cluster_collection, CaloRecGPU::EventDataHolder &event_data) const override
Fill the CaloRecGPU::EventDataHolder with the relevant information.
virtual StatusCode initialize() override
uint8_t qbit2(void) const
get quality bits of second PMT (data member)
bool isOrderedAndComplete() const
tell wether container is complete and in order
Data object for each calorimeter readout cell.
CaloRecGPU::Helpers::CUDA_pinned_CPU_object< CaloRecGPU::ClusterInfoArr > m_clusters
void record_times(const size_t event_num, const std::vector< size_t > ×) const
Gaudi::Property< bool > m_measureTimes
If true, times are recorded to the file given by m_timeFileName.
CaloRecGPU::Helpers::CUDA_pinned_CPU_object< CaloRecGPU::CellStateArr > m_cell_state
void sendToGPU(const bool clear_CPU=false, const bool has_state=false, const bool has_clusters=false, const bool has_moments=false)
uint8_t qual1(void) const
get quality of first PMT (data member)
size_type size() const noexcept
Returns the number of elements in the collection.
virtual double e() const
The total energy of the particle.
constexpr int32_t secondary_cluster_weight() const
CaloRecGPU::Helpers::CUDA_pinned_CPU_object< CaloRecGPU::CellInfoArr > m_cell_info
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.