CMS 3D CMS Logo

Public Member Functions | Private Attributes

RecoFCcorFactorAlgo< S > Class Template Reference

#include <genlkupmap.h>

List of all members.

Public Member Functions

std::pair< double, double > calcpair (double)
template<>
std::pair< double, double > calcpair (double truefc)
template<>
std::pair< double, double > calcpair (double truefc)
 RecoFCcorFactorAlgo (int num_samples, double fixedphase_ns)
template<>
 RecoFCcorFactorAlgo (int num_samples, double fixedphase_ns)
template<>
 RecoFCcorFactorAlgo (int num_samples, double fixedphase_ns)

Private Attributes

double fixedphasens_
double integrationwindowns_
shape_
double time0shiftns_

Detailed Description

template<class S>
class RecoFCcorFactorAlgo< S >

Definition at line 122 of file genlkupmap.h.


Constructor & Destructor Documentation

template<class S>
RecoFCcorFactorAlgo< S >::RecoFCcorFactorAlgo ( int  num_samples,
double  fixedphase_ns 
)
template<>
RecoFCcorFactorAlgo< CastorPulseShapes::Shape >::RecoFCcorFactorAlgo ( int  num_samples,
double  fixedphase_ns 
)

Definition at line 13 of file CastorPulseContainmentCorrection.cc.

References CastorPulseShapes::castorShape(), gather_cfg::cout, and asciidump::s.

{
  fixedphasens_ = fixedphase_ns;
  CastorPulseShapes shapes;
  shape_=shapes.castorShape();
  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)shape_.integrate(tmin, tmin+binsize_ns);
    double bin1val = (double)shape_.integrate(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
}
template<>
RecoFCcorFactorAlgo< HcalPulseShapes::Shape >::RecoFCcorFactorAlgo ( int  num_samples,
double  fixedphase_ns 
)

Definition at line 20 of file HcalPulseContainmentCorrection.cc.

References gather_cfg::cout, HcalPulseShapes::hbShape(), and asciidump::s.

{
  fixedphasens_ = fixedphase_ns;
  HcalPulseShapes shapes;
  shape_=shapes.hbShape();
  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)shape_.integrate(tmin, tmin+binsize_ns);
    double bin1val = (double)shape_.integrate(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
}

Member Function Documentation

template<class S>
std::pair<double,double> RecoFCcorFactorAlgo< S >::calcpair ( double  )
template<>
std::pair< double, double > RecoFCcorFactorAlgo< HcalPulseShapes::Shape >::calcpair ( double  truefc)

Definition at line 63 of file HcalPulseContainmentCorrection.cc.

References gather_cfg::cout, HcalTimeSlew::delay(), funct::integral(), max(), HcalTimeSlew::Medium, asciidump::s, and tmax.

{
  double timeslew_ns = HcalTimeSlew::delay(std::max(0.0,(double)truefc),
                                           HcalTimeSlew::Medium);
  double shift_ns  = fixedphasens_ - time0shiftns_ + timeslew_ns;

  double tmin      = -shift_ns;
  double tmax      = tmin+integrationwindowns_;

  double integral  = shape_.integrate( tmin, tmax );
  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;
}
template<>
std::pair< double, double > RecoFCcorFactorAlgo< CastorPulseShapes::Shape >::calcpair ( double  truefc)

Definition at line 55 of file CastorPulseContainmentCorrection.cc.

References gather_cfg::cout, CastorTimeSlew::delay(), funct::integral(), max(), CastorTimeSlew::Medium, asciidump::s, and tmax.

{
  double timeslew_ns = CastorTimeSlew::delay(std::max(0.0,(double)truefc),
                                           CastorTimeSlew::Medium);
  double shift_ns  = fixedphasens_ - time0shiftns_ + timeslew_ns;

  double tmin      = -shift_ns;
  double tmax      = tmin+integrationwindowns_;

  double integral  = shape_.integrate( tmin, tmax );
  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;
}

Member Data Documentation

template<class S>
double RecoFCcorFactorAlgo< S >::fixedphasens_ [private]

Definition at line 130 of file genlkupmap.h.

template<class S>
double RecoFCcorFactorAlgo< S >::integrationwindowns_ [private]

Definition at line 131 of file genlkupmap.h.

template<class S>
S RecoFCcorFactorAlgo< S >::shape_ [private]

Definition at line 133 of file genlkupmap.h.

template<class S>
double RecoFCcorFactorAlgo< S >::time0shiftns_ [private]

Definition at line 132 of file genlkupmap.h.