CMS 3D CMS Logo

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

#include <CastorPulseContainmentCorrection.h>

Public Member Functions

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

Private Attributes

std::map< double, double > mCorFactors_
 

Detailed Description

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

Definition at line 12 of file CastorPulseContainmentCorrection.h.

Constructor & Destructor Documentation

CastorPulseContainmentCorrection::CastorPulseContainmentCorrection ( 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 81 of file CastorPulseContainmentCorrection.cc.

References mCorFactors_.

84 {
85  RecoFCcorFactorAlgo<CastorPulseShapes::Shape> corFalgo(num_samples, (double)fixedphase_ns);
86 
87  // Generate lookup map for the correction function, never exceeding
88  // a maximum fractional error for lookups.
89  //
90  genlkupmap< RecoFCcorFactorAlgo<CastorPulseShapes::Shape> > (1.0, 5000.0f, // generation domain
91  max_fracerror, // maximum fractional error
92  1.0, // min_xstep = minimum true fC increment
93  corFalgo,
94  mCorFactors_); // return lookup map
95 }

Member Function Documentation

double CastorPulseContainmentCorrection::fractionContained ( double  fc_ampl) const
inline

Definition at line 19 of file CastorPulseContainmentCorrection.h.

References getCorrection().

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

Definition at line 98 of file CastorPulseContainmentCorrection.cc.

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

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

99 {
100  double correction;
101 
102  std::map<double,double>::const_iterator fcupper,fclower;
103 
104  fcupper = mCorFactors_.upper_bound(fc_ampl);
105  fclower = fcupper;
106  fclower--;
107 
108  if (fcupper == mCorFactors_.end()) {
109  correction = fclower->second;
110  }
111  else if (fcupper == mCorFactors_.begin()) {
112  correction = fcupper->second;
113  }
114  else {
115  if (fabs(fclower->first - fc_ampl) <
116  fabs(fcupper->first - fc_ampl) )
117  correction = fclower->second;
118  else
119  correction = fcupper->second;
120  }
121 
122 #if 0
123  char s[80];
124  sprintf (s, "%7.1f (%8.5f %8.5f) (%8.5f %8.5f) %8.5f",
125  fc_ampl,
126  fclower->first, fclower->second,
127  fcupper->first, fcupper->second,
128  correction);
129  cout << s << endl;
130 #endif
131 
132  return correction;
133 }

Member Data Documentation

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