ATLAS Offline Software
CaloThinCellsBySamplingAlg.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
3  */
13 #include "CaloUtils/CaloCellList.h"
16 #include "StoreGate/ReadHandle.h"
17 
18 
23 {
26 
27  if (!m_samplingNames.empty()) {
29  }
30  return StatusCode::SUCCESS;
31 }
32 
33 
38 StatusCode CaloThinCellsBySamplingAlg::execute (const EventContext& ctx) const
39 {
41  cells.thinAll();
42 
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:271
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
CaloSampling::getSampling
static CaloSample getSampling(const std::string &name)
Return the sampling code for a given name.
Definition: Calorimeter/CaloGeoHelpers/Root/CaloSampling.cxx:32
CaloThinCellsBySamplingAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Execute the algorithm.
Definition: CaloThinCellsBySamplingAlg.cxx:38
ThinningHandle.h
Handle for requesting thinning for a data object.
index
Definition: index.py:1
CaloCellList.h
CaloCell_Base_ID::calo_sample
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
Definition: CaloCell_Base_ID.cxx:141
CaloThinCellsBySamplingAlg::m_cellHashes
std::vector< IdentifierHash > m_cellHashes
Decoded list of cells to save.
Definition: CaloThinCellsBySamplingAlg.h:71
SG::ThinningHandle
Handle for requesting thinning for a data object.
Definition: ThinningHandle.h:84
SG::ThinningHandleKey::initialize
StatusCode initialize(const std::string &stream, const std::string &qualifier, bool used=true)
Should be called during the initialize phase.
CaloCell_ID.h
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
CaloThinCellsBySamplingAlg.h
Thin calorimeter cells by sampling.
CaloThinCellsBySamplingAlg::m_streamName
StringProperty m_streamName
Name of the stream being thinned.
Definition: CaloThinCellsBySamplingAlg.h:60
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloThinCellsBySamplingAlg::m_samplingNames
StringArrayProperty m_samplingNames
Definition: CaloThinCellsBySamplingAlg.h:67
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
WriteCellNoiseToCool.cellHash
cellHash
Definition: WriteCellNoiseToCool.py:433
CaloThinCellsBySamplingAlg::initialize
virtual StatusCode initialize() override
Gaudi initialize method.
Definition: CaloThinCellsBySamplingAlg.cxx:22
CaloThinCellsBySamplingAlg::m_cells
SG::ThinningHandleKey< CaloCellContainer > m_cells
Cell container to thin.
Definition: CaloThinCellsBySamplingAlg.h:64
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CaloSampling::getNumberOfSamplings
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:30
CaloThinCellsBySamplingAlg::m_caloID
const CaloCell_ID * m_caloID
Calo ID helper.
Definition: CaloThinCellsBySamplingAlg.h:74
ReadHandle.h
Handle class for reading from StoreGate.
IdentifierHash
Definition: IdentifierHash.h:38
CaloThinCellsBySamplingAlg::decodeSamplings
StatusCode decodeSamplings()
Decode the provided list of calorimeter samplings.
Definition: CaloThinCellsBySamplingAlg.cxx:57
CaloCell_Base_ID::calo_cell_hash_max
size_type calo_cell_hash_max(void) const
cell 'global' hash table max size