CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
fit::HistoPoissonLikelihoodRatio< T > Class Template Reference

#include <HistoPoissonLikelihoodRatio.h>

Public Member Functions

Tfunction ()
 
const Tfunction () const
 
 HistoPoissonLikelihoodRatio ()
 
 HistoPoissonLikelihoodRatio (T &t, TH1 *histo, double rangeMin, double rangeMax)
 
size_t numberOfBins () const
 
double operator() () const
 
void setHistos (TH1 *histo)
 

Private Attributes

std::vector< double > cont_
 
double deltaX_
 
size_t nBins_
 
double rangeMax_
 
double rangeMin_
 
Tt_
 
double xMax_
 
double xMin_
 

Detailed Description

template<typename T>
class fit::HistoPoissonLikelihoodRatio< T >

Definition at line 11 of file HistoPoissonLikelihoodRatio.h.

Constructor & Destructor Documentation

◆ HistoPoissonLikelihoodRatio() [1/2]

template<typename T>
fit::HistoPoissonLikelihoodRatio< T >::HistoPoissonLikelihoodRatio ( )
inline

Definition at line 13 of file HistoPoissonLikelihoodRatio.h.

13 {}

◆ HistoPoissonLikelihoodRatio() [2/2]

template<typename T>
fit::HistoPoissonLikelihoodRatio< T >::HistoPoissonLikelihoodRatio ( T t,
TH1 *  histo,
double  rangeMin,
double  rangeMax 
)
inline

Definition at line 14 of file HistoPoissonLikelihoodRatio.h.

15  : t_(&t), rangeMin_(rangeMin), rangeMax_(rangeMax) {
16  nBins_ = histo->GetNbinsX();
17  xMin_ = histo->GetXaxis()->GetXmin();
18  xMax_ = histo->GetXaxis()->GetXmax();
19  deltaX_ = (xMax_ - xMin_) / nBins_;
20  for (size_t i = 0; i < nBins_; ++i) {
21  cont_.push_back(histo->GetBinContent(i + 1));
22  }
23  }

References fit::HistoPoissonLikelihoodRatio< T >::cont_, fit::HistoPoissonLikelihoodRatio< T >::deltaX_, timingPdfMaker::histo, mps_fire::i, fit::HistoPoissonLikelihoodRatio< T >::nBins_, fit::HistoPoissonLikelihoodRatio< T >::xMax_, and fit::HistoPoissonLikelihoodRatio< T >::xMin_.

Member Function Documentation

◆ function() [1/2]

template<typename T>
T& fit::HistoPoissonLikelihoodRatio< T >::function ( )
inline

Definition at line 52 of file HistoPoissonLikelihoodRatio.h.

52 { return *t_; }

References fit::HistoPoissonLikelihoodRatio< T >::t_.

◆ function() [2/2]

template<typename T>
const T& fit::HistoPoissonLikelihoodRatio< T >::function ( ) const
inline

Definition at line 53 of file HistoPoissonLikelihoodRatio.h.

53 { return *t_; }

References fit::HistoPoissonLikelihoodRatio< T >::t_.

◆ numberOfBins()

template<typename T>
size_t fit::HistoPoissonLikelihoodRatio< T >::numberOfBins ( ) const
inline

Definition at line 43 of file HistoPoissonLikelihoodRatio.h.

43  {
44  size_t fullBins = 0;
45  for (size_t i = 0; i < nBins_; ++i) {
46  double x = xMin_ + (i + .5) * deltaX_;
47  if ((x > rangeMin_) && (x < rangeMax_))
48  fullBins++;
49  }
50  return fullBins;
51  }

References fit::HistoPoissonLikelihoodRatio< T >::deltaX_, mps_fire::i, fit::HistoPoissonLikelihoodRatio< T >::nBins_, fit::HistoPoissonLikelihoodRatio< T >::rangeMax_, fit::HistoPoissonLikelihoodRatio< T >::rangeMin_, and fit::HistoPoissonLikelihoodRatio< T >::xMin_.

◆ operator()()

template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::operator() ( ) const
inline

Definition at line 24 of file HistoPoissonLikelihoodRatio.h.

24  {
25  double chi2lambda = 0;
26  for (size_t i = 0; i < nBins_; ++i) {
27  double x = xMin_ + (i + .5) * deltaX_;
28  if ((x > rangeMin_) && (x < rangeMax_)) {
29  double nu = (*t_)(x);
30  if (nu > 0 && cont_[i] > 0)
31  chi2lambda += nu - cont_[i] + cont_[i] * log(cont_[i] / nu);
32  }
33  }
34  chi2lambda *= 2;
35  return chi2lambda;
36  }

References fit::HistoPoissonLikelihoodRatio< T >::cont_, fit::HistoPoissonLikelihoodRatio< T >::deltaX_, mps_fire::i, dqm-mbProfile::log, fit::HistoPoissonLikelihoodRatio< T >::nBins_, fit::HistoPoissonLikelihoodRatio< T >::rangeMax_, fit::HistoPoissonLikelihoodRatio< T >::rangeMin_, and fit::HistoPoissonLikelihoodRatio< T >::xMin_.

◆ setHistos()

template<typename T>
void fit::HistoPoissonLikelihoodRatio< T >::setHistos ( TH1 *  histo)
inline

Member Data Documentation

◆ cont_

template<typename T>
std::vector<double> fit::HistoPoissonLikelihoodRatio< T >::cont_
private

◆ deltaX_

template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::deltaX_
private

◆ nBins_

template<typename T>
size_t fit::HistoPoissonLikelihoodRatio< T >::nBins_
private

◆ rangeMax_

template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::rangeMax_
private

◆ rangeMin_

template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::rangeMin_
private

◆ t_

template<typename T>
T* fit::HistoPoissonLikelihoodRatio< T >::t_
private

◆ xMax_

template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::xMax_
private

◆ xMin_

template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::xMin_
private
mps_fire.i
i
Definition: mps_fire.py:428
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:278
DDAxes::x
fit::HistoPoissonLikelihoodRatio::rangeMin_
double rangeMin_
Definition: HistoPoissonLikelihoodRatio.h:57
fit::HistoPoissonLikelihoodRatio::nBins_
size_t nBins_
Definition: HistoPoissonLikelihoodRatio.h:58
fit::HistoPoissonLikelihoodRatio::deltaX_
double deltaX_
Definition: HistoPoissonLikelihoodRatio.h:59
fit::HistoPoissonLikelihoodRatio::cont_
std::vector< double > cont_
Definition: HistoPoissonLikelihoodRatio.h:60
fit::HistoPoissonLikelihoodRatio::rangeMax_
double rangeMax_
Definition: HistoPoissonLikelihoodRatio.h:57
fit::HistoPoissonLikelihoodRatio::t_
T * t_
Definition: HistoPoissonLikelihoodRatio.h:56
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
fit::HistoPoissonLikelihoodRatio::xMin_
double xMin_
Definition: HistoPoissonLikelihoodRatio.h:59
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
fit::HistoPoissonLikelihoodRatio::xMax_
double xMax_
Definition: HistoPoissonLikelihoodRatio.h:59