CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
HcalSimpleRecAlgoImpl Namespace Reference

Functions

template<class Digi , class RecHit >
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 PulseShapeFitOOTPileupCorrection *psFitOOTpuCorr, HcalDeterministicFit *hltOOTpuCorr, PedestalSub *hltPedSub)
 
template<class Digi , class RecHit >
RecHit recoHBHE (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 PulseShapeFitOOTPileupCorrection *psFitOOTpuCorr, HcalDeterministicFit *hltOOTpuCorr, PedestalSub *hltPedSub)
 
template<class Digi >
float recoHFTime (const Digi &digi, const int maxI, const double amp_fC, const bool slewCorrect, double maxA, float t0, float t2)
 
template<class Digi >
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)
 

Function Documentation

template<class Digi , class RecHit >
RecHit HcalSimpleRecAlgoImpl::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 PulseShapeFitOOTPileupCorrection psFitOOTpuCorr,
HcalDeterministicFit hltOOTpuCorr,
PedestalSub hltPedSub 
)
inline

Definition at line 313 of file HcalSimpleRecAlgo.cc.

References HcalCoder::adc2fC(), HcalDeterministicFit::apply(), PulseShapeFitOOTPileupCorrection::apply(), fwrapper::cs, HcalTimeSlew::delay(), eCorr(), HcalBarrel, HcalDetId::ieta(), HcalDetId::iphi(), leakCorr(), bookConverter::max, findQualityFiles::maxI, removePileup(), setAuxEnergy(), setRawEnergy(), CaloSamples::size(), HcalDetId::subdet(), reco::t2, HcalCalibrations::timecorr(), and timeshift_ns_hbheho().

