CMS 3D CMS Logo

Public Member Functions | Private Attributes

fit::HistoPoissonLikelihoodRatio< T > Class Template Reference

#include <HistoPoissonLikelihoodRatio.h>

List of all members.

Public Member Functions

Tfunction ()
const Tfunction () const
 HistoPoissonLikelihoodRatio (T &t, TH1 *histo, double rangeMin, double rangeMax)
 HistoPoissonLikelihoodRatio ()
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

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

Definition at line 13 of file HistoPoissonLikelihoodRatio.h.

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

Definition at line 14 of file HistoPoissonLikelihoodRatio.h.

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

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

Member Function Documentation

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

Definition at line 51 of file HistoPoissonLikelihoodRatio.h.

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

{ return * t_; }
template<typename T>
const T& fit::HistoPoissonLikelihoodRatio< T >::function ( ) const [inline]

Definition at line 52 of file HistoPoissonLikelihoodRatio.h.

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

{ return * t_; }
template<typename T>
size_t fit::HistoPoissonLikelihoodRatio< T >::numberOfBins ( ) const [inline]
template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::operator() ( ) const [inline]

Definition at line 24 of file HistoPoissonLikelihoodRatio.h.

References fit::HistoPoissonLikelihoodRatio< T >::cont_, fit::HistoPoissonLikelihoodRatio< T >::deltaX_, i, funct::log(), fit::HistoPoissonLikelihoodRatio< T >::nBins_, fit::HistoPoissonLikelihoodRatio< T >::rangeMax_, fit::HistoPoissonLikelihoodRatio< T >::rangeMin_, x, and fit::HistoPoissonLikelihoodRatio< T >::xMin_.

                              { 
      double chi2lambda = 0;
      for(size_t i = 0; i < nBins_; ++i) { 
        double x = xMin_ + ( i +.5 ) * deltaX_;
        if((x > rangeMin_)&&(x < rangeMax_)) {
          double nu = (*t_)(x);
          if(nu > 0 && cont_[i]>0) chi2lambda += nu - cont_[i] + cont_[i]*log(cont_[i]/nu);
        }
      }
      chi2lambda *= 2;
      return chi2lambda;
    }
template<typename T>
void fit::HistoPoissonLikelihoodRatio< T >::setHistos ( TH1 *  histo) [inline]

Member Data Documentation

template<typename T>
std::vector<double> fit::HistoPoissonLikelihoodRatio< T >::cont_ [private]
template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::deltaX_ [private]
template<typename T>
size_t fit::HistoPoissonLikelihoodRatio< T >::nBins_ [private]
template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::rangeMax_ [private]
template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::rangeMin_ [private]
template<typename T>
T* fit::HistoPoissonLikelihoodRatio< T >::t_ [private]
template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::xMax_ [private]
template<typename T>
double fit::HistoPoissonLikelihoodRatio< T >::xMin_ [private]