82 std::vector<IdentifierHash> theNeighbors;
83 theNeighbors.reserve(22);
85 std::map<const CaloCell*,float> cannedUncorrectedEnergies;
88 for (; itrCell_test!=theCont->end();++itrCell_test){
89 const CaloCell* pointerToCell=*itrCell_test;
90 cannedUncorrectedEnergies[pointerToCell] = pointerToCell->
energy();
95 int nGoodCellsPerDrawer[4][64];
98 memset(nGoodCellsPerDrawer,0,
sizeof(nGoodCellsPerDrawer));
103 for (; cellItr <= lastCell; ++cellItr) {
104 const CaloCell* CCell = (*theCont)[cellItr];
105 if (CCell && ! CCell->
badcell() ) {
114 const char *
name[4] = {
"LBC",
"EBC",
"LBA",
"EBA"};
121 if ( nGoodCellsPerDrawer[
part][
module] < 2 ) {
130 for (; itrCell!=theCont->end();++itrCell){
136 if (!caloDDE)
continue;
151 if ( nGoodCellsPerDrawer[
part][
module] < 2 ) {
172 const float oldE=aCell->
energy();
181 float volumeOfTheCell=0;
182 if (caloDDE) volumeOfTheCell = caloDDE->
volume();
184 if (volumeOfTheCell==0)
continue;
196 float goodNeighborEnergyDensitySum=0;
197 unsigned goodNeighbors=0;
199 float betterNeighborEnergyDensitySum=0;
200 unsigned betterNeighbors=0;
203 for (
unsigned int iN=0;iN<theNeighbors.size();iN++) {
204 const CaloCell* thisNeighbor = theCont->findCell(theNeighbors[iN]);
206 if (!thisNeighbor)
continue;
208 float thisEnergy = thisNeighbor->
energy();
210 thisEnergy = cannedUncorrectedEnergies[thisNeighbor];
223 float thisVolume = thisNeighborDDE->
volume();
224 if (thisVolume <= 0)
continue;
228 float thisEnergyDensity= thisEnergy / thisVolume;
229 goodNeighborEnergyDensitySum += thisEnergyDensity;
234 if (thisNeighborRegion==theCellRegion) {
237 betterNeighborEnergyDensitySum+=thisEnergyDensity;
246 unsigned nNeighbors=0;
247 float neighborEnergyDensitySum=0;
249 if (betterNeighbors>=2) {
250 nNeighbors=betterNeighbors;
251 neighborEnergyDensitySum=betterNeighborEnergyDensitySum;
255 nNeighbors=goodNeighbors;
256 neighborEnergyDensitySum=goodNeighborEnergyDensitySum;
259 if(nNeighbors <= 0) {
264 const float averageEnergyDensity = neighborEnergyDensitySum/nNeighbors;
267 const float predictedEnergy = averageEnergyDensity * volumeOfTheCell;
270 <<oldE <<
"Enew=" << predictedEnergy <<
", used " << nNeighbors <<
" neighbors" );
273 return StatusCode::SUCCESS;