152 const double energyRaw = eclShower.getEnergy();
153 const double energyRawHighest = eclShower.getEnergyHighestCrystal();
157 const int iGroup = eclShower.getNOptimalGroupIndex();
158 const int iEnergy = eclShower.getNOptimalEnergyBin();
159 const double e3x3 = eclShower.getNOptimalEnergy();
169 const int iy = iEnergy + 1;
171 const int ixNom = 3 * iGroup + 1;
172 const int ixLowerE = ixNom + 1;
173 const int ixHigherE = ixNom + 2;
177 const double logEHigher =
m_logPeakEnergy.GetBinContent(ixHigherE, iy);
179 const double biasNom =
m_bias.GetBinContent(ixNom, iy);
180 const double biasLower =
m_bias.GetBinContent(ixLowerE, iy);
181 const double biasHigher =
m_bias.GetBinContent(ixHigherE, iy);
188 const double logESumN = log(energyRaw);
190 double logEOther = logELower;
191 double biasOther = biasLower;
192 double peakOther = peakLower;
193 if (logESumN > logENom) {
194 logEOther = logEHigher;
195 biasOther = biasHigher;
196 peakOther = peakHigher;
200 double bias = biasNom;
201 double peak = peakNom;
202 if (std::abs(logEOther - logENom) > 0.0001) {
203 bias = biasNom + (biasOther - biasNom) * (logESumN - logENom) / (logEOther - logENom);
204 peak = peakNom + (peakOther - peakNom) * (logESumN - logENom) / (logEOther - logENom);
208 const double ePartialCorr = (energyRaw - bias) / peak;
214 const int icellIDMaxE = eclShower.getCentralCellId();
215 const float thetaLocation = eclShower.getTheta();
216 const float phiLocation = eclShower.getPhi();
221 const int iThetaID = positionVector[1];
222 const int iRegion = positionVector[2];
223 const int iThetaBin = positionVector[3];
224 const int iPhiBin = positionVector[4];
225 const int iPhiMech = positionVector[5];
229 float logEnergy = log(ePartialCorr);
231 if (logEnergy <
leakLogE[iRegion][0]) {
236 while (logEnergy >
leakLogE[iRegion][ie0 + 1]) {ie0++;}
241 int iXBin = iThetaID + ie0 *
nThetaID + 1;
244 const double cor0 = thetaCor * phiCor;
247 iXBin = iThetaID + (ie0 + 1) *
nThetaID + 1;
250 const double cor1 = thetaCor * phiCor;
253 const double positionCor = cor0 + (cor1 - cor0) * (logEnergy -
leakLogE[iRegion][ie0]) / (
leakLogE[iRegion][ie0 + 1] -
258 const double correctedEnergy = ePartialCorr / positionCor;
259 const double overallCorrection = energyRaw / correctedEnergy;
260 const double correctedEnergyHighest = energyRawHighest / overallCorrection;
263 eclShower.setEnergy(correctedEnergy);
264 eclShower.setEnergyHighestCrystal(correctedEnergyHighest);
266 B2DEBUG(28,
"ECLShowerCorrectorModule: cellID: " << positionVector[0] <<
" iG: " << iGroup <<
" iE: " << iEnergy <<
" Eraw: " <<
267 energyRaw <<
" E3x3: " << e3x3 <<
" Ecor: " << correctedEnergy);
268 B2DEBUG(28,
" peakNom: " << peakNom <<
" biasNom: " << biasNom <<
" positionCor: " << positionCor <<
" overallCor: " <<
275 uint16_t nShowersPerRegion[
nLeakReg] = {};
278 const int iCellId = eclShower.getCentralCellId();