CMS 3D CMS Logo

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, const HcalTimeSlew *hcalTimeSlew_delay)
 
 HcalPulseContainmentAlgo (int num_samples, double fixedphase_ns, const HcalTimeSlew *hcalTimeSlew_delay)
 

Private Member Functions

void init (int num_samples)
 

Private Attributes

double fixedphasens_
 
const HcalTimeSlewhcalTimeSlew_delay_
 
double integrationwindowns_
 
HcalShapeIntegrator integrator_
 
double time0shiftns_
 

Detailed Description

Definition at line 9 of file HcalPulseContainmentAlgo.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file HcalPulseContainmentAlgo.cc.

References init().

21 : fixedphasens_(fixedphase_ns),
22  integrator_(shape),
23  hcalTimeSlew_delay_(hcalTimeSlew_delay)
24 {
25  init(num_samples);
26 }
const HcalTimeSlew * hcalTimeSlew_delay_
HcalPulseContainmentAlgo::HcalPulseContainmentAlgo ( int  num_samples,
double  fixedphase_ns,
const HcalTimeSlew hcalTimeSlew_delay 
)

Definition at line 12 of file HcalPulseContainmentAlgo.cc.

References init().

13 : fixedphasens_(fixedphase_ns),
14  integrator_(&(HcalPulseShapes().hbShape())),
15  hcalTimeSlew_delay_(hcalTimeSlew_delay)
16 {
17  init(num_samples);
18 }
const HcalTimeSlew * hcalTimeSlew_delay_

Member Function Documentation

std::pair< double, double > HcalPulseContainmentAlgo::calcpair ( double  truefc)

Definition at line 68 of file HcalPulseContainmentAlgo.cc.

References gather_cfg::cout, HcalTimeSlew::delay(), fixedphasens_, hcalTimeSlew_delay_, funct::integral(), integrationwindowns_, integrator_, SiStripPI::max, HcalTimeSlew::Medium, alignCSCRings::s, time0shiftns_, and tmax.

69 {
70  double timeslew_ns = hcalTimeSlew_delay_->delay(std::max(0.0,(double)truefc), HcalTimeSlew::Medium);
71 
72  double shift_ns = fixedphasens_ - time0shiftns_ + timeslew_ns;
73  //std::cout << "SHIFT " << fixedphasens_ << " " << time0shiftns_ << " " << timeslew_ns << std::endl;
74  double tmin = -shift_ns;
75  double tmax = tmin+integrationwindowns_;
76 
77  //double integral = shape_.integrate( tmin, tmax );
78  double integral = integrator_(tmin, tmax);
79  //std::cout << "INTEGRAL " << integral << " " << truefc << " " << tmin << " " << tmax << std::endl;
80  double corfactor = 1.0/integral;
81  double recofc = (double)truefc * integral;
82 
83 #if 0
84  char s[80];
85  sprintf (s, "%8.2f %8.4f %8.4f %8.5f %8.5f %8.5f ",
86  truefc, tmin, tmax, integral, corfactor, recofc);
87  cout << s;
88 #endif
89 
90  std::pair<double,double> thepair(recofc,corfactor);
91  return thepair;
92 }
const HcalTimeSlew * hcalTimeSlew_delay_
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:69
static const double tmax[3]
float delay(float fC, BiasSetting bias=Medium) const
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
Definition: HcalTimeSlew.cc:14
void HcalPulseContainmentAlgo::init ( int  num_samples)
private

Definition at line 29 of file HcalPulseContainmentAlgo.cc.

References gather_cfg::cout, integrationwindowns_, integrator_, alignCSCRings::s, and time0shiftns_.

Referenced by HcalPulseContainmentAlgo().

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

Member Data Documentation

double HcalPulseContainmentAlgo::fixedphasens_
private

Definition at line 21 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair().

const HcalTimeSlew* HcalPulseContainmentAlgo::hcalTimeSlew_delay_
private

Definition at line 25 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair().

double HcalPulseContainmentAlgo::integrationwindowns_
private

Definition at line 22 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair(), and init().

HcalShapeIntegrator HcalPulseContainmentAlgo::integrator_
private

Definition at line 24 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair(), and init().

double HcalPulseContainmentAlgo::time0shiftns_
private

Definition at line 23 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair(), and init().