682 if (nbins <= 0) {
Warning(
"TH1",
"nbins is <=0 - set to nbins = 1"); nbins = 1; }
704 if (nbins <= 0) {
Warning(
"TH1",
"nbins is <=0 - set to nbins = 1"); nbins = 1; }
726 if (nbins <= 0) {
Warning(
"TH1",
"nbins is <=0 - set to nbins = 1"); nbins = 1; }
745 Draw(
b ?
b->GetDrawOption() :
"");
810 Error(
"Add",
"Attempt to add a non-existing function");
830 for (
Int_t i = 0; i < 10; ++i)
s1[i] = 0;
836 Int_t bin, binx, biny, binz;
841 for (binz = 0; binz < ncellsz; ++binz) {
843 for (biny = 0; biny < ncellsy; ++biny) {
845 for (binx = 0; binx < ncellsx; ++binx) {
849 bin = binx + ncellsx * (biny + ncellsy * binz);
901 Error(
"Add",
"Attempt to add a non-existing histogram");
914 Info(
"Add",
"Attempt to add histograms with different number of bins - trying to use TH1::Merge");
916 Error(
"Add",
"Attempt to add histograms with different number of bins : nbins h1 = %d , nbins h2 = %d",
GetNbinsX(),
h1->
GetNbinsX());
921 Info(
"Add",
"Attempt to add histograms with different axis limits - trying to use TH1::Merge");
923 Warning(
"Add",
"Attempt to add histograms with different axis limits");
926 Info(
"Add",
"Attempt to add histograms with different bin limits - trying to use TH1::Merge");
928 Warning(
"Add",
"Attempt to add histograms with different bin limits");
932 Info(
"Add",
"Attempt to add histograms with different labels - trying to use TH1::Merge");
934 Info(
"Warning",
"Attempt to add histograms with different labels");
939 l.Add(
const_cast<TH1*
>(
h1));
982 if (e1sq) w1 = 1. / e1sq;
987 double sf = (s2[0] != 0) ? s2[1]/s2[0] : 1;
991 if (e2sq) w2 = 1. / e2sq;
996 double sf = (
s1[0] != 0) ?
s1[1]/
s1[0] : 1;
1001 double y = (w1*
y1 + w2*
y2)/(w1 + w2);
1004 double err2 = 1./(w1 + w2);
1005 if (err2 < 1.E-200) err2 = 0;
1021 if (i == 1)
s1[i] +=
c1*
c1*s2[i];
1022 else s1[i] +=
c1*s2[i];
1069 Error(
"Add",
"Attempt to add a non-existing histogram");
1077 if (
h1 == h2 &&
c2 < 0) {
c2 = 0; normWidth =
kTRUE;}
1088 Info(
"Add",
"Attempt to add histograms with different number of bins - trying to use TH1::Merge");
1090 Error(
"Add",
"Attempt to add histograms with different number of bins : nbins h1 = %d , nbins h2 = %d",
GetNbinsX(),
h1->
GetNbinsX());
1095 Info(
"Add",
"Attempt to add histograms with different axis limits - trying to use TH1::Merge");
1097 Warning(
"Add",
"Attempt to add histograms with different axis limits");
1100 Info(
"Add",
"Attempt to add histograms with different bin limits - trying to use TH1::Merge");
1102 Warning(
"Add",
"Attempt to add histograms with different bin limits");
1106 Info(
"Add",
"Attempt to add histograms with different labels - trying to use TH1::Merge");
1108 Info(
"Warning",
"Attempt to add histograms with different labels");
1114 l.Add(
const_cast<TH1*
>(
h1));
1115 l.Add(
const_cast<TH1*
>(h2));
1137 Bool_t resetStats = (
c1*
c2 < 0) || normWidth;
1144 if (i == 1) s3[i] =
c1*
c1*
s1[i] +
c2*
c2*s2[i];
1146 else s3[i] =
c1*
s1[i] +
c2*s2[i];
1162 Int_t bin, binx, biny, binz;
1163 for (binz = 0; binz < nbinsz; ++binz) {
1165 for (biny = 0; biny < nbinsy; ++biny) {
1167 for (binx = 0; binx < nbinsx; ++binx) {
1169 bin =
GetBin(binx, biny, binz);
1190 if (e1sq) w1 = 1./ e1sq;
1194 double sf = (
s1[0] != 0) ?
s1[1]/
s1[0] : 1;
1198 if (e2sq) w2 = 1./ e2sq;
1202 double sf = (s2[0] != 0) ? s2[1]/s2[0] : 1;
1207 double y = (w1*
y1 + w2*
y2)/(w1 + w2);
1210 double err2 = 1./(w1 + w2);
1211 if (err2 < 1.E-200) err2 = 0;
1285 return ((next &&
x > 0.) || (!next &&
x <= 0.)) ? std::ldexp(std::copysign(1., f2), nn)
1286 : std::ldexp(std::copysign(1., f2), --nn);
1299 return (
Int_t)std::ldexp(1., nn);
1339 Double_t rr = (xhma - xhmi) / (xma - xmi);
1349 Int_t nbup = (xhma - xma) / bw;
1352 if (nbup != nbside) {
1354 xhma -= bw * (nbup - nbside);
1355 nb -= (nbup - nbside);
1359 Int_t nblw = (xmi - xhmi) / bw;
1362 if (nblw != nbside) {
1364 xhmi += bw * (nblw - nbside);
1365 nb -= (nblw - nbside);
1395 if (nbentries == 0) {
1405 if (nbentries < 0 && action == 0)
return 0;
1408 if (nbentries < 0) {
1409 nbentries = -nbentries;
1421 for (
Int_t i=0;i<nbentries;i++) {
1424 if (!std::isfinite(
x))
continue;
1433 "inconsistency found by power-of-2 autobin algorithm: fallback to standard method");
1451 DoFillN(nbentries,&buffer[2],&buffer[1],2);
1485 if (nbentries < 0) {
1488 nbentries = -nbentries;
1520 if ( h2Array->
fN != fN ) {
1525 for (
int i = 0; i < fN; ++i ) {
1559 for (
int i = 1; i <= a1->
GetNbins(); ++i) {
1562 if (label1 != label2) {
1594 ::Info(
"CheckEqualAxes",
"Axes have different number of bins : nbin1 = %d nbin2 = %d",a1->
GetNbins(),a2->
GetNbins() );
1600 ::Info(
"CheckEqualAxes",
"Axes have different limits");
1606 ::Info(
"CheckEqualAxes",
"Axes have different bin limits");
1614 ::Info(
"CheckEqualAxes",
"Axes have different labels");
1629 Int_t nbins1 = lastBin1-firstBin1 + 1;
1637 if (firstBin2 < lastBin2) {
1639 nbins2 = lastBin1-firstBin1 + 1;
1644 if (nbins1 != nbins2 ) {
1645 ::Info(
"CheckConsistentSubAxes",
"Axes have different number of bins");
1653 ::Info(
"CheckConsistentSubAxes",
"Axes have different limits");
1665 if (
h1 == h2)
return true;
1680 (dim > 1 && nbinsy != h2->
GetNbinsY()) ||
1681 (dim > 2 && nbinsz != h2->
GetNbinsZ()) ) {
1997 Int_t ndf = 0, igood = 0;
2005 printf(
"Chi2 = %f, Prob = %g, NDF = %d, igood = %d\n", chi2,prob,ndf,igood);
2008 if (ndf == 0)
return 0;
2056 Int_t i_start, i_end;
2057 Int_t j_start, j_end;
2058 Int_t k_start, k_end;
2087 Error(
"Chi2TestX",
"Histograms have different dimensions.");
2092 if (nbinx1 != nbinx2) {
2093 Error(
"Chi2TestX",
"different number of x channels");
2095 if (nbiny1 != nbiny2) {
2096 Error(
"Chi2TestX",
"different number of y channels");
2098 if (nbinz1 != nbinz2) {
2099 Error(
"Chi2TestX",
"different number of z channels");
2103 i_start = j_start = k_start = 1;
2134 ndf = (i_end - i_start + 1) * (j_end - j_start + 1) * (k_end - k_start + 1) - 1;
2141 if (scaledHistogram && !comparisonUU) {
2142 Info(
"Chi2TestX",
"NORM option should be used together with UU option. It is ignored");
2149 Double_t effEntries1 = (s[1] ? s[0] * s[0] / s[1] : 0.0);
2153 Double_t effEntries2 = (s[1] ? s[0] * s[0] / s[1] : 0.0);
2155 if (!comparisonUU && !comparisonUW && !comparisonWW ) {
2157 if (
TMath::Abs(sumBinContent1 - effEntries1) < 1) {
2158 if (
TMath::Abs(sumBinContent2 - effEntries2) < 1) comparisonUU =
true;
2159 else comparisonUW =
true;
2161 else comparisonWW =
true;
2165 if (
TMath::Abs(sumBinContent1 - effEntries1) >= 1) {
2166 Warning(
"Chi2TestX",
"First histogram is not unweighted and option UW has been requested");
2169 if ( (!scaledHistogram && comparisonUU) ) {
2170 if ( (
TMath::Abs(sumBinContent1 - effEntries1) >= 1) || (
TMath::Abs(sumBinContent2 - effEntries2) >= 1) ) {
2171 Warning(
"Chi2TestX",
"Both histograms are not unweighted and option UU has been requested");
2177 if (comparisonUU && scaledHistogram) {
2178 for (
Int_t i = i_start; i <= i_end; ++i) {
2179 for (
Int_t j = j_start; j <= j_end; ++j) {
2180 for (
Int_t k = k_start; k <= k_end; ++k) {
2189 if (e1sq > 0.0) cnt1 =
TMath::Floor(cnt1 * cnt1 / e1sq + 0.5);
2192 if (e2sq > 0.0) cnt2 =
TMath::Floor(cnt2 * cnt2 / e2sq + 0.5);
2203 if (sumw1 <= 0.0 || sumw2 <= 0.0) {
2204 Error(
"Chi2TestX",
"Cannot use option NORM when one histogram has all zero errors");
2209 for (
Int_t i = i_start; i <= i_end; ++i) {
2210 for (
Int_t j = j_start; j <= j_end; ++j) {
2211 for (
Int_t k = k_start; k <= k_end; ++k) {
2225 if (sum1 == 0.0 || sum2 == 0.0) {
2226 Error(
"Chi2TestX",
"one histogram is empty");
2230 if ( comparisonWW && ( sumw1 <= 0.0 && sumw2 <= 0.0 ) ){
2231 Error(
"Chi2TestX",
"Hist1 and Hist2 have both all zero errors\n");
2241 for (
Int_t i = i_start; i <= i_end; ++i) {
2242 for (
Int_t j = j_start; j <= j_end; ++j) {
2243 for (
Int_t k = k_start; k <= k_end; ++k) {
2250 if (scaledHistogram) {
2255 if (e1sq > 0) cnt1 =
TMath::Floor(cnt1 * cnt1 / e1sq + 0.5);
2258 if (e2sq > 0) cnt2 =
TMath::Floor(cnt2 * cnt2 / e2sq + 0.5);
2262 if (
Int_t(cnt1) == 0 &&
Int_t(cnt2) == 0) --ndf;
2269 if (res) res[i - i_start] = (cnt1 - nexp1) /
TMath::Sqrt(nexp1);
2278 Double_t delta = sum2 * cnt1 - sum1 * cnt2;
2279 chi2 += delta * delta / cntsum;
2284 chi2 /= sum1 * sum2;
2289 Info(
"Chi2TestX",
"There is a bin in h1 with less than 1 event.\n");
2293 Info(
"Chi2TestX",
"There is a bin in h2 with less than 1 event.\n");
2304 if ( comparisonUW ) {
2305 for (
Int_t i = i_start; i <= i_end; ++i) {
2306 for (
Int_t j = j_start; j <= j_end; ++j) {
2307 for (
Int_t k = k_start; k <= k_end; ++k) {
2316 if (cnt1 * cnt1 == 0 && cnt2 * cnt2 == 0) {
2322 if (cnt2 * cnt2 == 0 && e2sq == 0) {
2326 e2sq = sumw2 / sum2;
2331 Error(
"Chi2TestX",
"Hist2 has in bin (%d,%d,%d) zero content and zero errors\n", i, j, k);
2337 if (e2sq > 0 && cnt2 * cnt2 / e2sq < 10)
n++;
2339 Double_t var1 = sum2 * cnt2 - sum1 * e2sq;
2340 Double_t var2 = var1 * var1 + 4. * sum2 * sum2 * cnt1 * e2sq;
2345 while (var1 * var1 + cnt1 == 0 || var1 + var2 == 0) {
2348 var1 = sum2 * cnt2 - sum1 * e2sq;
2349 var2 = var1 * var1 + 4. * sum2 * sum2 * cnt1 * e2sq;
2353 while (var1 + var2 == 0) {
2356 var1 = sum2 * cnt2 - sum1 * e2sq;
2357 var2 = var1 * var1 + 4. * sum2 * sum2 * cnt1 * e2sq;
2358 while (var1 * var1 + cnt1 == 0 || var1 + var2 == 0) {
2361 var1 = sum2 * cnt2 - sum1 * e2sq;
2362 var2 = var1 * var1 + 4. * sum2 * sum2 * cnt1 * e2sq;
2367 Double_t probb = (var1 + var2) / (2. * sum2 * sum2);
2375 chi2 += delta1 * delta1 / nexp1;
2378 chi2 += delta2 * delta2 / e2sq;
2383 Double_t temp1 = sum2 * e2sq / var2;
2384 Double_t temp2 = 1.0 + (sum1 * e2sq - sum2 * cnt2) / var2;
2385 temp2 = temp1 * temp1 * sum1 * probb * (1.0 - probb) + temp2 * temp2 * e2sq / 4.0;
2398 Info(
"Chi2TestX",
"There is a bin in h1 with less than 1 event.\n");
2402 Info(
"Chi2TestX",
"There is a bin in h2 with less than 10 effective events.\n");
2412 for (
Int_t i = i_start; i <= i_end; ++i) {
2413 for (
Int_t j = j_start; j <= j_end; ++j) {
2414 for (
Int_t k = k_start; k <= k_end; ++k) {
2424 if (cnt1 * cnt1 == 0 && cnt2 * cnt2 == 0) {
2429 if (e1sq == 0 && e2sq == 0) {
2431 Error(
"Chi2TestX",
"h1 and h2 both have bin %d,%d,%d with all zero errors\n", i,j,k);
2436 Double_t delta = sum2 * cnt1 - sum1 * cnt2;
2437 chi2 += delta * delta /
sigma;
2440 Double_t temp = cnt1 * sum1 * e2sq + cnt2 * sum2 * e1sq;
2453 res[i - i_start] = z;
2456 if (e1sq > 0 && cnt1 * cnt1 / e1sq < 10)
m++;
2457 if (e2sq > 0 && cnt2 * cnt2 / e2sq < 10)
n++;
2463 Info(
"Chi2TestX",
"There is a bin in h1 with less than 10 effective events.\n");
2467 Info(
"Chi2TestX",
"There is a bin in h2 with less than 10 effective events.\n");
2484 Error(
"Chisquare",
"Function pointer is Null - return -1");
2530 Int_t nbins = nbinsx * nbinsy * nbinsz;
2535 for (
Int_t binz=1; binz <= nbinsz; ++binz) {
2536 for (
Int_t biny=1; biny <= nbinsy; ++biny) {
2537 for (
Int_t binx=1; binx <= nbinsx; ++binx) {
2540 if (onlyPositive &&
y < 0) {
2541 Error(
"ComputeIntegral",
"Bin content is negative - return a NaN value");
2552 Error(
"ComputeIntegral",
"Integral = zero");
return 0;
2607 hintegrated->
Reset();
2611 for (
Int_t binz = firstZ; binz <= lastZ; ++binz) {
2612 for (
Int_t biny = firstY; biny <= lastY; ++biny) {
2613 for (
Int_t binx = firstX; binx <= lastX; ++binx) {
2614 const Int_t bin = hintegrated->
GetBin(binx, biny, binz);
2625 for (
Int_t binz = lastZ; binz >= firstZ; --binz) {
2626 for (
Int_t biny = lastY; biny >= firstY; --biny) {
2627 for (
Int_t binx = lastX; binx >= firstX; --binx) {
2628 const Int_t bin = hintegrated->
GetBin(binx, biny, binz);
2659 ((
TH1&)obj).fDirectory =
nullptr;
2673 delete [] ((
TH1&)obj).fBuffer;
2674 ((
TH1&)obj).fBuffer =
nullptr;
2680 ((
TH1&)obj).fBuffer = buf;
2706 ((
TH1&)obj).fXaxis.SetParent(&obj);
2707 ((
TH1&)obj).fYaxis.SetParent(&obj);
2708 ((
TH1&)obj).fZaxis.SetParent(&obj);
2718 ((
TH1&)obj).fFunctions->UseRWLock();
2746 oldparent = oldstats->GetParent();
2747 oldstats->SetParent(
nullptr);
2753 oldstats->SetParent(oldparent);
2765 if(newname && strlen(newname) ) {
2820 Error(
"Divide",
"Attempt to divide by a non-existing function");
2838 Int_t bin, binx, biny, binz;
2843 for (binz = 0; binz < nz; ++binz) {
2845 for (biny = 0; biny < ny; ++biny) {
2847 for (binx = 0; binx < nx; ++binx) {
2851 bin = binx + nx * (biny + ny * binz);
2888 Error(
"Divide",
"Input histogram passed does not exist (NULL).");
2898 Error(
"Divide",
"Cannot divide histograms with different number of bins");
2901 Warning(
"Divide",
"Dividing histograms with different axis limits");
2903 Warning(
"Divide",
"Dividing histograms with different bin limits");
2905 Warning(
"Divide",
"Dividing histograms with different labels");
2960 Error(
"Divide",
"At least one of the input histograms passed does not exist (NULL).");
2971 Error(
"Divide",
"Cannot divide histograms with different number of bins");
2974 Warning(
"Divide",
"Dividing histograms with different axis limits");
2976 Warning(
"Divide",
"Dividing histograms with different bin limits");
2978 Warning(
"Divide",
"Dividing histograms with different labels");
2983 Error(
"Divide",
"Coefficient of dividing histogram cannot be zero");
3020 fSumw2.
fArray[i] = c1sq * c2sq * (e1sq * b2sq + e2sq * b1sq) / (c2sq * c2sq * b2sq * b2sq);
3079 if (!
gPad->IsEditable())
gROOT->MakeDefCanvas();
3081 if (
gPad->GetX1() == 0 &&
gPad->GetX2() == 1 &&
3082 gPad->GetY1() == 0 &&
gPad->GetY2() == 1 &&
3090 gPad->IncrementPaletteColor(1, opt1);
3115 if (name_postfix) newName.
Form(
"%s%s",
GetName(), name_postfix);
3119 if (
gPad)
gPad->IncrementPaletteColor(1, opt);
3144 Error(
"DrawNormalized",
"Sum of weights is null. Cannot normalize histogram: %s",
GetName());
3156 if (opt.
IsNull() || opt ==
"SAME") opt +=
"HIST";
3191 Int_t range, stat, add;
3211 for (
Int_t binz = 1; binz <= nbinsz; ++binz) {
3213 for (
Int_t biny = 1; biny <= nbinsy; ++biny) {
3215 for (
Int_t binx = 1; binx <= nbinsx; ++binx) {
3315 for (
Int_t binx = 1; binx<=ndim[0]; binx++) {
3316 for (
Int_t biny=1; biny<=ndim[1]; biny++) {
3317 for (
Int_t binz=1; binz<=ndim[2]; binz++) {
3347 if (bin <0)
return -1;
3380 if (bin <0)
return -1;
3413 if (bin <0)
return -1;
3449 for (i=0;i<ntimes;i+=stride) {
3456 auto weights =
w ? &
w[i] :
nullptr;
3457 DoFillN((ntimes-i)/stride,&
x[i],weights,stride);
3477 for (i=0;i<ntimes;i+=stride) {
3479 if (bin <0)
continue;
3484 if (bin == 0 || bin > nbins) {
3517 Int_t bin, binx, ibin, loop;
3521 if (!
f1) {
Error(
"FillRandom",
"Unknown function: %s",fname);
return; }
3531 Info(
"FillRandom",
"Using function axis and range [%g,%g]",
xmin,
xmax);
3541 for (binx=1;binx<=nbinsx;binx++) {
3543 integral[binx] = integral[binx-1] + fint;
3547 if (integral[nbinsx] == 0 ) {
3549 Error(
"FillRandom",
"Integral = zero");
return;
3551 for (bin=1;bin<=nbinsx;bin++) integral[bin] /= integral[nbinsx];
3554 for (loop=0;loop<ntimes;loop++) {
3560 +xAxis->
GetBinWidth(ibin+
first)*(r1-integral[ibin])/(integral[ibin+1] - integral[ibin]);
3588 if (!
h) {
Error(
"FillRandom",
"Null histogram");
return; }
3590 Error(
"FillRandom",
"Histograms with different dimensions");
return;
3592 if (std::isnan(
h->ComputeIntegral(
true))) {
3593 Error(
"FillRandom",
"Histograms contains negative bins, does not represent probabilities");
3602 if (ntimes > 10*nbins) {
3606 if (sumw == 0)
return;
3609 Double_t mean =
h->RetrieveBinContent(bin)*ntimes/sumw;
3620 if (sumgen < ntimes) {
3622 for (i =
Int_t(sumgen+0.5); i < ntimes; ++i)
3628 else if (sumgen > ntimes) {
3630 i =
Int_t(sumgen+0.5);
3631 while( i > ntimes) {
3646 catch(std::exception&) {}
3650 if (
h->ComputeIntegral() ==0)
return;
3653 for (loop=0;loop<ntimes;loop++) {
3679 return binx + nx*biny;
3687 return binx + nx*(biny +ny*binz);
3712 return binx + nx*biny;
3720 return binx + nx*(biny +ny*binz);
3738 Warning(
"FindFirstBinAbove",
"Invalid axis number : %d, axis x assumed\n",axis);
3752 for (
Int_t binx = firstBin; binx <= lastBin; binx++) {
3753 for (
Int_t biny = 1; biny <= nbinsy; biny++) {
3754 for (
Int_t binz = 1; binz <= nbinsz; binz++) {
3760 else if (axis == 2) {
3764 for (
Int_t biny = firstBin; biny <= lastBin; biny++) {
3765 for (
Int_t binx = 1; binx <= nbinsx; binx++) {
3766 for (
Int_t binz = 1; binz <= nbinsz; binz++) {
3772 else if (axis == 3) {
3776 for (
Int_t binz = firstBin; binz <= lastBin; binz++) {
3777 for (
Int_t binx = 1; binx <= nbinsx; binx++) {
3778 for (
Int_t biny = 1; biny <= nbinsy; biny++) {
3802 Warning(
"FindFirstBinAbove",
"Invalid axis number : %d, axis x assumed\n",axis);
3816 for (
Int_t binx = lastBin; binx >= firstBin; binx--) {
3817 for (
Int_t biny = 1; biny <= nbinsy; biny++) {
3818 for (
Int_t binz = 1; binz <= nbinsz; binz++) {
3824 else if (axis == 2) {
3828 for (
Int_t biny = lastBin; biny >= firstBin; biny--) {
3829 for (
Int_t binx = 1; binx <= nbinsx; binx++) {
3830 for (
Int_t binz = 1; binz <= nbinsz; binz++) {
3836 else if (axis == 3) {
3840 for (
Int_t binz = lastBin; binz >= firstBin; binz--) {
3841 for (
Int_t binx = 1; binx <= nbinsx; binx++) {
3842 for (
Int_t biny = 1; biny <= nbinsy; biny++) {
3899 linear= (
char*)strstr(fname,
"++");
3903 TF1 f1(fname, fname, xxmin, xxmax);
3907 TF2 f2(fname, fname);
3908 return Fit(&f2,
option,goption,xxmin,xxmax);
3911 TF3 f3(fname, fname);
3912 return Fit(&f3,
option,goption,xxmin,xxmax);
3917 if (!
f1) {
Printf(
"Unknown function: %s",fname);
return -1; }
4285 gROOT->MakeDefCanvas();
4288 Error(
"FitPanel",
"Unable to create a default canvas");
4295 if (handler && handler->
LoadPlugin() != -1) {
4297 Error(
"FitPanel",
"Unable to create the FitPanel");
4300 Error(
"FitPanel",
"Unable to find the FitPanel plug-in");
4357 asym->
Divide(top,bottom);
4371 for(
Int_t k=1; k<= zmax; k++){
4450 return (s[1] ? s[0]*s[0]/s[1] :
TMath::Abs(s[0]) );
4462 Info(
"SetHighlight",
"Supported only 1-D or 2-D histograms");
4479 return ((
TH1*)
this)->GetPainter()->GetObjectInfo(px,py);
4580 Error(
"GetQuantiles",
"Only available for 1-d histograms");
4590 Int_t nq = nprobSum;
4595 for (i=1;i<nq;i++) {
4600 for (i = 0; i < nq; i++) {
4602 while (ibin < nbins-1 &&
fIntegral[ibin+1] == prob[i]) {
4603 if (
fIntegral[ibin+2] == prob[i]) ibin++;
4611 if (!probSum)
delete [] prob;
4629 Double_t allcha, sumx, sumx2,
x, val, stddev, mean;
4640 allcha = sumx = sumx2 = 0;
4641 for (bin=hxfirst;bin<=hxlast;bin++) {
4644 if (val > valmax) valmax = val;
4649 if (allcha == 0)
return;
4651 stddev = sumx2/allcha - mean*mean;
4654 if (stddev == 0) stddev = binwidx*(hxlast-hxfirst+1)/4;
4661 Double_t constant = 0.5*(valmax+binwidx*allcha/(sqrtpi*stddev));
4669 if ((mean < xmin || mean >
xmax) && stddev > (
xmax-
xmin)) {
4690 Int_t nchanx = hxlast - hxfirst + 1;
4711 Int_t nchanx = hxlast - hxfirst + 1;
4714 if (nchanx <=1 || npar == 1) {
4737 const Int_t idim = 20;
4748 if (
m > idim ||
m >
n)
return;
4751 for (
l = 2;
l <=
m; ++
l) {
4753 b[
m +
l*20 - 21] = zero;
4760 for (k = hxfirst; k <= hxlast; ++k) {
4765 for (
l = 2;
l <=
m; ++
l) {
4768 da[
l-1] += power*yk;
4770 for (
l = 2;
l <=
m; ++
l) {
4772 b[
m +
l*20 - 21] += power;
4775 for (i = 3; i <=
m; ++i) {
4776 for (k = i; k <=
m; ++k) {
4777 b[k - 1 + (i-1)*20 - 21] =
b[k + (i-2)*20 - 21];
4782 for (i=0; i<
m; ++i)
a[i] = da[i];
4802 xbar = ybar = x2bar = xybar = 0;
4807 for (i = hxfirst; i <= hxlast; ++i) {
4811 if (yk <= 0) yk = 1
e-9;
4820 det = fn*x2bar - xbar*xbar;
4828 a0 = (x2bar*ybar - xbar*xybar) / det;
4829 a1 = (fn*xybar - xbar*ybar) / det;
4840 Int_t a_dim1, a_offset, b_dim1, b_offset;
4842 Int_t im1, jp1, nm1, nmi;
4848 b_offset = b_dim1 + 1;
4851 a_offset = a_dim1 + 1;
4854 if (idim <
n)
return;
4857 for (j = 1; j <=
n; ++j) {
4858 if (
a[j + j*a_dim1] <= 0) { ifail = -1;
return; }
4859 a[j + j*a_dim1] = one /
a[j + j*a_dim1];
4860 if (j ==
n)
continue;
4862 for (
l = jp1;
l <=
n; ++
l) {
4863 a[j +
l*a_dim1] =
a[j + j*a_dim1] *
a[
l + j*a_dim1];
4864 s1 = -
a[
l + (j+1)*a_dim1];
4865 for (i = 1; i <= j; ++i) {
s1 =
a[
l + i*a_dim1] *
a[i + (j+1)*a_dim1] +
s1; }
4866 a[
l + (j+1)*a_dim1] = -
s1;
4871 for (
l = 1;
l <= k; ++
l) {
4872 b[
l*b_dim1 + 1] =
a[a_dim1 + 1]*
b[
l*b_dim1 + 1];
4875 for (
l = 1;
l <= k; ++
l) {
4876 for (i = 2; i <=
n; ++i) {
4878 s21 = -
b[i +
l*b_dim1];
4879 for (j = 1; j <= im1; ++j) {
4880 s21 =
a[i + j*a_dim1]*
b[j +
l*b_dim1] + s21;
4882 b[i +
l*b_dim1] = -
a[i + i*a_dim1]*s21;
4885 for (i = 1; i <= nm1; ++i) {
4887 s22 = -
b[nmi +
l*b_dim1];
4888 for (j = 1; j <= i; ++j) {
4890 s22 =
a[nmi + nmjp1*a_dim1]*
b[nmjp1 +
l*b_dim1] + s22;
4892 b[nmi +
l*b_dim1] = -s22;
4930 if (binx < 0) binx = 0;
4931 if (binx > ofx) binx = ofx;
4946 binx = binglobal%nx;
4952 binx = binglobal%nx;
4953 biny = ((binglobal-binx)/nx)%ny;
4958 binx = binglobal%nx;
4959 biny = ((binglobal-binx)/nx)%ny;
4960 binz = ((binglobal-binx)/nx -biny)/ny;
4979 Error(
"GetRandom",
"Function only valid for 1-d histograms");
4989 integral = ((
TH1*)
this)->ComputeIntegral(
true);
4991 if (integral == 0)
return 0;
5030 if (bin < 0) bin = 0;
5056 Error(
"GetBinWithContent",
"function is only valid for 1-D histograms");
5062 if (firstx <= 0) firstx = 1;
5066 for (
Int_t i=firstx;i<=lastx;i++) {
5068 if (diff <= 0) {binx = i;
return diff;}
5069 if (diff < curmax && diff <= maxdiff) {curmax = diff, binminx=i;}
5104 return y0 + (
x-x0)*((
y1-y0)/(
x1-x0));
5113 Error(
"Interpolate",
"This function must be called with 1 argument for a TH1");
5122 Error(
"Interpolate",
"This function must be called with 1 argument for a TH1");
5150 Int_t binx, biny, binz;