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;
85 auto otenergy = results[2] * 1000000.f;
88 auto mipCalib = (mip != 0.f) ?
MIPGeV_*
std::abs(vdt::fast_cosf(ang))/(mip) : 0.f;
92 LogDebug(
"ESRecHitSimAlgo") <<
"ESRecHitSimAlgo : reconstructed energy "<<
energy;
146 double *
results =
new double[4];
154 for (
int i=0;
i<digi.
size();
i++) {
156 LogDebug(
"ESRecHitSimAlgo") <<
"ESRecHitSimAlgo : Digi "<<
i<<
" ADC counts "<<digi.
sample(
i).
adc()<<
" Ped "<<ped;
162 if (adc[0] > 20) status = 14;
163 if (adc[1] <= 0 || adc[2] <= 0) status = 10;
164 if (adc[0] > adc[1] && adc[0] > adc[2]) status = 8;
165 if (adc[2] > adc[1] && adc[2] > adc[0]) status = 9;
166 double r12 = (adc[1] != 0) ? adc[0]/adc[1] : 99;
167 double r23 = (adc[2] != 0) ? adc[1]/adc[2] : 99;
170 if (r23 < ratioCuts_->getR23Low()) status = 7;
179 double aaa = (A2 > 0 && A1 > 0) ?
log(A2/A1)/n : 20.;
180 double bbb = w/n*DeltaT;
181 double ccc=
exp(aaa+bbb);
183 double t0 = (2.-ccc)/(1.-ccc) * DeltaT - 5;
187 double A_1 =
pow(w/n*(t1),n) *
exp(n-w*(t1));
188 double AA1 = (A_1 != 0.) ? A1 / A_1 : 0.;
190 if (adc[1] > 2800 && adc[2] > 2800) status = 11;
191 else if (adc[1] > 2800) status = 12;
192 else if (adc[2] > 2800) status = 13;
215 double energy = results[0];
216 double t0 = results[1];
217 int status = (int) results[2];
218 double otenergy = results[3] * 1000000.;
221 double mipCalib = (fabs(
cos(*it_ang)) != 0.) ? (*it_mip)/fabs(
cos(*it_ang)) : 0.;
222 energy *= (mipCalib != 0.) ?
MIPGeV_/mipCalib : 0.;
223 otenergy *= (mipCalib != 0.) ?
MIPGeV_/mipCalib : 0.;
225 LogDebug(
"ESRecHitSimAlgo") <<
"ESRecHitSimAlgo : reconstructed energy "<<
energy;
230 if (it_status->getStatusCode() == 1) {
235 else if (status == 5)
237 else if (status == 6)
239 else if (status == 7)
241 else if (status == 8)
243 else if (status == 9)
245 else if (status == 10)
247 else if (status == 11)
249 else if (status == 12)
251 else if (status == 13)
253 else if (status == 14)
int adc(sample_type sample)
get the ADC sample (12 bits)
static std::vector< std::string > checklist log
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_
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
void setOutOfTimeEnergy(float energy)
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]