CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HcalPulseContainmentCorrection Class Reference

#include <HcalPulseContainmentCorrection.h>

Public Member Functions

double fractionContained (double fc_ampl) const
 
double getCorrection (double fc_ampl) const
 
 HcalPulseContainmentCorrection (int num_samples, float fixedphase_ns, float max_fracerror, const HcalTimeSlew *hcalTimeSlew_delay)
 Generate energy correction factors based on a predetermined phase of the hit + time slew. More...
 
 HcalPulseContainmentCorrection (const HcalPulseShape *shape, int num_samples, float fixedphase_ns, float max_fracerror, const HcalTimeSlew *hcalTimeSlew_delay)
 

Private Attributes

std::map< double, double > mCorFactors_
 

Detailed Description

Amplitude correction for pulse containment in time. Currently only for HPD pulse shape.

Author
P. Dudero - Minnesota

Definition at line 15 of file HcalPulseContainmentCorrection.h.

Constructor & Destructor Documentation

HcalPulseContainmentCorrection::HcalPulseContainmentCorrection ( int  num_samples,
float  fixedphase_ns,
float  max_fracerror,
const HcalTimeSlew hcalTimeSlew_delay 
)

Generate energy correction factors based on a predetermined phase of the hit + time slew.

Definition at line 17 of file HcalPulseContainmentCorrection.cc.

References mCorFactors_.

21 {
22  HcalPulseContainmentAlgo corFalgo(num_samples, (double)fixedphase_ns, hcalTimeSlew_delay);
23 
24  // Generate lookup map for the correction function, never exceeding
25  // a maximum fractional error for lookups.
26  //
27  // static const double max_recofc = 5000.0f; // HPD,
28  // max_recofc = 200000.0f; // SiPMs
29  genlkupmap<HcalPulseContainmentAlgo> (1.0, 200000.0f, // generation domain
30  max_fracerror, // maximum fractional error
31  1.0, // min_xstep = minimum true fC increment
32  corFalgo,
33  mCorFactors_); // return lookup map
34 }
HcalPulseContainmentCorrection::HcalPulseContainmentCorrection ( const HcalPulseShape shape,
int  num_samples,
float  fixedphase_ns,
float  max_fracerror,
const HcalTimeSlew hcalTimeSlew_delay 
)

Definition at line 37 of file HcalPulseContainmentCorrection.cc.

References mCorFactors_.

43 {
44  HcalPulseContainmentAlgo corFalgo(shape, num_samples, (double)fixedphase_ns, hcalTimeSlew_delay);
45  genlkupmap<HcalPulseContainmentAlgo> (1.0, 200000.0f, // generation domain
46  max_fracerror, // maximum fractional error
47  1.0, // min_xstep = minimum true fC increment
48  corFalgo,
49  mCorFactors_); // return lookup map
50 }

Member Function Documentation

double HcalPulseContainmentCorrection::fractionContained ( double  fc_ampl) const
inline

Definition at line 27 of file HcalPulseContainmentCorrection.h.

References getCorrection().

27 { return 1.0/this->getCorrection(fc_ampl); }
double getCorrection(double fc_ampl) const
double HcalPulseContainmentCorrection::getCorrection ( double  fc_ampl) const

Definition at line 52 of file HcalPulseContainmentCorrection.cc.

References gather_cfg::cout, mCorFactors_, and alignCSCRings::s.

Referenced by JetReCalibrator.JetReCalibrator::correct(), fractionContained(), ZdcSimpleRecAlgoImpl::reco1(), ZdcSimpleRecAlgoImpl::reco2(), and HcalSimpleRecAlgoImpl::removePileup().

53 {
54  double correction;
55 
56  std::map<double,double>::const_iterator fcupper,fclower;
57 
58  fcupper = mCorFactors_.upper_bound(fc_ampl);
59  fclower = fcupper;
60  fclower--;
61 
62  if (fcupper == mCorFactors_.end()) {
63  correction = fclower->second;
64  }
65  else if (fcupper == mCorFactors_.begin()) {
66  correction = fcupper->second;
67  }
68  else {
69  if (fabs(fclower->first - fc_ampl) <
70  fabs(fcupper->first - fc_ampl) )
71  correction = fclower->second;
72  else
73  correction = fcupper->second;
74  }
75 
76 #if 0
77  char s[80];
78  sprintf (s, "%7.1f (%8.5f %8.5f) (%8.5f %8.5f) %8.5f",
79  fc_ampl,
80  fclower->first, fclower->second,
81  fcupper->first, fcupper->second,
82  correction);
83  cout << s << endl;
84 #endif
85 
86  return correction;
87 }

Member Data Documentation

std::map<double,double> HcalPulseContainmentCorrection::mCorFactors_
private