12 correctForTimeslew_(correctForTimeslew),
13 correctForPulse_(correctForPulse),
14 phaseNS_(phaseNS), setForData_(
false), setLeakCorrection_(
false)
17 pulseCorr_ = std::auto_ptr<HcalPulseContainmentManager>(
24 correctForTimeslew_(
false), setForData_(
false) { }
65 static float eCorr(
int ieta,
int iphi,
double ampl);
70 namespace HcalSimpleRecAlgoImpl {
71 template<
class Digi,
class RecHit>
78 double ampl=0;
int maxI = -1;
double maxA = -1e10;
float ta=0;
80 for (
int i=ifirst;
i<tool.
size() &&
i<n+ifirst;
i++) {
81 int capid=digi[
i].capid();
94 if(maxI==0 || maxI==(tool.
size()-1)) {
95 LogDebug(
"HCAL Pulse") <<
"HcalSimpleRecAlgo::reconstruct :"
96 <<
" Invalid max amplitude position, "
97 <<
" max Amplitude: "<< maxI
99 <<
" last: "<<(tool.
size()-1)
102 int capid=digi[maxI-1].capid();
104 capid=digi[maxI+1].capid();
109 if (maxA<minA) minA=maxA;
110 if (t2<minA) minA=t2;
111 if (minA<0) { maxA-=minA; t0-=minA; t2-=minA; }
113 float wpksamp = (t0 + maxA + t2);
114 if (wpksamp!=0) wpksamp=(maxA + 2.0*t2) / wpksamp;
116 if (corr!=0 && pulseCorrect ) {
146 int ieta = cell.
ieta();
147 int iphi = cell.iphi();
148 ampl *=
eCorr(ieta,iphi,ampl);
157 return RecHit(digi.id(),ampl,
time);
162 return HcalSimpleRecAlgoImpl::reco<HBHEDataFrame,HBHERecHit>(digi,coder,calibs,
170 return HcalSimpleRecAlgoImpl::reco<HODataFrame,HORecHit>(digi,coder,calibs,
178 return HcalSimpleRecAlgoImpl::reco<HcalCalibDataFrame,HcalCalibRecHit>(digi,coder,calibs,
192 double ampl=0;
int maxI = -1;
double maxA = -1e10;
float ta=0;
float amp_fC=0;
193 for (
int i=first;
i<tool.
size() &&
i<first+toadd;
i++) {
194 int capid=digi[
i].capid();
197 amp_fC += tool[
i]-calibs.
pedestal(capid);
206 if(maxI==0 || maxI==(tool.
size()-1)) {
207 LogDebug(
"HCAL Pulse") <<
"HcalSimpleRecAlgo::reconstruct :"
208 <<
" Invalid max amplitude position, "
209 <<
" max Amplitude: "<< maxI
210 <<
" first: "<< first
211 <<
" last: "<<(tool.
size()-1)
214 int capid=digi[maxI-1].capid();
216 capid=digi[maxI+1].capid();
231 if (wpksamp != 0.
f) wpksamp = maxA/wpksamp;
234 if (wpksamp != 0.
f) wpksamp = 1.+(t2/wpksamp);
262 double tslew=
exp(0.337681-5.94689
e-4*amp_fC)+
exp(2.44628-1.34888
e-2*amp_fC);
263 time -= (float)tslew;
277 static const float low32[7] = {0.741,0.721,0.730,0.698,0.708,0.751,0.861};
278 static const float high32[7] = {0.973,0.925,0.900,0.897,0.950,0.935,1};
279 static const float low6[15] = {0.635,0.623,0.670,0.633,0.644,0.648,0.600,
280 0.570,0.595,0.554,0.505,0.513,0.515,0.561,0.579};
281 static const float high6[15] = {0.875,0.937,0.942,0.900,0.922,0.925,0.901,
282 0.850,0.852,0.818,0.731,0.717,0.782,0.853,0.778};
285 double slope, mid, en;
288 if (!(iphi==6 && ieta<0 && ieta>-16) && !(iphi==32 && ieta<0 && ieta>-8))
292 double xeta = (double) ieta;
293 if (energy > 0.) en=
energy;
298 mid = 17.14 + 0.7147*xeta;
299 if (en > 100.) corr = high32[jeta];
300 else corr = low32[jeta]+(high32[jeta]-low32[jeta])/(1.0+
exp(-(en-mid)*
slope));
302 else if (iphi == 6) {
304 mid = 15.96 + 0.3075*xeta;
305 if (en > 100.0) corr = high6[jeta];
306 else corr = low6[jeta]+(high6[jeta]-low6[jeta])/(1.0+
exp(-(en-mid)*slope));
394 int index = (int)flx;
404 yval = y1 + (y2-y1)*(flx-(
float)
index);
518 int index = (int)flx;
531 yval = y1 + (y2-y1)*(flx-(
float)
index);
static const float actual_ns_hf[num_bins_hf]
HBHERecHit reconstruct(const HBHEDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
static float timeshift_ns_hf(float wpksamp)
Same as above, but for the HF PMTs.
double getCorrection(double fc_ampl) const
void beginRun(edm::EventSetup const &es)
static const double slope[3]
double pedestal(int fCapId) const
get pedestal for capid=0..3
static const float wpksamp0_hbheho
static const float wpksamp0_hf
static const float actual_ns_hbheho[num_bins_hbheho]
const T & max(const T &a, const T &b)
int ieta() const
get the cell ieta
void initPulseCorr(int toadd)
static float leakCorr(double energy)
Leak correction.
std::auto_ptr< HcalPulseContainmentManager > pulseCorr_
static float timeshift_ns_hbheho(float wpksamp)
static float eCorr(int ieta, int iphi, double ampl)
Ugly hack to apply energy corrections to some HB- cells.
void setRecoParams(bool correctForTimeslew, bool correctForPulse, bool setLeakCorrection, int pileupCleaningID, float phaseNS)
constexpr double MaximumFractionalError
int size() const
get the size
double timecorr() const
get time correction factor
static const int num_bins_hf
static const int num_bins_hbheho
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
int presamples() const
number of samples before the sample from the triggered beam crossing (according to the hardware) ...
const HcalDetId & id() const
RecHit reco(const Digi &digi, const HcalCoder &coder, const HcalCalibrations &calibs, int ifirst, int n, bool slewCorrect, bool pulseCorrect, const HcalPulseContainmentCorrection *corr, HcalTimeSlew::BiasSetting slewFlavor, bool forData, bool useLeak)
static double delay(double fC, BiasSetting bias=Medium)
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...