Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-02 03:46:04

0001 #include "RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerGlobal.h"
0002 
0003 #include "FWCore/Framework/interface/EventSetup.h"
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 
0008 #include <FWCore/ParameterSet/interface/ConfigurationDescriptions.h>
0009 #include <FWCore/ParameterSet/interface/ParameterSetDescription.h>
0010 
0011 EcalUncalibRecHitWorkerGlobal::EcalUncalibRecHitWorkerGlobal(const edm::ParameterSet& ps, edm::ConsumesCollector& c)
0012     : EcalUncalibRecHitWorkerRunOneDigiBase(ps, c),
0013       tokenPeds_(c.esConsumes<EcalPedestals, EcalPedestalsRcd>()),
0014       tokenGains_(c.esConsumes<EcalGainRatios, EcalGainRatiosRcd>()),
0015       tokenGrps_(c.esConsumes<EcalWeightXtalGroups, EcalWeightXtalGroupsRcd>()),
0016       tokenWgts_(c.esConsumes<EcalTBWeights, EcalTBWeightsRcd>()),
0017       testbeamEEShape(c),
0018       testbeamEBShape(c),
0019       tokenSampleMask_(c.esConsumes<EcalSampleMask, EcalSampleMaskRcd>()),
0020       tokenTimeCorrBias_(c.esConsumes<EcalTimeBiasCorrections, EcalTimeBiasCorrectionsRcd>()),
0021       tokenItime_(c.esConsumes<EcalTimeCalibConstants, EcalTimeCalibConstantsRcd>()),
0022       tokenOfftime_(c.esConsumes<EcalTimeOffsetConstant, EcalTimeOffsetConstantRcd>()) {
0023   // ratio method parameters
0024   EBtimeFitParameters_ = ps.getParameter<std::vector<double>>("EBtimeFitParameters");
0025   EEtimeFitParameters_ = ps.getParameter<std::vector<double>>("EEtimeFitParameters");
0026   EBamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EBamplitudeFitParameters");
0027   EEamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EEamplitudeFitParameters");
0028   EBtimeFitLimits_.first = ps.getParameter<double>("EBtimeFitLimits_Lower");
0029   EBtimeFitLimits_.second = ps.getParameter<double>("EBtimeFitLimits_Upper");
0030   EEtimeFitLimits_.first = ps.getParameter<double>("EEtimeFitLimits_Lower");
0031   EEtimeFitLimits_.second = ps.getParameter<double>("EEtimeFitLimits_Upper");
0032   EBtimeConstantTerm_ = ps.getParameter<double>("EBtimeConstantTerm");
0033   EBtimeNconst_ = ps.getParameter<double>("EBtimeNconst");
0034   EEtimeConstantTerm_ = ps.getParameter<double>("EEtimeConstantTerm");
0035   EEtimeNconst_ = ps.getParameter<double>("EEtimeNconst");
0036   outOfTimeThreshG12pEB_ = ps.getParameter<double>("outOfTimeThresholdGain12pEB");
0037   outOfTimeThreshG12mEB_ = ps.getParameter<double>("outOfTimeThresholdGain12mEB");
0038   outOfTimeThreshG61pEB_ = ps.getParameter<double>("outOfTimeThresholdGain61pEB");
0039   outOfTimeThreshG61mEB_ = ps.getParameter<double>("outOfTimeThresholdGain61mEB");
0040   outOfTimeThreshG12pEE_ = ps.getParameter<double>("outOfTimeThresholdGain12pEE");
0041   outOfTimeThreshG12mEE_ = ps.getParameter<double>("outOfTimeThresholdGain12mEE");
0042   outOfTimeThreshG61pEE_ = ps.getParameter<double>("outOfTimeThresholdGain61pEE");
0043   outOfTimeThreshG61mEE_ = ps.getParameter<double>("outOfTimeThresholdGain61mEE");
0044   amplitudeThreshEB_ = ps.getParameter<double>("amplitudeThresholdEB");
0045   amplitudeThreshEE_ = ps.getParameter<double>("amplitudeThresholdEE");
0046 
0047   // spike threshold
0048   ebSpikeThresh_ = ps.getParameter<double>("ebSpikeThreshold");
0049 
0050   ebPulseShape_ = ps.getParameter<std::vector<double>>("ebPulseShape");
0051   eePulseShape_ = ps.getParameter<std::vector<double>>("eePulseShape");
0052 
0053   // chi2 parameters
0054   kPoorRecoFlagEB_ = ps.getParameter<bool>("kPoorRecoFlagEB");
0055   kPoorRecoFlagEE_ = ps.getParameter<bool>("kPoorRecoFlagEE");
0056 
0057   chi2ThreshEB_ = ps.getParameter<double>("chi2ThreshEB_");
0058   chi2ThreshEE_ = ps.getParameter<double>("chi2ThreshEE_");
0059   EBchi2Parameters_ = ps.getParameter<std::vector<double>>("EBchi2Parameters");
0060   EEchi2Parameters_ = ps.getParameter<std::vector<double>>("EEchi2Parameters");
0061 }
0062 
0063 void EcalUncalibRecHitWorkerGlobal::set(const edm::EventSetup& es) {
0064   // common setup
0065   gains_ = es.getHandle(tokenGains_);
0066   peds_ = es.getHandle(tokenPeds_);
0067 
0068   // for the weights method
0069   grps_ = es.getHandle(tokenGrps_);
0070   wgts_ = es.getHandle(tokenWgts_);
0071 
0072   // which of the samples need be used
0073   sampleMaskHand_ = es.getHandle(tokenSampleMask_);
0074 
0075   // for the ratio method
0076 
0077   itime_ = es.getHandle(tokenItime_);
0078   offtime_ = es.getHandle(tokenOfftime_);
0079 
0080   // for the time correction methods
0081   timeCorrBias_ = es.getHandle(tokenTimeCorrBias_);
0082 
0083   // for the DB Ecal Pulse Sim Shape
0084   testbeamEEShape.setEventSetup(es);
0085   testbeamEBShape.setEventSetup(es);
0086 }
0087 
0088 // check saturation: 5 samples with gainId = 0
0089 template <class C>
0090 int EcalUncalibRecHitWorkerGlobal::isSaturated(const C& dataFrame) {
0091   //bool saturated_ = 0;
0092   int cnt;
0093   for (int j = 0; j < C::MAXSAMPLES - 5; ++j) {
0094     cnt = 0;
0095     for (int i = j; i < (j + 5) && i < C::MAXSAMPLES; ++i) {
0096       if (dataFrame.sample(i).gainId() == 0)
0097         ++cnt;
0098     }
0099     if (cnt == 5)
0100       return j - 1;  // the last unsaturated sample
0101   }
0102   return -1;  // no saturation found
0103 }
0104 
0105 /**
0106  * Amplitude-dependent time corrections; EE and EB have separate corrections:
0107  * EXtimeCorrAmplitudes (ADC) and EXtimeCorrShifts (ns) need to have the same number of elements
0108  * Bins must be ordered in amplitude. First-last bins take care of under-overflows.
0109  *
0110  * The algorithm is the same for EE and EB, only the correction vectors are different.
0111  *
0112  * @return Jitter (in clock cycles) which will be added to UncalibRechit.setJitter(), 0 if no correction is applied.
0113  */
0114 double EcalUncalibRecHitWorkerGlobal::timeCorrection(float ampli,
0115                                                      const std::vector<float>& amplitudeBins,
0116                                                      const std::vector<float>& shiftBins) {
0117   // computed initially in ns. Than turned in the BX's, as
0118   // EcalUncalibratedRecHit need be.
0119   double theCorrection = 0;
0120 
0121   // sanity check for arrays
0122   if (amplitudeBins.empty()) {
0123     edm::LogError("EcalRecHitError") << "timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
0124 
0125     return 0;
0126   }
0127 
0128   if (amplitudeBins.size() != shiftBins.size()) {
0129     edm::LogError("EcalRecHitError") << "Size of timeCorrAmplitudeBins different from "
0130                                         "timeCorrShiftBins. Forcing no time bias corrections. ";
0131 
0132     return 0;
0133   }
0134 
0135   int myBin = -1;
0136   for (int bin = 0; bin < (int)amplitudeBins.size(); bin++) {
0137     if (ampli > amplitudeBins.at(bin)) {
0138       myBin = bin;
0139     } else {
0140       break;
0141     }
0142   }
0143 
0144   if (myBin == -1) {
0145     theCorrection = shiftBins.at(0);
0146   } else if (myBin == ((int)(amplitudeBins.size() - 1))) {
0147     theCorrection = shiftBins.at(myBin);
0148   } else if (-1 < myBin && myBin < ((int)amplitudeBins.size() - 1)) {
0149     // interpolate linearly between two assingned points
0150     theCorrection = (shiftBins.at(myBin + 1) - shiftBins.at(myBin));
0151     theCorrection *=
0152         (((double)ampli) - amplitudeBins.at(myBin)) / (amplitudeBins.at(myBin + 1) - amplitudeBins.at(myBin));
0153     theCorrection += shiftBins.at(myBin);
0154   } else {
0155     edm::LogError("EcalRecHitError") << "Assigning time correction impossible. Setting it to 0 ";
0156     theCorrection = 0.;
0157   }
0158 
0159   // convert ns into clocks
0160   return theCorrection / 25.;
0161 }
0162 
0163 bool EcalUncalibRecHitWorkerGlobal::run(const edm::Event& evt,
0164                                         const EcalDigiCollection::const_iterator& itdg,
0165                                         EcalUncalibratedRecHitCollection& result) {
0166   DetId detid(itdg->id());
0167 
0168   const EcalSampleMask* sampleMask_ = sampleMaskHand_.product();
0169 
0170   // intelligence for recHit computation
0171   EcalUncalibratedRecHit uncalibRecHit;
0172 
0173   const EcalPedestals::Item* aped = nullptr;
0174   const EcalMGPAGainRatio* aGain = nullptr;
0175   const EcalXtalGroupId* gid = nullptr;
0176   float offsetTime = 0;
0177 
0178   if (detid.subdetId() == EcalEndcap) {
0179     unsigned int hashedIndex = EEDetId(detid).hashedIndex();
0180     aped = &peds_->endcap(hashedIndex);
0181     aGain = &gains_->endcap(hashedIndex);
0182     gid = &grps_->endcap(hashedIndex);
0183     offsetTime = offtime_->getEEValue();
0184   } else {
0185     unsigned int hashedIndex = EBDetId(detid).hashedIndex();
0186     aped = &peds_->barrel(hashedIndex);
0187     aGain = &gains_->barrel(hashedIndex);
0188     gid = &grps_->barrel(hashedIndex);
0189     offsetTime = offtime_->getEBValue();
0190   }
0191 
0192   pedVec[0] = aped->mean_x12;
0193   pedVec[1] = aped->mean_x6;
0194   pedVec[2] = aped->mean_x1;
0195   pedRMSVec[0] = aped->rms_x12;
0196   pedRMSVec[1] = aped->rms_x6;
0197   pedRMSVec[2] = aped->rms_x1;
0198   gainRatios[0] = 1.;
0199   gainRatios[1] = aGain->gain12Over6();
0200   gainRatios[2] = aGain->gain6Over1() * aGain->gain12Over6();
0201 
0202   // compute the right bin of the pulse shape using time calibration constants
0203   EcalTimeCalibConstantMap::const_iterator it = itime_->find(detid);
0204   EcalTimeCalibConstant itimeconst = 0;
0205   if (it != itime_->end()) {
0206     itimeconst = (*it);
0207   } else {
0208     edm::LogError("EcalRecHitError") << "No time intercalib const found for xtal " << detid.rawId()
0209                                      << "! something wrong with EcalTimeCalibConstants in your DB? ";
0210   }
0211 
0212   // === amplitude computation ===
0213   int leadingSample = -1;
0214   if (detid.subdetId() == EcalEndcap) {
0215     leadingSample = ((EcalDataFrame)(*itdg)).lastUnsaturatedSample();
0216   } else {
0217     leadingSample = ((EcalDataFrame)(*itdg)).lastUnsaturatedSample();
0218   }
0219 
0220   if (leadingSample == 4) {  // saturation on the expected max sample
0221     uncalibRecHit = EcalUncalibratedRecHit((*itdg).id(), 4095 * 12, 0, 0, 0);
0222     uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kSaturated);
0223     // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation
0224     uncalibRecHit.setChi2(0);
0225   } else if (leadingSample >= 0) {  // saturation on other samples: cannot extrapolate from the fourth one
0226     double pedestal = 0.;
0227     double gainratio = 1.;
0228     int gainId = ((EcalDataFrame)(*itdg)).sample(5).gainId();
0229 
0230     if (gainId == 0 || gainId == 3) {
0231       pedestal = aped->mean_x1;
0232       gainratio = aGain->gain6Over1() * aGain->gain12Over6();
0233     } else if (gainId == 1) {
0234       pedestal = aped->mean_x12;
0235       gainratio = 1.;
0236     } else if (gainId == 2) {
0237       pedestal = aped->mean_x6;
0238       gainratio = aGain->gain12Over6();
0239     }
0240     double amplitude = ((double)(((EcalDataFrame)(*itdg)).sample(5).adc()) - pedestal) * gainratio;
0241     uncalibRecHit = EcalUncalibratedRecHit((*itdg).id(), amplitude, 0, 0, 0);
0242     uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kSaturated);
0243     // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation
0244     uncalibRecHit.setChi2(0);
0245   } else {
0246     // weights method
0247     EcalTBWeights::EcalTDCId tdcid(1);
0248     EcalTBWeights::EcalTBWeightMap const& wgtsMap = wgts_->getMap();
0249     EcalTBWeights::EcalTBWeightMap::const_iterator wit;
0250     wit = wgtsMap.find(std::make_pair(*gid, tdcid));
0251     if (wit == wgtsMap.end()) {
0252       edm::LogError("EcalUncalibRecHitError")
0253           << "No weights found for EcalGroupId: " << gid->id() << " and  EcalTDCId: " << tdcid
0254           << "\n  skipping digi with id: " << detid.rawId();
0255 
0256       return false;
0257     }
0258     const EcalWeightSet& wset = wit->second;  // this is the EcalWeightSet
0259 
0260     const EcalWeightSet::EcalWeightMatrix& mat1 = wset.getWeightsBeforeGainSwitch();
0261     const EcalWeightSet::EcalWeightMatrix& mat2 = wset.getWeightsAfterGainSwitch();
0262 
0263     weights[0] = &mat1;
0264     weights[1] = &mat2;
0265 
0266     // get uncalibrated recHit from weights
0267     if (detid.subdetId() == EcalEndcap) {
0268       uncalibRecHit = weightsMethod_endcap_.makeRecHit(*itdg, pedVec, pedRMSVec, gainRatios, weights, testbeamEEShape);
0269     } else {
0270       uncalibRecHit = weightsMethod_barrel_.makeRecHit(*itdg, pedVec, pedRMSVec, gainRatios, weights, testbeamEBShape);
0271     }
0272 
0273     // === time computation ===
0274     // ratio method
0275     float const clockToNsConstant = 25.;
0276     if (detid.subdetId() == EcalEndcap) {
0277       ratioMethod_endcap_.init(*itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios);
0278       ratioMethod_endcap_.computeTime(EEtimeFitParameters_, EEtimeFitLimits_, EEamplitudeFitParameters_);
0279       ratioMethod_endcap_.computeAmplitude(EEamplitudeFitParameters_);
0280       EcalUncalibRecHitRatioMethodAlgo<EEDataFrame>::CalculatedRecHit crh = ratioMethod_endcap_.getCalculatedRecHit();
0281       double theTimeCorrectionEE = timeCorrection(
0282           uncalibRecHit.amplitude(), timeCorrBias_->EETimeCorrAmplitudeBins, timeCorrBias_->EETimeCorrShiftBins);
0283 
0284       uncalibRecHit.setJitter(crh.timeMax - 5 + theTimeCorrectionEE);
0285       uncalibRecHit.setJitterError(
0286           std::sqrt(pow(crh.timeError, 2) + std::pow(EEtimeConstantTerm_, 2) / std::pow(clockToNsConstant, 2)));
0287       // consider flagging as kOutOfTime only if above noise
0288       if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEE_) {
0289         float outOfTimeThreshP = outOfTimeThreshG12pEE_;
0290         float outOfTimeThreshM = outOfTimeThreshG12mEE_;
0291         // determine if gain has switched away from gainId==1 (x12 gain)
0292         // and determine cuts (number of 'sigmas') to ose for kOutOfTime
0293         // >3k ADC is necessasry condition for gain switch to occur
0294         if (uncalibRecHit.amplitude() > 3000.) {
0295           for (int iSample = 0; iSample < EEDataFrame::MAXSAMPLES; iSample++) {
0296             int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
0297             if (GainId != 1) {
0298               outOfTimeThreshP = outOfTimeThreshG61pEE_;
0299               outOfTimeThreshM = outOfTimeThreshG61mEE_;
0300               break;
0301             }
0302           }
0303         }
0304         float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
0305         float cterm = EEtimeConstantTerm_;
0306         float sigmaped = pedRMSVec[0];  // approx for lower gains
0307         float nterm = EEtimeNconst_ * sigmaped / uncalibRecHit.amplitude();
0308         float sigmat = std::sqrt(nterm * nterm + cterm * cterm);
0309         if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < (-1. * sigmat * outOfTimeThreshM))) {
0310           uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kOutOfTime);
0311         }
0312       }
0313 
0314     } else {
0315       ratioMethod_barrel_.init(*itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios);
0316       ratioMethod_barrel_.fixMGPAslew(*itdg);
0317       ratioMethod_barrel_.computeTime(EBtimeFitParameters_, EBtimeFitLimits_, EBamplitudeFitParameters_);
0318       ratioMethod_barrel_.computeAmplitude(EBamplitudeFitParameters_);
0319       EcalUncalibRecHitRatioMethodAlgo<EBDataFrame>::CalculatedRecHit crh = ratioMethod_barrel_.getCalculatedRecHit();
0320 
0321       double theTimeCorrectionEB = timeCorrection(
0322           uncalibRecHit.amplitude(), timeCorrBias_->EBTimeCorrAmplitudeBins, timeCorrBias_->EBTimeCorrShiftBins);
0323 
0324       uncalibRecHit.setJitter(crh.timeMax - 5 + theTimeCorrectionEB);
0325 
0326       uncalibRecHit.setJitterError(
0327           std::sqrt(std::pow(crh.timeError, 2) + std::pow(EBtimeConstantTerm_, 2) / std::pow(clockToNsConstant, 2)));
0328       // consider flagging as kOutOfTime only if above noise
0329       if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEB_) {
0330         float outOfTimeThreshP = outOfTimeThreshG12pEB_;
0331         float outOfTimeThreshM = outOfTimeThreshG12mEB_;
0332         // determine if gain has switched away from gainId==1 (x12 gain)
0333         // and determine cuts (number of 'sigmas') to ose for kOutOfTime
0334         // >3k ADC is necessasry condition for gain switch to occur
0335         if (uncalibRecHit.amplitude() > 3000.) {
0336           for (int iSample = 0; iSample < EBDataFrame::MAXSAMPLES; iSample++) {
0337             int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
0338             if (GainId != 1) {
0339               outOfTimeThreshP = outOfTimeThreshG61pEB_;
0340               outOfTimeThreshM = outOfTimeThreshG61mEB_;
0341               break;
0342             }
0343           }
0344         }
0345         float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
0346         float cterm = EBtimeConstantTerm_;
0347         float sigmaped = pedRMSVec[0];  // approx for lower gains
0348         float nterm = EBtimeNconst_ * sigmaped / uncalibRecHit.amplitude();
0349         float sigmat = std::sqrt(nterm * nterm + cterm * cterm);
0350         if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < (-1. * sigmat * outOfTimeThreshM))) {
0351           uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kOutOfTime);
0352         }
0353       }
0354     }
0355 
0356     // === chi2express ===
0357     if (detid.subdetId() == EcalEndcap) {
0358       double amplitude = uncalibRecHit.amplitude();
0359       double amplitudeOutOfTime = 0.;
0360       double jitter = uncalibRecHit.jitter();
0361 
0362       EcalUncalibRecHitRecChi2Algo<EEDataFrame> chi2expressEE_(*itdg,
0363                                                                amplitude,
0364                                                                (itimeconst + offsetTime),
0365                                                                amplitudeOutOfTime,
0366                                                                jitter,
0367                                                                pedVec,
0368                                                                pedRMSVec,
0369                                                                gainRatios,
0370                                                                testbeamEEShape,
0371                                                                EEchi2Parameters_);
0372       double chi2 = chi2expressEE_.chi2();
0373       uncalibRecHit.setChi2(chi2);
0374 
0375       if (kPoorRecoFlagEE_) {
0376         if (chi2 > chi2ThreshEE_) {
0377           // first check if all samples are ok, if not don't use chi2 to flag
0378           bool samplesok = true;
0379           for (int sample = 0; sample < EcalDataFrame::MAXSAMPLES; ++sample) {
0380             if (!sampleMask_->useSampleEE(sample)) {
0381               samplesok = false;
0382               break;
0383             }
0384           }
0385           if (samplesok)
0386             uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kPoorReco);
0387         }
0388       }
0389 
0390     } else {
0391       double amplitude = uncalibRecHit.amplitude();
0392       double amplitudeOutOfTime = 0.;
0393       double jitter = uncalibRecHit.jitter();
0394 
0395       EcalUncalibRecHitRecChi2Algo<EBDataFrame> chi2expressEB_(*itdg,
0396                                                                amplitude,
0397                                                                (itimeconst + offsetTime),
0398                                                                amplitudeOutOfTime,
0399                                                                jitter,
0400                                                                pedVec,
0401                                                                pedRMSVec,
0402                                                                gainRatios,
0403                                                                testbeamEBShape,
0404                                                                EBchi2Parameters_);
0405       double chi2 = chi2expressEB_.chi2();
0406       uncalibRecHit.setChi2(chi2);
0407 
0408       if (kPoorRecoFlagEB_) {
0409         if (chi2 > chi2ThreshEB_) {
0410           // first check if all samples are ok, if not don't use chi2 to flag
0411           bool samplesok = true;
0412           for (int sample = 0; sample < EcalDataFrame::MAXSAMPLES; ++sample) {
0413             if (!sampleMask_->useSampleEB(sample)) {
0414               samplesok = false;
0415               break;
0416             }
0417           }
0418           if (samplesok)
0419             uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kPoorReco);
0420         }
0421       }
0422     }
0423   }
0424 
0425   // set flags if gain switch has occurred
0426   if (((EcalDataFrame)(*itdg)).hasSwitchToGain6())
0427     uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kHasSwitchToGain6);
0428   if (((EcalDataFrame)(*itdg)).hasSwitchToGain1())
0429     uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kHasSwitchToGain1);
0430 
0431   // put the recHit in the collection
0432   if (detid.subdetId() == EcalEndcap) {
0433     result.push_back(uncalibRecHit);
0434   } else {
0435     result.push_back(uncalibRecHit);
0436   }
0437 
0438   return true;
0439 }
0440 
0441 edm::ParameterSetDescription EcalUncalibRecHitWorkerGlobal::getAlgoDescription() {
0442   edm::ParameterSetDescription psd;
0443   psd.addNode(
0444       edm::ParameterDescription<std::vector<double>>(
0445           "eePulseShape", {5.2e-05, -5.26e-05, 6.66e-05, 0.1168, 0.7575, 1.0, 0.8876, 0.6732, 0.4741, 0.3194}, true) and
0446       edm::ParameterDescription<std::vector<double>>(
0447           "EBtimeFitParameters",
0448           {-2.015452, 3.130702, -12.3473, 41.88921, -82.83944, 91.01147, -50.35761, 11.05621},
0449           true) and
0450       edm::ParameterDescription<double>("outOfTimeThresholdGain61pEB", 5, true) and
0451       edm::ParameterDescription<double>("amplitudeThresholdEE", 10, true) and
0452       edm::ParameterDescription<double>("EBtimeConstantTerm", 0.6, true) and
0453       edm::ParameterDescription<double>("outOfTimeThresholdGain61pEE", 1000, true) and
0454       edm::ParameterDescription<double>("ebSpikeThreshold", 1.042, true) and
0455       edm::ParameterDescription<double>("EBtimeNconst", 28.5, true) and
0456       edm::ParameterDescription<bool>("kPoorRecoFlagEB", true, true) and
0457       edm::ParameterDescription<std::vector<double>>(
0458           "ebPulseShape", {5.2e-05, -5.26e-05, 6.66e-05, 0.1168, 0.7575, 1.0, 0.8876, 0.6732, 0.4741, 0.3194}, true) and
0459       edm::ParameterDescription<double>("EBtimeFitLimits_Lower", 0.2, true) and
0460       edm::ParameterDescription<bool>("kPoorRecoFlagEE", false, true) and
0461       edm::ParameterDescription<double>("chi2ThreshEB_", 36.0, true) and
0462       edm::ParameterDescription<std::vector<double>>(
0463           "EEtimeFitParameters",
0464           {-2.390548, 3.553628, -17.62341, 67.67538, -133.213, 140.7432, -75.41106, 16.20277},
0465           true) and
0466       edm::ParameterDescription<double>("outOfTimeThresholdGain61mEE", 1000, true) and
0467       edm::ParameterDescription<std::vector<double>>("EEchi2Parameters", {2.122, 0.022, 2.122, 0.022}, true) and
0468       edm::ParameterDescription<double>("outOfTimeThresholdGain12mEE", 1000, true) and
0469       edm::ParameterDescription<double>("outOfTimeThresholdGain12mEB", 5, true) and
0470       edm::ParameterDescription<double>("EEtimeFitLimits_Upper", 1.4, true) and
0471       edm::ParameterDescription<double>("EEtimeFitLimits_Lower", 0.2, true) and
0472       edm::ParameterDescription<std::vector<double>>("EEamplitudeFitParameters", {1.89, 1.4}, true) and
0473       edm::ParameterDescription<std::vector<double>>("EBamplitudeFitParameters", {1.138, 1.652}, true) and
0474       edm::ParameterDescription<double>("amplitudeThresholdEB", 10, true) and
0475       edm::ParameterDescription<double>("outOfTimeThresholdGain12pEE", 1000, true) and
0476       edm::ParameterDescription<double>("outOfTimeThresholdGain12pEB", 5, true) and
0477       edm::ParameterDescription<double>("EEtimeNconst", 31.8, true) and
0478       edm::ParameterDescription<double>("outOfTimeThresholdGain61mEB", 5, true) and
0479       edm::ParameterDescription<std::vector<double>>("EBchi2Parameters", {2.122, 0.022, 2.122, 0.022}, true) and
0480       edm::ParameterDescription<double>("EEtimeConstantTerm", 1.0, true) and
0481       edm::ParameterDescription<double>("chi2ThreshEE_", 95.0, true) and
0482       edm::ParameterDescription<double>("EBtimeFitLimits_Upper", 1.4, true));
0483 
0484   return psd;
0485 }
0486 
0487 #include "FWCore/Framework/interface/MakerMacros.h"
0488 #include "RecoLocalCalo/EcalRecProducers/interface/EcalUncalibRecHitWorkerFactory.h"
0489 DEFINE_EDM_PLUGIN(EcalUncalibRecHitWorkerFactory, EcalUncalibRecHitWorkerGlobal, "EcalUncalibRecHitWorkerGlobal");
0490 #include "RecoLocalCalo/EcalRecProducers/interface/EcalUncalibRecHitFillDescriptionWorkerFactory.h"
0491 DEFINE_EDM_PLUGIN(EcalUncalibRecHitFillDescriptionWorkerFactory,
0492                   EcalUncalibRecHitWorkerGlobal,
0493                   "EcalUncalibRecHitWorkerGlobal");