CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EcalUncalibRecHitWorkerMultiFit.cc
Go to the documentation of this file.
2 
8 
12 
15  // get the BX for the pulses to be activated
16  std::vector<int32_t> activeBXs = ps.getParameter<std::vector<int32_t>>("activeBXs");
17  activeBX.resize(activeBXs.size());
18  for (unsigned int ibx = 0; ibx < activeBXs.size(); ++ibx) {
19  activeBX.coeffRef(ibx) = activeBXs[ibx];
20  }
21 
22  // uncertainty calculation (CPU intensive)
23  ampErrorCalculation_ = ps.getParameter<bool>("ampErrorCalculation");
24  useLumiInfoRunHeader_ = ps.getParameter<bool>("useLumiInfoRunHeader");
25 
26  if (useLumiInfoRunHeader_) {
27  bunchSpacing_ = c.consumes<unsigned int>(edm::InputTag("bunchSpacingProducer"));
29  } else {
30  bunchSpacingManual_ = ps.getParameter<int>("bunchSpacing");
31  }
32 
33  doPrefitEB_ = ps.getParameter<bool>("doPrefitEB");
34  doPrefitEE_ = ps.getParameter<bool>("doPrefitEE");
35 
36  prefitMaxChiSqEB_ = ps.getParameter<double>("prefitMaxChiSqEB");
37  prefitMaxChiSqEE_ = ps.getParameter<double>("prefitMaxChiSqEE");
38 
39  dynamicPedestalsEB_ = ps.getParameter<bool>("dynamicPedestalsEB");
40  dynamicPedestalsEE_ = ps.getParameter<bool>("dynamicPedestalsEE");
41  mitigateBadSamplesEB_ = ps.getParameter<bool>("mitigateBadSamplesEB");
42  mitigateBadSamplesEE_ = ps.getParameter<bool>("mitigateBadSamplesEE");
43  gainSwitchUseMaxSampleEB_ = ps.getParameter<bool>("gainSwitchUseMaxSampleEB");
44  gainSwitchUseMaxSampleEE_ = ps.getParameter<bool>("gainSwitchUseMaxSampleEE");
45  selectiveBadSampleCriteriaEB_ = ps.getParameter<bool>("selectiveBadSampleCriteriaEB");
46  selectiveBadSampleCriteriaEE_ = ps.getParameter<bool>("selectiveBadSampleCriteriaEE");
47  addPedestalUncertaintyEB_ = ps.getParameter<double>("addPedestalUncertaintyEB");
48  addPedestalUncertaintyEE_ = ps.getParameter<double>("addPedestalUncertaintyEE");
49  simplifiedNoiseModelForGainSwitch_ = ps.getParameter<bool>("simplifiedNoiseModelForGainSwitch");
61 
62  // algorithm to be used for timing
63  auto const& timeAlgoName = ps.getParameter<std::string>("timealgo");
64  if (timeAlgoName == "RatioMethod")
66  else if (timeAlgoName == "WeightsMethod")
68  else if (timeAlgoName == "crossCorrelationMethod") {
70  double startTime = ps.getParameter<double>("crossCorrelationStartTime");
71  double stopTime = ps.getParameter<double>("crossCorrelationStopTime");
72  double targetTimePrecision = ps.getParameter<double>("crossCorrelationTargetTimePrecision");
73  computeCC_ = std::make_unique<EcalUncalibRecHitTimingCCAlgo>(startTime, stopTime, targetTimePrecision);
74  } else if (timeAlgoName != "None")
75  edm::LogError("EcalUncalibRecHitError") << "No time estimation algorithm defined";
76 
77  // ratio method parameters
78  EBtimeFitParameters_ = ps.getParameter<std::vector<double>>("EBtimeFitParameters");
79  EEtimeFitParameters_ = ps.getParameter<std::vector<double>>("EEtimeFitParameters");
80  EBamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EBamplitudeFitParameters");
81  EEamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EEamplitudeFitParameters");
82  EBtimeFitLimits_.first = ps.getParameter<double>("EBtimeFitLimits_Lower");
83  EBtimeFitLimits_.second = ps.getParameter<double>("EBtimeFitLimits_Upper");
84  EEtimeFitLimits_.first = ps.getParameter<double>("EEtimeFitLimits_Lower");
85  EEtimeFitLimits_.second = ps.getParameter<double>("EEtimeFitLimits_Upper");
86  EBtimeConstantTerm_ = ps.getParameter<double>("EBtimeConstantTerm");
87  EEtimeConstantTerm_ = ps.getParameter<double>("EEtimeConstantTerm");
88  EBtimeNconst_ = ps.getParameter<double>("EBtimeNconst");
89  EEtimeNconst_ = ps.getParameter<double>("EEtimeNconst");
90  outOfTimeThreshG12pEB_ = ps.getParameter<double>("outOfTimeThresholdGain12pEB");
91  outOfTimeThreshG12mEB_ = ps.getParameter<double>("outOfTimeThresholdGain12mEB");
92  outOfTimeThreshG61pEB_ = ps.getParameter<double>("outOfTimeThresholdGain61pEB");
93  outOfTimeThreshG61mEB_ = ps.getParameter<double>("outOfTimeThresholdGain61mEB");
94  outOfTimeThreshG12pEE_ = ps.getParameter<double>("outOfTimeThresholdGain12pEE");
95  outOfTimeThreshG12mEE_ = ps.getParameter<double>("outOfTimeThresholdGain12mEE");
96  outOfTimeThreshG61pEE_ = ps.getParameter<double>("outOfTimeThresholdGain61pEE");
97  outOfTimeThreshG61mEE_ = ps.getParameter<double>("outOfTimeThresholdGain61mEE");
98  amplitudeThreshEB_ = ps.getParameter<double>("amplitudeThresholdEB");
99  amplitudeThreshEE_ = ps.getParameter<double>("amplitudeThresholdEE");
100 }
101 
103  // common setup
105  peds = es.getHandle(pedsToken_);
106 
107  // for the multifit method
113 
114  // weights parameters for the time
115  grps = es.getHandle(grpsToken_);
116  wgts = es.getHandle(wgtsToken_);
117 
118  // which of the samples need be used
120 
121  // for the ratio method
124 
125  // for the time correction methods
127 
128  int nnoise = SampleVector::RowsAtCompileTime;
129  SampleMatrix& noisecorEBg12 = noisecors_[1][0];
130  SampleMatrix& noisecorEBg6 = noisecors_[1][1];
131  SampleMatrix& noisecorEBg1 = noisecors_[1][2];
132  SampleMatrix& noisecorEEg12 = noisecors_[0][0];
133  SampleMatrix& noisecorEEg6 = noisecors_[0][1];
134  SampleMatrix& noisecorEEg1 = noisecors_[0][2];
135 
136  for (int i = 0; i < nnoise; ++i) {
137  for (int j = 0; j < nnoise; ++j) {
138  int vidx = std::abs(j - i);
139  noisecorEBg12(i, j) = noisecovariances->EBG12SamplesCorrelation[vidx];
140  noisecorEEg12(i, j) = noisecovariances->EEG12SamplesCorrelation[vidx];
141  noisecorEBg6(i, j) = noisecovariances->EBG6SamplesCorrelation[vidx];
142  noisecorEEg6(i, j) = noisecovariances->EEG6SamplesCorrelation[vidx];
143  noisecorEBg1(i, j) = noisecovariances->EBG1SamplesCorrelation[vidx];
144  noisecorEEg1(i, j) = noisecovariances->EEG1SamplesCorrelation[vidx];
145  }
146  }
147 }
148 
150  unsigned int bunchspacing = 450;
151 
152  if (useLumiInfoRunHeader_) {
153  edm::Handle<unsigned int> bunchSpacingH;
154  evt.getByToken(bunchSpacing_, bunchSpacingH);
155  bunchspacing = *bunchSpacingH;
156  } else {
157  bunchspacing = bunchSpacingManual_;
158  }
159 
161  if (bunchspacing == 25) {
162  activeBX.resize(10);
163  activeBX << -5, -4, -3, -2, -1, 0, 1, 2, 3, 4;
164  } else {
165  //50ns configuration otherwise (also for no pileup)
166  activeBX.resize(5);
167  activeBX << -4, -2, 0, 2, 4;
168  }
169  }
170 }
171 
182  const std::vector<float>& amplitudeBins,
183  const std::vector<float>& shiftBins) {
184  // computed initially in ns. Than turned in the BX's, as
185  // EcalUncalibratedRecHit need be.
186  double theCorrection = 0;
187 
188  // sanity check for arrays
189  if (amplitudeBins.empty()) {
190  edm::LogError("EcalRecHitError") << "timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
191 
192  return 0;
193  }
194 
195  if (amplitudeBins.size() != shiftBins.size()) {
196  edm::LogError("EcalRecHitError") << "Size of timeCorrAmplitudeBins different from "
197  "timeCorrShiftBins. Forcing no time bias corrections. ";
198 
199  return 0;
200  }
201 
202  // FIXME? what about a binary search?
203  int myBin = -1;
204  for (int bin = 0; bin < (int)amplitudeBins.size(); bin++) {
205  if (ampli > amplitudeBins[bin]) {
206  myBin = bin;
207  } else {
208  break;
209  }
210  }
211 
212  if (myBin == -1) {
213  theCorrection = shiftBins[0];
214  } else if (myBin == ((int)(amplitudeBins.size() - 1))) {
215  theCorrection = shiftBins[myBin];
216  } else {
217  // interpolate linearly between two assingned points
218  theCorrection = (shiftBins[myBin + 1] - shiftBins[myBin]);
219  theCorrection *= (((double)ampli) - amplitudeBins[myBin]) / (amplitudeBins[myBin + 1] - amplitudeBins[myBin]);
220  theCorrection += shiftBins[myBin];
221  }
222 
223  // convert ns into clocks
224  constexpr double inv25 = 1. / 25.;
225  return theCorrection * inv25;
226 }
227 
229  const EcalDigiCollection& digis,
231  if (digis.empty())
232  return;
233 
234  // assume all digis come from the same subdetector (either barrel or endcap)
235  DetId detid(digis.begin()->id());
236  bool barrel = (detid.subdetId() == EcalBarrel);
237 
239  if (barrel) {
247  } else {
255  }
256 
257  FullSampleVector fullpulse(FullSampleVector::Zero());
258  FullSampleMatrix fullpulsecov(FullSampleMatrix::Zero());
259 
260  result.reserve(result.size() + digis.size());
261  for (auto itdg = digis.begin(); itdg != digis.end(); ++itdg) {
262  DetId detid(itdg->id());
263 
264  const EcalSampleMask* sampleMask_ = sampleMaskHand_.product();
265 
266  // intelligence for recHit computation
267  float offsetTime = 0;
268 
269  const EcalPedestals::Item* aped = nullptr;
270  const EcalMGPAGainRatio* aGain = nullptr;
271  const EcalXtalGroupId* gid = nullptr;
272  const EcalPulseShapes::Item* aPulse = nullptr;
273  const EcalPulseCovariances::Item* aPulseCov = nullptr;
274 
275  if (barrel) {
276  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
277  aped = &peds->barrel(hashedIndex);
278  aGain = &gains->barrel(hashedIndex);
279  gid = &grps->barrel(hashedIndex);
280  aPulse = &pulseshapes->barrel(hashedIndex);
281  aPulseCov = &pulsecovariances->barrel(hashedIndex);
282  offsetTime = offtime->getEBValue();
283  } else {
284  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
285  aped = &peds->endcap(hashedIndex);
286  aGain = &gains->endcap(hashedIndex);
287  gid = &grps->endcap(hashedIndex);
288  aPulse = &pulseshapes->endcap(hashedIndex);
289  aPulseCov = &pulsecovariances->endcap(hashedIndex);
290  offsetTime = offtime->getEEValue();
291  }
292 
293  double pedVec[3] = {aped->mean_x12, aped->mean_x6, aped->mean_x1};
294  double pedRMSVec[3] = {aped->rms_x12, aped->rms_x6, aped->rms_x1};
295  double gainRatios[3] = {1., aGain->gain12Over6(), aGain->gain6Over1() * aGain->gain12Over6()};
296 
297  for (int i = 0; i < EcalPulseShape::TEMPLATESAMPLES; ++i)
298  fullpulse(i + 7) = aPulse->pdfval[i];
299 
300  for (int i = 0; i < EcalPulseShape::TEMPLATESAMPLES; i++)
301  for (int j = 0; j < EcalPulseShape::TEMPLATESAMPLES; j++)
302  fullpulsecov(i + 7, j + 7) = aPulseCov->covval[i][j];
303 
304  // compute the right bin of the pulse shape using time calibration constants
306  EcalTimeCalibConstant itimeconst = 0;
307  if (it != itime->end()) {
308  itimeconst = (*it);
309  } else {
310  edm::LogError("EcalRecHitError") << "No time intercalib const found for xtal " << detid.rawId()
311  << "! something wrong with EcalTimeCalibConstants in your DB? ";
312  }
313 
314  int lastSampleBeforeSaturation = -2;
315  for (unsigned int iSample = 0; iSample < EcalDataFrame::MAXSAMPLES; iSample++) {
316  if (((EcalDataFrame)(*itdg)).sample(iSample).gainId() == 0) {
317  lastSampleBeforeSaturation = iSample - 1;
318  break;
319  }
320  }
321 
322  // === amplitude computation ===
323 
324  if (lastSampleBeforeSaturation == 4) { // saturation on the expected max sample
325  result.emplace_back((*itdg).id(), 4095 * 12, 0, 0, 0);
326  auto& uncalibRecHit = result.back();
327  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kSaturated);
328  // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation
329  uncalibRecHit.setChi2(0);
330  } else if (lastSampleBeforeSaturation >=
331  -1) { // saturation on other samples: cannot extrapolate from the fourth one
332  int gainId = ((EcalDataFrame)(*itdg)).sample(5).gainId();
333  if (gainId == 0)
334  gainId = 3;
335  auto pedestal = pedVec[gainId - 1];
336  auto gainratio = gainRatios[gainId - 1];
337  double amplitude = ((double)(((EcalDataFrame)(*itdg)).sample(5).adc()) - pedestal) * gainratio;
338  result.emplace_back((*itdg).id(), amplitude, 0, 0, 0);
339  auto& uncalibRecHit = result.back();
340  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kSaturated);
341  // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation
342  uncalibRecHit.setChi2(0);
343  } else {
344  // multifit
345  const SampleMatrixGainArray& noisecors = noisecor(barrel);
346 
347  result.push_back(multiFitMethod_.makeRecHit(*itdg, aped, aGain, noisecors, fullpulse, fullpulsecov, activeBX));
348  auto& uncalibRecHit = result.back();
349 
350  // === time computation ===
351  if (timealgo_ == ratioMethod) {
352  // ratio method
353  constexpr float clockToNsConstant = 25.;
354  constexpr float invClockToNs = 1. / clockToNsConstant;
355  if (not barrel) {
356  ratioMethod_endcap_.init(*itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios);
361  double theTimeCorrectionEE = timeCorrection(
362  uncalibRecHit.amplitude(), timeCorrBias_->EETimeCorrAmplitudeBins, timeCorrBias_->EETimeCorrShiftBins);
363 
364  uncalibRecHit.setJitter(crh.timeMax - 5 + theTimeCorrectionEE);
365  uncalibRecHit.setJitterError(
366  std::sqrt(std::pow(crh.timeError, 2) + std::pow(EEtimeConstantTerm_ * invClockToNs, 2)));
367 
368  // consider flagging as kOutOfTime only if above noise
369  if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEE_) {
370  float outOfTimeThreshP = outOfTimeThreshG12pEE_;
371  float outOfTimeThreshM = outOfTimeThreshG12mEE_;
372  // determine if gain has switched away from gainId==1 (x12 gain)
373  // and determine cuts (number of 'sigmas') to ose for kOutOfTime
374  // >3k ADC is necessasry condition for gain switch to occur
375  if (uncalibRecHit.amplitude() > 3000.) {
376  for (int iSample = 0; iSample < EEDataFrame::MAXSAMPLES; iSample++) {
377  int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
378  if (GainId != 1) {
379  outOfTimeThreshP = outOfTimeThreshG61pEE_;
380  outOfTimeThreshM = outOfTimeThreshG61mEE_;
381  break;
382  }
383  }
384  }
385  float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
386  float cterm = EEtimeConstantTerm_;
387  float sigmaped = pedRMSVec[0]; // approx for lower gains
388  float nterm = EEtimeNconst_ * sigmaped / uncalibRecHit.amplitude();
389  float sigmat = std::sqrt(nterm * nterm + cterm * cterm);
390  if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < -sigmat * outOfTimeThreshM)) {
391  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kOutOfTime);
392  }
393  }
394 
395  } else {
396  ratioMethod_barrel_.init(*itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios);
402 
403  double theTimeCorrectionEB = timeCorrection(
404  uncalibRecHit.amplitude(), timeCorrBias_->EBTimeCorrAmplitudeBins, timeCorrBias_->EBTimeCorrShiftBins);
405 
406  uncalibRecHit.setJitter(crh.timeMax - 5 + theTimeCorrectionEB);
407  uncalibRecHit.setJitterError(std::hypot(crh.timeError, EBtimeConstantTerm_ / clockToNsConstant));
408 
409  // consider flagging as kOutOfTime only if above noise
410  if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEB_) {
411  float outOfTimeThreshP = outOfTimeThreshG12pEB_;
412  float outOfTimeThreshM = outOfTimeThreshG12mEB_;
413  // determine if gain has switched away from gainId==1 (x12 gain)
414  // and determine cuts (number of 'sigmas') to ose for kOutOfTime
415  // >3k ADC is necessasry condition for gain switch to occur
416  if (uncalibRecHit.amplitude() > 3000.) {
417  for (int iSample = 0; iSample < EBDataFrame::MAXSAMPLES; iSample++) {
418  int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
419  if (GainId != 1) {
420  outOfTimeThreshP = outOfTimeThreshG61pEB_;
421  outOfTimeThreshM = outOfTimeThreshG61mEB_;
422  break;
423  }
424  }
425  }
426  float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
427  float cterm = EBtimeConstantTerm_;
428  float sigmaped = pedRMSVec[0]; // approx for lower gains
429  float nterm = EBtimeNconst_ * sigmaped / uncalibRecHit.amplitude();
430  float sigmat = std::sqrt(nterm * nterm + cterm * cterm);
431  if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < -sigmat * outOfTimeThreshM)) {
432  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kOutOfTime);
433  }
434  }
435  }
436  } else if (timealgo_ == weightsMethod) {
437  // weights method on the PU subtracted pulse shape
438  std::vector<double> amplitudes;
439  for (unsigned int ibx = 0; ibx < activeBX.size(); ++ibx)
440  amplitudes.push_back(uncalibRecHit.outOfTimeAmplitude(ibx));
441 
442  EcalTBWeights::EcalTDCId tdcid(1);
443  EcalTBWeights::EcalTBWeightMap const& wgtsMap = wgts->getMap();
444  EcalTBWeights::EcalTBWeightMap::const_iterator wit;
445  wit = wgtsMap.find(std::make_pair(*gid, tdcid));
446  if (wit == wgtsMap.end()) {
447  edm::LogError("EcalUncalibRecHitError")
448  << "No weights found for EcalGroupId: " << gid->id() << " and EcalTDCId: " << tdcid
449  << "\n skipping digi with id: " << detid.rawId();
450  result.pop_back();
451  continue;
452  }
453  const EcalWeightSet& wset = wit->second; // this is the EcalWeightSet
454 
457 
458  weights[0] = &mat1;
459  weights[1] = &mat2;
460 
461  double timerh;
462  if (detid.subdetId() == EcalEndcap) {
463  timerh = weightsMethod_endcap_.time(*itdg, amplitudes, aped, aGain, fullpulse, weights);
464  } else {
465  timerh = weightsMethod_barrel_.time(*itdg, amplitudes, aped, aGain, fullpulse, weights);
466  }
467  uncalibRecHit.setJitter(timerh);
468  uncalibRecHit.setJitterError(0.); // not computed with weights
469 
470  } else if (timealgo_ == crossCorrelationMethod) {
471  std::vector<double> amplitudes(activeBX.size());
472  for (unsigned int ibx = 0; ibx < activeBX.size(); ++ibx)
473  amplitudes[ibx] = uncalibRecHit.outOfTimeAmplitude(ibx);
474 
475  float jitterError = 0.;
476  float jitter = computeCC_->computeTimeCC(*itdg, amplitudes, aped, aGain, fullpulse, uncalibRecHit, jitterError);
477 
478  uncalibRecHit.setJitter(jitter);
479  uncalibRecHit.setJitterError(jitterError);
480 
481  } else { // no time method;
482  uncalibRecHit.setJitter(0.);
483  uncalibRecHit.setJitterError(0.);
484  }
485  }
486 
487  // set flags if gain switch has occurred
488  auto& uncalibRecHit = result.back();
489  if (((EcalDataFrame)(*itdg)).hasSwitchToGain6())
490  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kHasSwitchToGain6);
491  if (((EcalDataFrame)(*itdg)).hasSwitchToGain1())
492  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kHasSwitchToGain1);
493  }
494 }
495 
498  psd.addNode(edm::ParameterDescription<std::vector<int>>("activeBXs", {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4}, true) and
499  edm::ParameterDescription<bool>("ampErrorCalculation", true, true) and
500  edm::ParameterDescription<bool>("useLumiInfoRunHeader", true, true) and
501  edm::ParameterDescription<int>("bunchSpacing", 0, true) and
502  edm::ParameterDescription<bool>("doPrefitEB", false, true) and
503  edm::ParameterDescription<bool>("doPrefitEE", false, true) and
504  edm::ParameterDescription<double>("prefitMaxChiSqEB", 25., true) and
505  edm::ParameterDescription<double>("prefitMaxChiSqEE", 10., true) and
506  edm::ParameterDescription<bool>("dynamicPedestalsEB", false, true) and
507  edm::ParameterDescription<bool>("dynamicPedestalsEE", false, true) and
508  edm::ParameterDescription<bool>("mitigateBadSamplesEB", false, true) and
509  edm::ParameterDescription<bool>("mitigateBadSamplesEE", false, true) and
510  edm::ParameterDescription<bool>("gainSwitchUseMaxSampleEB", false, true) and
511  edm::ParameterDescription<bool>("gainSwitchUseMaxSampleEE", false, true) and
512  edm::ParameterDescription<bool>("selectiveBadSampleCriteriaEB", false, true) and
513  edm::ParameterDescription<bool>("selectiveBadSampleCriteriaEE", false, true) and
514  edm::ParameterDescription<double>("addPedestalUncertaintyEB", 0., true) and
515  edm::ParameterDescription<double>("addPedestalUncertaintyEE", 0., true) and
516  edm::ParameterDescription<bool>("simplifiedNoiseModelForGainSwitch", true, true) and
517  edm::ParameterDescription<std::string>("timealgo", "RatioMethod", true) and
518  edm::ParameterDescription<std::vector<double>>("EBtimeFitParameters",
519  {-2.015452e+00,
520  3.130702e+00,
521  -1.234730e+01,
522  4.188921e+01,
523  -8.283944e+01,
524  9.101147e+01,
525  -5.035761e+01,
526  1.105621e+01},
527  true) and
528  edm::ParameterDescription<std::vector<double>>("EEtimeFitParameters",
529  {-2.390548e+00,
530  3.553628e+00,
531  -1.762341e+01,
532  6.767538e+01,
533  -1.332130e+02,
534  1.407432e+02,
535  -7.541106e+01,
536  1.620277e+01},
537  true) and
538  edm::ParameterDescription<std::vector<double>>("EBamplitudeFitParameters", {1.138, 1.652}, true) and
539  edm::ParameterDescription<std::vector<double>>("EEamplitudeFitParameters", {1.890, 1.400}, true) and
540  edm::ParameterDescription<double>("EBtimeFitLimits_Lower", 0.2, true) and
541  edm::ParameterDescription<double>("EBtimeFitLimits_Upper", 1.4, true) and
542  edm::ParameterDescription<double>("EEtimeFitLimits_Lower", 0.2, true) and
543  edm::ParameterDescription<double>("EEtimeFitLimits_Upper", 1.4, true) and
544  edm::ParameterDescription<double>("EBtimeConstantTerm", .6, true) and
545  edm::ParameterDescription<double>("EEtimeConstantTerm", 1.0, true) and
546  edm::ParameterDescription<double>("EBtimeNconst", 28.5, true) and
547  edm::ParameterDescription<double>("EEtimeNconst", 31.8, true) and
548  edm::ParameterDescription<double>("outOfTimeThresholdGain12pEB", 5, true) and
549  edm::ParameterDescription<double>("outOfTimeThresholdGain12mEB", 5, true) and
550  edm::ParameterDescription<double>("outOfTimeThresholdGain61pEB", 5, true) and
551  edm::ParameterDescription<double>("outOfTimeThresholdGain61mEB", 5, true) and
552  edm::ParameterDescription<double>("outOfTimeThresholdGain12pEE", 1000, true) and
553  edm::ParameterDescription<double>("outOfTimeThresholdGain12mEE", 1000, true) and
554  edm::ParameterDescription<double>("outOfTimeThresholdGain61pEE", 1000, true) and
555  edm::ParameterDescription<double>("outOfTimeThresholdGain61mEE", 1000, true) and
556  edm::ParameterDescription<double>("amplitudeThresholdEB", 10, true) and
557  edm::ParameterDescription<double>("amplitudeThresholdEE", 10, true) and
558  edm::ParameterDescription<double>("crossCorrelationStartTime", -25.0, true) and
559  edm::ParameterDescription<double>("crossCorrelationStopTime", 25.0, true) and
560  edm::ParameterDescription<double>("crossCorrelationTargetTimePrecision", 0.01, true));
561 
562  return psd;
563 }
564 
571  "EcalUncalibRecHitWorkerMultiFit");
edm::ESGetToken< EcalPulseCovariances, EcalPulseCovariancesRcd > pulseConvariancesToken_
edm::ParameterSetDescription getAlgoDescription() override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::array< SampleMatrixGainArray, 2 > noisecors_
EcalPulseShapesMap EcalPulseShapes
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
const edm::EventSetup & c
void computeAmplitude(std::vector< double > &amplitudeFitParameters)
unsigned size(int bx) const
EcalUncalibRecHitMultiFitAlgo multiFitMethod_
std::array< SampleMatrix, NGains > SampleMatrixGainArray
EcalUncalibRecHitTimeWeightsAlgo< EEDataFrame > weightsMethod_endcap_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::ESGetToken< EcalPulseShapes, EcalPulseShapesRcd > pulseShapesToken_
Eigen::Matrix< double, FullSampleVectorSize, FullSampleVectorSize > FullSampleMatrix
double time(const C &dataFrame, const std::vector< double > &amplitudes, const EcalPedestals::Item *aped, const EcalMGPAGainRatio *aGain, const FullSampleVector &fullpulse, const EcalWeightSet::EcalWeightMatrix **weights)
Compute time.
Eigen::Matrix< double, FullSampleVectorSize, 1 > FullSampleVector
std::map< std::pair< EcalXtalGroupId, EcalTDCId >, EcalWeightSet > EcalTBWeightMap
Definition: EcalTBWeights.h:18
void computeTime(std::vector< double > &timeFitParameters, std::pair< double, double > &timeFitLimits, std::vector< double > &amplitudeFitParameters)
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > gainsToken_
EcalCondObjectContainer< EcalXtalGroupId > EcalWeightXtalGroups
static const int TEMPLATESAMPLES
edm::ESHandle< EcalWeightXtalGroups > grps
void push_back(T const &t)
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:19
const_iterator begin() const
The iterator returned can not safely be used across threads.
Log< level::Error, false > LogError
edm::ESGetToken< EcalSamplesCorrelation, EcalSamplesCorrelationRcd > noiseConvariancesToken_
edm::EDGetTokenT< unsigned int > bunchSpacing_
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > ratioMethod_barrel_
tuple result
Definition: mps_fire.py:311
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedsToken_
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:36
edm::ESGetToken< EcalTBWeights, EcalTBWeightsRcd > wgtsToken_
string startTime
EcalGainRatioMap EcalGainRatios
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > ratioMethod_endcap_
T sqrt(T t)
Definition: SSEVec.h:19
edm::ESHandle< EcalPulseShapes > pulseshapes
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
EcalPulseCovariancesMap EcalPulseCovariances
edm::ESHandle< EcalTimeCalibConstants > itime
double timeCorrection(float ampli, const std::vector< float > &amplitudeBins, const std::vector< float > &shiftBins)
float gain6Over1() const
std::unique_ptr< EcalUncalibRecHitTimingCCAlgo > computeCC_
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:27
EcalUncalibratedRecHit makeRecHit(const EcalDataFrame &dataFrame, const EcalPedestals::Item *aped, const EcalMGPAGainRatio *aGain, const SampleMatrixGainArray &noisecors, const FullSampleVector &fullpulse, const FullSampleMatrix &fullpulsecov, const BXVector &activeBX)
compute rechits
edm::ESHandle< EcalTimeBiasCorrections > timeCorrBias_
Definition: DetId.h:17
EcalPedestalsMap EcalPedestals
Definition: EcalPedestals.h:50
edm::ESGetToken< EcalTimeOffsetConstant, EcalTimeOffsetConstantRcd > offtimeToken_
void set(const edm::EventSetup &es) override
edm::ESHandle< EcalPulseCovariances > pulsecovariances
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
int hashedIndex() const
Definition: EEDetId.h:183
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:26
EcalTimeCalibConstantMap EcalTimeCalibConstants
std::vector< Item >::const_iterator const_iterator
void resize(int bx, unsigned size)
T const * product() const
Definition: ESHandle.h:86
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned int id() const
float gain12Over6() const
edm::ESGetToken< EcalTimeBiasCorrections, EcalTimeBiasCorrectionsRcd > timeCorrBiasToken_
Eigen::Matrix< double, SampleVectorSize, SampleVectorSize > SampleMatrix
EcalUncalibRecHitTimeWeightsAlgo< EBDataFrame > weightsMethod_barrel_
edm::ESHandle< EcalTimeOffsetConstant > offtime
const_iterator end() const
float EcalTimeCalibConstant
size_type size() const
edm::ESGetToken< EcalSampleMask, EcalSampleMaskRcd > sampleMaskToken_
edm::ESGetToken< EcalTimeCalibConstants, EcalTimeCalibConstantsRcd > itimeToken_
void reserve(size_type n)
#define DEFINE_EDM_PLUGIN(factory, type, name)
void run(const edm::Event &evt, const EcalDigiCollection &digis, EcalUncalibratedRecHitCollection &result) override
const SampleMatrix & noisecor(bool barrel, int gain) const
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
edm::ESHandle< EcalSampleMask > sampleMaskHand_
const EcalWeightSet::EcalWeightMatrix * weights[2]
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
edm::ESHandle< EcalSamplesCorrelation > noisecovariances
void init(const C &dataFrame, const EcalSampleMask &sampleMask, const double *pedestals, const double *pedestalRMSes, const double *gainRatios)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
edm::ESGetToken< EcalWeightXtalGroups, EcalWeightXtalGroupsRcd > grpsToken_
const_reference back() const