|
|
Go to the documentation of this file.
22 correctForPulse_(correctForPulse),
25 setLeakCorrection_(
false),
44 bool correctForTimeslew,
bool correctForPulse,
bool setLeakCorrection,
int pileupCleaningID,
float phaseNS) {
72 const Digi& digi,
const int maxI,
const double amp_fC,
const bool slewCorrect,
double maxA,
float t0,
float t2) {
86 wpksamp = maxA / wpksamp;
90 wpksamp = 1. + (
t2 / wpksamp);
95 if (slewCorrect && amp_fC > 0.0) {
97 double tslew =
exp(0.337681 - 5.94689
e-4 * amp_fC) +
exp(2.44628 - 1.34888
e-2 * amp_fC);
104 template <
class Digi>
110 const bool pulseCorrect,
113 const BunchXParameter* bxInfo,
114 const unsigned lenInfo,
117 double* p_uncorr_ampl,
121 bool* leakCorrApplied,
126 const int nRead =
cs.size();
127 const int iStop =
std::min(nRead,
n + ifirst);
134 double* correctedEnergy =
nullptr;
135 double fc_ampl = 0.0, corr_fc_ampl = 0.0;
136 bool pulseShapeCorrApplied =
false, readjustTiming =
false;
137 *leakCorrApplied =
false;
139 if (pileupCorrection) {
140 correctedEnergy = &
buf[0];
145 for (
int i = 0;
i < nRead; ++
i) {
146 const int capid = digi[
i].capid();
151 for (
int i = ifirst;
i < iStop; ++
i)
152 fc_ampl += correctionInput[
i];
155 for (
int i = 0;
i < nRead; ++
i) {
156 uncorrectedEnergy[
i] = correctionInput[
i] * gains[
i];
158 correctionInput[
i] = uncorrectedEnergy[
i];
161 pileupCorrection->
apply(digi.id(),
170 &pulseShapeCorrApplied,
176 for (
int i = ifirst;
i < iStop; ++
i)
178 corr_fc_ampl += correctedEnergy[
i] / gains[
i];
180 for (
int i = ifirst;
i < iStop; ++
i)
181 corr_fc_ampl += correctedEnergy[
i];
182 for (
int i = 0;
i < nRead; ++
i)
183 correctedEnergy[
i] *= gains[
i];
186 correctedEnergy = &uncorrectedEnergy[0];
189 const int istart =
std::max(ifirst - 1, 0);
190 const int iend =
std::min(
n + ifirst + 1, nRead);
191 for (
int i = istart;
i < iend; ++
i) {
192 const int capid = digi[
i].capid();
194 if (
i >= ifirst &&
i < iStop)
197 uncorrectedEnergy[
i] = ta;
199 corr_fc_ampl = fc_ampl;
203 double ampl = 0.0, corr_ampl = 0.0;
204 for (
int i = ifirst;
i < iStop; ++
i) {
205 ampl += uncorrectedEnergy[
i];
206 corr_ampl += correctedEnergy[
i];
210 if (
corr && pulseCorrect) {
211 ampl *=
corr->getCorrection(fc_ampl);
212 if (pileupCorrection) {
213 if (!pulseShapeCorrApplied)
214 corr_ampl *=
corr->getCorrection(corr_fc_ampl);
220 const double* etime = readjustTiming ? &correctedEnergy[0] : &uncorrectedEnergy[0];
222 double maxA = -1.e300;
223 for (
int i = ifirst;
i < iStop; ++
i)
224 if (etime[
i] > maxA) {
232 *p_uncorr_ampl = ampl;
233 *p_fc_ampl = readjustTiming ? corr_fc_ampl : fc_ampl;
237 if (maxI <= 0 || maxI >= (nRead - 1)) {
238 LogDebug(
"HCAL Pulse") <<
"HcalSimpleRecAlgoImpl::removePileup :"
239 <<
" Invalid max amplitude position, "
240 <<
" max Amplitude: " <<
maxI <<
" first: " << ifirst <<
" last: " << ifirst +
n
245 *p_t0 = etime[
maxI - 1];
246 *p_t2 = etime[
maxI + 1];
250 template <
class Digi,
class RecHit>
256 const bool slewCorrect,
257 const bool pulseCorrect,
263 const BunchXParameter* bxInfo,
264 const unsigned lenInfo,
265 const int puCorrMethod,
267 double fc_ampl = 0, ampl = 0, uncorr_ampl = 0, m3_ampl = 0, maxA = -1.e300;
268 int nRead = 0,
maxI = -1;
269 bool leakCorrApplied =
false;
270 float t0 = 0,
t2 = 0;
297 if (
maxI > 0 &&
maxI < (nRead - 1)) {
310 float wpksamp = (
t0 + maxA +
t2);
312 wpksamp = (maxA + 2.0 *
t2) / wpksamp;
322 if (useLeak && !leakCorrApplied) {
323 uncorr_ampl *=
leakCorr(uncorr_ampl);
324 if (puCorrMethod < 2)
328 RecHit rh(digi.id(), ampl,
time);
337 return HcalSimpleRecAlgoImpl::reco<HODataFrame, HORecHit>(digi,
360 return HcalSimpleRecAlgoImpl::reco<HcalCalibDataFrame, HcalCalibRecHit>(digi,
385 double amp_fC, ampl, uncorr_ampl, maxA;
387 bool leakCorrApplied;
410 float time = -9999.f;
426 double amp_fC, ampl, uncorr_ampl, maxA;
428 bool leakCorrApplied;
451 float time = -9999.f;
465 static const float low32[7] = {0.741, 0.721, 0.730, 0.698, 0.708, 0.751, 0.861};
466 static const float high32[7] = {0.973, 0.925, 0.900, 0.897, 0.950, 0.935, 1};
467 static const float low6[15] = {
468 0.635, 0.623, 0.670, 0.633, 0.644, 0.648, 0.600, 0.570, 0.595, 0.554, 0.505, 0.513, 0.515, 0.561, 0.579};
469 static const float high6[15] = {
470 0.875, 0.937, 0.942, 0.900, 0.922, 0.925, 0.901, 0.850, 0.852, 0.818, 0.731, 0.717, 0.782, 0.853, 0.778};
472 double slope, mid, en;
475 if (!(
iphi == 6 && ieta < 0 && ieta > -16) && !(
iphi == 32 && ieta < 0 && ieta > -8))
479 double xeta = (double)
ieta;
487 mid = 17.14 + 0.7147 * xeta;
492 }
else if (
iphi == 6 && runnum < 216091) {
494 mid = 15.96 + 0.3075 * xeta;
void setAuxEnergy(HcalRecHit &h, float e)
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
constexpr HcalDetId const & id() const
unique_ptr< ClusterSequence > cs
static const float wpksamp0_hbheho
void removePileup(const Digi &digi, const HcalCoder &coder, const HcalCalibrations &calibs, const int ifirst, const int n, const bool pulseCorrect, const HcalPulseContainmentCorrection *corr, const AbsOOTPileupCorrection *pileupCorrection, const BunchXParameter *bxInfo, const unsigned lenInfo, double *p_maxA, double *p_ampl, double *p_uncorr_ampl, double *p_fc_ampl, int *p_nRead, int *p_maxI, bool *leakCorrApplied, float *p_t0, float *p_t2)
void setBXInfo(const BunchXParameter *info, unsigned lenInfo)
void setHFPileupCorrection(std::shared_ptr< AbsOOTPileupCorrection > corr)
void beginRun(edm::EventSetup const &es)
static float timeshift_ns_hf(float wpksamp)
Timeshift correction for the HF PMTs.
float recoHFTime(const Digi &digi, const int maxI, const double amp_fC, const bool slewCorrect, double maxA, float t0, float t2)
static const int MAXSAMPLES
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...
constexpr double MaximumFractionalError
std::unique_ptr< HcalPulseContainmentManager > pulseCorr_
static float leakCorr(double energy)
Leak correction.
unsigned lenBunchCrossingInfo_
static const float wpksamp0_hf
const BunchXParameter * bunchCrossingInfo_
static const float actual_ns_hbheho[num_bins_hbheho]
constexpr double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
constexpr double timecorr() const
get time correction factor
static const int num_bins_hf
void initPulseCorr(int toadd)
static const int num_bins_hbheho
virtual bool inputIsEnergy() const =0
HFRecHit reconstructQIE10(const QIE10DataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
RecHit reco(const Digi &digi, const HcalCoder &coder, const HcalCalibrations &calibs, const int ifirst, const int n, const bool slewCorrect, const bool pulseCorrect, const HcalPulseContainmentCorrection *corr, const HcalTimeSlew::BiasSetting slewFlavor, const int runnum, const bool useLeak, const AbsOOTPileupCorrection *pileupCorrection, const BunchXParameter *bxInfo, const unsigned lenInfo, const int puCorrMethod, const HcalTimeSlew *hcalTimeSlew_delay_)
void setRecoParams(bool correctForTimeslew, bool correctForPulse, bool setLeakCorrection, int pileupCleaningID, float phaseNS)
float timeshift_ns_hbheho(float wpksamp)
HcalSimpleRecAlgo(bool correctForTimeslew, bool correctForContainment, float fixedPhaseNs)
constexpr double pedestal(int fCapId) const
get pedestal for capid=0..3
void setHOPileupCorrection(std::shared_ptr< AbsOOTPileupCorrection > corr)
void setRawEnergy(HcalRecHit &h, float e)
std::shared_ptr< AbsOOTPileupCorrection > hoPileupCorr_
const HcalTimeSlew * hcalTimeSlew_delay_
static const float actual_ns_hf[num_bins_hf]
std::shared_ptr< AbsOOTPileupCorrection > hfPileupCorr_
static const double slope[3]
constexpr HcalDetId const & id() const
constexpr edm::DataFrame::id_type id() const
HFRecHit reconstruct(const HFDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
const HcalCalibDetId & id() const
virtual void apply(const HcalDetId &id, const double *inputCharge, unsigned lenInputCharge, const BunchXParameter *bcParams, unsigned lenBcParams, unsigned firstTimeSlice, unsigned nTimeSlices, double *correctedCharge, unsigned lenCorrectedCharge, bool *pulseShapeCorrApplied, bool *leakCorrApplied, bool *readjustTiming) const =0
float hbminus_special_ecorr(int ieta, int iphi, double energy, int runnum)
Ugly hack to apply energy corrections to some HB- cells.