321  {
322  double fc_ampl =0, ampl =0, uncorr_ampl =0, m3_ampl =0, maxA = -1.e300;
323  int nRead = 0, maxI = -1;
324  bool leakCorrApplied = false;
325  float t0 =0, t2 =0;
326  float time = -9999;
327 
328 // Disable method 1 inside the removePileup function this way!
329 // Some code in removePileup does NOT do pileup correction & to make sure maximum share of code
330  const AbsOOTPileupCorrection * inputAbsOOTpuCorr = ( puCorrMethod == 1 ? pileupCorrection: 0 );
331 
332  removePileup(digi, coder, calibs, ifirst, n,
333  pulseCorrect, corr, inputAbsOOTpuCorr,
334  bxInfo, lenInfo, &maxA, &ampl,
335  &uncorr_ampl, &fc_ampl, &nRead, &maxI,
336  &leakCorrApplied, &t0, &t2);
337 
338  if (maxI > 0 && maxI < (nRead - 1))
339  {
340  // Handle negative excursions by moving "zero":
341  float minA=t0;
342  if (maxA<minA) minA=maxA;
343  if (t2<minA) minA=t2;
344  if (minA<0) { maxA-=minA; t0-=minA; t2-=minA; } // positivizes all samples
345 
346  float wpksamp = (t0 + maxA + t2);
347  if (wpksamp!=0) wpksamp=(maxA + 2.0*t2) / wpksamp;
348  time = (maxI - digi.presamples())*25.0 + timeshift_ns_hbheho(wpksamp);
349 
350  if (slewCorrect) time-=HcalTimeSlew::delay(std::max(1.0,fc_ampl),slewFlavor);
351 
352  time=time-calibs.timecorr(); // time calibration
353  }
354 
355  // Note that uncorr_ampl is always set from outside of method 2!
356  if( puCorrMethod == 2 ){
357  std::vector<double> correctedOutput;
358 
359  CaloSamples cs;
360  coder.adc2fC(digi,cs);
361  std::vector<int> capidvec;
362  for(int ip=0; ip<cs.size(); ip++){
363  const int capid = digi[ip].capid();
364  capidvec.push_back(capid);
365  }
366  psFitOOTpuCorr->apply(cs, capidvec, calibs, correctedOutput);
367  if( correctedOutput.back() == 0 && correctedOutput.size() >1 ){
368  time = correctedOutput[1]; ampl = correctedOutput[0];
369  }
370  }
371 
372  // S. Brandt - Feb 19th : Adding Section for HLT
373  // Run "Method 3" all the time.
374  {
375  std::vector<double> hltCorrOutput;
376 
377  CaloSamples cs;
378  coder.adc2fC(digi,cs);
379  std::vector<int> capidvec;
380  for(int ip=0; ip<cs.size(); ip++){
381  const int capid = digi[ip].capid();
382  capidvec.push_back(capid);
383  }
384  hltOOTpuCorr->apply(cs, capidvec, calibs, digi, hltCorrOutput);
385  if( hltCorrOutput.size() > 1 ){
386  m3_ampl = hltCorrOutput[0];
387  if (puCorrMethod == 3) {
388  time = hltCorrOutput[1]; ampl = hltCorrOutput[0];
389  }
390  }
391  }
392 
393  // Temporary hack to apply energy-dependent corrections to some HB- cells
394  if (runnum > 0) {
395  const HcalDetId& cell = digi.id();
396  if (cell.subdet() == HcalBarrel) {
397  const int ieta = cell.ieta();
398  const int iphi = cell.iphi();
399  uncorr_ampl *= eCorr(ieta, iphi, uncorr_ampl, runnum);
400  ampl *= eCorr(ieta, iphi, ampl, runnum);
401  m3_ampl *= eCorr(ieta, iphi, m3_ampl, runnum);
402  }
403  }
404 
405  // Correction for a leak to pre-sample
406  if(useLeak && !leakCorrApplied) {
407  uncorr_ampl *= leakCorr(uncorr_ampl);
408  if (puCorrMethod < 2)
409  ampl *= leakCorr(ampl);
410  }
411 
412  RecHit rh(digi.id(),ampl,time);
413  setRawEnergy(rh, static_cast<float>(uncorr_ampl));
414  setAuxEnergy(rh, static_cast<float>(m3_ampl));
415  return rh;
416  }
void apply(const CaloSamples &cs, const std::vector< int > &capidvec, const HcalCalibrations &calibs, const Digi &digi, std::vector< double > &Output) const
auto_ptr< ClusterSequence > cs
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
void setRawEnergy(HcalRecHit &h, float e)
Definition: rawEnergy.h:215
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:16
tuple puCorrMethod
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
static float leakCorr(double energy)
Leak correction.
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)
static float timeshift_ns_hbheho(float wpksamp)
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:101
int size() const
get the size
Definition: CaloSamples.h:24
double timecorr() const
get time correction factor
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
void apply(const CaloSamples &cs, const std::vector< int > &capidvec, const HcalCalibrations &calibs, std::vector< double > &correctedOutput) const
tuple runnum
Definition: summaryLumi.py:210
static float eCorr(int ieta, int iphi, double ampl, int runnum)
Ugly hack to apply energy corrections to some HB- cells.
void setAuxEnergy(HcalRecHit &h, float e)
Definition: rawEnergy.h:232
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...
Definition: HcalTimeSlew.cc:12
template<class Digi , class RecHit >
RecHit HcalSimpleRecAlgoImpl::recoHBHE ( 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 PulseShapeFitOOTPileupCorrection psFitOOTpuCorr,
HcalDeterministicFit hltOOTpuCorr,
PedestalSub hltPedSub 
)
inline

Definition at line 419 of file HcalSimpleRecAlgo.cc.

References HcalCoder::adc2fC(), HcalDeterministicFit::apply(), PulseShapeFitOOTPileupCorrection::apply(), fwrapper::cs, HcalTimeSlew::delay(), eCorr(), HcalCaloFlagLabels::HBHEPulseFitBit, HcalBarrel, HcalDetId::ieta(), HcalDetId::iphi(), leakCorr(), bookConverter::max, findQualityFiles::maxI, removePileup(), setAuxEnergy(), CaloRecHit::setFlagField(), setRawEnergy(), CaloSamples::size(), HcalDetId::subdet(), reco::t2, HcalCalibrations::timecorr(), and timeshift_ns_hbheho().

