13 correctForTimeslew_(correctForTimeslew),
14 correctForPulse_(correctForPulse),
15 phaseNS_(phaseNS), setForData_(
false), setLeakCorrection_(
false)
18 pulseCorr_ = std::auto_ptr<HcalPulseContainmentManager>(
25 correctForTimeslew_(
false), setForData_(
false) { }
66 static float eCorr(
int ieta,
int iphi,
double ampl);
71 namespace HcalSimpleRecAlgoImpl {
72 template<
class Digi,
class RecHit>
79 double ampl=0;
int maxI = -1;
double maxA = -1e10;
float ta=0;
81 for (
int i=ifirst;
i<tool.
size() &&
i<n+ifirst;
i++) {
82 int capid=digi[
i].capid();
95 if(maxI==0 || maxI==(tool.
size()-1)) {
96 LogDebug(
"HCAL Pulse") <<
"HcalSimpleRecAlgo::reconstruct :"
97 <<
" Invalid max amplitude position, "
98 <<
" max Amplitude: "<< maxI
100 <<
" last: "<<(tool.
size()-1)
103 int capid=digi[maxI-1].capid();
105 capid=digi[maxI+1].capid();
110 if (maxA<minA) minA=maxA;
111 if (t2<minA) minA=
t2;
112 if (minA<0) { maxA-=minA; t0-=minA; t2-=minA; }
114 float wpksamp = (t0 + maxA +
t2);
115 if (wpksamp!=0) wpksamp=(maxA + 2.0*
t2) / wpksamp;
117 if (corr!=0 && pulseCorrect ) {
147 int ieta = cell.
ieta();
148 int iphi = cell.iphi();
149 ampl *=
eCorr(ieta,iphi,ampl);
158 return RecHit(digi.id(),ampl,
time);
163 return HcalSimpleRecAlgoImpl::reco<HBHEDataFrame,HBHERecHit>(digi,coder,calibs,
171 return HcalSimpleRecAlgoImpl::reco<HODataFrame,HORecHit>(digi,coder,calibs,
179 return HcalSimpleRecAlgoImpl::reco<HcalCalibDataFrame,HcalCalibRecHit>(digi,coder,calibs,
198 HBHERecHit result = HcalSimpleRecAlgoImpl::reco<HcalUpgradeDataFrame,HBHERecHit>( digi, coder, calibs,
first, toadd,
correctForTimeslew_,
correctForPulse_,
pulseCorr_->get(digi.id(), toadd,
phaseNS_),
HcalTimeSlew::Medium,
false,
false);
212 double ampl=0;
int maxI = -1;
double maxA = -1e10;
float ta=0;
float amp_fC=0;
213 for (
int i=first;
i<tool.
size() &&
i<first+toadd;
i++) {
214 int capid=digi[
i].capid();
217 amp_fC += tool[
i]-calibs.
pedestal(capid);
226 if(maxI==0 || maxI==(tool.
size()-1)) {
227 LogDebug(
"HCAL Pulse") <<
"HcalSimpleRecAlgo::reconstruct :"
228 <<
" Invalid max amplitude position, "
229 <<
" max Amplitude: "<< maxI
230 <<
" first: "<< first
231 <<
" last: "<<(tool.
size()-1)
234 int capid=digi[maxI-1].capid();
236 capid=digi[maxI+1].capid();
251 if (wpksamp != 0.
f) wpksamp = maxA/wpksamp;
254 if (wpksamp != 0.
f) wpksamp = 1.+(t2/wpksamp);
282 double tslew=
exp(0.337681-5.94689
e-4*amp_fC)+
exp(2.44628-1.34888
e-2*amp_fC);
283 time -= (float)tslew;
301 double ampl=0;
int maxI = -1;
double maxA = -1e10;
float ta=0;
float amp_fC=0;
302 for (
int i=first;
i<tool.
size() &&
i<first+toadd;
i++) {
303 int capid=digi[
i].capid();
306 amp_fC += tool[
i]-calibs.
pedestal(capid);
315 if(maxI==0 || maxI==(tool.
size()-1)) {
316 LogDebug(
"HCAL Pulse") <<
"HcalSimpleRecAlgo::reconstruct :"
317 <<
" Invalid max amplitude position, "
318 <<
" max Amplitude: "<< maxI
319 <<
" first: "<< first
320 <<
" last: "<<(tool.
size()-1)
323 int capid=digi[maxI-1].capid();
325 capid=digi[maxI+1].capid();
340 if (wpksamp != 0.
f) wpksamp = maxA/wpksamp;
343 if (wpksamp != 0.
f) wpksamp = 1.+(t2/wpksamp);
371 double tslew=
exp(0.337681-5.94689
e-4*amp_fC)+
exp(2.44628-1.34888
e-2*amp_fC);
372 time -= (float)tslew;
388 static const float low32[7] = {0.741,0.721,0.730,0.698,0.708,0.751,0.861};
389 static const float high32[7] = {0.973,0.925,0.900,0.897,0.950,0.935,1};
390 static const float low6[15] = {0.635,0.623,0.670,0.633,0.644,0.648,0.600,
391 0.570,0.595,0.554,0.505,0.513,0.515,0.561,0.579};
392 static const float high6[15] = {0.875,0.937,0.942,0.900,0.922,0.925,0.901,
393 0.850,0.852,0.818,0.731,0.717,0.782,0.853,0.778};
396 double slope, mid, en;
399 if (!(iphi==6 && ieta<0 && ieta>-16) && !(iphi==32 && ieta<0 && ieta>-8))
403 double xeta = (double) ieta;
404 if (energy > 0.) en=
energy;
409 mid = 17.14 + 0.7147*xeta;
410 if (en > 100.) corr = high32[jeta];
411 else corr = low32[jeta]+(high32[jeta]-low32[jeta])/(1.0+
exp(-(en-mid)*
slope));
413 else if (iphi == 6) {
415 mid = 15.96 + 0.3075*xeta;
416 if (en > 100.0) corr = high6[jeta];
417 else corr = low6[jeta]+(high6[jeta]-low6[jeta])/(1.0+
exp(-(en-mid)*slope));
505 int index = (int)flx;
515 yval = y1 + (y2-y1)*(flx-(
float)
index);
629 int index = (int)flx;
642 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)
auto const T2 &decltype(t1.eta()) t2
HFRecHit reconstructHFUpgrade(const HcalUpgradeDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
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
HBHERecHit reconstructHBHEUpgrade(const HcalUpgradeDataFrame &digi, int first, int toadd, const HcalCoder &coder, const HcalCalibrations &calibs) const
static const int num_bins_hf
const HcalDetId & id() const
static const int num_bins_hbheho
void reconstruct(const HcalUpgradeDataFrame &digi, HBHERecHit &recHit) const
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...