36#include "CaloEvent/CaloClusterContainer.h"
43 ISvcLocator* pSvcLocator)
64 return StatusCode::SUCCESS;
71 return StatusCode::SUCCESS;
90 cell2ClusterMap->resize(maxRange);
96 <<
" contains " << clusColl->size() <<
" clusters");
98 std::vector<double> weightedESum;
99 weightedESum.resize(clusColl->size());
101 std::vector<int> numberOfCells;
102 numberOfCells.resize(clusColl->size());
108 unsigned int iClus = 0;
113 for (; cellIter != cellIterEnd; cellIter++) {
123 (*cell2ClusterMap)[myHashId] = theNav;
130 weightedESum[iClus] += (clus->getCellWeight(*cellIter))
131 * ((*cellIter)->energy());
132 numberOfCells[iClus]++;
139 double epsilon = 0.001;
140 unsigned int iClus = 0;
142 if (fabs(weightedESum[iClus] - clus->e())
143 > epsilon * fabs(clus->e()))
147 <<
" MeV, while weighted sum of cells gives E = "
148 << weightedESum[iClus]
149 <<
" MeV! Complain with the creator of the CaloClusterContainer named "
152 ATH_MSG_DEBUG(
"CaloCluster and weighted sum of cell members have E = "
153 << clus->e() <<
" MeV, good!" );
155 if (numberOfCells[iClus] !=
static_cast<int>(clus->getNumberOfCells())) {
158 << clus->getNumberOfCells() <<
" cells, while N = "
159 << numberOfCells[iClus]
160 <<
" cells are in the map! Something is wrong with the creation of the Map!" );
163 << clus->getNumberOfCells() <<
" cells is in the map, good!" );
169 if (
msgLvl(MSG::VERBOSE)) {
170 for (
unsigned int iHash = 0; iHash < maxRange; iHash++) {
174 msg(MSG::VERBOSE) <<
"CaloCell with hashID " << iHash <<
" belongs to";
179 *(pClus->cell_begin()));
186 for (; cellIter != cellIterEnd; cellIter++) {
190 if (((
unsigned int) myHashId) == iHash)
197 msg() <<
" Cluster with E_clus = " << pClus->e()
198 <<
" MeV with weight w_cell = " << pClus->getCellWeight(pCell)
206 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Helpers for checking error return status codes and reporting errors.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
An algorithm that can be simultaneously executed in multiple threads.
SG::ReadHandleKey< CaloClusterContainer > m_clusterKey
Name of the CaloClusterContainer to use.
virtual ~CaloCell2ClusterMapper()
virtual StatusCode execute(const EventContext &ctx) const override
CaloCell2ClusterMapper(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
SG::WriteHandleKey< CaloCell2ClusterMap > m_mapOutputKey
Name of the CaloCell2ClusterMap in StoreGate.
virtual StatusCode finalize() override
Container class for CaloCell.
const CaloCell * findCell(const IdentifierHash theHash) const
fast find method given identifier hash.
size_type calo_cell_hash_max() const
cell 'global' hash table max size
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
Helper class for offline cell identifiers.
Data object for each calorimeter readout cell.
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Principal data class for CaloCell clusters.
CaloCompositeCellBase< CaloClusterNavigable >::cell_iterator cell_iterator
Iterator on CaloCell s.
a typed memory pool that saves time spent allocation small object.
pointer nextElementPtr()
obtain the next available element in pool by pointer pool is resized if its limit has been reached On...
This is a "hash" representation of an Identifier.
Navigable template generalization to handle navigation.
void putElement(const CONT *objectContainer, const constituent_type *constituentObject, const RPAR &objectParameter=RPAR(), size_t sizeHint=0)
const_pointer_type cptr()
Dereference the pointer.
const std::string & name() const
Return the StoreGate ID for the referenced object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts