13 fixedphasens_ = fixedphase_ns;
16 const int binsize_ns = 25;
21 integrationwindowns_ = (double)(binsize_ns * num_samples);
26 for (
int shift_ns = 0; shift_ns < binsize_ns; shift_ns++) {
30 double tmin = -(double)shift_ns;
31 double bin0val = (double)shape_.
integrate(tmin, tmin + binsize_ns);
32 double bin1val = (double)shape_.integrate(tmin + binsize_ns, tmin + 2 * binsize_ns);
36 sprintf (s,
"%7.3f %8.5f %8.5f\n", tmin, bin0val, bin1val);
40 if (bin1val > bin0val) {
41 time0shiftns_ = shift_ns;
47 cout <<
"time0shiftns_ = " << time0shiftns_ << endl;
54 double shift_ns = fixedphasens_ - time0shiftns_ + timeslew_ns;
56 double tmin = -shift_ns;
57 double tmax = tmin + integrationwindowns_;
59 double integral = shape_.integrate(tmin, tmax);
61 double recofc = (double)truefc * integral;
65 sprintf (s,
"%8.2f %8.4f %8.4f %8.5f %8.5f %8.5f ",
66 truefc, tmin, tmax, integral, corfactor, recofc);
70 std::pair<double, double> thepair(recofc, corfactor);
78 float max_fracerror) {
84 genlkupmap<RecoFCcorFactorAlgo<CastorPulseShapes::Shape> >(1.0,
95 std::map<double, double>::const_iterator fcupper, fclower;
102 correction = fclower->second;
104 correction = fcupper->second;
106 if (fabs(fclower->first - fc_ampl) < fabs(fcupper->first - fc_ampl))
107 correction = fclower->second;
109 correction = fcupper->second;
114 sprintf (s,
"%7.1f (%8.5f %8.5f) (%8.5f %8.5f) %8.5f",
116 fclower->first, fclower->second,
117 fcupper->first, fcupper->second,
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...
std::pair< double, double > calcpair(double)
double getCorrection(double fc_ampl) const
RecoFCcorFactorAlgo(int num_samples, double fixedphase_ns)
Integral< F, X >::type integral(const F &f)
static const double tmax[3]
std::map< double, double > mCorFactors_
CastorPulseContainmentCorrection(int num_samples, float fixedphase_ns, float max_fracerror)
Generate energy correction factors based on a predetermined phase of the hit + time slew...
float integrate(double tmin, double tmax) const
const Shape & castorShape() const