136 if ( !towerContainer.
isValid()) {
138 return StatusCode::SUCCESS;
144 if (newTowerContainer.
record( std::make_unique<CaloTowerContainer> (towerContainer->towerseg()) ).isFailure()){
145 ATH_MSG_WARNING(
" cannot record new tower container with key " << towerContainer.
name() );
146 return StatusCode::SUCCESS;
148 newTowerContainer->init();
154 return StatusCode::SUCCESS;
165 if ( !cellToClusterMap.
isValid() )
168 << cellToClusterMap.
name() <<
">" );
169 return StatusCode::SUCCESS;
171 ATH_MSG_DEBUG(
"Successfully retrieved CaloCell2ClusterMap <"<< cellToClusterMap.
name() <<
">" );
181 ATH_MSG_DEBUG(
"Starting loop over Navigable CaloCell2ClusterMap" );
182 while ( clusterContainer ==
nullptr && fClusMap != lClusMap )
192 const nav_t* pNav = (*fClusMap);
194 ATH_MSG_DEBUG(
"Successfully picked up CaloClusterContainer " );
200 if ( clusterContainer ==
nullptr )
202 if (!theCells->empty() ) {
203 ATH_MSG_WARNING(
"No cluster found from CaloCell2ClusterMap, tool unusable" );
204 return StatusCode::SUCCESS;
208 return StatusCode::SUCCESS;
211 else ATH_MSG_DEBUG(
"Size of CaloClusterContainer = " << clusterContainer->
size() );
219 for (
const CaloTower* theTower : *towerContainer) {
220 int towerIndex = towerContainer->getTowerIndex(theTower);
222 CaloTower* newTower = newTowerContainer->getTower(towerIndex);
225 ATH_MSG_VERBOSE(
"In loop over tower grid: tower eta-phi" << theTower->eta() <<
" " << theTower->phi() );
230 double energyTower = 0.0;
231 double totalAttachedClusterEnergy = 0.0;
232 int numberOfCellsInTower = 0;
233 int numberOfAttachedCellsInTower = 0;
234 int numberOfClustersInTower = 0;
235 int totalNumberOfCellsInAttachedClusters = 0;
239 for ( ; cellInTowerIter != lastCellInTower; cellInTowerIter++ )
241 numberOfCellsInTower++;
245 double signedE = 0.0;
246 double weight = theTower->getCellWeight(cellInTowerIter);
248 const CaloCell* cell = (*cellInTowerIter);
251 size_t globalIndex=0;
252 if (!(theTower->getCellIndex(cell,globalIndex)) ) {
259 std::vector<CaloCell_ID::SUBCALO>::const_iterator theFound =
266 double cellEnergy = weight * signedE;
271 float noiseSigma = 1.0;
274 noiseSigma=noise->getNoise(cell->ID(),cell->gain());
275 if ( noiseSigma > 0. ) signedRatio = signedE/noiseSigma;
279 ATH_MSG_VERBOSE(
" Cell has E = " << signedE <<
" eta,phi " << cell->eta() <<
" " << cell->phi() );
288 size_t cellIndex(cell->caloDDE()->calo_hash());
289 ATH_MSG_VERBOSE(
"Cell index from CaloCell2ClusterMap = " << cellIndex );
290 const nav_t* nav = (cellToClusterMap->operator[])(cellIndex);
301 double eClusRaw = clusterFromCell->getBasicEnergy();
302 double eClus = clusterFromCell->energy();
311 numberOfAttachedCellsInTower++;
312 totalNumberOfCellsInAttachedClusters += clusterFromCell->getNumberOfCells();
313 totalAttachedClusterEnergy += eClusRaw;
314 energyTower += cellEnergy;
315 numberOfClustersInTower++;
320 ATH_MSG_VERBOSE(
" -- Found at least one cluster passing cuts. 'break'" );
332 newTower->
setE(energyTower);
335 if (
msgLvl(MSG::VERBOSE)) {
337 ATH_MSG_VERBOSE(
"Old/ new TopoTower energy from all cells = " << theTower->e() <<
" " << newTower->
e() );
338 ATH_MSG_VERBOSE(
"TopoTower energy adding all cells in clusters = " << energyTower );
339 ATH_MSG_VERBOSE(
"Total attached cluster energy = " << totalAttachedClusterEnergy );
340 ATH_MSG_VERBOSE(
"Total number of attached clusters = " << numberOfClustersInTower );
341 ATH_MSG_VERBOSE(
"Number of cells in attached clusters = " << totalNumberOfCellsInAttachedClusters );
342 ATH_MSG_VERBOSE(
"Total number of cells originally in tower = " << numberOfCellsInTower );
343 ATH_MSG_VERBOSE(
"Total number of cells from clusters = " << numberOfAttachedCellsInTower );
346 msg(MSG::VERBOSE) <<
" E*weight, eta, phi of cells in new tower ";
347 for ( ; cellInTowerIter != lastCellInTower; cellInTowerIter++ ) {
348 double weight = theTower->getCellWeight(cellInTowerIter);
349 const CaloCell* cell = (*cellInTowerIter);
351 msg(MSG::VERBOSE) << cell->e()*weight <<
" " << cell->eta() <<
" " << cell->phi() <<
" / ";
360 return StatusCode::SUCCESS;