ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCPUOutput.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
7#include "CaloCPUOutput.h"
13
14
15using namespace CaloRecGPU;
16
17CaloCPUOutput::CaloCPUOutput(const std::string & type, const std::string & name, const IInterface * parent):
18 base_class(type, name, parent)
19{
20}
21
22
24{
25 ATH_CHECK( m_cellsKey.initialize() );
26
27 ATH_CHECK( detStore()->retrieve(m_calo_id, "CaloCell_ID") );
28
29 return StatusCode::SUCCESS;
30}
31
32StatusCode CaloCPUOutput::execute (const EventContext & ctx, xAOD::CaloClusterContainer * cluster_collection) const
33{
35 if ( !cell_collection.isValid() )
36 {
37 ATH_MSG_ERROR( " Cannot retrieve CaloCellContainer: " << cell_collection.name() );
38 return StatusCode::FAILURE;
39 }
40
42
43 ed.allocate(false);
44
45 ed.importCells(static_cast<const CaloCellContainer *>(&(*cell_collection)));
46
47 ed.importClusters(cluster_collection, MomentsOptionsArray::all(), m_outputTags, true, false, false);
48
50 {
51 const auto err = StandaloneDataIO::save_event_to_folder(ctx.evt(), std::string(m_savePath),
54
56 {
57 return StatusCode::FAILURE;
58 }
59 }
60 else
61 {
62 const auto err = StandaloneDataIO::save_clusters_to_folder(ctx.evt(), std::string(m_savePath),
64
66 {
67 return StatusCode::FAILURE;
68 }
69 }
70
71 return StatusCode::SUCCESS;
72
73}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
defines an "iterator" over instances of a given type in StoreGateSvc
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *cluster_collection) const override
Gaudi::Property< std::string > m_fileSuffix
The suffix of the saved files.
Gaudi::Property< bool > m_outputTags
Whether to output cell assignment as tags instead of a list of indices per cluster.
CaloCPUOutput(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::string > m_filePrefix
The prefix of the saved files.
Gaudi::Property< std::string > m_savePath
The path specifying the folder to which the files should be saved.
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
vector of names of the cell containers to use as input.
Gaudi::Property< bool > m_saveCellInfo
If true, also outputs the cell energies, times, gains, qualities and provenances.
virtual StatusCode initialize() override
const CaloCell_ID * m_calo_id
Pointer to Calo ID Helper.
Gaudi::Property< unsigned int > m_numWidth
The number of digits to reserve for the events.
Container class for CaloCell.
Holds the mutable per-event information (clusters and cells) and provides utilities to convert betwee...
Definition DataHolders.h:73
CaloRecGPU::Helpers::CUDA_pinned_CPU_object< CaloRecGPU::CellInfoArr > m_cell_info
CaloRecGPU::Helpers::CUDA_pinned_CPU_object< CaloRecGPU::ClusterInfoArr > m_clusters
void allocate(const bool also_GPU=true)
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.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
static MomentsOptionsArray all()
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::ClusterInfoArr > &clusters, const std::string &prefix="", const std::string &suffix="", const unsigned int num_width=9, const bool output_errors=true)
static ErrorState save_clusters_to_folder(const size_t event_number, const std::filesystem::path &folder, 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)