19 constexpr
float PulseContainmentFractionalError = 0.002f;
25 const float timeShift,
27 const bool applyLegacyHBMCorrection,
28 const bool applyFixPCC,
29 std::unique_ptr<PulseShapeFitOOTPileupCorrection>
m2,
30 std::unique_ptr<HcalDeterministicFit> detFit,
31 std::unique_ptr<MahiFit> mahi,
34 pulseCorr_(PulseContainmentFractionalError, applyFixPCC, iC),
35 firstSampleShift_(firstSampleShift),
36 samplesToAdd_(samplesToAdd),
38 timeShift_(timeShift),
40 corrFPC_(correctForPhaseContainment),
41 applyLegacyHBMCorrection_(applyLegacyHBMCorrection),
42 psFitOOTpuCorr_(std::
move(m2)),
43 hltOOTpuCorr_(std::
move(detFit)),
44 mahiOOTpuCorr_(std::
move(mahi)) {
64 float m0t = 0.f, m0E = 0.f;
70 const double fc_ampl = info.
chargeInWindow(ibeg, ibeg + nSamplesToAdd);
73 m0E =
m0Energy(info, fc_ampl, applyContainment, phasens, nSamplesToAdd);
75 m0t =
m0Time(info, fc_ampl, nSamplesToAdd);
79 float m2t = 0.f, m2E = 0.f,
chi2 = -1.f;
80 bool useTriple =
false;
92 float m3t = 0.f, m3E = 0.f;
101 float m4E = 0.f, m4ESOIPlusOne = 0.f, m4chi2 = -1.f;
103 bool m4UseTriple =
false;
110 mahi->
phase1Apply(info, m4E, m4ESOIPlusOne, m4T, m4UseTriple, m4chi2);
125 }
else if (method2) {
129 }
else if (method3) {
136 rh =
HBHERecHit(channelId, rhE, rht, tdcTime);
149 if (useTriple || m4UseTriple)
157 const bool isRealData)
const {
161 const int ieta = cell.
ieta();
162 const int iphi = cell.
iphi();
169 const double fc_ampl,
170 const bool applyContainmentCorrection,
171 const double phaseNs,
172 const int nSamplesToAdd) {
180 double corrFactor = 1.0;
181 if (applyContainmentCorrection)
182 corrFactor =
pulseCorr_.
get(info.
id(), nSamplesToAdd, phaseNs)->getCorrection(fc_ampl);
190 const double fc_ampl,
191 const int nSamplesToExamine)
const {
192 float time = -9999.f;
196 const int soi = info.
soi();
200 const int iend =
std::min(ibeg + nSamplesToExamine, (
int)nSamples - 1);
204 if (maxI >= nSamples)
205 maxI = nSamples - 1U;
210 if (maxI < (nSamples - 1U))
215 if (nSamplesToExamine < (
int)
nSamples)
218 time = 25.f * (float)position;
219 if (emax0 > 0.
f && emax1 > 0.
f)
220 time += 25.f * emax1 / (emax0 + emax1);
constexpr unsigned nSamples() const
const Shape & getShape(int shapeType) const
HBHERecHit reconstruct(const HBHEChannelInfo &info, const HcalRecoParam *params, const HcalCalibrations &calibs, bool isRealData) override
const HcalTimeSlew * hcalTimeSlew_delay_
constexpr unsigned int samplesToAdd() const
constexpr bool hasTimeInfo() const
const HcalPulseContainmentCorrection * get(const HcalDetId &detId, int toAdd, float fixedphase_ns)
constexpr int recoShape() const
std::unique_ptr< HcalDeterministicFit > hltOOTpuCorr_
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &soiPlusOneEnergy, float &reconstructedTime, bool &useTriple, float &chi2) const
void beginRun(const edm::Run &, const edm::EventSetup &) override
constexpr double tsEnergy(const unsigned ts) const
constexpr unsigned peakEnergyTS(const unsigned begin, const unsigned end) const
HcalPulseContainmentManager pulseCorr_
SimpleHBHEPhase1Algo(int firstSampleShift, int samplesToAdd, float phaseNS, float timeShift, bool correctForPhaseContainment, bool applyLegacyHBMCorrection, bool applyFixPCC, std::unique_ptr< PulseShapeFitOOTPileupCorrection > m2, std::unique_ptr< HcalDeterministicFit > detFit, std::unique_ptr< MahiFit > mahi, edm::ConsumesCollector iC)
edm::ESGetToken< HcalTimeSlew, HcalTimeSlewRecord > delayToken_
float hbminus_special_ecorr(int ieta, int iphi, double energy, int runnum)
Special energy correction for some HB- cells.
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &reconstructedTime, bool &useTriple, float &chi2) const
static constexpr void setAux(const HBHEChannelInfo &info, HBHERecHit *rechit)
constexpr void setFlagField(uint32_t value, int base, int width=1)
constexpr void setChiSquared(const float chi2)
constexpr void setAuxEnergy(const float en)
bool getData(T &iHolder) const
constexpr HcalSubdetector subdet() const
get the subdetector
constexpr float soiRiseTime() const
static const unsigned MAXSAMPLES
constexpr int iphi() const
get the cell iphi
constexpr float correctionPhaseNS() const
constexpr HcalDetId id() const
constexpr int ieta() const
get the cell ieta
constexpr bool isSpecial(const float t)
float hbminusCorrectionFactor(const HcalDetId &cell, float energy, bool isRealData) const
bool applyLegacyHBMCorrection_
constexpr size_t nSamples
std::unique_ptr< MahiFit > mahiOOTpuCorr_
tuple correctForPhaseContainment
constexpr unsigned soi() const
constexpr bool correctForPhaseContainment() const
HcalPulseShapes theHcalPulseShapes_
constexpr double energyInWindow(const unsigned begin, const unsigned end) const
void beginRun(edm::EventSetup const &es)
float m0Energy(const HBHEChannelInfo &info, double reconstructedCharge, bool applyContainmentCorrection, double phaseNS, int nSamplesToAdd)
constexpr double chargeInWindow(const unsigned begin, const unsigned end) const
static int position[264][3]
float m0Time(const HBHEChannelInfo &info, double reconstructedCharge, int nSamplesToExamine) const
float delay(float fC, BiasSetting bias=Medium) const
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
std::unique_ptr< PulseShapeFitOOTPileupCorrection > psFitOOTpuCorr_
void phase1Apply(const HBHEChannelInfo &channelData, float &reconstructedEnergy, float &reconstructedTime, const HcalTimeSlew *hcalTimeSlew_delay) const
constexpr void setRawEnergy(const float en)