|
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>
|
| CaloCPUOutput (const std::string &type, const std::string &name, const IInterface *parent) |
|
virtual StatusCode | initialize () override |
|
virtual StatusCode | execute (const EventContext &ctx, xAOD::CaloClusterContainer *cluster_collection) const override |
| Execute on an entire collection of clusters. More...
|
|
virtual | ~CaloCPUOutput ()=default |
|
virtual StatusCode | execute (const EventContext &ctx, xAOD::CaloClusterContainer *collection) const=0 |
| Execute on an entire collection of clusters. More...
|
|
virtual StatusCode | execute (xAOD::CaloClusterContainer *collection) final |
| Execute on an entire collection of clusters. More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
virtual StatusCode | execute (xAOD::CaloClusterContainer *collection) final |
| Execute on an entire collection of clusters. More...
|
|
|
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...
|
|
StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) More...
|
|
StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) More...
|
|
std::vector< SG::VarHandleKeyArray * > | m_vhka |
|
bool | m_varHandleArraysDeclared |
|
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.
◆ StoreGateSvc_t
◆ CaloCPUOutput()
CaloCPUOutput::CaloCPUOutput |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
Definition at line 15 of file CaloCPUOutput.cxx.
18 declareInterface<CaloClusterCollectionProcessor> (
this);
◆ ~CaloCPUOutput()
virtual CaloCPUOutput::~CaloCPUOutput |
( |
| ) |
|
|
virtualdefault |
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute() [1/4]
Execute on an entire collection of clusters.
- Parameters
-
collection | The container of clusters. param ctx The event context. |
Implements CaloClusterCollectionProcessor.
Definition at line 31 of file CaloCPUOutput.cxx.
40 if ( !cell_collection.isValid() )
42 ATH_MSG_ERROR(
" Cannot retrieve CaloCellContainer: " << cell_collection.name() );
43 return StatusCode::FAILURE;
49 ret_clusts.allocate();
53 ret_info->energy[
i] = 0;
54 ret_info->gain[
i] = GainConversion::invalid_gain();
55 ret_info->time[
i] = 0;
56 ret_info->qualityProvenance[
i] = 0;
58 ret_state->clusterTag[
i] = ClusterTag::make_invalid_tag();
70 const unsigned int gain = GainConversion::from_standard_gain(
cell->gain());
79 size_t shared_count = 0;
81 const auto cluster_end = cluster_collection->end();
82 auto cluster_iter = cluster_collection->begin();
84 for (
int cluster_number = 0; cluster_iter != cluster_end; ++cluster_iter, ++cluster_number )
90 ATH_MSG_ERROR(
"Can't get valid links to CaloCells (CaloClusterCellLink)!");
91 return StatusCode::FAILURE;
95 ret_clusts->clusterEnergy[cluster_number] = cluster->
e();
96 ret_clusts->clusterEt[cluster_number] = cluster->
et();
97 ret_clusts->clusterEta[cluster_number] = cluster->
eta();
98 ret_clusts->clusterPhi[cluster_number] = cluster->
phi();
102 ret_clusts->seedCellID[cluster_number] = seed_cell_index;
104 for (
auto it = cell_links->
begin();
it != cell_links->
end(); ++
it)
107 const int cell_ID =
m_calo_id->calo_cell_hash(
it->ID());
111 std::memcpy(&weight_as_int, &
weight,
sizeof(
float));
116 if (weight_as_int == 0)
124 const ClusterTag other_tag = ret_state->clusterTag[cell_ID];
132 ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, weight_as_int, 0);
136 ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number);
141 ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(cluster_number, other_tag.
secondary_cluster_weight(), other_index);
147 const int max_cluster = cluster_number > other_index ? cluster_number : other_index;
148 const int min_cluster = cluster_number > other_index ? other_index : cluster_number;
149 ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(max_cluster, weight_as_int, min_cluster);
154 ret_state->clusterTag[cell_ID] = ClusterTag::make_tag(other_index, weight_as_int, cluster_number);
160 ret_clusts->number = cluster_collection->size();
168 ret_info, ret_state, ret_clusts,
173 return StatusCode::FAILURE;
186 return StatusCode::FAILURE;
190 return StatusCode::SUCCESS;
◆ execute() [2/4]
virtual StatusCode CaloClusterCollectionProcessor::execute |
Execute on an entire collection of clusters.
- Parameters
-
collection | The container of clusters. param ctx The event context. |
◆ execute() [3/4]
virtual StatusCode CaloClusterCollectionProcessor::execute |
|
inlinefinal |
Execute on an entire collection of clusters.
- Parameters
-
collection | The container of clusters. (deprecated) |
Definition at line 49 of file CaloClusterCollectionProcessor.h.
51 return execute (Gaudi::Hive::currentContext(), collection);
◆ execute() [4/4]
|
inlinefinalvirtualinherited |
Execute on an entire collection of clusters.
- Parameters
-
collection | The container of clusters. (deprecated) |
Definition at line 49 of file CaloClusterCollectionProcessor.h.
51 return execute (Gaudi::Hive::currentContext(), collection);
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ initialize()
StatusCode CaloCPUOutput::initialize |
( |
| ) |
|
|
overridevirtual |
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ interfaceID()
static const InterfaceID& CaloClusterCollectionProcessor::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ renounce()
◆ renounceArray()
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ 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_detStore
◆ m_evtStore
◆ 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.
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
virtual double phi() const
The azimuthal angle ( ) of the particle.
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
vector of names of the cell containers to use as input.
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version)
Const iterator class for DataVector/DataList.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *collection) const =0
Execute on an entire collection of clusters.
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
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
Gaudi::Property< unsigned int > m_numWidth
The number of digits to reserve for the events.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual void setOwner(IDataHandleHolder *o)=0
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
Execute on an entire collection of clusters.
Description of a calorimeter cluster.
virtual double eta() const
The pseudorapidity ( ) of the particle.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
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)
Gaudi::Property< std::string > m_savePath
The path specifying the folder to which the files should be saved.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
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)
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
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.
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
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.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
virtual double e() const
The total energy of the particle.
constexpr int32_t secondary_cluster_weight() const