test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CombinedChiSquaredLikelihood.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_Utilities_CombinedChiSquaredLikelihood_h
2 #define PhysicsTools_Utilities_CombinedChiSquaredLikelihood_h
5 
6 namespace fit {
7  template<typename ChiSquared, typename Likelihood>
9  public:
12  chi2_(chi2), like_(like) { }
13  // return chi-square value
14  double operator()() const {
15  return - 2 * like_() + chi2_();
16  }
17  ChiSquared & chi2() { return chi2_; }
18  const ChiSquared & chi2() const { return chi2_; }
19  Likelihood & like() { return like_; }
20  const Likelihood & like() const { return like_; }
21  size_t numberOfBins() const {
22  return chi2_.numberOfBins();
23  }
24  private:
27  };
28 
29  template<typename ChiSquared, typename Likelihood>
31  static void print(double amin, unsigned int numberOfFreeParameters, const CombinedChiSquaredLikelihood<ChiSquared, Likelihood> & f) {
32  unsigned int ndof = f.numberOfBins() - numberOfFreeParameters;
33  std::cout << "-2 log(maximum-likelihood) = " << amin << ", n.d.o.f = " << ndof
34  << ", free parameters = " << numberOfFreeParameters
35  << std::endl;
36  std::cout << "chi-2 contibution: " << f.chi2()() << "(n. bins: " << f.chi2().numberOfBins() << ")" << std::endl
37  << "likelihood contriution: " << -2.*f.like()() << std::endl;
38  }
39  };
40 
41 }
42 
43 #endif
static void print(double amin, unsigned int numberOfFreeParameters, const CombinedChiSquaredLikelihood< ChiSquared, Likelihood > &f)
CombinedChiSquaredLikelihood(const ChiSquared &chi2, const Likelihood &like)
double f[11][100]
tuple cout
Definition: gather_cfg.py:145