5 #include <vdt/vdtMath.h>
21 for (
int i=0;
i<digi.
size();
i++) {
23 LogDebug(
"ESRecHitSimAlgo") <<
"ESRecHitSimAlgo : Digi "<<
i<<
" ADC counts "<<digi.
sample(
i).
adc()<<
" Ped "<<ped;
33 auto r12 = (adc[1] != 0) ? adc[0]/adc[1] : 99.
f;
34 auto r23 = (adc[2] != 0) ? adc[1]/adc[2] : 99.
f;
46 auto aaa = (A2 > 0 && A1 > 0) ?
std::log(A2/A1)/n : 20.f;
50 auto t0 = (2.f-ccc)/(1.
f-ccc) * DeltaT - 5.f;
54 #if defined(__clang__) || defined(__INTEL_COMPILER)
89 auto otenergy = results[2] * 1000000.f;
92 auto mipCalib = (mip != 0.f) ?
MIPGeV_*
std::abs(vdt::fast_cosf(ang))/(mip) : 0.f;
96 LogDebug(
"ESRecHitSimAlgo") <<
"ESRecHitSimAlgo : reconstructed energy "<<
energy;
153 double *
results =
new double[4];
161 for (
int i=0;
i<digi.
size();
i++) {
163 LogDebug(
"ESRecHitSimAlgo") <<
"ESRecHitSimAlgo : Digi "<<
i<<
" ADC counts "<<digi.
sample(
i).
adc()<<
" Ped "<<ped;
169 if (adc[0] > 20) status = 14;
170 if (adc[1] <= 0 || adc[2] <= 0) status = 10;
171 if (adc[0] > adc[1] && adc[0] > adc[2]) status = 8;
172 if (adc[2] > adc[1] && adc[2] > adc[0]) status = 9;
173 double r12 = (adc[1] != 0) ? adc[0]/adc[1] : 99;
174 double r23 = (adc[2] != 0) ? adc[1]/adc[2] : 99;
177 if (r23 < ratioCuts_->getR23Low()) status = 7;
186 double aaa = (A2 > 0 && A1 > 0) ?
log(A2/A1)/n : 20.;
187 double bbb = w/n*DeltaT;
188 double ccc=
exp(aaa+bbb);
190 double t0 = (2.-ccc)/(1.-ccc) * DeltaT - 5;
194 double A_1 =
pow(w/n*(t1),n) *
exp(n-w*(t1));
195 double AA1 = (A_1 != 0.) ? A1 / A_1 : 0.;
197 if (adc[1] > 2800 && adc[2] > 2800) status = 11;
198 else if (adc[1] > 2800) status = 12;
199 else if (adc[2] > 2800) status = 13;
222 double energy = results[0];
223 double t0 = results[1];
224 int status = (int) results[2];
225 double otenergy = results[3] * 1000000.;
228 double mipCalib = (fabs(
cos(*it_ang)) != 0.) ? (*it_mip)/fabs(
cos(*it_ang)) : 0.;
229 energy *= (mipCalib != 0.) ?
MIPGeV_/mipCalib : 0.;
230 otenergy *= (mipCalib != 0.) ?
MIPGeV_/mipCalib : 0.;
232 LogDebug(
"ESRecHitSimAlgo") <<
"ESRecHitSimAlgo : reconstructed energy "<<
energy;
240 if (it_status->getStatusCode() == 1) {
245 else if (status == 5)
247 else if (status == 6)
249 else if (status == 7)
251 else if (status == 8)
253 else if (status == 9)
255 else if (status == 10)
257 else if (status == 11)
259 else if (status == 12)
261 else if (status == 13)
263 else if (status == 14)
int adc(sample_type sample)
get the ADC sample (12 bits)
EcalRecHit reconstruct(const ESDataFrame &digi) const
common ppss p3p6s2 common epss epspn46 common const1 w2
const ESDetId & id() const
const self & getMap() const
const ESPedestals * peds_
const ESIntercalibConstants * mips_
void setEnergyError(float energy)
const ESChannelStatus * channelStatus_
EcalRecHit oldreconstruct(const ESDataFrame &digi) const
Cos< T >::type cos(const T &t)
const_iterator find(uint32_t rawId) const
const ESSample & sample(int i) const
Abs< T >::type abs(const T &t)
const Item & preshower(size_t hashedIndex) const
double * oldEvalAmplitude(const ESDataFrame &digi, const double &ped, const double &w0, const double &w1, const double &w2) const
const ESRecHitRatioCuts * ratioCuts_
const ESAngleCorrectionFactors * ang_
std::vector< Item >::const_iterator const_iterator
EcalRecHit::ESFlags evalAmplitude(float *result, const ESDataFrame &digi, float ped) const
int adc() const
get the ADC sample (singed 16 bits)
Power< A, B >::type pow(const A &a, const B &b)
int hashedIndex() const
get a compact index for arrays [TODO: NEEDS WORK]