CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 Generate energy correction factors based on a predetermined phase of the hit + time slew. More...
 

Private Attributes

std::map< double, double > mCorFactors_
 

Detailed Description

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

Date:
Revision:
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 
)

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

Definition at line 89 of file HcalPulseContainmentCorrection.cc.

References mCorFactors_.

92 {
93  RecoFCcorFactorAlgo<HcalPulseShapes::Shape> corFalgo(num_samples, (double)fixedphase_ns);
94 
95  // Generate lookup map for the correction function, never exceeding
96  // a maximum fractional error for lookups.
97  //
98  // static const double max_recofc = 5000.0f;
99  genlkupmap< RecoFCcorFactorAlgo<HcalPulseShapes::Shape> > (1.0, 5000.0f, // generation domain
100  max_fracerror, // maximum fractional error
101  1.0, // min_xstep = minimum true fC increment
102  corFalgo,
103  mCorFactors_); // return lookup map
104 }

Member Function Documentation

double HcalPulseContainmentCorrection::fractionContained ( double  fc_ampl) const
inline

Definition at line 22 of file HcalPulseContainmentCorrection.h.

References getCorrection().

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

Definition at line 107 of file HcalPulseContainmentCorrection.cc.

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

Referenced by fractionContained(), HcalSimpleRecAlgoImpl::reco(), ZdcSimpleRecAlgoImpl::reco1(), and ZdcSimpleRecAlgoImpl::reco2().

108 {
109  double correction;
110 
111  std::map<double,double>::const_iterator fcupper,fclower;
112 
113  fcupper = mCorFactors_.upper_bound(fc_ampl);
114  fclower = fcupper;
115  fclower--;
116 
117  if (fcupper == mCorFactors_.end()) {
118  correction = fclower->second;
119  }
120  else if (fcupper == mCorFactors_.begin()) {
121  correction = fcupper->second;
122  }
123  else {
124  if (fabs(fclower->first - fc_ampl) <
125  fabs(fcupper->first - fc_ampl) )
126  correction = fclower->second;
127  else
128  correction = fcupper->second;
129  }
130 
131 #if 0
132  char s[80];
133  sprintf (s, "%7.1f (%8.5f %8.5f) (%8.5f %8.5f) %8.5f",
134  fc_ampl,
135  fclower->first, fclower->second,
136  fcupper->first, fcupper->second,
137  correction);
138  cout << s << endl;
139 #endif
140 
141  return correction;
142 }
tuple cout
Definition: gather_cfg.py:41
string s
Definition: asciidump.py:422

Member Data Documentation

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