5 #include <vdt/vdtMath.h>
20 for (
int i = 0;
i < digi.
size();
i++) {
22 LogDebug(
"ESRecHitSimAlgo") <<
"ESRecHitSimAlgo : Digi " <<
i <<
" ADC counts " << digi.
sample(
i).
adc() <<
" Ped "
31 if (
adc[1] <= 0 ||
adc[2] <= 0)
37 auto r12 = (
adc[1] != 0) ?
adc[0] /
adc[1] : 99.
f;
38 auto r23 = (
adc[2] != 0) ?
adc[1] /
adc[2] : 99.
f;
43 if (r23 < ratioCuts_->getR23Low())
50 constexpr
float n = 1.798;
51 constexpr
float w = 0.07291;
52 constexpr
float DeltaT = 25.;
53 auto aaa = (A2 > 0 && A1 > 0) ?
std::log(A2 / A1) / n : 20.f;
54 constexpr
float bbb = w / n * DeltaT;
57 auto t0 = (2.f - ccc) / (1.
f - ccc) * DeltaT - 5.f;
60 constexpr
float t1 = 20.;
61 #if defined(__clang__) || defined(__INTEL_COMPILER)
64 constexpr
float A_1 = 1. / (
std::pow(w / n * (t1), n) *
std::exp(n - w * (t1)));
68 if (
adc[1] > 2800.
f &&
adc[2] > 2800.
f)
70 else if (
adc[1] > 2800.
f)
72 else if (
adc[2] > 2800.
f)
96 auto otenergy =
results[2] * 1000000.f;
98 auto mipCalib = (mip != 0.f) ?
MIPGeV_ *
std::abs(vdt::fast_cosf(ang)) / (mip) : 0.f;
100 otenergy *= mipCalib;
102 LogDebug(
"ESRecHitSimAlgo") <<
"ESRecHitSimAlgo : reconstructed energy " <<
energy;
157 const ESDataFrame& digi,
const double& ped,
const double& w0,
const double& w1,
const double&
w2)
const {
158 double*
results =
new double[4]{};
166 for (
int i = 0;
i < digi.
size();
i++) {
168 LogDebug(
"ESRecHitSimAlgo") <<
"ESRecHitSimAlgo : Digi " <<
i <<
" ADC counts " << digi.
sample(
i).
adc() <<
" Ped "
177 if (
adc[1] <= 0 ||
adc[2] <= 0)
183 double r12 = (
adc[1] != 0) ?
adc[0] /
adc[1] : 99;
184 double r23 = (
adc[2] != 0) ?
adc[1] /
adc[2] : 99;
189 if (r23 < ratioCuts_->getR23Low())
199 double aaa = (A2 > 0 && A1 > 0) ?
log(A2 / A1) / n : 20.;
200 double bbb = w / n * DeltaT;
201 double ccc =
exp(aaa + bbb);
203 double t0 = (2. - ccc) / (1. - ccc) * DeltaT - 5;
207 double A_1 =
pow(w / n * (t1), n) *
exp(n - w * (t1));
208 double AA1 = (A_1 != 0.) ? A1 / A_1 : 0.;
210 if (
adc[1] > 2800 &&
adc[2] > 2800)
212 else if (
adc[1] > 2800)
214 else if (
adc[2] > 2800)
237 double energy = results[0];
238 double t0 = results[1];
239 int status = (int)results[2];
240 double otenergy = results[3] * 1000000.;
243 double mipCalib = (fabs(
cos(*it_ang)) != 0.) ? (*it_mip) / fabs(
cos(*it_ang)) : 0.;
244 energy *= (mipCalib != 0.) ?
MIPGeV_ / mipCalib : 0.;
245 otenergy *= (mipCalib != 0.) ?
MIPGeV_ / mipCalib : 0.;
247 LogDebug(
"ESRecHitSimAlgo") <<
"ESRecHitSimAlgo : reconstructed energy " <<
energy;
255 if (it_status->getStatusCode() == 1) {
260 else if (status == 5)
262 else if (status == 6)
264 else if (status == 7)
266 else if (status == 8)
268 else if (status == 9)
270 else if (status == 10)
272 else if (status == 11)
274 else if (status == 12)
276 else if (status == 13)
278 else if (status == 14)
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
Exp< T >::type exp(const T &t)
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)
uint16_t *__restrict__ uint16_t const *__restrict__ adc
int hashedIndex() const
get a compact index for arrays [TODO: NEEDS WORK]