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 21 of file HcalPulseContainmentAlgo.cc.

References init().

25  : fixedphasens_(fixedphase_ns), integrator_(shape), hcalTimeSlew_delay_(hcalTimeSlew_delay) {
26  init(num_samples);
27 }
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().

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

Member Function Documentation

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

Definition at line 65 of file HcalPulseContainmentAlgo.cc.

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

65  {
66  double timeslew_ns = hcalTimeSlew_delay_->delay(std::max(0.0, (double)truefc), HcalTimeSlew::Medium);
67 
68  double shift_ns = fixedphasens_ - time0shiftns_ + timeslew_ns;
69  //std::cout << "SHIFT " << fixedphasens_ << " " << time0shiftns_ << " " << timeslew_ns << std::endl;
70  double tmin = -shift_ns;
71  double tmax = tmin + integrationwindowns_;
72 
73  //double integral = shape_.integrate( tmin, tmax );
74  double integral = integrator_(tmin, tmax);
75  //std::cout << "INTEGRAL " << integral << " " << truefc << " " << tmin << " " << tmax << std::endl;
76  double corfactor = 1.0 / integral;
77  double recofc = (double)truefc * integral;
78 
79 #if 0
80  char s[80];
81  sprintf (s, "%8.2f %8.4f %8.4f %8.5f %8.5f %8.5f ",
82  truefc, tmin, tmax, integral, corfactor, recofc);
83  cout << s;
84 #endif
85 
86  std::pair<double, double> thepair(recofc, corfactor);
87  return thepair;
88 }
const HcalTimeSlew * hcalTimeSlew_delay_
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:70
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:20
void HcalPulseContainmentAlgo::init ( int  num_samples)
private

Definition at line 29 of file HcalPulseContainmentAlgo.cc.

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

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  // Digitize by integrating to find all time sample
42  // bin values for this shift.
43  //
44  double tmin = -(double)shift_ns;
45  double bin0val = (double)integrator_(tmin, tmin + binsize_ns);
46  double bin1val = (double)integrator_(tmin + binsize_ns, tmin + 2 * binsize_ns);
47 
48 #if 0
49  char s[80];
50  sprintf (s, "%7.3f %8.5f %8.5f\n", tmin, bin0val, bin1val);
51  cout << s;
52 #endif
53 
54  if (bin1val > bin0val) {
55  time0shiftns_ = shift_ns;
56  break;
57  }
58  }
59 
60 #if 0
61  cout << "time0shiftns_ = " << time0shiftns_ << endl;
62 #endif
63 }

Member Data Documentation

double HcalPulseContainmentAlgo::fixedphasens_
private

Definition at line 20 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair().

const HcalTimeSlew* HcalPulseContainmentAlgo::hcalTimeSlew_delay_
private

Definition at line 24 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair().

double HcalPulseContainmentAlgo::integrationwindowns_
private

Definition at line 21 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair(), and init().

HcalShapeIntegrator HcalPulseContainmentAlgo::integrator_
private

Definition at line 23 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair(), and init().

double HcalPulseContainmentAlgo::time0shiftns_
private

Definition at line 22 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair(), and init().