427  {
428  double fc_ampl =0, ampl =0, uncorr_ampl =0, m3_ampl =0, maxA = -1.e300;
429  int nRead = 0, maxI = -1;
430  bool leakCorrApplied = false;
431  float t0 =0, t2 =0;
432  float time = -9999;
433  bool useTriple = false;
434 
435  // Disable method 1 inside the removePileup function this way!
436  // Some code in removePileup does NOT do pileup correction & to make sure maximum share of code
437  const AbsOOTPileupCorrection * inputAbsOOTpuCorr = ( puCorrMethod == 1 ? pileupCorrection: 0 );
438 
439  removePileup(digi, coder, calibs, ifirst, n,
440  pulseCorrect, corr, inputAbsOOTpuCorr,
441  bxInfo, lenInfo, &maxA, &ampl,
442  &uncorr_ampl, &fc_ampl, &nRead, &maxI,
443  &leakCorrApplied, &t0, &t2);
444 
445  if (maxI > 0 && maxI < (nRead - 1))
446  {
447  // Handle negative excursions by moving "zero":
448  float minA=t0;
449  if (maxA<minA) minA=maxA;
450  if (t2<minA) minA=t2;
451  if (minA<0) { maxA-=minA; t0-=minA; t2-=minA; } // positivizes all samples
452 
453  float wpksamp = (t0 + maxA + t2);
454  if (wpksamp!=0) wpksamp=(maxA + 2.0*t2) / wpksamp;
455  time = (maxI - digi.presamples())*25.0 + timeshift_ns_hbheho(wpksamp);
456 
457  if (slewCorrect) time-=HcalTimeSlew::delay(std::max(1.0,fc_ampl),slewFlavor);
458 
459  time=time-calibs.timecorr(); // time calibration
460  }
461 
462  // Note that uncorr_ampl is always set from outside of method 2!
463  if( puCorrMethod == 2 ){
464  std::vector<double> correctedOutput;
465 
466  CaloSamples cs;
467  coder.adc2fC(digi,cs);
468  std::vector<int> capidvec;
469  for(int ip=0; ip<cs.size(); ip++){
470  const int capid = digi[ip].capid();
471  capidvec.push_back(capid);
472  }
473  psFitOOTpuCorr->apply(cs, capidvec, calibs, correctedOutput);
474  if( correctedOutput.back() == 0 && correctedOutput.size() >1 ){
475  time = correctedOutput[1]; ampl = correctedOutput[0];
476  useTriple = correctedOutput[4];
477  }
478  }
479 
480  // S. Brandt - Feb 19th : Adding Section for HLT
481  // Run "Method 3" all the time.
482  {
483  std::vector<double> hltCorrOutput;
484 
485  CaloSamples cs;
486  coder.adc2fC(digi,cs);
487  std::vector<int> capidvec;
488  for(int ip=0; ip<cs.size(); ip++){
489  const int capid = digi[ip].capid();
490  capidvec.push_back(capid);
491  }
492  hltOOTpuCorr->apply(cs, capidvec, calibs, digi, hltCorrOutput);
493  if (hltCorrOutput.size() > 1) {
494  m3_ampl = hltCorrOutput[0];
495  if (puCorrMethod == 3) {
496  time = hltCorrOutput[1]; ampl = hltCorrOutput[0];
497  }
498  }
499  }
500 
501  // Temporary hack to apply energy-dependent corrections to some HB- cells
502  if (runnum > 0) {
503  const HcalDetId& cell = digi.id();
504  if (cell.subdet() == HcalBarrel) {
505  const int ieta = cell.ieta();
506  const int iphi = cell.iphi();
507  uncorr_ampl *= eCorr(ieta, iphi, uncorr_ampl, runnum);
508  ampl *= eCorr(ieta, iphi, ampl, runnum);
509  m3_ampl *= eCorr(ieta, iphi, m3_ampl, runnum);
510  }
511  }
512 
513  // Correction for a leak to pre-sample
514  if(useLeak && !leakCorrApplied) {
515  uncorr_ampl *= leakCorr(uncorr_ampl);
516  if (puCorrMethod < 2)
517  ampl *= leakCorr(ampl);
518  }
519 
520  HBHERecHit rh(digi.id(),ampl,time);
521  if(useTriple)
522  {
524  }
525  setRawEnergy(rh, static_cast<float>(uncorr_ampl));
526  setAuxEnergy(rh, static_cast<float>(m3_ampl));
527  return rh;
528  }
void apply(const CaloSamples &cs, const std::vector< int > &capidvec, const HcalCalibrations &calibs, const Digi &digi, std::vector< double > &Output) const
auto_ptr< ClusterSequence > cs
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
void setFlagField(uint32_t value, int base, int width=1)
Definition: CaloRecHit.cc:20
void setRawEnergy(HcalRecHit &h, float e)
Definition: rawEnergy.h:215
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:16
tuple puCorrMethod
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
static float leakCorr(double energy)
Leak correction.
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)
static float timeshift_ns_hbheho(float wpksamp)
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:101
int size() const
get the size
Definition: CaloSamples.h:24
double timecorr() const
get time correction factor
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
void apply(const CaloSamples &cs, const std::vector< int > &capidvec, const HcalCalibrations &calibs, std::vector< double > &correctedOutput) const
tuple runnum
Definition: summaryLumi.py:210
static float eCorr(int ieta, int iphi, double ampl, int runnum)
Ugly hack to apply energy corrections to some HB- cells.
void setAuxEnergy(HcalRecHit &h, float e)
Definition: rawEnergy.h:232
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...
Definition: HcalTimeSlew.cc:12
template<class Digi >
float HcalSimpleRecAlgoImpl::recoHFTime ( const Digi &  digi,
const int  maxI,
const double  amp_fC,
const bool  slewCorrect,
double  maxA,
float  t0,
float  t2 
)
inline

