Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-01-13 23:40:02

0001 /** \class EcalUncalibRecHitRecGlobalAlgo
0002  *  Template used to compute amplitude, pedestal using a weights method
0003  *                           time using a ratio method
0004  *                           chi2 using express method
0005  *
0006  *  \author R. Bruneliere - A. Zabi
0007  */
0008 
0009 #include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h"
0010 #include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h"
0011 #include "CondFormats/DataRecord/interface/EcalPulseCovariancesRcd.h"
0012 #include "CondFormats/DataRecord/interface/EcalPulseShapesRcd.h"
0013 #include "CondFormats/DataRecord/interface/EcalSampleMaskRcd.h"
0014 #include "CondFormats/DataRecord/interface/EcalSamplesCorrelationRcd.h"
0015 #include "CondFormats/DataRecord/interface/EcalTBWeightsRcd.h"
0016 #include "CondFormats/DataRecord/interface/EcalTimeBiasCorrectionsRcd.h"
0017 #include "CondFormats/DataRecord/interface/EcalTimeCalibConstantsRcd.h"
0018 #include "CondFormats/DataRecord/interface/EcalTimeOffsetConstantRcd.h"
0019 #include "CondFormats/DataRecord/interface/EcalWeightXtalGroupsRcd.h"
0020 #include "CondFormats/EcalObjects/interface/EcalGainRatios.h"
0021 #include "CondFormats/EcalObjects/interface/EcalPedestals.h"
0022 #include "CondFormats/EcalObjects/interface/EcalPulseCovariances.h"
0023 #include "CondFormats/EcalObjects/interface/EcalPulseShapes.h"
0024 #include "CondFormats/EcalObjects/interface/EcalSampleMask.h"
0025 #include "CondFormats/EcalObjects/interface/EcalSamplesCorrelation.h"
0026 #include "CondFormats/EcalObjects/interface/EcalTBWeights.h"
0027 #include "CondFormats/EcalObjects/interface/EcalTimeBiasCorrections.h"
0028 #include "CondFormats/EcalObjects/interface/EcalTimeCalibConstants.h"
0029 #include "CondFormats/EcalObjects/interface/EcalTimeOffsetConstant.h"
0030 #include "CondFormats/EcalObjects/interface/EcalWeightXtalGroups.h"
0031 #include "FWCore/Framework/interface/ESHandle.h"
0032 #include "FWCore/Framework/interface/Event.h"
0033 #include "FWCore/Framework/interface/EventSetup.h"
0034 #include "FWCore/Framework/interface/Run.h"
0035 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0036 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0037 #include "FWCore/ParameterSet/interface/EmptyGroupDescription.h"
0038 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0039 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0040 #include "FWCore/Utilities/interface/ESGetToken.h"
0041 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitMultiFitAlgo.h"
0042 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitRatioMethodAlgo.h"
0043 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitRecChi2Algo.h"
0044 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitTimeWeightsAlgo.h"
0045 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitTimingCCAlgo.h"
0046 #include "RecoLocalCalo/EcalRecAlgos/interface/EigenMatrixTypes.h"
0047 #include "RecoLocalCalo/EcalRecProducers/interface/EcalUncalibRecHitWorkerBaseClass.h"
0048 
0049 class EcalUncalibRecHitWorkerMultiFit final : public EcalUncalibRecHitWorkerBaseClass {
0050 public:
0051   EcalUncalibRecHitWorkerMultiFit(const edm::ParameterSet&, edm::ConsumesCollector& c);
0052   EcalUncalibRecHitWorkerMultiFit(){};
0053 
0054 private:
0055   void set(const edm::EventSetup& es) override;
0056   void set(const edm::Event& evt) override;
0057   void run(const edm::Event& evt, const EcalDigiCollection& digis, EcalUncalibratedRecHitCollection& result) override;
0058 
0059 public:
0060   edm::ParameterSetDescription getAlgoDescription() override;
0061 
0062 private:
0063   edm::ESHandle<EcalPedestals> peds;
0064   edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> pedsToken_;
0065   edm::ESHandle<EcalGainRatios> gains;
0066   edm::ESGetToken<EcalGainRatios, EcalGainRatiosRcd> gainsToken_;
0067   edm::ESHandle<EcalSamplesCorrelation> noisecovariances;
0068   edm::ESGetToken<EcalSamplesCorrelation, EcalSamplesCorrelationRcd> noiseConvariancesToken_;
0069   edm::ESHandle<EcalPulseShapes> pulseshapes;
0070   edm::ESGetToken<EcalPulseShapes, EcalPulseShapesRcd> pulseShapesToken_;
0071   edm::ESHandle<EcalPulseCovariances> pulsecovariances;
0072   edm::ESGetToken<EcalPulseCovariances, EcalPulseCovariancesRcd> pulseConvariancesToken_;
0073 
0074   double timeCorrection(float ampli, const std::vector<float>& amplitudeBins, const std::vector<float>& shiftBins);
0075 
0076   const SampleMatrix& noisecor(bool barrel, int gain) const { return noisecors_[barrel ? 1 : 0][gain]; }
0077   const SampleMatrixGainArray& noisecor(bool barrel) const { return noisecors_[barrel ? 1 : 0]; }
0078 
0079   // multifit method
0080   std::array<SampleMatrixGainArray, 2> noisecors_;
0081   BXVector activeBX;
0082   bool ampErrorCalculation_;
0083   bool useLumiInfoRunHeader_;
0084   EcalUncalibRecHitMultiFitAlgo multiFitMethod_;
0085 
0086   int bunchSpacingManual_;
0087   edm::EDGetTokenT<unsigned int> bunchSpacing_;
0088 
0089   // determine which of the samples must actually be used by ECAL local reco
0090   edm::ESHandle<EcalSampleMask> sampleMaskHand_;
0091   edm::ESGetToken<EcalSampleMask, EcalSampleMaskRcd> sampleMaskToken_;
0092 
0093   // time algorithm to be used to set the jitter and its uncertainty
0094   enum TimeAlgo { noMethod, ratioMethod, weightsMethod, crossCorrelationMethod };
0095   TimeAlgo timealgo_ = noMethod;
0096 
0097   // time weights method
0098   edm::ESHandle<EcalWeightXtalGroups> grps;
0099   edm::ESGetToken<EcalWeightXtalGroups, EcalWeightXtalGroupsRcd> grpsToken_;
0100   edm::ESHandle<EcalTBWeights> wgts;
0101   edm::ESGetToken<EcalTBWeights, EcalTBWeightsRcd> wgtsToken_;
0102   const EcalWeightSet::EcalWeightMatrix* weights[2];
0103   EcalUncalibRecHitTimeWeightsAlgo<EBDataFrame> weightsMethod_barrel_;
0104   EcalUncalibRecHitTimeWeightsAlgo<EEDataFrame> weightsMethod_endcap_;
0105   bool doPrefitEB_;
0106   bool doPrefitEE_;
0107   double prefitMaxChiSqEB_;
0108   double prefitMaxChiSqEE_;
0109   bool dynamicPedestalsEB_;
0110   bool dynamicPedestalsEE_;
0111   bool mitigateBadSamplesEB_;
0112   bool mitigateBadSamplesEE_;
0113   bool gainSwitchUseMaxSampleEB_;
0114   bool gainSwitchUseMaxSampleEE_;
0115   bool selectiveBadSampleCriteriaEB_;
0116   bool selectiveBadSampleCriteriaEE_;
0117   double addPedestalUncertaintyEB_;
0118   double addPedestalUncertaintyEE_;
0119   bool simplifiedNoiseModelForGainSwitch_;
0120 
0121   // ratio method
0122   std::vector<double> EBtimeFitParameters_;
0123   std::vector<double> EEtimeFitParameters_;
0124   std::vector<double> EBamplitudeFitParameters_;
0125   std::vector<double> EEamplitudeFitParameters_;
0126   std::pair<double, double> EBtimeFitLimits_;
0127   std::pair<double, double> EEtimeFitLimits_;
0128 
0129   EcalUncalibRecHitRatioMethodAlgo<EBDataFrame> ratioMethod_barrel_;
0130   EcalUncalibRecHitRatioMethodAlgo<EEDataFrame> ratioMethod_endcap_;
0131 
0132   double EBtimeConstantTerm_;
0133   double EEtimeConstantTerm_;
0134   double EBtimeNconst_;
0135   double EEtimeNconst_;
0136   double outOfTimeThreshG12pEB_;
0137   double outOfTimeThreshG12mEB_;
0138   double outOfTimeThreshG61pEB_;
0139   double outOfTimeThreshG61mEB_;
0140   double outOfTimeThreshG12pEE_;
0141   double outOfTimeThreshG12mEE_;
0142   double outOfTimeThreshG61pEE_;
0143   double outOfTimeThreshG61mEE_;
0144   double amplitudeThreshEB_;
0145   double amplitudeThreshEE_;
0146   double ebSpikeThresh_;
0147 
0148   edm::ESHandle<EcalTimeBiasCorrections> timeCorrBias_;
0149   edm::ESGetToken<EcalTimeBiasCorrections, EcalTimeBiasCorrectionsRcd> timeCorrBiasToken_;
0150 
0151   edm::ESHandle<EcalTimeCalibConstants> itime;
0152   edm::ESGetToken<EcalTimeCalibConstants, EcalTimeCalibConstantsRcd> itimeToken_;
0153   edm::ESHandle<EcalTimeOffsetConstant> offtime;
0154   edm::ESGetToken<EcalTimeOffsetConstant, EcalTimeOffsetConstantRcd> offtimeToken_;
0155   std::vector<double> ebPulseShape_;
0156   std::vector<double> eePulseShape_;
0157 
0158   // chi2 thresholds for flags settings
0159   bool kPoorRecoFlagEB_;
0160   bool kPoorRecoFlagEE_;
0161   double chi2ThreshEB_;
0162   double chi2ThreshEE_;
0163 
0164   //Timing Cross Correlation Algo
0165   std::unique_ptr<EcalUncalibRecHitTimingCCAlgo> computeCC_;
0166   double CCminTimeToBeLateMin_;
0167   double CCminTimeToBeLateMax_;
0168   double CCTimeShiftWrtRations_;
0169   double CCtargetTimePrecision_;
0170   double CCtargetTimePrecisionForDelayedPulses_;
0171 };
0172 
0173 EcalUncalibRecHitWorkerMultiFit::EcalUncalibRecHitWorkerMultiFit(const edm::ParameterSet& ps, edm::ConsumesCollector& c)
0174     : EcalUncalibRecHitWorkerBaseClass(ps, c) {
0175   // get the BX for the pulses to be activated
0176   std::vector<int32_t> activeBXs = ps.getParameter<std::vector<int32_t>>("activeBXs");
0177   activeBX.resize(activeBXs.size());
0178   for (unsigned int ibx = 0; ibx < activeBXs.size(); ++ibx) {
0179     activeBX.coeffRef(ibx) = activeBXs[ibx];
0180   }
0181 
0182   // uncertainty calculation (CPU intensive)
0183   ampErrorCalculation_ = ps.getParameter<bool>("ampErrorCalculation");
0184   useLumiInfoRunHeader_ = ps.getParameter<bool>("useLumiInfoRunHeader");
0185 
0186   if (useLumiInfoRunHeader_) {
0187     bunchSpacing_ = c.consumes<unsigned int>(edm::InputTag("bunchSpacingProducer"));
0188     bunchSpacingManual_ = 0;
0189   } else {
0190     bunchSpacingManual_ = ps.getParameter<int>("bunchSpacing");
0191   }
0192 
0193   doPrefitEB_ = ps.getParameter<bool>("doPrefitEB");
0194   doPrefitEE_ = ps.getParameter<bool>("doPrefitEE");
0195 
0196   prefitMaxChiSqEB_ = ps.getParameter<double>("prefitMaxChiSqEB");
0197   prefitMaxChiSqEE_ = ps.getParameter<double>("prefitMaxChiSqEE");
0198 
0199   dynamicPedestalsEB_ = ps.getParameter<bool>("dynamicPedestalsEB");
0200   dynamicPedestalsEE_ = ps.getParameter<bool>("dynamicPedestalsEE");
0201   mitigateBadSamplesEB_ = ps.getParameter<bool>("mitigateBadSamplesEB");
0202   mitigateBadSamplesEE_ = ps.getParameter<bool>("mitigateBadSamplesEE");
0203   gainSwitchUseMaxSampleEB_ = ps.getParameter<bool>("gainSwitchUseMaxSampleEB");
0204   gainSwitchUseMaxSampleEE_ = ps.getParameter<bool>("gainSwitchUseMaxSampleEE");
0205   selectiveBadSampleCriteriaEB_ = ps.getParameter<bool>("selectiveBadSampleCriteriaEB");
0206   selectiveBadSampleCriteriaEE_ = ps.getParameter<bool>("selectiveBadSampleCriteriaEE");
0207   addPedestalUncertaintyEB_ = ps.getParameter<double>("addPedestalUncertaintyEB");
0208   addPedestalUncertaintyEE_ = ps.getParameter<double>("addPedestalUncertaintyEE");
0209   simplifiedNoiseModelForGainSwitch_ = ps.getParameter<bool>("simplifiedNoiseModelForGainSwitch");
0210   pedsToken_ = c.esConsumes<EcalPedestals, EcalPedestalsRcd>();
0211   gainsToken_ = c.esConsumes<EcalGainRatios, EcalGainRatiosRcd>();
0212   noiseConvariancesToken_ = c.esConsumes<EcalSamplesCorrelation, EcalSamplesCorrelationRcd>();
0213   pulseShapesToken_ = c.esConsumes<EcalPulseShapes, EcalPulseShapesRcd>();
0214   pulseConvariancesToken_ = c.esConsumes<EcalPulseCovariances, EcalPulseCovariancesRcd>();
0215   sampleMaskToken_ = c.esConsumes<EcalSampleMask, EcalSampleMaskRcd>();
0216   grpsToken_ = c.esConsumes<EcalWeightXtalGroups, EcalWeightXtalGroupsRcd>();
0217   wgtsToken_ = c.esConsumes<EcalTBWeights, EcalTBWeightsRcd>();
0218   timeCorrBiasToken_ = c.esConsumes<EcalTimeBiasCorrections, EcalTimeBiasCorrectionsRcd>();
0219   itimeToken_ = c.esConsumes<EcalTimeCalibConstants, EcalTimeCalibConstantsRcd>();
0220   offtimeToken_ = c.esConsumes<EcalTimeOffsetConstant, EcalTimeOffsetConstantRcd>();
0221 
0222   // algorithm to be used for timing
0223   auto const& timeAlgoName = ps.getParameter<std::string>("timealgo");
0224   if (timeAlgoName == "RatioMethod")
0225     timealgo_ = ratioMethod;
0226   else if (timeAlgoName == "WeightsMethod")
0227     timealgo_ = weightsMethod;
0228   else if (timeAlgoName == "crossCorrelationMethod") {
0229     timealgo_ = crossCorrelationMethod;
0230     double startTime = ps.getParameter<double>("crossCorrelationStartTime");
0231     double stopTime = ps.getParameter<double>("crossCorrelationStopTime");
0232     CCtargetTimePrecision_ = ps.getParameter<double>("crossCorrelationTargetTimePrecision");
0233     CCtargetTimePrecisionForDelayedPulses_ =
0234         ps.getParameter<double>("crossCorrelationTargetTimePrecisionForDelayedPulses");
0235     CCminTimeToBeLateMin_ = ps.getParameter<double>("crossCorrelationMinTimeToBeLateMin") / ecalPh1::Samp_Period;
0236     CCminTimeToBeLateMax_ = ps.getParameter<double>("crossCorrelationMinTimeToBeLateMax") / ecalPh1::Samp_Period;
0237     CCTimeShiftWrtRations_ = ps.getParameter<double>("crossCorrelationTimeShiftWrtRations");
0238     computeCC_ = std::make_unique<EcalUncalibRecHitTimingCCAlgo>(startTime, stopTime);
0239   } else if (timeAlgoName != "None")
0240     edm::LogError("EcalUncalibRecHitError") << "No time estimation algorithm defined";
0241 
0242   // ratio method parameters
0243   EBtimeFitParameters_ = ps.getParameter<std::vector<double>>("EBtimeFitParameters");
0244   EEtimeFitParameters_ = ps.getParameter<std::vector<double>>("EEtimeFitParameters");
0245   EBamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EBamplitudeFitParameters");
0246   EEamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EEamplitudeFitParameters");
0247   EBtimeFitLimits_.first = ps.getParameter<double>("EBtimeFitLimits_Lower");
0248   EBtimeFitLimits_.second = ps.getParameter<double>("EBtimeFitLimits_Upper");
0249   EEtimeFitLimits_.first = ps.getParameter<double>("EEtimeFitLimits_Lower");
0250   EEtimeFitLimits_.second = ps.getParameter<double>("EEtimeFitLimits_Upper");
0251   EBtimeConstantTerm_ = ps.getParameter<double>("EBtimeConstantTerm");
0252   EEtimeConstantTerm_ = ps.getParameter<double>("EEtimeConstantTerm");
0253   EBtimeNconst_ = ps.getParameter<double>("EBtimeNconst");
0254   EEtimeNconst_ = ps.getParameter<double>("EEtimeNconst");
0255   outOfTimeThreshG12pEB_ = ps.getParameter<double>("outOfTimeThresholdGain12pEB");
0256   outOfTimeThreshG12mEB_ = ps.getParameter<double>("outOfTimeThresholdGain12mEB");
0257   outOfTimeThreshG61pEB_ = ps.getParameter<double>("outOfTimeThresholdGain61pEB");
0258   outOfTimeThreshG61mEB_ = ps.getParameter<double>("outOfTimeThresholdGain61mEB");
0259   outOfTimeThreshG12pEE_ = ps.getParameter<double>("outOfTimeThresholdGain12pEE");
0260   outOfTimeThreshG12mEE_ = ps.getParameter<double>("outOfTimeThresholdGain12mEE");
0261   outOfTimeThreshG61pEE_ = ps.getParameter<double>("outOfTimeThresholdGain61pEE");
0262   outOfTimeThreshG61mEE_ = ps.getParameter<double>("outOfTimeThresholdGain61mEE");
0263   amplitudeThreshEB_ = ps.getParameter<double>("amplitudeThresholdEB");
0264   amplitudeThreshEE_ = ps.getParameter<double>("amplitudeThresholdEE");
0265 }
0266 
0267 void EcalUncalibRecHitWorkerMultiFit::set(const edm::EventSetup& es) {
0268   // common setup
0269   gains = es.getHandle(gainsToken_);
0270   peds = es.getHandle(pedsToken_);
0271 
0272   // for the multifit method
0273   if (!ampErrorCalculation_)
0274     multiFitMethod_.disableErrorCalculation();
0275   noisecovariances = es.getHandle(noiseConvariancesToken_);
0276   pulseshapes = es.getHandle(pulseShapesToken_);
0277   pulsecovariances = es.getHandle(pulseConvariancesToken_);
0278 
0279   // weights parameters for the time
0280   grps = es.getHandle(grpsToken_);
0281   wgts = es.getHandle(wgtsToken_);
0282 
0283   // which of the samples need be used
0284   sampleMaskHand_ = es.getHandle(sampleMaskToken_);
0285 
0286   // for the ratio method
0287   itime = es.getHandle(itimeToken_);
0288   offtime = es.getHandle(offtimeToken_);
0289 
0290   // for the time correction methods
0291   timeCorrBias_ = es.getHandle(timeCorrBiasToken_);
0292 
0293   int nnoise = SampleVector::RowsAtCompileTime;
0294   SampleMatrix& noisecorEBg12 = noisecors_[1][0];
0295   SampleMatrix& noisecorEBg6 = noisecors_[1][1];
0296   SampleMatrix& noisecorEBg1 = noisecors_[1][2];
0297   SampleMatrix& noisecorEEg12 = noisecors_[0][0];
0298   SampleMatrix& noisecorEEg6 = noisecors_[0][1];
0299   SampleMatrix& noisecorEEg1 = noisecors_[0][2];
0300 
0301   for (int i = 0; i < nnoise; ++i) {
0302     for (int j = 0; j < nnoise; ++j) {
0303       int vidx = std::abs(j - i);
0304       noisecorEBg12(i, j) = noisecovariances->EBG12SamplesCorrelation[vidx];
0305       noisecorEEg12(i, j) = noisecovariances->EEG12SamplesCorrelation[vidx];
0306       noisecorEBg6(i, j) = noisecovariances->EBG6SamplesCorrelation[vidx];
0307       noisecorEEg6(i, j) = noisecovariances->EEG6SamplesCorrelation[vidx];
0308       noisecorEBg1(i, j) = noisecovariances->EBG1SamplesCorrelation[vidx];
0309       noisecorEEg1(i, j) = noisecovariances->EEG1SamplesCorrelation[vidx];
0310     }
0311   }
0312 }
0313 
0314 void EcalUncalibRecHitWorkerMultiFit::set(const edm::Event& evt) {
0315   unsigned int bunchspacing = 450;
0316 
0317   if (useLumiInfoRunHeader_) {
0318     edm::Handle<unsigned int> bunchSpacingH;
0319     evt.getByToken(bunchSpacing_, bunchSpacingH);
0320     bunchspacing = *bunchSpacingH;
0321   } else {
0322     bunchspacing = bunchSpacingManual_;
0323   }
0324 
0325   if (useLumiInfoRunHeader_ || bunchSpacingManual_ > 0) {
0326     if (bunchspacing == 25) {
0327       activeBX.resize(10);
0328       activeBX << -5, -4, -3, -2, -1, 0, 1, 2, 3, 4;
0329     } else {
0330       //50ns configuration otherwise (also for no pileup)
0331       activeBX.resize(5);
0332       activeBX << -4, -2, 0, 2, 4;
0333     }
0334   }
0335 }
0336 
0337 /**
0338  * Amplitude-dependent time corrections; EE and EB have separate corrections:
0339  * EXtimeCorrAmplitudes (ADC) and EXtimeCorrShifts (ns) need to have the same number of elements
0340  * Bins must be ordered in amplitude. First-last bins take care of under-overflows.
0341  *
0342  * The algorithm is the same for EE and EB, only the correction vectors are different.
0343  *
0344  * @return Jitter (in clock cycles) which will be added to UncalibRechit.setJitter(), 0 if no correction is applied.
0345  */
0346 double EcalUncalibRecHitWorkerMultiFit::timeCorrection(float ampli,
0347                                                        const std::vector<float>& amplitudeBins,
0348                                                        const std::vector<float>& shiftBins) {
0349   // computed initially in ns. Than turned in the BX's, as
0350   // EcalUncalibratedRecHit need be.
0351   double theCorrection = 0;
0352 
0353   // sanity check for arrays
0354   if (amplitudeBins.empty()) {
0355     edm::LogError("EcalRecHitError") << "timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
0356 
0357     return 0;
0358   }
0359 
0360   if (amplitudeBins.size() != shiftBins.size()) {
0361     edm::LogError("EcalRecHitError") << "Size of timeCorrAmplitudeBins different from "
0362                                         "timeCorrShiftBins. Forcing no time bias corrections. ";
0363 
0364     return 0;
0365   }
0366 
0367   // FIXME? what about a binary search?
0368   int myBin = -1;
0369   for (int bin = 0; bin < (int)amplitudeBins.size(); bin++) {
0370     if (ampli > amplitudeBins[bin]) {
0371       myBin = bin;
0372     } else {
0373       break;
0374     }
0375   }
0376 
0377   if (myBin == -1) {
0378     theCorrection = shiftBins[0];
0379   } else if (myBin == ((int)(amplitudeBins.size() - 1))) {
0380     theCorrection = shiftBins[myBin];
0381   } else {
0382     // interpolate linearly between two assingned points
0383     theCorrection = (shiftBins[myBin + 1] - shiftBins[myBin]);
0384     theCorrection *= (((double)ampli) - amplitudeBins[myBin]) / (amplitudeBins[myBin + 1] - amplitudeBins[myBin]);
0385     theCorrection += shiftBins[myBin];
0386   }
0387 
0388   // convert ns into clocks
0389   constexpr double inv25 = 1. / 25.;
0390   return theCorrection * inv25;
0391 }
0392 
0393 void EcalUncalibRecHitWorkerMultiFit::run(const edm::Event& evt,
0394                                           const EcalDigiCollection& digis,
0395                                           EcalUncalibratedRecHitCollection& result) {
0396   if (digis.empty())
0397     return;
0398 
0399   // assume all digis come from the same subdetector (either barrel or endcap)
0400   DetId detid(digis.begin()->id());
0401   bool barrel = (detid.subdetId() == EcalBarrel);
0402 
0403   multiFitMethod_.setSimplifiedNoiseModelForGainSwitch(simplifiedNoiseModelForGainSwitch_);
0404   if (barrel) {
0405     multiFitMethod_.setDoPrefit(doPrefitEB_);
0406     multiFitMethod_.setPrefitMaxChiSq(prefitMaxChiSqEB_);
0407     multiFitMethod_.setDynamicPedestals(dynamicPedestalsEB_);
0408     multiFitMethod_.setMitigateBadSamples(mitigateBadSamplesEB_);
0409     multiFitMethod_.setGainSwitchUseMaxSample(gainSwitchUseMaxSampleEB_);
0410     multiFitMethod_.setSelectiveBadSampleCriteria(selectiveBadSampleCriteriaEB_);
0411     multiFitMethod_.setAddPedestalUncertainty(addPedestalUncertaintyEB_);
0412   } else {
0413     multiFitMethod_.setDoPrefit(doPrefitEE_);
0414     multiFitMethod_.setPrefitMaxChiSq(prefitMaxChiSqEE_);
0415     multiFitMethod_.setDynamicPedestals(dynamicPedestalsEE_);
0416     multiFitMethod_.setMitigateBadSamples(mitigateBadSamplesEE_);
0417     multiFitMethod_.setGainSwitchUseMaxSample(gainSwitchUseMaxSampleEE_);
0418     multiFitMethod_.setSelectiveBadSampleCriteria(selectiveBadSampleCriteriaEE_);
0419     multiFitMethod_.setAddPedestalUncertainty(addPedestalUncertaintyEE_);
0420   }
0421 
0422   FullSampleVector fullpulse(FullSampleVector::Zero());
0423   FullSampleMatrix fullpulsecov(FullSampleMatrix::Zero());
0424 
0425   result.reserve(result.size() + digis.size());
0426   for (auto itdg = digis.begin(); itdg != digis.end(); ++itdg) {
0427     DetId detid(itdg->id());
0428 
0429     const EcalSampleMask* sampleMask_ = sampleMaskHand_.product();
0430 
0431     // intelligence for recHit computation
0432     float offsetTime = 0;
0433 
0434     const EcalPedestals::Item* aped = nullptr;
0435     const EcalMGPAGainRatio* aGain = nullptr;
0436     const EcalXtalGroupId* gid = nullptr;
0437     const EcalPulseShapes::Item* aPulse = nullptr;
0438     const EcalPulseCovariances::Item* aPulseCov = nullptr;
0439 
0440     if (barrel) {
0441       unsigned int hashedIndex = EBDetId(detid).hashedIndex();
0442       aped = &peds->barrel(hashedIndex);
0443       aGain = &gains->barrel(hashedIndex);
0444       gid = &grps->barrel(hashedIndex);
0445       aPulse = &pulseshapes->barrel(hashedIndex);
0446       aPulseCov = &pulsecovariances->barrel(hashedIndex);
0447       offsetTime = offtime->getEBValue();
0448     } else {
0449       unsigned int hashedIndex = EEDetId(detid).hashedIndex();
0450       aped = &peds->endcap(hashedIndex);
0451       aGain = &gains->endcap(hashedIndex);
0452       gid = &grps->endcap(hashedIndex);
0453       aPulse = &pulseshapes->endcap(hashedIndex);
0454       aPulseCov = &pulsecovariances->endcap(hashedIndex);
0455       offsetTime = offtime->getEEValue();
0456     }
0457 
0458     double pedVec[3] = {aped->mean_x12, aped->mean_x6, aped->mean_x1};
0459     double pedRMSVec[3] = {aped->rms_x12, aped->rms_x6, aped->rms_x1};
0460     double gainRatios[3] = {1., aGain->gain12Over6(), aGain->gain6Over1() * aGain->gain12Over6()};
0461 
0462     for (int i = 0; i < EcalPulseShape::TEMPLATESAMPLES; ++i)
0463       fullpulse(i + 7) = aPulse->pdfval[i];
0464 
0465     for (int i = 0; i < EcalPulseShape::TEMPLATESAMPLES; i++)
0466       for (int j = 0; j < EcalPulseShape::TEMPLATESAMPLES; j++)
0467         fullpulsecov(i + 7, j + 7) = aPulseCov->covval[i][j];
0468 
0469     // compute the right bin of the pulse shape using time calibration constants
0470     EcalTimeCalibConstantMap::const_iterator it = itime->find(detid);
0471     EcalTimeCalibConstant itimeconst = 0;
0472     if (it != itime->end()) {
0473       itimeconst = (*it);
0474     } else {
0475       edm::LogError("EcalRecHitError") << "No time intercalib const found for xtal " << detid.rawId()
0476                                        << "! something wrong with EcalTimeCalibConstants in your DB? ";
0477     }
0478 
0479     int lastSampleBeforeSaturation = -2;
0480     for (unsigned int iSample = 0; iSample < EcalDataFrame::MAXSAMPLES; iSample++) {
0481       if (((EcalDataFrame)(*itdg)).sample(iSample).gainId() == 0) {
0482         lastSampleBeforeSaturation = iSample - 1;
0483         break;
0484       }
0485     }
0486 
0487     // === amplitude computation ===
0488 
0489     if (lastSampleBeforeSaturation == 4) {  // saturation on the expected max sample
0490       result.emplace_back((*itdg).id(), 4095 * 12, 0, 0, 0);
0491       auto& uncalibRecHit = result.back();
0492       uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kSaturated);
0493       // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation
0494       uncalibRecHit.setChi2(0);
0495     } else if (lastSampleBeforeSaturation >=
0496                -1) {  // saturation on other samples: cannot extrapolate from the fourth one
0497       int gainId = ((EcalDataFrame)(*itdg)).sample(5).gainId();
0498       if (gainId == 0)
0499         gainId = 3;
0500       auto pedestal = pedVec[gainId - 1];
0501       auto gainratio = gainRatios[gainId - 1];
0502       double amplitude = ((double)(((EcalDataFrame)(*itdg)).sample(5).adc()) - pedestal) * gainratio;
0503       result.emplace_back((*itdg).id(), amplitude, 0, 0, 0);
0504       auto& uncalibRecHit = result.back();
0505       uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kSaturated);
0506       // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation
0507       uncalibRecHit.setChi2(0);
0508     } else {
0509       // multifit
0510       const SampleMatrixGainArray& noisecors = noisecor(barrel);
0511 
0512       result.push_back(multiFitMethod_.makeRecHit(*itdg, aped, aGain, noisecors, fullpulse, fullpulsecov, activeBX));
0513       auto& uncalibRecHit = result.back();
0514 
0515       // === time computation ===
0516       if (timealgo_ == ratioMethod) {
0517         // ratio method
0518         constexpr float clockToNsConstant = 25.;
0519         constexpr float invClockToNs = 1. / clockToNsConstant;
0520         if (not barrel) {
0521           ratioMethod_endcap_.init(*itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios);
0522           ratioMethod_endcap_.computeTime(EEtimeFitParameters_, EEtimeFitLimits_, EEamplitudeFitParameters_);
0523           ratioMethod_endcap_.computeAmplitude(EEamplitudeFitParameters_);
0524           EcalUncalibRecHitRatioMethodAlgo<EEDataFrame>::CalculatedRecHit crh =
0525               ratioMethod_endcap_.getCalculatedRecHit();
0526           double theTimeCorrectionEE = timeCorrection(
0527               uncalibRecHit.amplitude(), timeCorrBias_->EETimeCorrAmplitudeBins, timeCorrBias_->EETimeCorrShiftBins);
0528 
0529           uncalibRecHit.setJitter(crh.timeMax - 5 + theTimeCorrectionEE);
0530           uncalibRecHit.setJitterError(
0531               std::sqrt(std::pow(crh.timeError, 2) + std::pow(EEtimeConstantTerm_ * invClockToNs, 2)));
0532 
0533           // consider flagging as kOutOfTime only if above noise
0534           if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEE_) {
0535             float outOfTimeThreshP = outOfTimeThreshG12pEE_;
0536             float outOfTimeThreshM = outOfTimeThreshG12mEE_;
0537             // determine if gain has switched away from gainId==1 (x12 gain)
0538             // and determine cuts (number of 'sigmas') to ose for kOutOfTime
0539             // >3k ADC is necessasry condition for gain switch to occur
0540             if (uncalibRecHit.amplitude() > 3000.) {
0541               for (int iSample = 0; iSample < EEDataFrame::MAXSAMPLES; iSample++) {
0542                 int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
0543                 if (GainId != 1) {
0544                   outOfTimeThreshP = outOfTimeThreshG61pEE_;
0545                   outOfTimeThreshM = outOfTimeThreshG61mEE_;
0546                   break;
0547                 }
0548               }
0549             }
0550             float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
0551             float cterm = EEtimeConstantTerm_;
0552             float sigmaped = pedRMSVec[0];  // approx for lower gains
0553             float nterm = EEtimeNconst_ * sigmaped / uncalibRecHit.amplitude();
0554             float sigmat = std::sqrt(nterm * nterm + cterm * cterm);
0555             if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < -sigmat * outOfTimeThreshM)) {
0556               uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kOutOfTime);
0557             }
0558           }
0559 
0560         } else {
0561           ratioMethod_barrel_.init(*itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios);
0562           ratioMethod_barrel_.fixMGPAslew(*itdg);
0563           ratioMethod_barrel_.computeTime(EBtimeFitParameters_, EBtimeFitLimits_, EBamplitudeFitParameters_);
0564           ratioMethod_barrel_.computeAmplitude(EBamplitudeFitParameters_);
0565           EcalUncalibRecHitRatioMethodAlgo<EBDataFrame>::CalculatedRecHit crh =
0566               ratioMethod_barrel_.getCalculatedRecHit();
0567 
0568           double theTimeCorrectionEB = timeCorrection(
0569               uncalibRecHit.amplitude(), timeCorrBias_->EBTimeCorrAmplitudeBins, timeCorrBias_->EBTimeCorrShiftBins);
0570 
0571           uncalibRecHit.setJitter(crh.timeMax - 5 + theTimeCorrectionEB);
0572           uncalibRecHit.setJitterError(std::hypot(crh.timeError, EBtimeConstantTerm_ / clockToNsConstant));
0573 
0574           // consider flagging as kOutOfTime only if above noise
0575           if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEB_) {
0576             float outOfTimeThreshP = outOfTimeThreshG12pEB_;
0577             float outOfTimeThreshM = outOfTimeThreshG12mEB_;
0578             // determine if gain has switched away from gainId==1 (x12 gain)
0579             // and determine cuts (number of 'sigmas') to ose for kOutOfTime
0580             // >3k ADC is necessasry condition for gain switch to occur
0581             if (uncalibRecHit.amplitude() > 3000.) {
0582               for (int iSample = 0; iSample < EBDataFrame::MAXSAMPLES; iSample++) {
0583                 int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
0584                 if (GainId != 1) {
0585                   outOfTimeThreshP = outOfTimeThreshG61pEB_;
0586                   outOfTimeThreshM = outOfTimeThreshG61mEB_;
0587                   break;
0588                 }
0589               }
0590             }
0591             float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
0592             float cterm = EBtimeConstantTerm_;
0593             float sigmaped = pedRMSVec[0];  // approx for lower gains
0594             float nterm = EBtimeNconst_ * sigmaped / uncalibRecHit.amplitude();
0595             float sigmat = std::sqrt(nterm * nterm + cterm * cterm);
0596             if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < -sigmat * outOfTimeThreshM)) {
0597               uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kOutOfTime);
0598             }
0599           }
0600         }
0601       } else if (timealgo_ == weightsMethod) {
0602         //  weights method on the PU subtracted pulse shape
0603         std::vector<double> amplitudes;
0604         for (unsigned int ibx = 0; ibx < activeBX.size(); ++ibx)
0605           amplitudes.push_back(uncalibRecHit.outOfTimeAmplitude(ibx));
0606 
0607         EcalTBWeights::EcalTDCId tdcid(1);
0608         EcalTBWeights::EcalTBWeightMap const& wgtsMap = wgts->getMap();
0609         EcalTBWeights::EcalTBWeightMap::const_iterator wit;
0610         wit = wgtsMap.find(std::make_pair(*gid, tdcid));
0611         if (wit == wgtsMap.end()) {
0612           edm::LogError("EcalUncalibRecHitError")
0613               << "No weights found for EcalGroupId: " << gid->id() << " and  EcalTDCId: " << tdcid
0614               << "\n  skipping digi with id: " << detid.rawId();
0615           result.pop_back();
0616           continue;
0617         }
0618         const EcalWeightSet& wset = wit->second;  // this is the EcalWeightSet
0619 
0620         const EcalWeightSet::EcalWeightMatrix& mat1 = wset.getWeightsBeforeGainSwitch();
0621         const EcalWeightSet::EcalWeightMatrix& mat2 = wset.getWeightsAfterGainSwitch();
0622 
0623         weights[0] = &mat1;
0624         weights[1] = &mat2;
0625 
0626         double timerh;
0627         if (detid.subdetId() == EcalEndcap) {
0628           timerh = weightsMethod_endcap_.time(*itdg, amplitudes, aped, aGain, fullpulse, weights);
0629         } else {
0630           timerh = weightsMethod_barrel_.time(*itdg, amplitudes, aped, aGain, fullpulse, weights);
0631         }
0632         uncalibRecHit.setJitter(timerh);
0633         uncalibRecHit.setJitterError(0.);  // not computed with weights
0634 
0635       } else if (timealgo_ == crossCorrelationMethod) {
0636         std::vector<double> amplitudes(activeBX.size());
0637         for (unsigned int ibx = 0; ibx < activeBX.size(); ++ibx)
0638           amplitudes[ibx] = uncalibRecHit.outOfTimeAmplitude(ibx);
0639 
0640         float jitterError = 0.;
0641         float jitter =
0642             computeCC_->computeTimeCC(
0643                 *itdg, amplitudes, aped, aGain, fullpulse, uncalibRecHit, jitterError, CCtargetTimePrecision_, true) +
0644             CCTimeShiftWrtRations_ / ecalPh1::Samp_Period;
0645         float noCorrectedJitter = computeCC_->computeTimeCC(*itdg,
0646                                                             amplitudes,
0647                                                             aped,
0648                                                             aGain,
0649                                                             fullpulse,
0650                                                             uncalibRecHit,
0651                                                             jitterError,
0652                                                             CCtargetTimePrecisionForDelayedPulses_,
0653                                                             false) +
0654                                   CCTimeShiftWrtRations_ / ecalPh1::Samp_Period;
0655 
0656         uncalibRecHit.setJitter(jitter);
0657         uncalibRecHit.setJitterError(jitterError);
0658 
0659         // consider flagging as kOutOfTime only if above noise
0660         float threshold, cterm, timeNconst;
0661         float timeThrP = 0.;
0662         float timeThrM = 0.;
0663         if (barrel) {
0664           threshold = pedRMSVec[0] * amplitudeThreshEB_;
0665           cterm = EBtimeConstantTerm_;
0666           timeNconst = EBtimeNconst_;
0667           timeThrP = outOfTimeThreshG12pEB_;
0668           timeThrM = outOfTimeThreshG12mEB_;
0669           if (uncalibRecHit.amplitude() > 3000.) {  // Gain switch
0670             for (int iSample = 0; iSample < EBDataFrame::MAXSAMPLES; iSample++) {
0671               int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
0672               if (GainId != 1) {
0673                 timeThrP = outOfTimeThreshG61pEB_;
0674                 timeThrM = outOfTimeThreshG61mEB_;
0675                 break;
0676               }
0677             }
0678           }
0679         } else {  //EndCap
0680           threshold = pedRMSVec[0] * amplitudeThreshEE_;
0681           cterm = EEtimeConstantTerm_;
0682           timeNconst = EEtimeNconst_;
0683           timeThrP = outOfTimeThreshG12pEE_;
0684           timeThrM = outOfTimeThreshG12mEE_;
0685           if (uncalibRecHit.amplitude() > 3000.) {  // Gain switch
0686             for (int iSample = 0; iSample < EEDataFrame::MAXSAMPLES; iSample++) {
0687               int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
0688               if (GainId != 1) {
0689                 timeThrP = outOfTimeThreshG61pEE_;
0690                 timeThrM = outOfTimeThreshG61mEE_;
0691                 break;
0692               }
0693             }
0694           }
0695         }
0696         if (uncalibRecHit.amplitude() > threshold) {
0697           float correctedTime = noCorrectedJitter * ecalPh1::Samp_Period + itimeconst + offsetTime;
0698           float sigmaped = pedRMSVec[0];  // approx for lower gains
0699           float nterm = timeNconst * sigmaped / uncalibRecHit.amplitude();
0700           float sigmat = std::sqrt(nterm * nterm + cterm * cterm);
0701           if ((correctedTime > sigmat * timeThrP) || (correctedTime < -sigmat * timeThrM))
0702             uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kOutOfTime);
0703         }
0704 
0705       } else {  // no time method;
0706         uncalibRecHit.setJitter(0.);
0707         uncalibRecHit.setJitterError(0.);
0708       }
0709     }
0710 
0711     // set flags if gain switch has occurred
0712     auto& uncalibRecHit = result.back();
0713     if (((EcalDataFrame)(*itdg)).hasSwitchToGain6())
0714       uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kHasSwitchToGain6);
0715     if (((EcalDataFrame)(*itdg)).hasSwitchToGain1())
0716       uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kHasSwitchToGain1);
0717   }
0718 }
0719 
0720 edm::ParameterSetDescription EcalUncalibRecHitWorkerMultiFit::getAlgoDescription() {
0721   edm::ParameterSetDescription psd;
0722   psd.addNode(edm::ParameterDescription<std::vector<int>>("activeBXs", {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4}, true) and
0723               edm::ParameterDescription<bool>("ampErrorCalculation", true, true) and
0724               edm::ParameterDescription<bool>("useLumiInfoRunHeader", true, true) and
0725               edm::ParameterDescription<int>("bunchSpacing", 0, true) and
0726               edm::ParameterDescription<bool>("doPrefitEB", false, true) and
0727               edm::ParameterDescription<bool>("doPrefitEE", false, true) and
0728               edm::ParameterDescription<double>("prefitMaxChiSqEB", 25., true) and
0729               edm::ParameterDescription<double>("prefitMaxChiSqEE", 10., true) and
0730               edm::ParameterDescription<bool>("dynamicPedestalsEB", false, true) and
0731               edm::ParameterDescription<bool>("dynamicPedestalsEE", false, true) and
0732               edm::ParameterDescription<bool>("mitigateBadSamplesEB", false, true) and
0733               edm::ParameterDescription<bool>("mitigateBadSamplesEE", false, true) and
0734               edm::ParameterDescription<bool>("gainSwitchUseMaxSampleEB", false, true) and
0735               edm::ParameterDescription<bool>("gainSwitchUseMaxSampleEE", false, true) and
0736               edm::ParameterDescription<bool>("selectiveBadSampleCriteriaEB", false, true) and
0737               edm::ParameterDescription<bool>("selectiveBadSampleCriteriaEE", false, true) and
0738               edm::ParameterDescription<double>("addPedestalUncertaintyEB", 0., true) and
0739               edm::ParameterDescription<double>("addPedestalUncertaintyEE", 0., true) and
0740               edm::ParameterDescription<bool>("simplifiedNoiseModelForGainSwitch", true, true) and
0741               edm::ParameterDescription<std::string>("timealgo", "RatioMethod", true) and
0742               edm::ParameterDescription<std::vector<double>>("EBtimeFitParameters",
0743                                                              {-2.015452e+00,
0744                                                               3.130702e+00,
0745                                                               -1.234730e+01,
0746                                                               4.188921e+01,
0747                                                               -8.283944e+01,
0748                                                               9.101147e+01,
0749                                                               -5.035761e+01,
0750                                                               1.105621e+01},
0751                                                              true) and
0752               edm::ParameterDescription<std::vector<double>>("EEtimeFitParameters",
0753                                                              {-2.390548e+00,
0754                                                               3.553628e+00,
0755                                                               -1.762341e+01,
0756                                                               6.767538e+01,
0757                                                               -1.332130e+02,
0758                                                               1.407432e+02,
0759                                                               -7.541106e+01,
0760                                                               1.620277e+01},
0761                                                              true) and
0762               edm::ParameterDescription<std::vector<double>>("EBamplitudeFitParameters", {1.138, 1.652}, true) and
0763               edm::ParameterDescription<std::vector<double>>("EEamplitudeFitParameters", {1.890, 1.400}, true) and
0764               edm::ParameterDescription<double>("EBtimeFitLimits_Lower", 0.2, true) and
0765               edm::ParameterDescription<double>("EBtimeFitLimits_Upper", 1.4, true) and
0766               edm::ParameterDescription<double>("EEtimeFitLimits_Lower", 0.2, true) and
0767               edm::ParameterDescription<double>("EEtimeFitLimits_Upper", 1.4, true) and
0768               edm::ParameterDescription<double>("EBtimeConstantTerm", .6, true) and
0769               edm::ParameterDescription<double>("EEtimeConstantTerm", 1.0, true) and
0770               edm::ParameterDescription<double>("EBtimeNconst", 28.5, true) and
0771               edm::ParameterDescription<double>("EEtimeNconst", 31.8, true) and
0772               edm::ParameterDescription<double>("outOfTimeThresholdGain12pEB", 5, true) and
0773               edm::ParameterDescription<double>("outOfTimeThresholdGain12mEB", 5, true) and
0774               edm::ParameterDescription<double>("outOfTimeThresholdGain61pEB", 5, true) and
0775               edm::ParameterDescription<double>("outOfTimeThresholdGain61mEB", 5, true) and
0776               edm::ParameterDescription<double>("outOfTimeThresholdGain12pEE", 1000, true) and
0777               edm::ParameterDescription<double>("outOfTimeThresholdGain12mEE", 1000, true) and
0778               edm::ParameterDescription<double>("outOfTimeThresholdGain61pEE", 1000, true) and
0779               edm::ParameterDescription<double>("outOfTimeThresholdGain61mEE", 1000, true) and
0780               edm::ParameterDescription<double>("amplitudeThresholdEB", 10, true) and
0781               edm::ParameterDescription<double>("amplitudeThresholdEE", 10, true) and
0782               edm::ParameterDescription<double>("crossCorrelationStartTime", -15.0, true) and
0783               edm::ParameterDescription<double>("crossCorrelationStopTime", 25.0, true) and
0784               edm::ParameterDescription<double>("crossCorrelationTargetTimePrecision", 0.01, true) and
0785               edm::ParameterDescription<double>("crossCorrelationTargetTimePrecisionForDelayedPulses", 0.05, true) and
0786               edm::ParameterDescription<double>("crossCorrelationTimeShiftWrtRations", 1., true) and
0787               edm::ParameterDescription<double>("crossCorrelationMinTimeToBeLateMin", 2., true) and
0788               edm::ParameterDescription<double>("crossCorrelationMinTimeToBeLateMax", 5., true));
0789 
0790   return psd;
0791 }
0792 
0793 #include "FWCore/Framework/interface/MakerMacros.h"
0794 #include "RecoLocalCalo/EcalRecProducers/interface/EcalUncalibRecHitWorkerFactory.h"
0795 DEFINE_EDM_PLUGIN(EcalUncalibRecHitWorkerFactory, EcalUncalibRecHitWorkerMultiFit, "EcalUncalibRecHitWorkerMultiFit");
0796 #include "RecoLocalCalo/EcalRecProducers/interface/EcalUncalibRecHitFillDescriptionWorkerFactory.h"
0797 DEFINE_EDM_PLUGIN(EcalUncalibRecHitFillDescriptionWorkerFactory,
0798                   EcalUncalibRecHitWorkerMultiFit,
0799                   "EcalUncalibRecHitWorkerMultiFit");