13#ifndef CALOTOWER_MAX_CELL_COUNT
14#define CALOTOWER_MAX_CELL_COUNT 200000
31 return StatusCode::SUCCESS;
37 if(cellToTower.empty()) {
39 return StatusCode::FAILURE;
46 if (!caloTowerContainer.
isValid())
47 return StatusCode::FAILURE;
49 auto addedCellsMap = std::make_unique<std::bitset< CALOTOWER_MAX_CELL_COUNT> >();
54 ATH_MSG_ERROR(
"Cluster without cell links found in collection: " << inputClusterContainer.
name());
55 return StatusCode::FAILURE;
58 for (
const CaloCell* cell : *cellLinks) {
62 if (!addedCellsMap->test(cellHash)) {
63 addedCellsMap->set(cellHash);
64 assert(cellHash<cellToTower.size());
65 const auto& c2ts=cellToTower[cellHash];
68 (*caloTowerContainer)[c2t.m_towerIdx]->addEnergy(cell->e()*c2t.m_weight);
73 return StatusCode::SUCCESS;
77{
return StatusCode::SUCCESS; }
#define ATH_CHECK
Evaluate an expression and check for errors.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Data object for each calorimeter readout cell.
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
std::vector< std::vector< cellToTower_t > > CellToTowerVec
const CellToTowerVec & getIndexCache(const EventContext &ctx) const
SG::WriteHandle< xAOD::CaloTowerContainer > makeContainer(const EventContext &ctx) const
Intialize m_cellToTower cache.
CaloTowerxAODAlgoBase(const std::string &name, ISvcLocator *pSvcLocator)
Default algorithm constructor.
virtual ~CaloTowerxAODFromClusters()
Baseclass destructor.
virtual StatusCode initialize() override
Initialize algorithm.
virtual StatusCode execute(const EventContext &) const override
Execute algorithm.
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_inputClusterContainerKey
CaloTowerxAODFromClusters(const std::string &name, ISvcLocator *pSvcLocator)
Default algorithm constructor.
virtual StatusCode finalize() override
Finalize algorithm.
This is a "hash" representation of an Identifier.
const std::string & name() const
Return the StoreGate ID for the referenced object.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.