Skip to content

Commit 22924d4

Browse files
committed
1 parent 173f02c commit 22924d4

File tree

3 files changed

+34
-25
lines changed

3 files changed

+34
-25
lines changed

RecoLocalCalo/EcalRecAlgos/interface/EcalUncalibRecHitTimingCCAlgo.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class EcalUncalibRecHitTimingCCAlgo {
2525
const FullSampleVector& fullpulse,
2626
const float targetTimePrecision,
2727
const bool correctForOOT = true,
28-
const bool correctForSlew = true ) const;
28+
const bool correctForSlew = true) const;
2929

3030
private:
3131
const float startTime_;
@@ -39,7 +39,10 @@ class EcalUncalibRecHitTimingCCAlgo {
3939
static constexpr float ONE_MINUS_GOLDEN_RATIO = 1.0 - GOLDEN_RATIO;
4040

4141
FullSampleVector interpolatePulse(const FullSampleVector& fullpulse, const float t = 0) const;
42-
float computeCC(const std::vector<float>& samples, const std::vector<float>& weights, const FullSampleVector& sigmalTemplate, const float t) const;
42+
float computeCC(const std::vector<float>& samples,
43+
const std::vector<float>& weights,
44+
const FullSampleVector& sigmalTemplate,
45+
const float t) const;
4346
};
4447

4548
#endif

