From 444e894622b2cc5e0719a3ca01b2858bf438cd80 Mon Sep 17 00:00:00 2001 From: Emanuele Di Marco Date: Fri, 4 Aug 2017 18:36:46 +0200 Subject: [PATCH 1/4] do not use the ECAL digi lastSaturatedSample() method to decide if doing multifit or not. This do not consider cases with saturation on the tail --- .../plugins/EcalUncalibRecHitWorkerMultiFit.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc index aec0f80cd034b..f585d8f89eb8a 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc @@ -340,16 +340,23 @@ EcalUncalibRecHitWorkerMultiFit::run( const edm::Event & evt, << "! something wrong with EcalTimeCalibConstants in your DB? "; } + int lastSampleBeforeSaturation = -1; + for(unsigned int iSample = 0; iSample < EcalDataFrame::MAXSAMPLES; iSample++) { + if ( ((EcalDataFrame)(*itdg)).sample(iSample).gainId() == 0 ) { + lastSampleBeforeSaturation=iSample-1; + break; + } + } + // === amplitude computation === - int leadingSample = ((EcalDataFrame)(*itdg)).lastUnsaturatedSample(); - if ( leadingSample == 4 ) { // saturation on the expected max sample + if ( lastSampleBeforeSaturation == 4 ) { // saturation on the expected max sample result.emplace_back((*itdg).id(), 4095*12, 0, 0, 0); auto & uncalibRecHit = result.back(); uncalibRecHit.setFlagBit( EcalUncalibratedRecHit::kSaturated ); // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation uncalibRecHit.setChi2(0); - } else if ( leadingSample >= 0 ) { // saturation on other samples: cannot extrapolate from the fourth one + } else if ( lastSampleBeforeSaturation >= 0 ) { // saturation on other samples: cannot extrapolate from the fourth one int gainId = ((EcalDataFrame)(*itdg)).sample(5).gainId(); if (gainId==0) gainId=3; auto pedestal = pedVec[gainId-1]; From e94803a48b2f1ba1e5f262e223da76f4c590f20b Mon Sep 17 00:00:00 2001 From: Emanuele Di Marco Date: Mon, 21 Aug 2017 09:33:53 +0200 Subject: [PATCH 2/4] bug fix, flag saturation if also sample 0 is saturated --- .../plugins/EcalUncalibRecHitWorkerMultiFit.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc index f585d8f89eb8a..c03e0970c9265 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc @@ -340,7 +340,7 @@ EcalUncalibRecHitWorkerMultiFit::run( const edm::Event & evt, << "! something wrong with EcalTimeCalibConstants in your DB? "; } - int lastSampleBeforeSaturation = -1; + int lastSampleBeforeSaturation = -2; for(unsigned int iSample = 0; iSample < EcalDataFrame::MAXSAMPLES; iSample++) { if ( ((EcalDataFrame)(*itdg)).sample(iSample).gainId() == 0 ) { lastSampleBeforeSaturation=iSample-1; @@ -356,7 +356,7 @@ EcalUncalibRecHitWorkerMultiFit::run( const edm::Event & evt, uncalibRecHit.setFlagBit( EcalUncalibratedRecHit::kSaturated ); // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation uncalibRecHit.setChi2(0); - } else if ( lastSampleBeforeSaturation >= 0 ) { // saturation on other samples: cannot extrapolate from the fourth one + } else if ( lastSampleBeforeSaturation >= -1 ) { // saturation on other samples: cannot extrapolate from the fourth one int gainId = ((EcalDataFrame)(*itdg)).sample(5).gainId(); if (gainId==0) gainId=3; auto pedestal = pedVec[gainId-1]; From 8b2971ffa95e7ff84156ee9bd3fa74735c5b46ea Mon Sep 17 00:00:00 2001 From: Emanuele Di Marco Date: Mon, 21 Aug 2017 16:42:34 +0200 Subject: [PATCH 3/4] addressing code check issues --- .../plugins/EcalUncalibRecHitWorkerMultiFit.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc index c03e0970c9265..61ff3170fd0f6 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc @@ -207,7 +207,7 @@ double EcalUncalibRecHitWorkerMultiFit::timeCorrection( double theCorrection = 0; // sanity check for arrays - if (amplitudeBins.size() == 0) { + if (amplitudeBins.empty()) { edm::LogError("EcalRecHitError") << "timeCorrAmplitudeBins is empty, forcing no time bias corrections."; @@ -294,12 +294,12 @@ EcalUncalibRecHitWorkerMultiFit::run( const edm::Event & evt, // intelligence for recHit computation float offsetTime = 0; - const EcalPedestals::Item * aped = 0; - const EcalMGPAGainRatio * aGain = 0; - const EcalXtalGroupId * gid = 0; - const EcalPulseShapes::Item * aPulse = 0; - const EcalPulseCovariances::Item * aPulseCov = 0; - + const EcalPedestals::Item * aped = nullptr; + const EcalMGPAGainRatio * aGain = nullptr; + const EcalXtalGroupId * gid = nullptr; + const EcalPulseShapes::Item * aPulse = nullptr; + const EcalPulseCovariances::Item * aPulseCov = nullptr; + if (barrel) { unsigned int hashedIndex = EBDetId(detid).hashedIndex(); aped = &peds->barrel(hashedIndex); From 3d9fd5549abe333a3901ef3ed2999a69fa3b79dc Mon Sep 17 00:00:00 2001 From: Emanuele Di Marco Date: Tue, 22 Aug 2017 07:46:33 +0200 Subject: [PATCH 4/4] overriding virtual destructor --- .../EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.h b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.h index e41522189dc7f..2e75b60e70a45 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.h +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.h @@ -42,7 +42,7 @@ class EcalUncalibRecHitWorkerMultiFit final : public EcalUncalibRecHitWorkerBase public: EcalUncalibRecHitWorkerMultiFit(const edm::ParameterSet&, edm::ConsumesCollector& c); EcalUncalibRecHitWorkerMultiFit() {}; - virtual ~EcalUncalibRecHitWorkerMultiFit() {}; + ~EcalUncalibRecHitWorkerMultiFit() override {}; private: void set(const edm::EventSetup& es) override; void set(const edm::Event& evt) override;