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

Private Member Functions

void init (int num_samples)
 

Private Attributes

double fixedphasens_
 
const HcalTimeSlewhcalTimeSlew_delay_
 
double integrationwindowns_
 
HcalShapeIntegrator integrator_
 
bool phaseAsInSim_
 
double time0shiftns_
 

Detailed Description

Definition at line 9 of file HcalPulseContainmentAlgo.h.

Constructor & Destructor Documentation

◆ HcalPulseContainmentAlgo() [1/2]

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

Definition at line 23 of file HcalPulseContainmentAlgo.cc.

References init().

28  : fixedphasens_(fixedphase_ns),
29  phaseAsInSim_(phaseAsInSim),
31  hcalTimeSlew_delay_(hcalTimeSlew_delay) {
32  init(num_samples);
33 }
const HcalTimeSlew * hcalTimeSlew_delay_

◆ HcalPulseContainmentAlgo() [2/2]

HcalPulseContainmentAlgo::HcalPulseContainmentAlgo ( int  num_samples,
double  fixedphase_ns,
bool  phaseAsInSim,
const HcalTimeSlew hcalTimeSlew_delay 
)

Definition at line 12 of file HcalPulseContainmentAlgo.cc.

References init().

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

Member Function Documentation

◆ calcpair()

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

Definition at line 70 of file HcalPulseContainmentAlgo.cc.

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

70  {
71  double timeslew_ns = hcalTimeSlew_delay_->delay(std::max(0.0, (double)truefc), HcalTimeSlew::Medium);
72 
73  double tmin = 0;
74  if (phaseAsInSim_) { // timePhase as in hcalSimParameters, no time0shift
75  tmin = fixedphasens_ - timeslew_ns;
76  } else { // Run 2: timePhase opposite to SIM, time0shift
77  double shift_ns = fixedphasens_ - time0shiftns_ + timeslew_ns;
78  //edm::LogPrint("HcalPulseContainmentAlgo") << "SHIFT " << fixedphasens_ << " " << time0shiftns_ << " " << timeslew_ns;
79  tmin = -shift_ns;
80  }
81  double tmax = tmin + integrationwindowns_;
82 
83  //double integral = shape_.integrate( tmin, tmax );
84  double integral = integrator_(tmin, tmax);
85  //edm::LogPrint("HcalPulseContainmentAlgo") << "INTEGRAL " << integral << " " << truefc << " " << tmin << " " << tmax;
86  double corfactor = 1.0 / integral;
87  double recofc = (double)truefc * integral;
88 
89 #if 0
90  char s[80];
91  sprintf (s, "%8.2f %8.4f %8.4f %8.5f %8.5f %8.5f ",
92  truefc, tmin, tmax, integral, corfactor, recofc);
93  edm::LogPrint("HcalPulseContainmentAlgo") << s;
94 #endif
95 
96  std::pair<double, double> thepair(recofc, corfactor);
97  return thepair;
98 }
const HcalTimeSlew * hcalTimeSlew_delay_
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
Log< level::Warning, true > LogPrint
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:70
static const double tmax[3]

◆ init()

void HcalPulseContainmentAlgo::init ( int  num_samples)
private

Definition at line 35 of file HcalPulseContainmentAlgo.cc.

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

Referenced by HcalPulseContainmentAlgo().

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

Member Data Documentation

◆ fixedphasens_

double HcalPulseContainmentAlgo::fixedphasens_
private

Definition at line 24 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair().

◆ hcalTimeSlew_delay_

const HcalTimeSlew* HcalPulseContainmentAlgo::hcalTimeSlew_delay_
private

Definition at line 29 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair().

◆ integrationwindowns_

double HcalPulseContainmentAlgo::integrationwindowns_
private

Definition at line 25 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair(), and init().

◆ integrator_

HcalShapeIntegrator HcalPulseContainmentAlgo::integrator_
private

Definition at line 28 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair(), and init().

◆ phaseAsInSim_

bool HcalPulseContainmentAlgo::phaseAsInSim_
private

Definition at line 27 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair().

◆ time0shiftns_

double HcalPulseContainmentAlgo::time0shiftns_
private

Definition at line 26 of file HcalPulseContainmentAlgo.h.

Referenced by calcpair(), and init().