RecoLocalCalo/EcalRecAlgos/src/EcalUncalibRecHitTimingCCAlgo.cc

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ double EcalUncalibRecHitTimingCCAlgo::computeTimeCC(const EcalDataFrame& dataFra
1010
const FullSampleVector& fullpulse,
1111
const float targetTimePrecision,
1212
const bool correctForOOT,
13-
const bool correctForSlew ) const {
14-
13+
const bool correctForSlew) const {
1514
constexpr unsigned int nsample = EcalDataFrame::MAXSAMPLES;
1615

1716
double maxamplitude = -std::numeric_limits<double>::max();
1817
float pulsenorm = 0.;
1918

2019
std::vector<float> pedSubSamples(nsample);
21-
std::vector<float> weights(nsample,1.f);
20+
std::vector<float> weights(nsample, 1.f);
2221
for (unsigned int iSample = 0; iSample < nsample; iSample++) {
2322
const EcalMGPASample& sample = dataFrame.sample(iSample);
2423

@@ -54,16 +53,16 @@ double EcalUncalibRecHitTimingCCAlgo::computeTimeCC(const EcalDataFrame& dataFra
5453
maxamplitude = amplitude;
5554
}
5655

57-
if( iSample > 0 && correctForSlew ){
58-
int GainIdPrev = dataFrame.sample(iSample - 1).gainId();
59-
bool GainIdInRange = GainIdPrev >= 1 && GainIdPrev <= 3 && gainId >= 1 && gainId <= 3;
60-
bool GainSlew = GainIdPrev < gainId;
61-
if( GainIdInRange && GainSlew ) weights[iSample - 1] = 0.f;
62-
}
63-
56+
if (iSample > 0 && correctForSlew) {
57+
int GainIdPrev = dataFrame.sample(iSample - 1).gainId();
58+
bool GainIdInRange = GainIdPrev >= 1 && GainIdPrev <= 3 && gainId >= 1 && gainId <= 3;
59+
bool GainSlew = GainIdPrev < gainId;
60+
if (GainIdInRange && GainSlew)
61+
weights[iSample - 1] = 0.f;
62+
}
6463
}
6564

66-
if( correctForOOT ){
65+
if (correctForOOT) {
6766
int ipulse = -1;
6867
for (auto const& amplit : amplitudes) {
6968
ipulse++;
@@ -73,7 +72,7 @@ double EcalUncalibRecHitTimingCCAlgo::computeTimeCC(const EcalDataFrame& dataFra
7372

7473
for (unsigned int isample = firstsamplet; isample < nsample; ++isample) {
7574
auto const pulse = fullpulse(isample + offset);
76-
pedSubSamples[isample] = pedSubSamples[isample] - ( amplit * pulse / pulsenorm );
75+
pedSubSamples[isample] = pedSubSamples[isample] - (amplit * pulse / pulsenorm);
7776
}
7877
}
7978
}
@@ -110,7 +109,9 @@ double EcalUncalibRecHitTimingCCAlgo::computeTimeCC(const EcalDataFrame& dataFra
110109
}
111110

112111
float tM = (t3 + t0) / 2 - GLOBAL_TIME_SHIFT;
113-
if (counter < MIN_NUM_OF_ITERATIONS || counter > MAX_NUM_OF_ITERATIONS - 1) { tM = TIME_WHEN_NOT_CONVERGING * ecalPh1::Samp_Period; }
112+
if (counter < MIN_NUM_OF_ITERATIONS || counter > MAX_NUM_OF_ITERATIONS - 1) {
113+
tM = TIME_WHEN_NOT_CONVERGING * ecalPh1::Samp_Period;
114+
}
114115
return -tM / ecalPh1::Samp_Period;
115116
}
116117

@@ -154,7 +155,7 @@ FullSampleVector EcalUncalibRecHitTimingCCAlgo::interpolatePulse(const FullSampl
154155
}
155156

156157
float EcalUncalibRecHitTimingCCAlgo::computeCC(const std::vector<float>& samples,
157-
const std::vector<float>& weights,
158+
const std::vector<float>& weights,
158159
const FullSampleVector& signalTemplate,
159160
const float time) const {
160161
constexpr int exclude = 1;

RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitWorkerMultiFit.cc

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -640,19 +640,24 @@ void EcalUncalibRecHitWorkerMultiFit::run(const edm::Event& evt,
640640
uncalibRecHit.setJitterError(0.); // not computed with weights
641641

642642
} else if (timealgo_ == crossCorrelationMethod) {
643-
644643
std::vector<double> amplitudes(activeBX.size());
645644
for (unsigned int ibx = 0; ibx < activeBX.size(); ++ibx)
646645
amplitudes[ibx] = uncalibRecHit.outOfTimeAmplitude(ibx);
647646

648-
bool const doSlewCorrection = barrel ? useSlewCorrectionEB_ : useSlewCorrectionEE_;
649-
650-
float jitter =
651-
computeCC_->computeTimeCC(*itdg, amplitudes, aped, aGain, fullpulse, CCtargetTimePrecision_, true, doSlewCorrection ) +
652-
CCTimeShiftWrtRations_ / ecalcctiming::clockToNS;
653-
float noCorrectedJitter =
654-
computeCC_->computeTimeCC(*itdg, amplitudes, aped, aGain, fullpulse, CCtargetTimePrecisionForDelayedPulses_, false, doSlewCorrection ) +
655-
CCTimeShiftWrtRations_ / ecalcctiming::clockToNS;
647+
bool const doSlewCorrection = barrel ? useSlewCorrectionEB_ : useSlewCorrectionEE_;
648+
649+
float jitter = computeCC_->computeTimeCC(
650+
*itdg, amplitudes, aped, aGain, fullpulse, CCtargetTimePrecision_, true, doSlewCorrection) +
651+
CCTimeShiftWrtRations_ / ecalcctiming::clockToNS;
652+
float noCorrectedJitter = computeCC_->computeTimeCC(*itdg,
653+
amplitudes,
654+
aped,
655+
aGain,
656+
fullpulse,
657+
CCtargetTimePrecisionForDelayedPulses_,
658+
false,
659+
doSlewCorrection) +
660+
CCTimeShiftWrtRations_ / ecalcctiming::clockToNS;
656661

657662
uncalibRecHit.setJitter(jitter);
658663
uncalibRecHit.setNonCorrectedTime(jitter, noCorrectedJitter);

0 commit comments

Comments
 (0)