CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalUncalibRecHitWorkerMultiFit.cc
Go to the documentation of this file.
2 
8 
20 
24 
27  noisecorEBg12(SampleMatrix::Zero()), noisecorEEg12(SampleMatrix::Zero()),
28  noisecorEBg6(SampleMatrix::Zero()), noisecorEEg6(SampleMatrix::Zero()),
29  noisecorEBg1(SampleMatrix::Zero()), noisecorEEg1(SampleMatrix::Zero()),
30  fullpulseEB(FullSampleVector::Zero()),fullpulseEE(FullSampleVector::Zero()),
31  fullpulsecovEB(FullSampleMatrix::Zero()),fullpulsecovEE(FullSampleMatrix::Zero()) {
32 
33  // get the BX for the pulses to be activated
34  std::vector<int32_t> activeBXs = ps.getParameter< std::vector<int32_t> >("activeBXs");
35  activeBX.resize(activeBXs.size());
36  for (unsigned int ibx=0; ibx<activeBXs.size(); ++ibx) {
37  activeBX.coeffRef(ibx) = activeBXs[ibx];
38  }
39 
40  // uncertainty calculation (CPU intensive)
41  ampErrorCalculation_ = ps.getParameter<bool>("ampErrorCalculation");
42  useLumiInfoRunHeader_ = ps.getParameter<bool>("useLumiInfoRunHeader");
43 
44  if (useLumiInfoRunHeader_) {
45  bunchSpacing_ = c.consumes<int>(edm::InputTag("addPileupInfo","bunchSpacing"));
46  }
47 
48  doPrefitEB_ = ps.getParameter<bool>("doPrefitEB");
49  doPrefitEE_ = ps.getParameter<bool>("doPrefitEE");
50 
51  prefitMaxChiSqEB_ = ps.getParameter<double>("prefitMaxChiSqEB");
52  prefitMaxChiSqEE_ = ps.getParameter<double>("prefitMaxChiSqEE");
53 
54  // algorithm to be used for timing
55  timealgo_ = ps.getParameter<std::string>("timealgo");
56 
57  // ratio method parameters
58  EBtimeFitParameters_ = ps.getParameter<std::vector<double> >("EBtimeFitParameters");
59  EEtimeFitParameters_ = ps.getParameter<std::vector<double> >("EEtimeFitParameters");
60  EBamplitudeFitParameters_ = ps.getParameter<std::vector<double> >("EBamplitudeFitParameters");
61  EEamplitudeFitParameters_ = ps.getParameter<std::vector<double> >("EEamplitudeFitParameters");
62  EBtimeFitLimits_.first = ps.getParameter<double>("EBtimeFitLimits_Lower");
63  EBtimeFitLimits_.second = ps.getParameter<double>("EBtimeFitLimits_Upper");
64  EEtimeFitLimits_.first = ps.getParameter<double>("EEtimeFitLimits_Lower");
65  EEtimeFitLimits_.second = ps.getParameter<double>("EEtimeFitLimits_Upper");
66  EBtimeConstantTerm_=ps.getParameter<double>("EBtimeConstantTerm");
67  EEtimeConstantTerm_=ps.getParameter<double>("EEtimeConstantTerm");
68  EBtimeNconst_=ps.getParameter<double>("EBtimeNconst");
69  EEtimeNconst_=ps.getParameter<double>("EEtimeNconst");
70  outOfTimeThreshG12pEB_ = ps.getParameter<double>("outOfTimeThresholdGain12pEB");
71  outOfTimeThreshG12mEB_ = ps.getParameter<double>("outOfTimeThresholdGain12mEB");
72  outOfTimeThreshG61pEB_ = ps.getParameter<double>("outOfTimeThresholdGain61pEB");
73  outOfTimeThreshG61mEB_ = ps.getParameter<double>("outOfTimeThresholdGain61mEB");
74  outOfTimeThreshG12pEE_ = ps.getParameter<double>("outOfTimeThresholdGain12pEE");
75  outOfTimeThreshG12mEE_ = ps.getParameter<double>("outOfTimeThresholdGain12mEE");
76  outOfTimeThreshG61pEE_ = ps.getParameter<double>("outOfTimeThresholdGain61pEE");
77  outOfTimeThreshG61mEE_ = ps.getParameter<double>("outOfTimeThresholdGain61mEE");
78  amplitudeThreshEB_ = ps.getParameter<double>("amplitudeThresholdEB");
79  amplitudeThreshEE_ = ps.getParameter<double>("amplitudeThresholdEE");
80 
81  // spike threshold
82  ebSpikeThresh_ = ps.getParameter<double>("ebSpikeThreshold");
83 
84  // leading edge parameters
85  ebPulseShape_ = ps.getParameter<std::vector<double> >("ebPulseShape");
86  eePulseShape_ = ps.getParameter<std::vector<double> >("eePulseShape");
87 
88  // chi2 parameters for flags determination
89  kPoorRecoFlagEB_ = ps.getParameter<bool>("kPoorRecoFlagEB");
90  kPoorRecoFlagEE_ = ps.getParameter<bool>("kPoorRecoFlagEE");;
91  chi2ThreshEB_=ps.getParameter<double>("chi2ThreshEB_");
92  chi2ThreshEE_=ps.getParameter<double>("chi2ThreshEE_");
93 
94 }
95 
96 
97 
98 void
100 {
101 
102  // common setup
103  es.get<EcalGainRatiosRcd>().get(gains);
104  es.get<EcalPedestalsRcd>().get(peds);
105 
106  // for the multifit method
111 
112  // weights parameters for the time
113  es.get<EcalWeightXtalGroupsRcd>().get(grps);
114  es.get<EcalTBWeightsRcd>().get(wgts);
115 
116  // which of the samples need be used
118 
119  // for the ratio method
120 
121  // for the leading edge method
124 
125  // for the time correction methods
127 }
128 
129 void
131 {
132 
133  if (useLumiInfoRunHeader_) {
134 
135  int bunchspacing = 450;
136 
137  if (evt.isRealData()) {
138  edm::RunNumber_t run = evt.run();
139  if (run == 178003 ||
140  run == 178004 ||
141  run == 209089 ||
142  run == 209106 ||
143  run == 209109 ||
144  run == 209146 ||
145  run == 209148 ||
146  run == 209151) {
147  bunchspacing = 25;
148  }
149  else {
150  bunchspacing = 50;
151  }
152  }
153  else {
154  edm::Handle<int> bunchSpacingH;
155  evt.getByToken(bunchSpacing_,bunchSpacingH);
156  bunchspacing = *bunchSpacingH;
157  }
158 
159  if (bunchspacing == 25) {
160  activeBX.resize(10);
161  activeBX << -5,-4,-3,-2,-1,0,1,2,3,4;
162  }
163  else {
164  //50ns configuration otherwise (also for no pileup)
165  activeBX.resize(5);
166  activeBX << -4,-2,0,2,4;
167  }
168  }
169 
170 }
171 
182  float ampli,
183  const std::vector<float>& amplitudeBins,
184  const std::vector<float>& shiftBins) {
185 
186  // computed initially in ns. Than turned in the BX's, as
187  // EcalUncalibratedRecHit need be.
188  double theCorrection = 0;
189 
190  // sanity check for arrays
191  if (amplitudeBins.size() == 0) {
192  edm::LogError("EcalRecHitError")
193  << "timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
194 
195  return 0;
196  }
197 
198  if (amplitudeBins.size() != shiftBins.size()) {
199  edm::LogError("EcalRecHitError")
200  << "Size of timeCorrAmplitudeBins different from "
201  "timeCorrShiftBins. Forcing no time bias corrections. ";
202 
203  return 0;
204  }
205 
206  int myBin = -1;
207  for (int bin = 0; bin < (int) amplitudeBins.size(); bin++) {
208  if (ampli > amplitudeBins.at(bin)) {
209  myBin = bin;
210  } else {
211  break;
212  }
213  }
214 
215  if (myBin == -1) {
216  theCorrection = shiftBins.at(0);
217  } else if (myBin == ((int)(amplitudeBins.size() - 1))) {
218  theCorrection = shiftBins.at(myBin);
219  } else if (-1 < myBin && myBin < ((int) amplitudeBins.size() - 1)) {
220  // interpolate linearly between two assingned points
221  theCorrection = (shiftBins.at(myBin + 1) - shiftBins.at(myBin));
222  theCorrection *= (((double) ampli) - amplitudeBins.at(myBin)) /
223  (amplitudeBins.at(myBin + 1) - amplitudeBins.at(myBin));
224  theCorrection += shiftBins.at(myBin);
225  } else {
226  edm::LogError("EcalRecHitError")
227  << "Assigning time correction impossible. Setting it to 0 ";
228  theCorrection = 0.;
229  }
230 
231  // convert ns into clocks
232  return theCorrection / 25.;
233 }
234 
235 
236 
237 bool
241 {
242  DetId detid(itdg->id());
243 
244  const EcalSampleMask *sampleMask_ = sampleMaskHand_.product();
245 
246  // intelligence for recHit computation
247  EcalUncalibratedRecHit uncalibRecHit;
248  float offsetTime = 0;
249 
250  const EcalPedestals::Item * aped = 0;
251  const EcalMGPAGainRatio * aGain = 0;
252  const EcalXtalGroupId * gid = 0;
253  const EcalPulseShapes::Item * aPulse = 0;
254  const EcalPulseCovariances::Item * aPulseCov = 0;
255 
256  if (detid.subdetId()==EcalEndcap) {
257  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
258  aped = &peds->endcap(hashedIndex);
259  aGain = &gains->endcap(hashedIndex);
260  gid = &grps->endcap(hashedIndex);
261  aPulse = &pulseshapes->endcap(hashedIndex);
262  aPulseCov = &pulsecovariances->endcap(hashedIndex);
265  offsetTime = offtime->getEEValue();
266  } else {
267  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
268  aped = &peds->barrel(hashedIndex);
269  aGain = &gains->barrel(hashedIndex);
270  gid = &grps->barrel(hashedIndex);
271  aPulse = &pulseshapes->barrel(hashedIndex);
272  aPulseCov = &pulsecovariances->barrel(hashedIndex);
275  offsetTime = offtime->getEBValue();
276  }
277 
278  pedVec[0] = aped->mean_x12;
279  pedVec[1] = aped->mean_x6;
280  pedVec[2] = aped->mean_x1;
281  pedRMSVec[0] = aped->rms_x12;
282  pedRMSVec[1] = aped->rms_x6;
283  pedRMSVec[2] = aped->rms_x1;
284  gainRatios[0] = 1.;
285  gainRatios[1] = aGain->gain12Over6();
286  gainRatios[2] = aGain->gain6Over1()*aGain->gain12Over6();
287 
288  int nnoise = noisecovariances->EBG12SamplesCorrelation.size();
289  for (int i=0; i<nnoise; ++i) {
290  for (int j=0; j<nnoise; ++j) {
291  int vidx = std::abs(j-i);
292  noisecorEBg12(i,j) = noisecovariances->EBG12SamplesCorrelation[vidx];
293  noisecorEEg12(i,j) = noisecovariances->EEG12SamplesCorrelation[vidx];
294  noisecorEBg6(i,j) = noisecovariances->EBG6SamplesCorrelation[vidx];
295  noisecorEEg6(i,j) = noisecovariances->EEG6SamplesCorrelation[vidx];
296  noisecorEBg1(i,j) = noisecovariances->EBG1SamplesCorrelation[vidx];
297  noisecorEEg1(i,j) = noisecovariances->EEG1SamplesCorrelation[vidx];
298  }
299  }
300 
301  for (int i=0; i<EcalPulseShape::TEMPLATESAMPLES; ++i) {
302  fullpulseEB(i+7) = aPulse->pdfval[i];
303  fullpulseEE(i+7) = aPulse->pdfval[i];
304  }
305 
306  for(int k=0; k<std::pow(EcalPulseShape::TEMPLATESAMPLES,2); ++k) {
309  fullpulsecovEB(i+7,j+7) = aPulseCov->covval[i][j];
310  fullpulsecovEE(i+7,j+7) = aPulseCov->covval[i][j];
311  }
312 
313  // compute the right bin of the pulse shape using time calibration constants
315  EcalTimeCalibConstant itimeconst = 0;
316  if( it != itime->end() ) {
317  itimeconst = (*it);
318  } else {
319  edm::LogError("EcalRecHitError") << "No time intercalib const found for xtal "
320  << detid.rawId()
321  << "! something wrong with EcalTimeCalibConstants in your DB? ";
322  }
323 
324  // === amplitude computation ===
325  int leadingSample = ((EcalDataFrame)(*itdg)).lastUnsaturatedSample();
326 
327  if ( leadingSample >= 0 ) { // saturation
328  if ( leadingSample != 4 ) {
329  // all samples different from the fifth are not reliable for the amplitude estimation
330  // put by default the energy at the saturation threshold and flag as saturated
331  float sratio = 1;
332  if ( detid.subdetId()==EcalBarrel) {
333  sratio = ebPulseShape_[5] / ebPulseShape_[4];
334  } else {
335  sratio = eePulseShape_[5] / eePulseShape_[4];
336  }
337  uncalibRecHit = EcalUncalibratedRecHit( (*itdg).id(), 4095*12*sratio, 0, 0, 0);
339  } else {
340  // float clockToNsConstant = 25.;
341  // reconstruct the rechit
342  if (detid.subdetId()==EcalEndcap) {
344  // float mult = (float)eePulseShape_.size() / (float)(*itdg).size();
345  // bin (or some analogous mapping) will be used instead of the leadingSample
346  //int bin = (int)(( (mult * leadingSample + mult/2) * clockToNsConstant + itimeconst ) / clockToNsConstant);
347  // bin is not uset for the moment
349  uncalibRecHit = leadingEdgeMethod_endcap_.makeRecHit(*itdg, pedVec, gainRatios, 0, 0);
352  } else {
354  // float mult = (float)ebPulseShape_.size() / (float)(*itdg).size();
355  // bin (or some analogous mapping) will be used instead of the leadingSample
356  //int bin = (int)(( (mult * leadingSample + mult/2) * clockToNsConstant + itimeconst ) / clockToNsConstant);
357  // bin is not uset for the moment
359  uncalibRecHit = leadingEdgeMethod_barrel_.makeRecHit(*itdg, pedVec, gainRatios, 0, 0);
362  }
363  }
364  // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation
365  uncalibRecHit.setChi2(0);
366  } else {
367  // multifit
368  bool barrel = detid.subdetId()==EcalBarrel;
369  int gain = 12;
370  if (((EcalDataFrame)(*itdg)).hasSwitchToGain6()) {
371  gain = 6;
372  }
373  if (((EcalDataFrame)(*itdg)).hasSwitchToGain1()) {
374  gain = 1;
375  }
376  const SampleMatrix &noisecormat = noisecor(barrel,gain);
377  const FullSampleVector &fullpulse = barrel ? fullpulseEB : fullpulseEE;
378  const FullSampleMatrix &fullpulsecov = barrel ? fullpulsecovEB : fullpulsecovEE;
379 
380  uncalibRecHit = multiFitMethod_.makeRecHit(*itdg, aped, aGain, noisecormat,fullpulse,fullpulsecov,activeBX);
381 
382  // === time computation ===
383  if(timealgo_.compare("RatioMethod")==0) {
384  // ratio method
385  float const clockToNsConstant = 25.;
386  if (detid.subdetId()==EcalEndcap) {
387  ratioMethod_endcap_.init( *itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios );
391  double theTimeCorrectionEE = timeCorrection(uncalibRecHit.amplitude(),
392  timeCorrBias_->EETimeCorrAmplitudeBins, timeCorrBias_->EETimeCorrShiftBins);
393 
394  uncalibRecHit.setJitter( crh.timeMax - 5 + theTimeCorrectionEE);
395  uncalibRecHit.setJitterError( std::sqrt(pow(crh.timeError,2) + std::pow(EEtimeConstantTerm_,2)/std::pow(clockToNsConstant,2)) );
396 
397  // consider flagging as kOutOfTime only if above noise
398  if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEE_){
399  float outOfTimeThreshP = outOfTimeThreshG12pEE_;
400  float outOfTimeThreshM = outOfTimeThreshG12mEE_;
401  // determine if gain has switched away from gainId==1 (x12 gain)
402  // and determine cuts (number of 'sigmas') to ose for kOutOfTime
403  // >3k ADC is necessasry condition for gain switch to occur
404  if (uncalibRecHit.amplitude() > 3000.){
405  for (int iSample = 0; iSample < EEDataFrame::MAXSAMPLES; iSample++) {
406  int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
407  if (GainId!=1) {
408  outOfTimeThreshP = outOfTimeThreshG61pEE_;
409  outOfTimeThreshM = outOfTimeThreshG61mEE_;
410  break;
411  }
412  }}
413  float correctedTime = (crh.timeMax-5) * clockToNsConstant + itimeconst + offsetTime;
414  float cterm = EEtimeConstantTerm_;
415  float sigmaped = pedRMSVec[0]; // approx for lower gains
416  float nterm = EEtimeNconst_*sigmaped/uncalibRecHit.amplitude();
417  float sigmat = std::sqrt( nterm*nterm + cterm*cterm );
418  if ( ( correctedTime > sigmat*outOfTimeThreshP ) ||
419  ( correctedTime < (-1.*sigmat*outOfTimeThreshM) ))
420  { uncalibRecHit.setFlagBit( EcalUncalibratedRecHit::kOutOfTime ); }
421  }
422 
423  } else {
424  ratioMethod_barrel_.init( *itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios );
429 
430  double theTimeCorrectionEB = timeCorrection(uncalibRecHit.amplitude(),
431  timeCorrBias_->EBTimeCorrAmplitudeBins, timeCorrBias_->EBTimeCorrShiftBins);
432 
433  uncalibRecHit.setJitter( crh.timeMax - 5 + theTimeCorrectionEB);
434  uncalibRecHit.setJitterError( std::sqrt(std::pow(crh.timeError,2) + std::pow(EBtimeConstantTerm_,2)/std::pow(clockToNsConstant,2)) );
435 
436  // consider flagging as kOutOfTime only if above noise
437  if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEB_){
438  float outOfTimeThreshP = outOfTimeThreshG12pEB_;
439  float outOfTimeThreshM = outOfTimeThreshG12mEB_;
440  // determine if gain has switched away from gainId==1 (x12 gain)
441  // and determine cuts (number of 'sigmas') to ose for kOutOfTime
442  // >3k ADC is necessasry condition for gain switch to occur
443  if (uncalibRecHit.amplitude() > 3000.){
444  for (int iSample = 0; iSample < EBDataFrame::MAXSAMPLES; iSample++) {
445  int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
446  if (GainId!=1) {
447  outOfTimeThreshP = outOfTimeThreshG61pEB_;
448  outOfTimeThreshM = outOfTimeThreshG61mEB_;
449  break;}
450  } }
451  float correctedTime = (crh.timeMax-5) * clockToNsConstant + itimeconst + offsetTime;
452  float cterm = EBtimeConstantTerm_;
453  float sigmaped = pedRMSVec[0]; // approx for lower gains
454  float nterm = EBtimeNconst_*sigmaped/uncalibRecHit.amplitude();
455  float sigmat = std::sqrt( nterm*nterm + cterm*cterm );
456  if ( ( correctedTime > sigmat*outOfTimeThreshP ) ||
457  ( correctedTime < (-1.*sigmat*outOfTimeThreshM) ))
458  { uncalibRecHit.setFlagBit( EcalUncalibratedRecHit::kOutOfTime ); }
459  }
460 
461  }
462  } else if(timealgo_.compare("WeightsMethod")==0) {
463  // weights method on the PU subtracted pulse shape
464  std::vector<double> amplitudes;
465  for(unsigned int ibx=0; ibx<activeBX.size(); ++ibx) amplitudes.push_back(uncalibRecHit.outOfTimeAmplitude(ibx));
466 
467  EcalTBWeights::EcalTDCId tdcid(1);
468  EcalTBWeights::EcalTBWeightMap const & wgtsMap = wgts->getMap();
469  EcalTBWeights::EcalTBWeightMap::const_iterator wit;
470  wit = wgtsMap.find( std::make_pair(*gid,tdcid) );
471  if( wit == wgtsMap.end() ) {
472  edm::LogError("EcalUncalibRecHitError") << "No weights found for EcalGroupId: "
473  << gid->id() << " and EcalTDCId: " << tdcid
474  << "\n skipping digi with id: " << detid.rawId();
475 
476  return false;
477  }
478  const EcalWeightSet& wset = wit->second; // this is the EcalWeightSet
479 
482 
483  weights[0] = &mat1;
484  weights[1] = &mat2;
485 
486  double timerh;
487  if (detid.subdetId()==EcalEndcap) {
488  timerh = weightsMethod_endcap_.time( *itdg, amplitudes, aped, aGain, fullpulse, weights);
489  } else {
490  timerh = weightsMethod_barrel_.time( *itdg, amplitudes, aped, aGain, fullpulse, weights);
491  }
492  uncalibRecHit.setJitter( timerh );
493  uncalibRecHit.setJitterError( 0. ); // not computed with weights
494  } else if(timealgo_.compare("None")==0) {
495  uncalibRecHit.setJitter( 0. );
496  uncalibRecHit.setJitterError( 0. );
497  } else {
498  edm::LogError("EcalUncalibRecHitError") << "No time estimation algorithm called "
499  << timealgo_
500  << "\n setting jitter to 0. and jitter uncertainty to 10000. ";
501 
502  uncalibRecHit.setJitter( 0. );
503  uncalibRecHit.setJitterError( 10000. );
504  }
505  }
506 
507  // set flags if gain switch has occurred
508  if( ((EcalDataFrame)(*itdg)).hasSwitchToGain6() ) uncalibRecHit.setFlagBit( EcalUncalibratedRecHit::kHasSwitchToGain6 );
509  if( ((EcalDataFrame)(*itdg)).hasSwitchToGain1() ) uncalibRecHit.setFlagBit( EcalUncalibratedRecHit::kHasSwitchToGain1 );
510 
511  // set quality flags based on chi2 of the the fit
512  /*
513  if(detid.subdetId()==EcalEndcap) {
514  if(kPoorRecoFlagEE_ && uncalibRecHit.chi2()>chi2ThreshEE_) {
515  bool samplesok = true;
516  for (int sample =0; sample < EcalDataFrame::MAXSAMPLES; ++sample) {
517  if (!sampleMask_->useSampleEE(sample)) {
518  samplesok = false;
519  break;
520  }
521  }
522  if (samplesok) uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kPoorReco);
523  }
524  } else {
525  if(kPoorRecoFlagEB_ && uncalibRecHit.chi2()>chi2ThreshEB_) {
526  bool samplesok = true;
527  for (int sample =0; sample < EcalDataFrame::MAXSAMPLES; ++sample) {
528  if (!sampleMask_->useSampleEB(sample)) {
529  samplesok = false;
530  break;
531  }
532  }
533  if (samplesok) uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kPoorReco);
534  }
535  }
536  */
537 
538  // put the recHit in the collection
539  if (detid.subdetId()==EcalEndcap) {
540  result.push_back( uncalibRecHit );
541  } else {
542  result.push_back( uncalibRecHit );
543  }
544 
545  return true;
546 }
547 
548 
550  if (barrel) {
551  if (gain==6) {
552  return noisecorEBg6;
553  }
554  else if (gain==1) {
555  return noisecorEBg1;
556  }
557  else {
558  return noisecorEBg12;
559  }
560  }
561  else {
562  if (gain==6) {
563  return noisecorEEg6;
564  }
565  else if (gain==1) {
566  return noisecorEEg1;
567  }
568  else {
569  return noisecorEEg12;
570  }
571  }
572 
573  return noisecorEBg12;
574 
575 }
576 
579 
581  psd0.addNode((edm::ParameterDescription<std::vector<double>>("EBPulseShapeTemplate", {1.13979e-02, 7.58151e-01, 1.00000e+00, 8.87744e-01, 6.73548e-01, 4.74332e-01, 3.19561e-01, 2.15144e-01, 1.47464e-01, 1.01087e-01, 6.93181e-02, 4.75044e-02}, true) and
582  edm::ParameterDescription<std::vector<double>>("EEPulseShapeTemplate", {1.16442e-01, 7.56246e-01, 1.00000e+00, 8.97182e-01, 6.86831e-01, 4.91506e-01, 3.44111e-01, 2.45731e-01, 1.74115e-01, 1.23361e-01, 8.74288e-02, 6.19570e-02}, true)));
583 
584  psd0.addNode((edm::ParameterDescription<std::string>("EEdigiCollection", "", true) and
585  edm::ParameterDescription<std::string>("EBdigiCollection", "", true) and
586  edm::ParameterDescription<std::string>("ESdigiCollection", "", true) and
587  edm::ParameterDescription<bool>("UseLCcorrection", true, false) and
588  edm::ParameterDescription<std::vector<double>>("EBCorrNoiseMatrixG12", {1.00000, 0.71073, 0.55721, 0.46089, 0.40449, 0.35931, 0.33924, 0.32439, 0.31581, 0.30481 }, true) and
589  edm::ParameterDescription<std::vector<double>>("EECorrNoiseMatrixG12", {1.00000, 0.71373, 0.44825, 0.30152, 0.21609, 0.14786, 0.11772, 0.10165, 0.09465, 0.08098 }, true) and
590  edm::ParameterDescription<std::vector<double>>("EBCorrNoiseMatrixG06", {1.00000, 0.70946, 0.58021, 0.49846, 0.45006, 0.41366, 0.39699, 0.38478, 0.37847, 0.37055 }, true) and
591  edm::ParameterDescription<std::vector<double>>("EECorrNoiseMatrixG06", {1.00000, 0.71217, 0.47464, 0.34056, 0.26282, 0.20287, 0.17734, 0.16256, 0.15618, 0.14443 }, true) and
592  edm::ParameterDescription<std::vector<double>>("EBCorrNoiseMatrixG01", {1.00000, 0.73354, 0.64442, 0.58851, 0.55425, 0.53082, 0.51916, 0.51097, 0.50732, 0.50409 }, true) and
593  edm::ParameterDescription<std::vector<double>>("EECorrNoiseMatrixG01", {1.00000, 0.72698, 0.62048, 0.55691, 0.51848, 0.49147, 0.47813, 0.47007, 0.46621, 0.46265 }, true) and
594  edm::ParameterDescription<bool>("EcalPreMixStage1", false, true) and
595  edm::ParameterDescription<bool>("EcalPreMixStage2", false, true)));
596 
597  psd0.addOptionalNode((edm::ParameterDescription<std::vector<double>>("EBPulseShapeCovariance", {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, -5.296e-07, 0.000e+00, 0.000e+00,
598  1.233e-05, 6.154e-05, 0.000e+00, -2.200e-05, -2.309e-05, -1.838e-05, -1.373e-05, -7.334e-06, -5.088e-06, -3.745e-06, -2.428e-06, 0.000e+00,
599  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, 0.000e+00, 0.000e+00, 0.000e+00,
600  -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, 1.223e-06, 8.245e-07, 5.589e-07,
601  -4.571e-06, -2.309e-05, 0.000e+00, 8.545e-06, 9.182e-06, 7.219e-06, 5.388e-06, 2.853e-06, 1.944e-06, 1.324e-06, 9.083e-07, 6.335e-07,
602  -3.614e-06, -1.838e-05, 0.000e+00, 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,
603  -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, 9.079e-07, 6.529e-07, 4.752e-07,
604  -1.286e-06, -7.334e-06, 0.000e+00, 2.678e-06, 2.853e-06, 2.385e-06, 1.917e-06, 1.375e-06, 9.100e-07, 6.455e-07, 4.693e-07, 3.657e-07,
605  -8.410e-07, -5.088e-06, 0.000e+00, 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,
606  -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, 7.217e-07, 4.862e-07, 3.768e-07,
607  0.000e+00, -2.428e-06, 0.000e+00, 8.245e-07, 9.083e-07, 7.754e-07, 6.529e-07, 4.693e-07, 4.436e-07, 4.862e-07, 6.509e-07, 4.418e-07,
608  0.000e+00, 0.000e+00, 0.000e+00, 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}, true) and
609  edm::ParameterDescription<std::vector<double>>("EEPulseShapeCovariance", {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, -3.411e-06, 0.000e+00, 0.000e+00,
610  3.333e-05, 2.862e-05, 0.000e+00, -1.244e-05, -1.431e-05, -1.233e-05, -1.032e-05, -5.883e-06, -4.154e-06, -2.902e-06, -2.128e-06, 0.000e+00,
611  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, 0.000e+00, 0.000e+00, 0.000e+00,
612  -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, 1.330e-06, 9.186e-07, 6.446e-07,
613  -1.661e-05, -1.431e-05, 0.000e+00, 6.649e-06, 7.966e-06, 6.898e-06, 5.794e-06, 3.157e-06, 2.184e-06, 1.567e-06, 1.084e-06, 7.575e-07,
614  -1.424e-05, -1.233e-05, 0.000e+00, 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,
615  -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, 1.289e-06, 9.020e-07, 6.146e-07,
616  -6.842e-06, -5.883e-06, 0.000e+00, 2.708e-06, 3.157e-06, 2.859e-06, 2.628e-06, 1.863e-06, 1.296e-06, 8.882e-07, 6.108e-07, 4.283e-07,
617  -4.915e-06, -4.154e-06, 0.000e+00, 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,
618  -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, 9.522e-07, 6.717e-07, 4.293e-07,
619  0.000e+00, -2.128e-06, 0.000e+00, 9.186e-07, 1.084e-06, 9.839e-07, 9.020e-07, 6.108e-07, 5.751e-07, 6.717e-07, 7.911e-07, 5.493e-07,
620  0.000e+00, 0.000e+00, 0.000e+00, 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}, true)), true);
621 
623  psd.addNode(edm::ParameterDescription<std::vector<int>>("activeBXs", {-5,-4,-3,-2,-1,0,1,2,3,4}, true) and
624  edm::ParameterDescription<bool>("ampErrorCalculation", true, true) and
625  edm::ParameterDescription<bool>("useLumiInfoRunHeader", true, true) and
626  edm::ParameterDescription<bool>("doPrefitEB", false, true) and
627  edm::ParameterDescription<bool>("doPrefitEE", false, true) and
628  edm::ParameterDescription<double>("prefitMaxChiSqEB", 25., true) and
629  edm::ParameterDescription<double>("prefitMaxChiSqEE", 10., true) and
630  edm::ParameterDescription<std::string>("timealgo", "RatioMethod", true) and
631  edm::ParameterDescription<std::vector<double>>("EBtimeFitParameters", {-2.015452e+00, 3.130702e+00, -1.234730e+01, 4.188921e+01, -8.283944e+01, 9.101147e+01, -5.035761e+01, 1.105621e+01}, true) and
632  edm::ParameterDescription<std::vector<double>>("EEtimeFitParameters", {-2.390548e+00, 3.553628e+00, -1.762341e+01, 6.767538e+01, -1.332130e+02, 1.407432e+02, -7.541106e+01, 1.620277e+01}, true) and
633  edm::ParameterDescription<std::vector<double>>("EBamplitudeFitParameters", {1.138,1.652}, true) and
634  edm::ParameterDescription<std::vector<double>>("EEamplitudeFitParameters", {1.890,1.400}, true) and
635  edm::ParameterDescription<double>("EBtimeFitLimits_Lower", 0.2, true) and
636  edm::ParameterDescription<double>("EBtimeFitLimits_Upper", 1.4, true) and
637  edm::ParameterDescription<double>("EEtimeFitLimits_Lower", 0.2, true) and
638  edm::ParameterDescription<double>("EEtimeFitLimits_Upper", 1.4, true) and
639  edm::ParameterDescription<double>("EBtimeConstantTerm", .6, true) and
640  edm::ParameterDescription<double>("EEtimeConstantTerm", 1.0, true) and
641  edm::ParameterDescription<double>("EBtimeNconst", 28.5, true) and
642  edm::ParameterDescription<double>("EEtimeNconst", 31.8, true) and
643  edm::ParameterDescription<double>("outOfTimeThresholdGain12pEB", 5, true) and
644  edm::ParameterDescription<double>("outOfTimeThresholdGain12mEB", 5, true) and
645  edm::ParameterDescription<double>("outOfTimeThresholdGain61pEB", 5, true) and
646  edm::ParameterDescription<double>("outOfTimeThresholdGain61mEB", 5, true) and
647  edm::ParameterDescription<double>("outOfTimeThresholdGain12pEE", 1000, true) and
648  edm::ParameterDescription<double>("outOfTimeThresholdGain12mEE", 1000, true) and
649  edm::ParameterDescription<double>("outOfTimeThresholdGain61pEE", 1000, true) and
650  edm::ParameterDescription<double>("outOfTimeThresholdGain61mEE", 1000, true) and
651  edm::ParameterDescription<double>("amplitudeThresholdEB", 10, true) and
652  edm::ParameterDescription<double>("amplitudeThresholdEE", 10, true) and
653  edm::ParameterDescription<double>("ebSpikeThreshold", 1.042, true) and
654  edm::ParameterDescription<std::vector<double>>("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
655  edm::ParameterDescription<std::vector<double>>("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
656  edm::ParameterDescription<bool>("kPoorRecoFlagEB", true, true) and
657  edm::ParameterDescription<bool>("kPoorRecoFlagEE", false, true) and
658  edm::ParameterDescription<double>("chi2ThreshEB_", 65.0, true) and
659  edm::ParameterDescription<double>("chi2ThreshEE_", 50.0, true) and
660  edm::ParameterDescription<edm::ParameterSetDescription>("EcalPulseShapeParameters", psd0, true));
661 
662  return psd;
663 }
664 
665 
666 
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::map< std::pair< EcalXtalGroupId, EcalTDCId >, EcalWeightSet > EcalTBWeightMap
Definition: EcalTBWeights.h:21
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:86
void computeAmplitude(std::vector< double > &amplitudeFitParameters)
unsigned size(int bx) const
EcalUncalibRecHitMultiFitAlgo multiFitMethod_
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
const SampleMatrix & noisecor(bool barrel, int gain) const
void setJitter(float jitter)
EcalUncalibRecHitTimeWeightsAlgo< EEDataFrame > weightsMethod_endcap_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
EcalUncalibRecHitLeadingEdgeAlgo< EBDataFrame > leadingEdgeMethod_barrel_
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.
EcalUncalibratedRecHit makeRecHit(const EcalDataFrame &dataFrame, const EcalPedestals::Item *aped, const EcalMGPAGainRatio *aGain, const SampleMatrix &noisecor, const FullSampleVector &fullpulse, const FullSampleMatrix &fullpulsecov, const BXVector &activeBX)
compute rechits
void computeTime(std::vector< double > &timeFitParameters, std::pair< double, double > &timeFitLimits, std::vector< double > &amplitudeFitParameters)
static const int TEMPLATESAMPLES
edm::ESHandle< EcalWeightXtalGroups > grps
void push_back(T const &t)
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
void setJitterError(float jitterErr)
Eigen::Matrix< double, 19, 19 > FullSampleMatrix
bool isRealData() const
Definition: EventBase.h:64
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > ratioMethod_barrel_
void setPulseShape(std::vector< double > &shape)
const unsigned int id() const
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result) override
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:42
float outOfTimeAmplitude(int bx) const
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > ratioMethod_endcap_
T sqrt(T t)
Definition: SSEVec.h:48
edm::ESHandle< EcalPulseShapes > pulseshapes
tuple result
Definition: query.py:137
RunNumber_t run() const
Definition: Event.h:85
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
ParameterDescriptionNode * addOptionalNode(ParameterDescriptionNode const &node, bool writeToCfi)
edm::ESHandle< EcalTimeCalibConstants > itime
double timeCorrection(float ampli, const std::vector< float > &amplitudeBins, const std::vector< float > &shiftBins)
float gain6Over1() const
Eigen::Matrix< double, 19, 1 > FullSampleVector
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:30
float covval[EcalPulseShape::TEMPLATESAMPLES][EcalPulseShape::TEMPLATESAMPLES]
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalWeightSet::EcalChi2WeightMatrix **chi2Matrix)
Compute parameters.
edm::ESHandle< EcalTimeBiasCorrections > timeCorrBias_
edm::ParameterSetDescription getAlgoDescription()
Definition: DetId.h:18
EcalUncalibRecHitLeadingEdgeAlgo< EEDataFrame > leadingEdgeMethod_endcap_
void set(const edm::EventSetup &es) override
edm::ESHandle< EcalPulseCovariances > pulsecovariances
int hashedIndex() const
Definition: EEDetId.h:182
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:29
const T & get() const
Definition: EventSetup.h:55
std::vector< Item >::const_iterator const_iterator
void resize(int bx, unsigned size)
T const * product() const
Definition: ESHandle.h:86
float gain12Over6() const
EcalUncalibRecHitTimeWeightsAlgo< EBDataFrame > weightsMethod_barrel_
edm::ESHandle< EcalTimeOffsetConstant > offtime
float pdfval[TEMPLATESAMPLES]
float EcalTimeCalibConstant
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:22
#define DEFINE_EDM_PLUGIN(factory, type, name)
unsigned int RunNumber_t
edm::ESHandle< EcalSampleMask > sampleMaskHand_
const EcalWeightSet::EcalWeightMatrix * weights[2]
edm::ESHandle< EcalSamplesCorrelation > noisecovariances
Eigen::Matrix< double, 10, 10 > SampleMatrix
void init(const C &dataFrame, const EcalSampleMask &sampleMask, const double *pedestals, const double *pedestalRMSes, const double *gainRatios)
static const int MAXSAMPLES
Definition: EcalDataFrame.h:48
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40