18 for (
unsigned int ibx = 0; ibx <
activeBXs.size(); ++ibx) {
64 if (timeAlgoName ==
"RatioMethod")
66 else if (timeAlgoName ==
"WeightsMethod")
68 else if (timeAlgoName !=
"None")
69 edm::LogError(
"EcalUncalibRecHitError") <<
"No time estimation algorithm defined";
134 int nnoise = SampleVector::RowsAtCompileTime;
142 for (
int i = 0;
i < nnoise; ++
i) {
143 for (
int j = 0;
j < nnoise; ++
j) {
156 unsigned int bunchspacing = 450;
161 bunchspacing = *bunchSpacingH;
167 if (bunchspacing == 25) {
169 activeBX << -5, -4, -3, -2, -1, 0, 1, 2, 3, 4;
188 const std::vector<float>& amplitudeBins,
189 const std::vector<float>& shiftBins) {
192 double theCorrection = 0;
195 if (amplitudeBins.empty()) {
196 edm::LogError(
"EcalRecHitError") <<
"timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
201 if (amplitudeBins.size() != shiftBins.size()) {
202 edm::LogError(
"EcalRecHitError") <<
"Size of timeCorrAmplitudeBins different from "
203 "timeCorrShiftBins. Forcing no time bias corrections. ";
210 for (
int bin = 0;
bin < (
int)amplitudeBins.size();
bin++) {
211 if (ampli > amplitudeBins[
bin]) {
219 theCorrection = shiftBins[0];
220 }
else if (myBin == ((
int)(amplitudeBins.size() - 1))) {
221 theCorrection = shiftBins[myBin];
224 theCorrection = (shiftBins[myBin + 1] - shiftBins[myBin]);
225 theCorrection *= (((double)ampli) - amplitudeBins[myBin]) / (amplitudeBins[myBin + 1] - amplitudeBins[myBin]);
226 theCorrection += shiftBins[myBin];
230 constexpr
double inv25 = 1. / 25.;
231 return theCorrection * inv25;
267 for (
auto itdg = digis.
begin(); itdg != digis.
end(); ++itdg) {
268 DetId detid(itdg->id());
273 float offsetTime = 0;
299 double pedVec[3] = {aped->mean_x12, aped->mean_x6, aped->mean_x1};
300 double pedRMSVec[3] = {aped->rms_x12, aped->rms_x6, aped->rms_x1};
304 fullpulse(
i + 7) = aPulse->pdfval[
i];
308 fullpulsecov(
i + 7,
j + 7) = aPulseCov->covval[
i][
j];
313 if (it !=
itime->end()) {
316 edm::LogError(
"EcalRecHitError") <<
"No time intercalib const found for xtal " << detid.rawId()
317 <<
"! something wrong with EcalTimeCalibConstants in your DB? ";
320 int lastSampleBeforeSaturation = -2;
323 lastSampleBeforeSaturation = iSample - 1;
330 if (lastSampleBeforeSaturation == 4) {
331 result.emplace_back((*itdg).id(), 4095 * 12, 0, 0, 0);
332 auto& uncalibRecHit =
result.back();
335 uncalibRecHit.setChi2(0);
336 }
else if (lastSampleBeforeSaturation >=
342 auto gainratio = gainRatios[
gainId - 1];
345 auto& uncalibRecHit =
result.back();
348 uncalibRecHit.setChi2(0);
354 auto& uncalibRecHit =
result.back();
359 constexpr
float clockToNsConstant = 25.;
360 constexpr
float invClockToNs = 1. / clockToNsConstant;
370 uncalibRecHit.setJitter(crh.timeMax - 5 + theTimeCorrectionEE);
371 uncalibRecHit.setJitterError(
381 if (uncalibRecHit.amplitude() > 3000.) {
391 float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
393 float sigmaped = pedRMSVec[0];
394 float nterm =
EEtimeNconst_ * sigmaped / uncalibRecHit.amplitude();
395 float sigmat =
std::sqrt(nterm * nterm + cterm * cterm);
396 if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < -sigmat * outOfTimeThreshM)) {
412 uncalibRecHit.setJitter(crh.timeMax - 5 + theTimeCorrectionEB);
413 uncalibRecHit.setJitterError(std::hypot(crh.timeError,
EBtimeConstantTerm_ / clockToNsConstant));
422 if (uncalibRecHit.amplitude() > 3000.) {
432 float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
434 float sigmaped = pedRMSVec[0];
435 float nterm =
EBtimeNconst_ * sigmaped / uncalibRecHit.amplitude();
436 float sigmat =
std::sqrt(nterm * nterm + cterm * cterm);
437 if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < -sigmat * outOfTimeThreshM)) {
444 std::vector<double> amplitudes;
445 for (
unsigned int ibx = 0; ibx <
activeBX.
size(); ++ibx)
446 amplitudes.push_back(uncalibRecHit.outOfTimeAmplitude(ibx));
450 EcalTBWeights::EcalTBWeightMap::const_iterator wit;
451 wit = wgtsMap.find(std::make_pair(*gid, tdcid));
452 if (wit == wgtsMap.end()) {
454 <<
"No weights found for EcalGroupId: " << gid->
id() <<
" and EcalTDCId: " << tdcid
455 <<
"\n skipping digi with id: " << detid.rawId();
473 uncalibRecHit.setJitter(timerh);
474 uncalibRecHit.setJitterError(0.);
476 uncalibRecHit.setJitter(0.);
477 uncalibRecHit.setJitterError(0.);
482 auto& uncalibRecHit =
result.back();
526 "EBCorrNoiseMatrixG12",
527 {1.00000, 0.71073, 0.55721, 0.46089, 0.40449, 0.35931, 0.33924, 0.32439, 0.31581, 0.30481},
530 "EECorrNoiseMatrixG12",
531 {1.00000, 0.71373, 0.44825, 0.30152, 0.21609, 0.14786, 0.11772, 0.10165, 0.09465, 0.08098},
534 "EBCorrNoiseMatrixG06",
535 {1.00000, 0.70946, 0.58021, 0.49846, 0.45006, 0.41366, 0.39699, 0.38478, 0.37847, 0.37055},
538 "EECorrNoiseMatrixG06",
539 {1.00000, 0.71217, 0.47464, 0.34056, 0.26282, 0.20287, 0.17734, 0.16256, 0.15618, 0.14443},
542 "EBCorrNoiseMatrixG01",
543 {1.00000, 0.73354, 0.64442, 0.58851, 0.55425, 0.53082, 0.51916, 0.51097, 0.50732, 0.50409},
546 "EECorrNoiseMatrixG01",
547 {1.00000, 0.72698, 0.62048, 0.55691, 0.51848, 0.49147, 0.47813, 0.47007, 0.46621, 0.46265},
554 "EBPulseShapeCovariance",
555 {3.001e-06, 1.233e-05, 0.000e+00, -4.416e-06, -4.571e-06, -3.614e-06, -2.636e-06, -1.286e-06, -8.410e-07,
556 -5.296e-07, 0.000e+00, 0.000e+00, 1.233e-05, 6.154e-05, 0.000e+00, -2.200e-05, -2.309e-05, -1.838e-05,
557 -1.373e-05, -7.334e-06, -5.088e-06, -3.745e-06, -2.428e-06, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
558 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
559 -4.416e-06, -2.200e-05, 0.000e+00, 8.319e-06, 8.545e-06, 6.792e-06, 5.059e-06, 2.678e-06, 1.816e-06,
560 1.223e-06, 8.245e-07, 5.589e-07, -4.571e-06, -2.309e-05, 0.000e+00, 8.545e-06, 9.182e-06, 7.219e-06,
561 5.388e-06, 2.853e-06, 1.944e-06, 1.324e-06, 9.083e-07, 6.335e-07, -3.614e-06, -1.838e-05, 0.000e+00,
562 6.792e-06, 7.219e-06, 6.016e-06, 4.437e-06, 2.385e-06, 1.636e-06, 1.118e-06, 7.754e-07, 5.556e-07,
563 -2.636e-06, -1.373e-05, 0.000e+00, 5.059e-06, 5.388e-06, 4.437e-06, 3.602e-06, 1.917e-06, 1.322e-06,
564 9.079e-07, 6.529e-07, 4.752e-07, -1.286e-06, -7.334e-06, 0.000e+00, 2.678e-06, 2.853e-06, 2.385e-06,
565 1.917e-06, 1.375e-06, 9.100e-07, 6.455e-07, 4.693e-07, 3.657e-07, -8.410e-07, -5.088e-06, 0.000e+00,
566 1.816e-06, 1.944e-06, 1.636e-06, 1.322e-06, 9.100e-07, 9.115e-07, 6.062e-07, 4.436e-07, 3.422e-07,
567 -5.296e-07, -3.745e-06, 0.000e+00, 1.223e-06, 1.324e-06, 1.118e-06, 9.079e-07, 6.455e-07, 6.062e-07,
568 7.217e-07, 4.862e-07, 3.768e-07, 0.000e+00, -2.428e-06, 0.000e+00, 8.245e-07, 9.083e-07, 7.754e-07,
569 6.529e-07, 4.693e-07, 4.436e-07, 4.862e-07, 6.509e-07, 4.418e-07, 0.000e+00, 0.000e+00, 0.000e+00,
570 5.589e-07, 6.335e-07, 5.556e-07, 4.752e-07, 3.657e-07, 3.422e-07, 3.768e-07, 4.418e-07, 6.142e-07},
573 "EEPulseShapeCovariance",
574 {3.941e-05, 3.333e-05, 0.000e+00, -1.449e-05, -1.661e-05, -1.424e-05, -1.183e-05, -6.842e-06, -4.915e-06,
575 -3.411e-06, 0.000e+00, 0.000e+00, 3.333e-05, 2.862e-05, 0.000e+00, -1.244e-05, -1.431e-05, -1.233e-05,
576 -1.032e-05, -5.883e-06, -4.154e-06, -2.902e-06, -2.128e-06, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
577 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
578 -1.449e-05, -1.244e-05, 0.000e+00, 5.840e-06, 6.649e-06, 5.720e-06, 4.812e-06, 2.708e-06, 1.869e-06,
579 1.330e-06, 9.186e-07, 6.446e-07, -1.661e-05, -1.431e-05, 0.000e+00, 6.649e-06, 7.966e-06, 6.898e-06,
580 5.794e-06, 3.157e-06, 2.184e-06, 1.567e-06, 1.084e-06, 7.575e-07, -1.424e-05, -1.233e-05, 0.000e+00,
581 5.720e-06, 6.898e-06, 6.341e-06, 5.347e-06, 2.859e-06, 1.991e-06, 1.431e-06, 9.839e-07, 6.886e-07,
582 -1.183e-05, -1.032e-05, 0.000e+00, 4.812e-06, 5.794e-06, 5.347e-06, 4.854e-06, 2.628e-06, 1.809e-06,
583 1.289e-06, 9.020e-07, 6.146e-07, -6.842e-06, -5.883e-06, 0.000e+00, 2.708e-06, 3.157e-06, 2.859e-06,
584 2.628e-06, 1.863e-06, 1.296e-06, 8.882e-07, 6.108e-07, 4.283e-07, -4.915e-06, -4.154e-06, 0.000e+00,
585 1.869e-06, 2.184e-06, 1.991e-06, 1.809e-06, 1.296e-06, 1.217e-06, 8.669e-07, 5.751e-07, 3.882e-07,
586 -3.411e-06, -2.902e-06, 0.000e+00, 1.330e-06, 1.567e-06, 1.431e-06, 1.289e-06, 8.882e-07, 8.669e-07,
587 9.522e-07, 6.717e-07, 4.293e-07, 0.000e+00, -2.128e-06, 0.000e+00, 9.186e-07, 1.084e-06, 9.839e-07,
588 9.020e-07, 6.108e-07, 5.751e-07, 6.717e-07, 7.911e-07, 5.493e-07, 0.000e+00, 0.000e+00, 0.000e+00,
589 6.446e-07, 7.575e-07, 6.886e-07, 6.146e-07, 4.283e-07, 3.882e-07, 4.293e-07, 5.493e-07, 7.027e-07},
595 edm::ParameterDescription<std::vector<int>>(
"activeBXs", {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4},
true) and
657 "ebPulseShape", {5.2e-05, -5.26e-05, 6.66e-05, 0.1168, 0.7575, 1., 0.8876, 0.6732, 0.4741, 0.3194},
true) and
659 "eePulseShape", {5.2e-05, -5.26e-05, 6.66e-05, 0.1168, 0.7575, 1., 0.8876, 0.6732, 0.4741, 0.3194},
true) and
675 "EcalUncalibRecHitWorkerMultiFit");