Skip to content

Commit

Permalink
Merge pull request #16009 from igv4321/allow-nadd-from-db
Browse files Browse the repository at this point in the history
Allowing the number of samples to be configured from db for Method 0
  • Loading branch information
cmsbuild committed Sep 30, 2016
2 parents 6b6f4b6 + e18d972 commit 4ccb48c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
7 changes: 4 additions & 3 deletions RecoLocalCalo/HcalRecAlgos/interface/SimpleHBHEPhase1Algo.h
Expand Up @@ -22,7 +22,7 @@ class SimpleHBHEPhase1Algo : public AbsHBHEPhase1Algo
// firstSampleShift -- first TS w.r.t. SOI to use for "Method 0"
// reconstruction.
//
// samplesToAdd -- number of samples to add for "Method 0"
// samplesToAdd -- default number of samples to add for "Method 0"
// reconstruction. If, let say, SOI = 4,
// firstSampleShift = -1, and samplesToAdd = 3
// then the code will add time slices 3, 4, and 5.
Expand Down Expand Up @@ -72,12 +72,13 @@ class SimpleHBHEPhase1Algo : public AbsHBHEPhase1Algo
float m0Energy(const HBHEChannelInfo& info,
double reconstructedCharge,
bool applyContainmentCorrection,
double phaseNS);
double phaseNS, int nSamplesToAdd);

// "Method 0" rechit timing (original low-pileup QIE8 algorithm)
float m0Time(const HBHEChannelInfo& info,
double reconstructedCharge,
const HcalCalibrations& calibs) const;
const HcalCalibrations& calibs,
int nSamplesToExamine) const;
private:
HcalPulseContainmentManager pulseCorr_;

Expand Down
24 changes: 13 additions & 11 deletions RecoLocalCalo/HcalRecAlgos/src/SimpleHBHEPhase1Algo.cc
Expand Up @@ -61,24 +61,24 @@ HBHERecHit SimpleHBHEPhase1Algo::reconstruct(const HBHEChannelInfo& info,
int ibeg = static_cast<int>(info.soi()) + firstSampleShift_;
if (ibeg < 0)
ibeg = 0;
const double fc_ampl = info.chargeInWindow(ibeg, ibeg + samplesToAdd_);
const int nSamplesToAdd = params ? params->samplesToAdd() : samplesToAdd_;
const double fc_ampl = info.chargeInWindow(ibeg, ibeg + nSamplesToAdd);
const bool applyContainment = params ? params->correctForPhaseContainment() : true;
const float phasens = params ? params->correctionPhaseNS() : phaseNS_;
m0E = m0Energy(info, fc_ampl, applyContainment, phasens);
m0E = m0Energy(info, fc_ampl, applyContainment, phasens, nSamplesToAdd);
m0E *= hbminusCorrectionFactor(channelId, m0E, isData);
m0t = m0Time(info, fc_ampl, calibs);
m0t = m0Time(info, fc_ampl, calibs, nSamplesToAdd);
}

// Run "Method 2"
float m2t = 0.f, m2E = 0.f;
float m2t = 0.f, m2E = 0.f, chi2 = -1.f;
bool useTriple = false;
float chi2=-1;
const PulseShapeFitOOTPileupCorrection* method2 = psFitOOTpuCorr_.get();
if (method2)
{
psFitOOTpuCorr_->setPulseShapeTemplate(theHcalPulseShapes_.getShape(info.recoShape()),
!info.hasTimeInfo());
// "phase1Apply" call below sets m2E, m2t, and useTriple.
// "phase1Apply" call below sets m2E, m2t, useTriple, and chi2.
// These parameters are pased by non-const reference.
method2->phase1Apply(info, m2E, m2t, useTriple, chi2);
m2E *= hbminusCorrectionFactor(channelId, m2E, isData);
Expand Down Expand Up @@ -143,18 +143,19 @@ float SimpleHBHEPhase1Algo::hbminusCorrectionFactor(const HcalDetId& cell,
float SimpleHBHEPhase1Algo::m0Energy(const HBHEChannelInfo& info,
const double fc_ampl,
const bool applyContainmentCorrection,
const double phaseNs)
const double phaseNs,
const int nSamplesToAdd)
{
int ibeg = static_cast<int>(info.soi()) + firstSampleShift_;
if (ibeg < 0)
ibeg = 0;
double e = info.energyInWindow(ibeg, ibeg + samplesToAdd_);
double e = info.energyInWindow(ibeg, ibeg + nSamplesToAdd);

// Pulse containment correction
{
double corrFactor = 1.0;
if (applyContainmentCorrection)
corrFactor = pulseCorr_.get(info.id(), samplesToAdd_, phaseNs)->getCorrection(fc_ampl);
corrFactor = pulseCorr_.get(info.id(), nSamplesToAdd, phaseNs)->getCorrection(fc_ampl);
e *= corrFactor;
}

Expand All @@ -163,7 +164,8 @@ float SimpleHBHEPhase1Algo::m0Energy(const HBHEChannelInfo& info,

float SimpleHBHEPhase1Algo::m0Time(const HBHEChannelInfo& info,
const double fc_ampl,
const HcalCalibrations& calibs) const
const HcalCalibrations& calibs,
const int nSamplesToExamine) const
{
float time = -9999.f; // historic value

Expand All @@ -174,7 +176,7 @@ float SimpleHBHEPhase1Algo::m0Time(const HBHEChannelInfo& info,
int ibeg = soi + firstSampleShift_;
if (ibeg < 0)
ibeg = 0;
const int iend = ibeg + samplesToAdd_;
const int iend = ibeg + nSamplesToExamine;
unsigned maxI = info.peakEnergyTS(ibeg, iend);
if (maxI < HBHEChannelInfo::MAXSAMPLES)
{
Expand Down

0 comments on commit 4ccb48c

Please sign in to comment.