Definition at line 129 of file HcalSimpleRecAlgo.cc.

References alignCSCRings::e, create_public_lumi_plots::exp, f, min(), reco::t2, and timeshift_ns_hf().

Referenced by HcalSimpleRecAlgo::reconstruct(), HcalSimpleRecAlgo::reconstructHFUpgrade(), and HcalSimpleRecAlgo::reconstructQIE10().

131  {
132  // Handle negative excursions by moving "zero":
133  float zerocorr=std::min(t0,t2);
134  if (zerocorr<0.f) {
135  t0 -= zerocorr;
136  t2 -= zerocorr;
137  maxA -= zerocorr;
138  }
139 
140  // pair the peak with the larger of the two neighboring time samples
141  float wpksamp=0.f;
142  if (t0>t2) {
143  wpksamp = t0+maxA;
144  if (wpksamp != 0.f) wpksamp = maxA/wpksamp;
145  } else {
146  wpksamp = maxA+t2;
147  if (wpksamp != 0.f) wpksamp = 1.+(t2/wpksamp);
148  }
149 
150  float time = (maxI - digi.presamples())*25.0 + timeshift_ns_hf(wpksamp);
151 
152  if (slewCorrect && amp_fC > 0.0) {
153  // -5.12327 - put in calibs.timecorr()
154  double tslew=exp(0.337681-5.94689e-4*amp_fC)+exp(2.44628-1.34888e-2*amp_fC);
155  time -= (float)tslew;
156  }
157 
158  return time;
159  }
static float timeshift_ns_hf(float wpksamp)
Same as above, but for the HF PMTs.
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:16
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
template<class Digi >
void HcalSimpleRecAlgoImpl::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 
)
inline

Definition at line 163 of file HcalSimpleRecAlgo.cc.

References HcalCoder::adc2fC(), AbsOOTPileupCorrection::apply(), fwrapper::cs, HcalPulseContainmentCorrection::getCorrection(), i, AbsOOTPileupCorrection::inputIsEnergy(), LogDebug, bookConverter::max, findQualityFiles::maxI, CaloSamples::MAXSAMPLES, min(), gen::n, HcalCalibrations::pedestal(), HcalCalibrations::respcorrgain(), and CaloSamples::size().

Referenced by reco(), recoHBHE(), HcalSimpleRecAlgo::reconstruct(), HcalSimpleRecAlgo::reconstructHFUpgrade(), and HcalSimpleRecAlgo::reconstructQIE10().

