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 Member Functions | Private Attributes
HcalPulseContainmentAlgo Class Reference

#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_
 

Detailed Description

Definition at line 7 of file HcalPulseContainmentAlgo.h.

Constructor & Destructor Documentation

HcalPulseContainmentAlgo::HcalPulseContainmentAlgo ( const HcalPulseShape shape,
int  num_samples,
double  fixedphase_ns 
)

Definition at line 20 of file HcalPulseContainmentAlgo.cc.

References init.

21 : fixedphasens_(fixedphase_ns),
22  integrator_(shape)
23 {
24  init(num_samples);
25 }
HcalPulseContainmentAlgo::HcalPulseContainmentAlgo ( int  num_samples,
double  fixedphase_ns 
)

Definition at line 12 of file HcalPulseContainmentAlgo.cc.

References init().

13 : fixedphasens_(fixedphase_ns),
14  integrator_(&(HcalPulseShapes().hbShape()))
15 {
16  init(num_samples);
17 }

Member Function Documentation

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_, bookConverter::max, HcalTimeSlew::Medium, alignCSCRings::s, time0shiftns_, and tmax.

68 {
69  double timeslew_ns = HcalTimeSlew::delay(std::max(0.0,(double)truefc),
71  double shift_ns = fixedphasens_ - time0shiftns_ + timeslew_ns;
72  //std::cout << "SHIFT " << fixedphasens_ << " " << time0shiftns_ << " " << timeslew_ns << std::endl;
73  double tmin = -shift_ns;
74  double tmax = tmin+integrationwindowns_;
75 
76  //double integral = shape_.integrate( tmin, tmax );
77  double integral = integrator_(tmin, tmax);
78  //std::cout << "INTEGRAL " << integral << " " << truefc << " " << tmin << " " << tmax << std::endl;
79  double corfactor = 1.0/integral;
80  double recofc = (double)truefc * integral;
81 
82 #if 0
83  char s[80];
84  sprintf (s, "%8.2f %8.4f %8.4f %8.5f %8.5f %8.5f ",
85  truefc, tmin, tmax, integral, corfactor, recofc);
86  cout << s;
87 #endif
88 
89  std::pair<double,double> thepair(recofc,corfactor);
90  return thepair;
91 }
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:69
static const double tmax[3]
tuple cout
Definition: gather_cfg.py:121
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...
Definition: HcalTimeSlew.cc:12
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().

29 {
30  const int binsize_ns = 25;
31 
32  // First set up controlling parameters for calculating the correction factor:
33  // Integration window size...
34  //
35  integrationwindowns_ = (double)(binsize_ns*num_samples);
36 
37  // First find the point at which time bin "1" exceeds time bin "0",
38  // and call that point "time 0".
39  //
40  for (int shift_ns=0; shift_ns<binsize_ns; shift_ns++) {
41 
42  // Digitize by integrating to find all time sample
43  // bin values for this shift.
44  //
45  double tmin = -(double)shift_ns;
46  double bin0val = (double) integrator_(tmin, tmin+binsize_ns);
47  double bin1val = (double) integrator_(tmin+binsize_ns, tmin+2*binsize_ns);
48 
49 #if 0
50  char s[80];
51  sprintf (s, "%7.3f %8.5f %8.5f\n", tmin, bin0val, bin1val);
52  cout << s;
53 #endif
54 
55  if (bin1val > bin0val) {
56  time0shiftns_ = shift_ns;
57  break;
58  }
59  }
60 
61 #if 0
62  cout << "time0shiftns_ = " << time0shiftns_ << endl;
63 #endif
64 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

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().

HcalShapeIntegrator HcalPulseContainmentAlgo::integrator_
private

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().