ATLAS Offline Software
Loading...
Searching...
No Matches
CaloThinCellsBySamplingAlg.cxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
3 */
10
11
17
18
23{
24 ATH_CHECK( m_cells.initialize (m_streamName) );
25 ATH_CHECK( detStore()->retrieve (m_caloID) );
26
27 if (!m_samplingNames.empty()) {
29 }
30 return StatusCode::SUCCESS;
31}
32
33
38StatusCode CaloThinCellsBySamplingAlg::execute (const EventContext& ctx) const
39{
41 cells.thinAll();
42
43 for (IdentifierHash cellHash : m_cellHashes) {
44 int index = cells->findIndex (cellHash);
45 if (index >= 0) {
46 cells.keep (index);
47 }
48 }
49
50 return StatusCode::SUCCESS;
51}
52
53
58{
59 bool acceptedSamplings[CaloSampling::getNumberOfSamplings()] = {false};
60 for (const std::string& name : m_samplingNames) {
62 if (samp == CaloSampling::Unknown) {
63 ATH_MSG_ERROR ( "Calorimeter sampling " << name
64 << " is not a valid Calorimeter sampling name and will be ignored! " );
65 }
66 else {
67 acceptedSamplings[static_cast<int> (samp)] = true;
68 }
69 }
70
71 size_t hashMax = m_caloID->calo_cell_hash_max();
72 for (size_t cellHash = 0; cellHash < hashMax; ++cellHash) {
73 if (acceptedSamplings[m_caloID->calo_sample (cellHash)]) {
74 m_cellHashes.emplace_back(cellHash);
75 }
76 }
77
78 return StatusCode::SUCCESS;
79}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
Thin calorimeter cells by sampling.
Handle class for reading from StoreGate.
Handle for requesting thinning for a data object.
const ServiceHandle< StoreGateSvc > & detStore() const
static CaloSample getSampling(const std::string &name)
Return the sampling code for a given name.
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.
StringProperty m_streamName
Name of the stream being thinned.
const CaloCell_ID * m_caloID
Calo ID helper.
StatusCode decodeSamplings()
Decode the provided list of calorimeter samplings.
SG::ThinningHandleKey< CaloCellContainer > m_cells
Cell container to thin.
std::vector< IdentifierHash > m_cellHashes
Decoded list of cells to save.
virtual StatusCode initialize() override
Gaudi initialize method.
virtual StatusCode execute(const EventContext &ctx) const override
Execute the algorithm.
This is a "hash" representation of an Identifier.
Handle for requesting thinning for a data object.
Definition index.py:1