173  {
174  CaloSamples cs;
175  coder.adc2fC(digi,cs);
176  const int nRead = cs.size();
177  const int iStop = std::min(nRead, n + ifirst);
178 
179  // Signal energy will be calculated both with
180  // and without OOT pileup corrections. Try to
181  // arrange the calculations so that we do not
182  // repeat them.
183  double uncorrectedEnergy[CaloSamples::MAXSAMPLES] {}, buf[CaloSamples::MAXSAMPLES] {};
184  double* correctedEnergy = 0;
185  double fc_ampl = 0.0, corr_fc_ampl = 0.0;
186  bool pulseShapeCorrApplied = false, readjustTiming = false;
187  *leakCorrApplied = false;
188 
189  if (pileupCorrection)
190  {
191  correctedEnergy = &buf[0];
192 
193  double correctionInput[CaloSamples::MAXSAMPLES] {};
194  double gains[CaloSamples::MAXSAMPLES] {};
195 
196  for (int i=0; i<nRead; ++i)
197  {
198  const int capid = digi[i].capid();
199  correctionInput[i] = cs[i] - calibs.pedestal(capid);
200  gains[i] = calibs.respcorrgain(capid);
201  }
202 
203  for (int i=ifirst; i<iStop; ++i)
204  fc_ampl += correctionInput[i];
205 
206  const bool useGain = pileupCorrection->inputIsEnergy();
207  for (int i=0; i<nRead; ++i)
208  {
209  uncorrectedEnergy[i] = correctionInput[i]*gains[i];
210  if (useGain)
211  correctionInput[i] = uncorrectedEnergy[i];
212  }
213 
214  pileupCorrection->apply(digi.id(), correctionInput, nRead,
215  bxInfo, lenInfo, ifirst, n,
216  correctedEnergy, CaloSamples::MAXSAMPLES,
217  &pulseShapeCorrApplied, leakCorrApplied,
218  &readjustTiming);
219  if (useGain)
220  {
221  // Gain factors have been already applied.
222  // Divide by them for accumulating corr_fc_ampl.
223  for (int i=ifirst; i<iStop; ++i)
224  if (gains[i])
225  corr_fc_ampl += correctedEnergy[i]/gains[i];
226  }
227  else
228  {
229  for (int i=ifirst; i<iStop; ++i)
230  corr_fc_ampl += correctedEnergy[i];
231  for (int i=0; i<nRead; ++i)
232  correctedEnergy[i] *= gains[i];
233  }
234  }
235  else
236  {
237  correctedEnergy = &uncorrectedEnergy[0];
238 
239  // In this situation, we do not need to process all time slices
240  const int istart = std::max(ifirst - 1, 0);
241  const int iend = std::min(n + ifirst + 1, nRead);
242  for (int i=istart; i<iend; ++i)
243  {
244  const int capid = digi[i].capid();
245  float ta = cs[i] - calibs.pedestal(capid);
246  if (i >= ifirst && i < iStop)
247  fc_ampl += ta;
248  ta *= calibs.respcorrgain(capid);
249  uncorrectedEnergy[i] = ta;
250  }
251  corr_fc_ampl = fc_ampl;
252  }
253 
254  // Uncorrected and corrected energies
255  double ampl = 0.0, corr_ampl = 0.0;
256  for (int i=ifirst; i<iStop; ++i)
257  {
258  ampl += uncorrectedEnergy[i];
259  corr_ampl += correctedEnergy[i];
260  }
261 
262  // Apply phase-based amplitude correction:
263  if (corr && pulseCorrect)
264  {
265  ampl *= corr->getCorrection(fc_ampl);
266  if (pileupCorrection)
267  {
268  if (!pulseShapeCorrApplied)
269  corr_ampl *= corr->getCorrection(corr_fc_ampl);
270  }
271  else
272  corr_ampl = ampl;
273  }
274 
275  // Which energies we want to use for timing?
276  const double *etime = readjustTiming ? &correctedEnergy[0] : &uncorrectedEnergy[0];
277  int maxI = -1; double maxA = -1.e300;
278  for (int i=ifirst; i<iStop; ++i)
279  if (etime[i] > maxA)
280  {
281  maxA = etime[i];
282  maxI = i;
283  }
284 
285  // Fill out the output
286  *p_maxA = maxA;
287  *p_ampl = corr_ampl;
288  *p_uncorr_ampl = ampl;
289  *p_fc_ampl = readjustTiming ? corr_fc_ampl : fc_ampl;
290  *p_nRead = nRead;
291  *p_maxI = maxI;
292 
293  if (maxI <= 0 || maxI >= (nRead-1))
294  {
295  LogDebug("HCAL Pulse") << "HcalSimpleRecAlgoImpl::removePileup :"
296  << " Invalid max amplitude position, "
297  << " max Amplitude: " << maxI
298  << " first: " << ifirst
299  << " last: " << ifirst + n
300  << std::endl;
301  *p_t0 = 0.f;
302  *p_t2 = 0.f;
303  }
304  else
305  {
306  *p_t0 = etime[maxI - 1];
307  *p_t2 = etime[maxI + 1];
308  }
309  }
#define LogDebug(id)
virtual bool inputIsEnergy() const =0
int i
Definition: DBlmapReader.cc:9
double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
auto_ptr< ClusterSequence > cs
static const int MAXSAMPLES
Definition: CaloSamples.h:73
double getCorrection(double fc_ampl) const
double pedestal(int fCapId) const
get pedestal for capid=0..3
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
T min(T a, T b)
Definition: MathUtil.h:58
int size() const
get the size
Definition: CaloSamples.h:24
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0