#include <HcalPulseContainmentAlgo.h>
Public Member Functions | |
std::pair< double, double > | calcpair (double) |
HcalPulseContainmentAlgo (const HcalPulseShape *shape, int num_samples, double fixedphase_ns) | |
HcalPulseContainmentAlgo (int num_samples, double fixedphase_ns) | |
Private Member Functions | |
void | init (int num_samples) |
Private Attributes | |
double | fixedphasens_ |
double | integrationwindowns_ |
HcalShapeIntegrator | integrator_ |
double | time0shiftns_ |
Definition at line 7 of file HcalPulseContainmentAlgo.h.
HcalPulseContainmentAlgo::HcalPulseContainmentAlgo | ( | const HcalPulseShape * | shape, |
int | num_samples, | ||
double | fixedphase_ns | ||
) |
Definition at line 20 of file HcalPulseContainmentAlgo.cc.
References init.
: fixedphasens_(fixedphase_ns), integrator_(shape) { init(num_samples); }
HcalPulseContainmentAlgo::HcalPulseContainmentAlgo | ( | int | num_samples, |
double | fixedphase_ns | ||
) |
Definition at line 12 of file HcalPulseContainmentAlgo.cc.
References init().
: fixedphasens_(fixedphase_ns), integrator_(&(HcalPulseShapes().hbShape())) { init(num_samples); }
std::pair< double, double > HcalPulseContainmentAlgo::calcpair | ( | double | truefc | ) |
Definition at line 67 of file HcalPulseContainmentAlgo.cc.
References gather_cfg::cout, HcalTimeSlew::delay(), fixedphasens_, funct::integral(), integrationwindowns_, integrator_, max(), HcalTimeSlew::Medium, alignCSCRings::s, time0shiftns_, and tmax.
{ double timeslew_ns = HcalTimeSlew::delay(std::max(0.0,(double)truefc), HcalTimeSlew::Medium); double shift_ns = fixedphasens_ - time0shiftns_ + timeslew_ns; //std::cout << "SHIFT " << fixedphasens_ << " " << time0shiftns_ << " " << timeslew_ns << std::endl; double tmin = -shift_ns; double tmax = tmin+integrationwindowns_; //double integral = shape_.integrate( tmin, tmax ); double integral = integrator_(tmin, tmax); //std::cout << "INTEGRAL " << integral << " " << truefc << " " << tmin << " " << tmax << std::endl; double corfactor = 1.0/integral; double recofc = (double)truefc * integral; #if 0 char s[80]; sprintf (s, "%8.2f %8.4f %8.4f %8.5f %8.5f %8.5f ", truefc, tmin, tmax, integral, corfactor, recofc); cout << s; #endif std::pair<double,double> thepair(recofc,corfactor); return thepair; }
void HcalPulseContainmentAlgo::init | ( | int | num_samples | ) | [private] |
Definition at line 28 of file HcalPulseContainmentAlgo.cc.
References gather_cfg::cout, integrationwindowns_, integrator_, alignCSCRings::s, and time0shiftns_.
Referenced by HcalPulseContainmentAlgo().
{ const int binsize_ns = 25; // First set up controlling parameters for calculating the correction factor: // Integration window size... // integrationwindowns_ = (double)(binsize_ns*num_samples); // First find the point at which time bin "1" exceeds time bin "0", // and call that point "time 0". // for (int shift_ns=0; shift_ns<binsize_ns; shift_ns++) { // Digitize by integrating to find all time sample // bin values for this shift. // double tmin = -(double)shift_ns; double bin0val = (double) integrator_(tmin, tmin+binsize_ns); double bin1val = (double) integrator_(tmin+binsize_ns, tmin+2*binsize_ns); #if 0 char s[80]; sprintf (s, "%7.3f %8.5f %8.5f\n", tmin, bin0val, bin1val); cout << s; #endif if (bin1val > bin0val) { time0shiftns_ = shift_ns; break; } } #if 0 cout << "time0shiftns_ = " << time0shiftns_ << endl; #endif }
double HcalPulseContainmentAlgo::fixedphasens_ [private] |
Definition at line 17 of file HcalPulseContainmentAlgo.h.
Referenced by calcpair().
double HcalPulseContainmentAlgo::integrationwindowns_ [private] |
Definition at line 18 of file HcalPulseContainmentAlgo.h.
Referenced by calcpair(), and init().
Definition at line 20 of file HcalPulseContainmentAlgo.h.
Referenced by calcpair(), and init().
double HcalPulseContainmentAlgo::time0shiftns_ [private] |
Definition at line 19 of file HcalPulseContainmentAlgo.h.
Referenced by calcpair(), and init().