65 std::vector<IdentifierHash> theNeighbors;
66 theNeighbors.reserve(22);
68 std::map<const CaloCell*,float> cannedUncorrectedEnergies;
71 for (; itrCell_test!=theCont->end();++itrCell_test){
72 const CaloCell* pointerToCell=*itrCell_test;
73 cannedUncorrectedEnergies[pointerToCell] = pointerToCell->
energy();
77 int nGoodCellsPerDrawer[4][64];
80 memset(nGoodCellsPerDrawer,0,
sizeof(nGoodCellsPerDrawer));
85 for (; cellItr <= lastCell; ++cellItr) {
86 const CaloCell* CCell = (*theCont)[cellItr];
87 if (CCell && ! CCell->
badcell() ) {
96 const char *
name[4] = {
"LBC",
"EBC",
"LBA",
"EBA"};
103 if ( nGoodCellsPerDrawer[
part][
module] < 2 ) {
112 for (; itrCell!=theCont->end();++itrCell){
118 if (!caloDDE)
continue;
133 if ( nGoodCellsPerDrawer[
part][
module] < 2 ) {
152 const float oldE=aCell->
energy();
161 float volumeOfTheCell=0;
162 if (caloDDE) volumeOfTheCell = caloDDE->
volume();
164 if (volumeOfTheCell==0)
continue;
174 float goodNeighborEnergyDensitySum=0;
175 unsigned goodNeighbors=0;
177 float betterNeighborEnergyDensitySum=0;
178 unsigned betterNeighbors=0;
181 for (
unsigned int iN=0;iN<theNeighbors.size();iN++) {
182 const CaloCell* thisNeighbor = theCont->findCell(theNeighbors[iN]);
184 if (!thisNeighbor)
continue;
186 float thisEnergy = thisNeighbor->
energy();
188 thisEnergy = cannedUncorrectedEnergies[thisNeighbor];
200 float thisVolume = thisNeighborDDE->
volume();
201 if (thisVolume <= 0)
continue;
205 float thisEnergyDensity= thisEnergy / thisVolume;
206 goodNeighborEnergyDensitySum += thisEnergyDensity;
211 if (thisNeighborRegion==theCellRegion) {
214 betterNeighborEnergyDensitySum+=thisEnergyDensity;
219 unsigned nNeighbors=0;
220 float neighborEnergyDensitySum=0;
222 if (betterNeighbors>=2) {
223 nNeighbors=betterNeighbors;
224 neighborEnergyDensitySum=betterNeighborEnergyDensitySum;
228 nNeighbors=goodNeighbors;
229 neighborEnergyDensitySum=goodNeighborEnergyDensitySum;
232 if(nNeighbors <= 0) {
237 const float averageEnergyDensity = neighborEnergyDensitySum/nNeighbors;
240 const float predictedEnergy = averageEnergyDensity * volumeOfTheCell;
244 <<oldE <<
"Enew=" << predictedEnergy <<
", used " << nNeighbors <<
" neighbors" );
247 return StatusCode::SUCCESS;