49 if(cellToTower.empty()) {
51 return StatusCode::FAILURE;
55 if (!inputCellContainer.
isValid()) {
56 ATH_MSG_ERROR(
"Can't retrieve CaloCellContainer with key " << inputCellContainer.
name() );
57 return StatusCode::FAILURE;
62 if (!caloTowerContainer.
isValid())
63 return StatusCode::FAILURE;
65 const size_t nCell2Tower=cellToTower.size();
66 if (nCell2Tower<inputCellContainer->size()) {
67 ATH_MSG_ERROR(
"Number of cells larger than size of internal cell2tower cache. nCells="
68 << inputCellContainer->size() <<
", cell2tower size=" << nCell2Tower );
69 return StatusCode::FAILURE;
72 for (
const CaloCell* cell : *inputCellContainer) {
77 assert(cellHash<cellToTower.size());
78 if (!(cellHash<cellToTower.size())) {
79 ATH_MSG_ERROR(
"Cell2Tower mapping too small " << cellToTower.size() <<
", expected at least" << cellHash );
80 return StatusCode::FAILURE;
82 const auto& c2ts=cellToTower[cellHash];
85 if (c2t.m_towerIdx > caloTowerContainer->size()) {
86 ATH_MSG_ERROR(
"Tower container size too small " << caloTowerContainer->size() <<
", expected at least" << c2t.m_towerIdx );
87 return StatusCode::FAILURE;
89 (*caloTowerContainer)[c2t.m_towerIdx]->addEnergy(cell->e()*c2t.m_weight);
95 return StatusCode::SUCCESS;
99{
return StatusCode::SUCCESS; }
#define ATH_CHECK
Evaluate an expression and check for errors.
CaloPhiRange class declaration.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Data object for each calorimeter readout cell.
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 StatusCode execute(const EventContext &ctx) const override
Execute algorithm.
virtual StatusCode initialize() override
Initialize algorithm.
CaloTowerxAODFromCells(const std::string &name, ISvcLocator *pSvcLocator)
Default algorithm constructor.
double m_cellThresholdE
Cell energy threshold (only for FilteredCell mode)
SG::ReadHandleKey< CaloCellContainer > m_inputCellContainerKey
virtual StatusCode finalize() override
Finalize algorithm.
virtual ~CaloTowerxAODFromCells()
Baseclass destructor.
This is a "hash" representation of an Identifier.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const std::string & name() const
Return the StoreGate ID for the referenced object.
virtual bool isValid() override final
Can the handle be successfully dereferenced?