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, bool phaseAsInSim, 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, bool phaseAsInSim, 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() [1/2]

HcalPulseContainmentCorrection::HcalPulseContainmentCorrection ( int  num_samples,
float  fixedphase_ns,
bool  phaseAsInSim,
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, phaseAsInSim, 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,
30  200000.0f, // generation domain
31  max_fracerror, // maximum fractional error
32  1.0, // min_xstep = minimum true fC increment
33  corFalgo,
34  mCorFactors_); // return lookup map
35 }

◆ HcalPulseContainmentCorrection() [2/2]

HcalPulseContainmentCorrection::HcalPulseContainmentCorrection ( const HcalPulseShape shape,
int  num_samples,
float  fixedphase_ns,
bool  phaseAsInSim,
float  max_fracerror,
const HcalTimeSlew hcalTimeSlew_delay 
)

Definition at line 38 of file HcalPulseContainmentCorrection.cc.

References mCorFactors_, and l1trig_cff::shape.

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

Member Function Documentation

◆ fractionContained()

double HcalPulseContainmentCorrection::fractionContained ( double  fc_ampl) const
inline

Definition at line 29 of file HcalPulseContainmentCorrection.h.

References getCorrection().

29 { return 1.0 / this->getCorrection(fc_ampl); }
double getCorrection(double fc_ampl) const

◆ getCorrection()

double HcalPulseContainmentCorrection::getCorrection ( double  fc_ampl) const

Definition at line 53 of file HcalPulseContainmentCorrection.cc.

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

Referenced by JetReCalibrator.JetReCalibrator::correct(), and fractionContained().

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  } else if (fcupper == mCorFactors_.begin()) {
65  correction = fcupper->second;
66  } else {
67  if (fabs(fclower->first - fc_ampl) < fabs(fcupper->first - fc_ampl))
68  correction = fclower->second;
69  else
70  correction = fcupper->second;
71  }
72 
73 #if 0
74  char s[80];
75  sprintf (s, "%7.1f (%8.5f %8.5f) (%8.5f %8.5f) %8.5f",
76  fc_ampl,
77  fclower->first, fclower->second,
78  fcupper->first, fcupper->second,
79  correction);
80  cout << s << endl;
81 #endif
82 
83  return correction;
84 }

Member Data Documentation

◆ mCorFactors_

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