|
ATLAS Offline Software
|
Outputs counts of cells, both by type and cluster presence, with each cluster being identified by its cell with the largest signal-to-noise ratio.
More...
#include <CaloCellsCounterCPU.h>
|
| CaloCellsCounterCPU (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 | ~CaloCellsCounterCPU ()=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", "./cell_counts", "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...
|
|
SG::ReadHandleKey< CaloCellContainer > | m_cellsKey {this, "CellsName", "", "Name(s) of Cell Containers"} |
| vector of names of the cell containers to use as input. More...
|
|
SG::ReadCondHandleKey< CaloNoise > | m_noiseCDOKey {this, "CaloNoiseKey", "totalNoise", "SG Key of CaloNoise data object"} |
| Key of the CaloNoise Conditions data object. More...
|
|
Gaudi::Property< float > | m_seedThreshold {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"} |
| Value to consider for the seed threshold. More...
|
|
Gaudi::Property< float > | m_growThreshold {this, "NeighborThresholdOnEorAbsEinSigma", 2., "Neighbor (grow) threshold (in units of noise Sigma)"} |
| Value to consider for the seed threshold. More...
|
|
Gaudi::Property< float > | m_cellThreshold {this, "CellThresholdOnEorAbsEinSigma", 0., "Cell (terminal) threshold (in units of noise Sigma)"} |
| Value to consider for the seed threshold. 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 |
|
Outputs counts of cells, both by type and cluster presence, with each cluster being identified by its cell with the largest signal-to-noise ratio.
- 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
- 20 July 2022
Definition at line 27 of file CaloCellsCounterCPU.h.
◆ StoreGateSvc_t
◆ CaloCellsCounterCPU()
CaloCellsCounterCPU::CaloCellsCounterCPU |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~CaloCellsCounterCPU()
virtual CaloCellsCounterCPU::~CaloCellsCounterCPU |
( |
| ) |
|
|
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 62 of file CaloCellsCounterCPU.cxx.
66 if ( !cell_collection.isValid() )
68 ATH_MSG_ERROR(
" Cannot retrieve CaloCellContainer: " << cell_collection.name() );
69 return StatusCode::FAILURE;
74 const CaloNoise * noise_tool = *noise_handle;
76 unsigned int gain_counts[GainConversion::num_gain_values()] = {0};
78 size_struct global_counts, global_cluster_counts;
88 const unsigned int gain = GainConversion::from_standard_gain(
cell->gain());
90 ++gain_counts[
gain - GainConversion::min_gain_value()];
100 ++global_counts.grow;
104 ++global_counts.term;
108 ++global_counts.invalid;
112 struct cluster_cell_info
115 double w_1 = -1, w_2 = -1,
energy = -9e99, SNR = -9e99;
123 else if (cl_2 ==
nullptr)
130 std::cout <<
"WARNING! Multiple shared cell: " << cell_id <<
" " << cl_1 <<
" " << cl_2 <<
" " <<
cl << std::endl;
134 bool is_shared()
const
136 return cl_1 !=
nullptr && cl_2 !=
nullptr;
141 std::map<int, cluster_cell_info> cluster_cells;
150 ATH_MSG_ERROR(
"Can't get valid links to CaloCells (CaloClusterCellLink)!");
151 return StatusCode::FAILURE;
154 for (
auto it = cell_links->
begin();
it != cell_links->
end(); ++
it)
159 const float this_energy = std::abs(
cell->energy());
161 const float this_snr = std::abs(this_energy / noise_tool->
getNoise(
m_calo_id->calo_cell_hash(
cell->ID()),
cell->gain()));
163 const IdentifierHash this_hash =
m_calo_id->calo_cell_hash(
cell->ID());
165 auto &
info = cluster_cells[this_hash];
167 info.energy = this_energy;
175 std::unordered_map<const xAOD::CaloCluster *, cluster_info_struct> cluster_sizes;
177 auto update_clusters = [&](
const cluster_cell_info & cci,
const int cell)
183 auto & c_info = cluster_sizes[
cl];
199 ++c_info.size.invalid;
204 ++c_info.size.shared;
208 if (cci.SNR > c_info.seed_snr || (cci.SNR == c_info.seed_snr &&
cell > c_info.seed_index))
210 c_info.seed_index =
cell;
211 c_info.seed_snr = cci.SNR;
212 c_info.seed_energy = cci.energy;
218 if (cci.cl_1 !=
nullptr || cci.cl_2 !=
nullptr)
220 ++global_cluster_counts.total;
223 ++global_cluster_counts.seed;
227 ++global_cluster_counts.grow;
231 ++global_cluster_counts.term;
235 ++global_cluster_counts.invalid;
239 ++global_cluster_counts.shared;
243 update_one(cci.cl_1);
244 update_one(cci.cl_2);
247 for (
auto &
it : cluster_cells)
249 update_clusters(
it.second,
it.first);
252 std::vector<cluster_info_struct> sorted_info;
254 sorted_info.reserve(cluster_sizes.size());
256 for (
auto &
v : cluster_sizes)
258 sorted_info.push_back(
v.second);
261 std::sort(sorted_info.begin(), sorted_info.end(),
262 [](
const auto &
a,
const auto &
b)
264 return a.seed_index < b.seed_index;
271 return StatusCode::FAILURE;
277 std::ofstream out_file(save_file);
279 if (!out_file.is_open())
281 return StatusCode::FAILURE;
284 out_file <<
"Cell counts: " << global_counts <<
"\n\n";
286 out_file <<
"Cells in clusters count: " << global_cluster_counts <<
"\n\n";
287 out_file <<
"Clusters:\n\n";
289 for (
const auto &
info : sorted_info)
291 out_file <<
info <<
"\n";
294 out_file << std::endl;
296 if (!out_file.good())
298 return StatusCode::FAILURE;
303 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 CaloCellsCounterCPU::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
◆ m_cellThreshold
Gaudi::Property<float> CaloCellsCounterCPU::m_cellThreshold {this, "CellThresholdOnEorAbsEinSigma", 0., "Cell (terminal) threshold (in units of noise Sigma)"} |
|
private |
Value to consider for the seed threshold.
Should be consistent with the one used in Topological Clustering to ensure cell classification is correct.
Definition at line 89 of file CaloCellsCounterCPU.h.
◆ m_detStore
◆ m_evtStore
◆ m_filePrefix
Gaudi::Property<std::string> CaloCellsCounterCPU::m_filePrefix {this, "FilePrefix", "", "Prefix of the saved files"} |
|
private |
◆ m_fileSuffix
Gaudi::Property<std::string> CaloCellsCounterCPU::m_fileSuffix {this, "FileSuffix", "", "Suffix of the saved files"} |
|
private |
◆ m_growThreshold
Gaudi::Property<float> CaloCellsCounterCPU::m_growThreshold {this, "NeighborThresholdOnEorAbsEinSigma", 2., "Neighbor (grow) threshold (in units of noise Sigma)"} |
|
private |
Value to consider for the seed threshold.
Should be consistent with the one used in Topological Clustering to ensure cell classification is correct.
Definition at line 84 of file CaloCellsCounterCPU.h.
◆ m_noiseCDOKey
Key of the CaloNoise Conditions data object.
Typical values are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default)
Definition at line 74 of file CaloCellsCounterCPU.h.
◆ m_numWidth
Gaudi::Property<unsigned int> CaloCellsCounterCPU::m_numWidth {this, "NumberWidth", 9, "The number of digits to reserve for the events"} |
|
private |
◆ m_savePath
Gaudi::Property<std::string> CaloCellsCounterCPU::m_savePath {this, "SavePath", "./cell_counts", "Path to where the files should be saved"} |
|
private |
◆ m_seedThreshold
Gaudi::Property<float> CaloCellsCounterCPU::m_seedThreshold {this, "SeedThresholdOnEorAbsEinSigma", 4., "Seed threshold (in units of noise Sigma)"} |
|
private |
Value to consider for the seed threshold.
Should be consistent with the one used in Topological Clustering to ensure cell classification is correct.
Definition at line 79 of file CaloCellsCounterCPU.h.
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
static std::string build_filename(const std::string &prefix, const std::string &text, const std::string &suffix, const std::string &ext)
Gaudi::Property< std::string > m_fileSuffix
The suffix of the saved files.
Const iterator class for DataVector/DataList.
path
python interpreter configuration --------------------------------------—
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.
Gaudi::Property< float > m_cellThreshold
Value to consider for the seed threshold.
const_iterator begin() const
const begin method
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
vector of names of the cell containers to use as input.
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
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< float > m_seedThreshold
Value to consider for the seed threshold.
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
Description of a calorimeter cluster.
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.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
static ErrorState prepare_folder_for_output(const std::filesystem::path &folder, const bool output_errors=true)
Gaudi::Property< std::string > m_savePath
The path specifying the folder to which the files should be saved.
StatusCode initialize(bool used=true)
const_iterator end() const
const end method
const CaloCell_ID * m_calo_id
Pointer to Calo ID Helper.
Data object for each calorimeter readout cell.
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Gaudi::Property< unsigned int > m_numWidth
The number of digits to reserve for the events.
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
Key of the CaloNoise Conditions data object.
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *cluster_collection) const override
Execute on an entire collection of clusters.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Gaudi::Property< std::string > m_filePrefix
The prefix of the saved files.
Gaudi::Property< float > m_growThreshold
Value to consider for the seed threshold.