62{
64
65 std::vector<IdentifierHash> theNeighbors;
66 theNeighbors.reserve(22);
67
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();
74 }
75 }
76
77 int nGoodCellsPerDrawer[4][64];
78
80 memset(nGoodCellsPerDrawer,0,sizeof(nGoodCellsPerDrawer));
81
84
85 for (; cellItr <= lastCell; ++cellItr) {
86 const CaloCell* CCell = (*theCont)[cellItr];
87 if (CCell && ! CCell->
badcell() ) {
88 Identifier
id = CCell->
ID();
92 }
93 }
94 if (msgLvl(MSG::VERBOSE)) {
95
96 const char *
name[4] = {
"LBC",
"EBC",
"LBA",
"EBA"};
98 for (
int module=0;
module<64; ++
module) {
99
100
101
102
103 if ( nGoodCellsPerDrawer[part][module] < 2 ) {
105 }
106 }
107 }
108 }
109 }
110
112 for (; itrCell!=theCont->end();++itrCell){
113 CaloCell * aCell=*itrCell;
114
116
117 const CaloDetDescrElement* caloDDE = aCell->
caloDDE();
118 if (!caloDDE) continue;
120
122
123 if (isTile) {
124
127 continue;
129
130 Identifier
id = aCell->
ID();
133 if ( nGoodCellsPerDrawer[part][module] < 2 ) {
135 continue;
136 }
137 }
138
139 } else {
140
143 continue;
146 continue;
147 }
148 }
149
150
151 const Identifier theCellID = aCell->
ID();
152 const float oldE=aCell->
energy();
153 const IdentifierHash theCellHashID =
m_calo_id->calo_cell_hash(theCellID);
154
155
157
158
159
160
161 float volumeOfTheCell=0;
162 if (caloDDE) volumeOfTheCell = caloDDE->
volume();
163
164 if (volumeOfTheCell==0) continue;
165
166
167
168
169
170
171 const Identifier theCellRegion=
m_calo_id->region_id(theCellID);
172
173
174 float goodNeighborEnergyDensitySum=0;
175 unsigned goodNeighbors=0;
176
177 float betterNeighborEnergyDensitySum=0;
178 unsigned betterNeighbors=0;
179
181 for (unsigned int iN=0;iN<theNeighbors.size();iN++) {
182 const CaloCell* thisNeighbor = theCont->findCell(theNeighbors[iN]);
183
184 if (!thisNeighbor) continue;
185 const CaloDetDescrElement* thisNeighborDDE = (thisNeighbor)->caloDDE();
186 float thisEnergy = thisNeighbor->
energy();
188 thisEnergy = cannedUncorrectedEnergies[thisNeighbor];
189 }
192 continue;
193 }
194
195
196
197
198
199
200 float thisVolume = thisNeighborDDE->
volume();
201 if (thisVolume <= 0) continue;
202
203
204 goodNeighbors++;
205 float thisEnergyDensity= thisEnergy / thisVolume;
206 goodNeighborEnergyDensitySum += thisEnergyDensity;
207
208
209 const Identifier thisNeighborRegion=
m_calo_id->region_id(thisNeighbor->
ID());
210
211 if (thisNeighborRegion==theCellRegion) {
213 betterNeighbors++;
214 betterNeighborEnergyDensitySum+=thisEnergyDensity;
215 }
216 }
217
218
219 unsigned nNeighbors=0;
220 float neighborEnergyDensitySum=0;
221
222 if (betterNeighbors>=2) {
223 nNeighbors=betterNeighbors;
224 neighborEnergyDensitySum=betterNeighborEnergyDensitySum;
225 }
226 else {
228 nNeighbors=goodNeighbors;
229 neighborEnergyDensitySum=goodNeighborEnergyDensitySum;
230 }
231
232 if(nNeighbors <= 0) {
234 continue;
235 }
236
237 const float averageEnergyDensity = neighborEnergyDensitySum/nNeighbors;
238
239
240 const float predictedEnergy = averageEnergyDensity * volumeOfTheCell;
242
244 <<oldE << "Enew=" << predictedEnergy << ", used " << nNeighbors << " neighbors" );
245 }
246 }
247 return StatusCode::SUCCESS;
248}
#define ATH_MSG_VERBOSE(x)
double energy() const
get energy (data member)
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
uint16_t provenance() const
get provenance (data member)
virtual void setEnergy(float energy)
set energy
virtual bool badcell() const
check is cell is dead
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
CaloCell_ID::SUBCALO getSubCalo() const
cell subcalo
bool is_tile() const
cell belongs to Tile
float volume() const
cell volume
DataModel_detail::const_iterator< DataVector > const_iterator
DataModel_detail::iterator< DataVector > iterator
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
bool test(const uint16_t prov, const LArProvenance check)