ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloRec
src
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
12
#include "
CaloThinCellsBySamplingAlg.h
"
13
#include "
CaloUtils/CaloCellList.h
"
14
#include "
CaloIdentifier/CaloCell_ID.h
"
15
#include "
StoreGate/ThinningHandle.h
"
16
#include "
StoreGate/ReadHandle.h
"
17
18
22
StatusCode
CaloThinCellsBySamplingAlg::initialize
()
23
{
24
ATH_CHECK
(
m_cells
.initialize (
m_streamName
) );
25
ATH_CHECK
(
detStore
()->retrieve (
m_caloID
) );
26
27
if
(!
m_samplingNames
.empty()) {
28
ATH_CHECK
(
decodeSamplings
() );
29
}
30
return
StatusCode::SUCCESS;
31
}
32
33
38
StatusCode
CaloThinCellsBySamplingAlg::execute
(
const
EventContext& ctx)
const
39
{
40
SG::ThinningHandle<CaloCellContainer>
cells (
m_cells
, ctx);
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
57
StatusCode
CaloThinCellsBySamplingAlg::decodeSamplings
()
58
{
59
bool
acceptedSamplings[
CaloSampling::getNumberOfSamplings
()] = {
false
};
60
for
(
const
std::string& name :
m_samplingNames
) {
61
CaloSampling::CaloSample
samp =
CaloSampling::getSampling
(name);
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:32
CaloCellList.h
CaloCell_ID.h
CaloThinCellsBySamplingAlg.h
Thin calorimeter cells by sampling.
ReadHandle.h
Handle class for reading from StoreGate.
ThinningHandle.h
Handle for requesting thinning for a data object.
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
CaloSampling::getSampling
static CaloSample getSampling(const std::string &name)
Return the sampling code for a given name.
Definition
Calorimeter/CaloGeoHelpers/Root/CaloSampling.cxx:32
CaloSampling::CaloSample
CaloSample
Definition
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloSampling::getNumberOfSamplings
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.
Definition
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:30
CaloThinCellsBySamplingAlg::m_streamName
StringProperty m_streamName
Name of the stream being thinned.
Definition
CaloThinCellsBySamplingAlg.h:60
CaloThinCellsBySamplingAlg::m_caloID
const CaloCell_ID * m_caloID
Calo ID helper.
Definition
CaloThinCellsBySamplingAlg.h:74
CaloThinCellsBySamplingAlg::decodeSamplings
StatusCode decodeSamplings()
Decode the provided list of calorimeter samplings.
Definition
CaloThinCellsBySamplingAlg.cxx:57
CaloThinCellsBySamplingAlg::m_samplingNames
StringArrayProperty m_samplingNames
Definition
CaloThinCellsBySamplingAlg.h:67
CaloThinCellsBySamplingAlg::m_cells
SG::ThinningHandleKey< CaloCellContainer > m_cells
Cell container to thin.
Definition
CaloThinCellsBySamplingAlg.h:64
CaloThinCellsBySamplingAlg::m_cellHashes
std::vector< IdentifierHash > m_cellHashes
Decoded list of cells to save.
Definition
CaloThinCellsBySamplingAlg.h:71
CaloThinCellsBySamplingAlg::initialize
virtual StatusCode initialize() override
Gaudi initialize method.
Definition
CaloThinCellsBySamplingAlg.cxx:22
CaloThinCellsBySamplingAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Execute the algorithm.
Definition
CaloThinCellsBySamplingAlg.cxx:38
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SG::ThinningHandle
Handle for requesting thinning for a data object.
Definition
ThinningHandle.h:84
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0