Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Standard tool to output CPU cluster info to the non-standard file format that we have been using for plotting and validation purposes.
More...
#include <CaloCPUOutput.h>
|
Gaudi::Property< std::string > | m_savePath {this, "SavePath", "./saved_clusters", "Path to where the files should be saved"} |
| The path specifying the folder to which the files should be saved. More...
|
|
Gaudi::Property< std::string > | m_filePrefix {this, "FilePrefix", "", "Prefix of the saved files"} |
| The prefix of the saved files. More...
|
|
Gaudi::Property< std::string > | m_fileSuffix {this, "FileSuffix", "", "Suffix of the saved files"} |
| The suffix of the saved files. More...
|
|
Gaudi::Property< unsigned int > | m_numWidth {this, "NumberWidth", 9, "The number of digits to reserve for the events"} |
| The number of digits to reserve for the events. More...
|
|
Gaudi::Property< bool > | m_saveCellInfo |
| If true , also outputs the cell energies, times, gains, qualities and provenances. More...
|
|
SG::ReadHandleKey< CaloCellContainer > | m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"} |
| vector of names of the cell containers to use as input. More...
|
|
const CaloCell_ID * | m_calo_id {nullptr} |
| Pointer to Calo ID Helper. More...
|
|
Standard tool to output CPU cluster info to the non-standard file format that we have been using for plotting and validation purposes.
- Author
- Nuno Fernandes nuno..nosp@m.dos..nosp@m.santo.nosp@m.s.fe.nosp@m.rnand.nosp@m.es@c.nosp@m.ern.c.nosp@m.h
- Date
- 31 May 2022 There are likely more elegant/general/generic/portable solutions, some of which might even avoid Root too, but our workflow was built around this one...
Definition at line 30 of file CaloCPUOutput.h.
◆ CaloCPUOutput()
CaloCPUOutput::CaloCPUOutput |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~CaloCPUOutput()
virtual CaloCPUOutput::~CaloCPUOutput |
( |
| ) |
|
|
virtualdefault |
◆ execute() [1/3]
Definition at line 30 of file CaloCPUOutput.cxx.
39 if ( !cell_collection.isValid() )
41 ATH_MSG_ERROR(
" Cannot retrieve CaloCellContainer: " << cell_collection.name() );
42 return StatusCode::FAILURE;
48 ret_clusts.allocate();
52 ret_info->energy[
i] = 0;
53 ret_info->gain[
i] = GainConversion::invalid_gain();
54 ret_info->time[
i] = 0;
55 ret_info->qualityProvenance[
i] = 0;
57 ret_state->clusterTag[
i] = ClusterTag::make_invalid_tag();
69 const unsigned int gain = GainConversion::from_standard_gain(
cell->gain());
78 size_t shared_count = 0;
80 const auto cluster_end = cluster_collection->
end();
81 auto cluster_iter = cluster_collection->
begin();
83 for (
int cluster_number = 0; cluster_iter != cluster_end; ++cluster_iter, ++cluster_number )
89 ATH_MSG_ERROR(
"Can't get valid links to CaloCells (CaloClusterCellLink)!");
90 return StatusCode::FAILURE;
94 ret_clusts->clusterEnergy[cluster_number] =
cluster->e();
95 ret_clusts->clusterEt[cluster_number] =
cluster->et();
96 ret_clusts->clusterEta[cluster_number] =
cluster->eta();
97 ret_clusts->clusterPhi[cluster_number] =
cluster->phi();
99 const int seed_cell_index =
m_calo_id->calo_cell_hash(
cluster->cell_begin()->ID());
101 ret_clusts->seedCellID[cluster_number] = seed_cell_index;
103 for (
auto it = cell_links->
begin();
it != cell_links->
end(); ++
it)
106 const int cell_ID =
m_calo_id->calo_cell_hash(
it->ID());
110 std::memcpy(&weight_as_int, &
weight,
sizeof(
float));
115 if (weight_as_int == 0)
123 const ClusterTag other_tag = ret_state->clusterTag[cell_ID];
131 ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, weight_as_int, 0);
135 ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number);
140 ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, other_tag.
secondary_cluster_weight(), other_index);
146 const int max_cluster = cluster_number > other_index ? cluster_number : other_index;
147 const int min_cluster = cluster_number > other_index ? other_index : cluster_number;
148 ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(max_cluster, weight_as_int, min_cluster);
153 ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(other_index, weight_as_int, cluster_number);
159 ret_clusts->number = cluster_collection->
size();
167 ret_info, ret_state, ret_clusts,
172 return StatusCode::FAILURE;
185 return StatusCode::FAILURE;
189 return StatusCode::SUCCESS;
◆ execute() [2/3]
virtual StatusCode CaloClusterCollectionProcessor::execute |
Execute on an entire collection of clusters.
- Parameters
-
collection | The container of clusters. param ctx The event context. |
◆ execute() [3/3]
virtual StatusCode CaloClusterCollectionProcessor::execute |
|
inlinefinal |
Execute on an entire collection of clusters.
- Parameters
-
collection | The container of clusters. (deprecated) |
Definition at line 50 of file CaloClusterCollectionProcessor.h.
52 return execute (Gaudi::Hive::currentContext(), collection);
◆ initialize()
StatusCode CaloCPUOutput::initialize |
( |
| ) |
|
|
overridevirtual |
◆ m_calo_id
◆ m_cellsKey
vector of names of the cell containers to use as input.
Definition at line 80 of file CaloCPUOutput.h.
◆ m_filePrefix
Gaudi::Property<std::string> CaloCPUOutput::m_filePrefix {this, "FilePrefix", "", "Prefix of the saved files"} |
|
private |
The prefix of the saved files.
Empty string by default.
Definition at line 57 of file CaloCPUOutput.h.
◆ m_fileSuffix
Gaudi::Property<std::string> CaloCPUOutput::m_fileSuffix {this, "FileSuffix", "", "Suffix of the saved files"} |
|
private |
The suffix of the saved files.
Empty string by default.
Definition at line 62 of file CaloCPUOutput.h.
◆ m_numWidth
Gaudi::Property<unsigned int> CaloCPUOutput::m_numWidth {this, "NumberWidth", 9, "The number of digits to reserve for the events"} |
|
private |
The number of digits to reserve for the events.
9 by default.
Definition at line 67 of file CaloCPUOutput.h.
◆ m_saveCellInfo
Gaudi::Property<bool> CaloCPUOutput::m_saveCellInfo |
|
private |
Initial value:{this, "AlsoOutputCellInfo", false,
"Whether to output cell energies, gains, times, etc., as this information is repeated in the GPU side too."}
If true
, also outputs the cell energies, times, gains, qualities and provenances.
As the GPU output contains exactly the same information, this will be redundant and thus it is defaulted to false
.
Definition at line 74 of file CaloCPUOutput.h.
◆ m_savePath
Gaudi::Property<std::string> CaloCPUOutput::m_savePath {this, "SavePath", "./saved_clusters", "Path to where the files should be saved"} |
|
private |
The path specifying the folder to which the files should be saved.
Default
./saved_clusters
Definition at line 52 of file CaloCPUOutput.h.
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
vector of names of the cell containers to use as input.
Const iterator class for DataVector/DataList.
Holds one objects of type \T in memory context Context.
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::CellStateArr > &cell_state, 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)
const_iterator begin() const
const begin method
Gaudi::Property< unsigned int > m_numWidth
The number of digits to reserve for the events.
Gaudi::Property< bool > m_saveCellInfo
If true, also outputs the cell energies, times, gains, qualities and provenances.
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
constexpr int32_t cluster_index() const
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *cluster_collection) const override
Description of a calorimeter cluster.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Gaudi::Property< std::string > m_savePath
The path specifying the folder to which the files should be saved.
static ErrorState save_cell_state_to_folder(const size_t event_number, const std::filesystem::path &folder, const CaloRecGPU::Helpers::CPU_object< CaloRecGPU::CellStateArr > &cell_state, const std::string &prefix="", const std::string &suffix="", const unsigned int num_width=9, const bool output_errors=true)
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.
Gaudi::Property< std::string > m_fileSuffix
The suffix of the saved files.
Gaudi::Property< std::string > m_filePrefix
The prefix of the saved files.
Data object for each calorimeter readout cell.
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)
const CaloCell_ID * m_calo_id
Pointer to Calo ID Helper.
size_type size() const noexcept
Returns the number of elements in the collection.
constexpr int32_t secondary_cluster_weight() const
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.