1 #ifndef PhysicsTools_Utilities_MultiHistoChiSquare_h
2 #define PhysicsTools_Utilities_MultiHistoChiSquare_h
21 template<
typename TT1,
typename TT2,
typename TT3,
typename TT4,
typename TT5,
typename TT6>
23 TT2 & t2, TH1 *histo2,
24 TT3 & t3, TH1 *histo3,
25 TT4 & t4, TH1 *histo4,
26 TT5 & t5, TH1 *histo5,
27 TT6 & t6, TH1 *histo6,
28 double rangeMin,
double rangeMax) :
29 chi1_(t1, histo1, rangeMin, rangeMax),
30 chi2_(t2, histo2, rangeMin, rangeMax),
31 chi3_(t3, histo3, rangeMin, rangeMax),
32 chi4_(t4, histo4, rangeMin, rangeMax),
33 chi5_(t5, histo5, rangeMin, rangeMax),
34 chi6_(t6, histo6, rangeMin, rangeMax) {
38 static size_t count = 0;
44 void setHistos(TH1 *histo1, TH1 *histo2, TH1 *histo3, TH1 * histo4, TH1 * histo5, TH1 * histo6 ) {
45 chi1_.setHistos(histo1);
46 chi2_.setHistos(histo2);
47 chi3_.setHistos(histo3);
48 chi4_.setHistos(histo4);
49 chi5_.setHistos(histo5);
50 chi6_.setHistos(histo6);
54 chi1_.numberOfBins() +
55 chi2_.numberOfBins() +
56 chi3_.numberOfBins() +
57 chi4_.numberOfBins() +
58 chi5_.numberOfBins() +
59 chi6_.numberOfBins() ;
84 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
86 helper::MultiHistoChiSquareNoArg> {
89 template<
typename TT1,
typename TT2,
typename TT3,
typename TT4,
typename TT5>
91 TT2 & t2, TH1 *histo2,
92 TT3 & t3, TH1 *histo3,
93 TT4 & t4, TH1 *histo4,
94 TT5 & t5, TH1 *histo5,
95 double rangeMin,
double rangeMax) :
96 chi1_(t1, histo1, rangeMin, rangeMax),
97 chi2_(t2, histo2, rangeMin, rangeMax),
98 chi3_(t3, histo3, rangeMin, rangeMax),
99 chi4_(t4, histo4, rangeMin, rangeMax),
100 chi5_(t5, histo5, rangeMin, rangeMax) {
104 static size_t count = 0;
108 void setHistos(TH1 *histo1, TH1 *histo2, TH1 *histo3, TH1 * histo4, TH1 * histo5) {
109 chi1_.setHistos(histo1);
110 chi2_.setHistos(histo2);
111 chi3_.setHistos(histo3);
112 chi4_.setHistos(histo4);
113 chi5_.setHistos(histo5);
117 chi1_.numberOfBins() +
118 chi2_.numberOfBins() +
119 chi3_.numberOfBins() +
120 chi4_.numberOfBins() +
121 chi5_.numberOfBins();
141 template<
typename T1,
typename T2,
typename T3,
typename T4>
143 helper::MultiHistoChiSquareNoArg,
147 template<
typename TT1,
typename TT2,
typename TT3,
typename TT4>
149 TT2 & t2, TH1 *histo2,
150 TT3 & t3, TH1 *histo3,
151 TT4 & t4, TH1 *histo4,
152 double rangeMin,
double rangeMax) :
153 chi1_(t1, histo1, rangeMin, rangeMax),
154 chi2_(t2, histo2, rangeMin, rangeMax),
155 chi3_(t3, histo3, rangeMin, rangeMax),
156 chi4_(t4, histo4, rangeMin, rangeMax) {
160 static size_t count = 0;
164 void setHistos(TH1 *histo1, TH1 *histo2, TH1 *histo3, TH1 * histo4) {
165 chi1_.setHistos(histo1);
166 chi2_.setHistos(histo2);
167 chi3_.setHistos(histo3);
168 chi4_.setHistos(histo4);
172 chi1_.numberOfBins() +
173 chi2_.numberOfBins() +
174 chi3_.numberOfBins() +
175 chi4_.numberOfBins();
193 template<
typename T1,
typename T2,
typename T3>
199 template<
typename TT1,
typename TT2,
typename TT3>
201 TT2 & t2, TH1 *histo2,
202 TT3 & t3, TH1 *histo3,
203 double rangeMin,
double rangeMax) :
204 chi1_(t1, histo1, rangeMin, rangeMax),
205 chi2_(t2, histo2, rangeMin, rangeMax),
206 chi3_(t3, histo3, rangeMin, rangeMax) {
212 chi1_.setHistos(histo1);
213 chi2_.setHistos(histo2);
214 chi3_.setHistos(histo3);
218 chi1_.numberOfBins() +
219 chi2_.numberOfBins() +
220 chi3_.numberOfBins();
234 template<
typename T1,
typename T2>
236 helper::MultiHistoChiSquareNoArg,
242 template<
typename TT1,
typename TT2>
244 TT2 & t2, TH1 *histo2,
245 double rangeMin,
double rangeMax):
246 chi1_(t1, histo1, rangeMin, rangeMax),
247 chi2_(t2, histo2, rangeMin, rangeMax) {
253 chi1_.setHistos(histo1);
254 chi2_.setHistos(histo2);
258 chi1_.numberOfBins() +
259 chi2_.numberOfBins();
266 template<
typename T1>
268 helper::MultiHistoChiSquareNoArg,
275 template<
typename TT1>
277 :
chi1_(t1, histo1, rangeMin, rangeMax) {
283 chi1_.setHistos(histo1);
286 return chi1_.numberOfBins();
292 template<
typename T1,
typename T2,
typename T3,
293 typename T4,
typename T5,
typename T6>
295 static void print(
double amin,
unsigned int numberOfFreeParameters,
298 std::cout <<
"chi-squared/n.d.o.f. = " << amin <<
"/" << ndof <<
" = " << amin/ndof
299 <<
"; prob: " << TMath::Prob(amin, ndof)
MultiHistoChiSquare(TT1 &t1, TH1 *histo1, double rangeMin, double rangeMax)
double operator()() const
const T6 & function6() const
double operator()() const
void setHistos(TH1 *histo1)
double operator()() const
MultiHistoChiSquare(TT1 &t1, TH1 *histo1, TT2 &t2, TH1 *histo2, TT3 &t3, TH1 *histo3, double rangeMin, double rangeMax)
size_t numberOfBins() const
const T1 & function1() const
double operator()() const
void setHistos(TH1 *histo1, TH1 *histo2)
MultiHistoChiSquare(TT1 &t1, TH1 *histo1, TT2 &t2, TH1 *histo2, TT3 &t3, TH1 *histo3, TT4 &t4, TH1 *histo4, TT5 &t5, TH1 *histo5, double rangeMin, double rangeMax)
size_t numberOfBins() const
const T3 & function3() const
size_t numberOfBins() const
const T2 & function2() const
MultiHistoChiSquare(TT1 &t1, TH1 *histo1, TT2 &t2, TH1 *histo2, TT3 &t3, TH1 *histo3, TT4 &t4, TH1 *histo4, TT5 &t5, TH1 *histo5, TT6 &t6, TH1 *histo6, double rangeMin, double rangeMax)
const T2 & function2() const
MultiHistoChiSquare(TT1 &t1, TH1 *histo1, TT2 &t2, TH1 *histo2, double rangeMin, double rangeMax)
double operator()() const
size_t numberOfBins() const
const T5 & function5() const
size_t numberOfBins() const
const T1 & function1() const
const T4 & function4() const
void setHistos(TH1 *histo1, TH1 *histo2, TH1 *histo3, TH1 *histo4, TH1 *histo5, TH1 *histo6)
MultiHistoChiSquare(TT1 &t1, TH1 *histo1, TT2 &t2, TH1 *histo2, TT3 &t3, TH1 *histo3, TT4 &t4, TH1 *histo4, double rangeMin, double rangeMax)
const T4 & function4() const
const T3 & function3() const
const T3 & function3() const
const T1 & function1() const
const T2 & function2() const
void setHistos(TH1 *histo1, TH1 *histo2, TH1 *histo3)
const T2 & function2() const
const T5 & function5() const
size_t numberOfBins() const
void setHistos(TH1 *histo1, TH1 *histo2, TH1 *histo3, TH1 *histo4, TH1 *histo5)
double operator()() const
const T3 & function3() const
static void print(double amin, unsigned int numberOfFreeParameters, const MultiHistoChiSquare< T1, T2, T3, T4, T5, T6 > &f)
const T4 & function4() const
const T1 & function1() const
void setHistos(TH1 *histo1, TH1 *histo2, TH1 *histo3, TH1 *histo4)