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");
2485 Error(
"Chisquare",
"Function pointer is Null - return -1");
2533 Int_t nbins = nbinsx * nbinsy * nbinsz;
2538 for (
Int_t binz=1; binz <= nbinsz; ++binz) {
2539 for (
Int_t biny=1; biny <= nbinsy; ++biny) {
2540 for (
Int_t binx=1; binx <= nbinsx; ++binx) {
2543 if (onlyPositive &&
y < 0) {
2544 Error(
"ComputeIntegral",
"Bin content is negative - return a NaN value");
2555 Error(
"ComputeIntegral",
"Integral = zero");
return 0;
2610 hintegrated->
Reset();
2614 for (
Int_t binz = firstZ; binz <= lastZ; ++binz) {
2615 for (
Int_t biny = firstY; biny <= lastY; ++biny) {
2616 for (
Int_t binx = firstX; binx <= lastX; ++binx) {
2617 const Int_t bin = hintegrated->
GetBin(binx, biny, binz);
2628 for (
Int_t binz = lastZ; binz >= firstZ; --binz) {
2629 for (
Int_t biny = lastY; biny >= firstY; --biny) {
2630 for (
Int_t binx = lastX; binx >= firstX; --binx) {
2631 const Int_t bin = hintegrated->
GetBin(binx, biny, binz);
2662 ((
TH1&)obj).fDirectory =
nullptr;
2676 delete [] ((
TH1&)obj).fBuffer;
2677 ((
TH1&)obj).fBuffer =
nullptr;
2683 ((
TH1&)obj).fBuffer = buf;
2713 ((
TH1&)obj).fXaxis.SetParent(&obj);
2714 ((
TH1&)obj).fYaxis.SetParent(&obj);
2715 ((
TH1&)obj).fZaxis.SetParent(&obj);
2725 ((
TH1&)obj).fFunctions->UseRWLock();
2753 oldparent = oldstats->GetParent();
2754 oldstats->SetParent(
nullptr);
2760 oldstats->SetParent(oldparent);
2772 if(newname && strlen(newname) ) {
2827 Error(
"Divide",
"Attempt to divide by a non-existing function");
2845 Int_t bin, binx, biny, binz;
2850 for (binz = 0; binz < nz; ++binz) {
2852 for (biny = 0; biny < ny; ++biny) {
2854 for (binx = 0; binx < nx; ++binx) {
2858 bin = binx + nx * (biny + ny * binz);
2895 Error(
"Divide",
"Input histogram passed does not exist (NULL).");
2905 Error(
"Divide",
"Cannot divide histograms with different number of bins");
2908 Warning(
"Divide",
"Dividing histograms with different axis limits");
2910 Warning(
"Divide",
"Dividing histograms with different bin limits");
2912 Warning(
"Divide",
"Dividing histograms with different labels");
2967 Error(
"Divide",
"At least one of the input histograms passed does not exist (NULL).");
2978 Error(
"Divide",
"Cannot divide histograms with different number of bins");
2981 Warning(
"Divide",
"Dividing histograms with different axis limits");
2983 Warning(
"Divide",
"Dividing histograms with different bin limits");
2985 Warning(
"Divide",
"Dividing histograms with different labels");
2990 Error(
"Divide",
"Coefficient of dividing histogram cannot be zero");
3027 fSumw2.
fArray[i] = c1sq * c2sq * (e1sq * b2sq + e2sq * b1sq) / (c2sq * c2sq * b2sq * b2sq);
3086 if (!
gPad->IsEditable())
gROOT->MakeDefCanvas();
3088 if (
gPad->GetX1() == 0 &&
gPad->GetX2() == 1 &&
3089 gPad->GetY1() == 0 &&
gPad->GetY2() == 1 &&
3097 gPad->IncrementPaletteColor(1, opt1);
3122 if (name_postfix) newName.
Form(
"%s%s",
GetName(), name_postfix);
3126 if (
gPad)
gPad->IncrementPaletteColor(1, opt);
3151 Error(
"DrawNormalized",
"Sum of weights is null. Cannot normalize histogram: %s",
GetName());
3163 if (opt.
IsNull() || opt ==
"SAME") opt +=
"HIST";
3198 Int_t range, stat, add;
3218 for (
Int_t binz = 1; binz <= nbinsz; ++binz) {
3220 for (
Int_t biny = 1; biny <= nbinsy; ++biny) {
3222 for (
Int_t binx = 1; binx <= nbinsx; ++binx) {
3320 if (!fft)
return nullptr;
3322 for (
Int_t binx = 1; binx<=ndim[0]; binx++) {
3323 for (
Int_t biny=1; biny<=ndim[1]; biny++) {
3324 for (
Int_t binz=1; binz<=ndim[2]; binz++) {
3354 if (bin <0)
return -1;
3387 if (bin <0)
return -1;
3420 if (bin <0)
return -1;
3456 for (i=0;i<ntimes;i+=stride) {
3463 auto weights =
w ? &
w[i] :
nullptr;
3464 DoFillN((ntimes-i)/stride,&
x[i],weights,stride);
3484 for (i=0;i<ntimes;i+=stride) {
3486 if (bin <0)
continue;
3491 if (bin == 0 || bin > nbins) {
3524 Int_t bin, binx, ibin, loop;
3528 if (!
f1) {
Error(
"FillRandom",
"Unknown function: %s",fname);
return; }
3538 Info(
"FillRandom",
"Using function axis and range [%g,%g]",
xmin,
xmax);
3548 for (binx=1;binx<=nbinsx;binx++) {
3550 integral[binx] = integral[binx-1] + fint;
3554 if (integral[nbinsx] == 0 ) {
3556 Error(
"FillRandom",
"Integral = zero");
return;
3558 for (bin=1;bin<=nbinsx;bin++) integral[bin] /= integral[nbinsx];
3561 for (loop=0;loop<ntimes;loop++) {
3567 +xAxis->
GetBinWidth(ibin+
first)*(r1-integral[ibin])/(integral[ibin+1] - integral[ibin]);
3595 if (!
h) {
Error(
"FillRandom",
"Null histogram");
return; }
3597 Error(
"FillRandom",
"Histograms with different dimensions");
return;
3599 if (std::isnan(
h->ComputeIntegral(
true))) {
3600 Error(
"FillRandom",
"Histograms contains negative bins, does not represent probabilities");
3609 if (ntimes > 10*nbins) {
3613 if (sumw == 0)
return;
3616 Double_t mean =
h->RetrieveBinContent(bin)*ntimes/sumw;
3627 if (sumgen < ntimes) {
3629 for (i =
Int_t(sumgen+0.5); i < ntimes; ++i)
3635 else if (sumgen > ntimes) {
3637 i =
Int_t(sumgen+0.5);
3638 while( i > ntimes) {
3653 catch(std::exception&) {}
3657 if (
h->ComputeIntegral() ==0)
return;
3660 for (loop=0;loop<ntimes;loop++) {
3686 return binx + nx*biny;
3694 return binx + nx*(biny +ny*binz);
3719 return binx + nx*biny;
3727 return binx + nx*(biny +ny*binz);
3745 Warning(
"FindFirstBinAbove",
"Invalid axis number : %d, axis x assumed\n",axis);
3759 for (
Int_t binx = firstBin; binx <= lastBin; binx++) {
3760 for (
Int_t biny = 1; biny <= nbinsy; biny++) {
3761 for (
Int_t binz = 1; binz <= nbinsz; binz++) {
3767 else if (axis == 2) {
3771 for (
Int_t biny = firstBin; biny <= lastBin; biny++) {
3772 for (
Int_t binx = 1; binx <= nbinsx; binx++) {
3773 for (
Int_t binz = 1; binz <= nbinsz; binz++) {
3779 else if (axis == 3) {
3783 for (
Int_t binz = firstBin; binz <= lastBin; binz++) {
3784 for (
Int_t binx = 1; binx <= nbinsx; binx++) {
3785 for (
Int_t biny = 1; biny <= nbinsy; biny++) {
3809 Warning(
"FindFirstBinAbove",
"Invalid axis number : %d, axis x assumed\n",axis);
3823 for (
Int_t binx = lastBin; binx >= firstBin; binx--) {
3824 for (
Int_t biny = 1; biny <= nbinsy; biny++) {
3825 for (
Int_t binz = 1; binz <= nbinsz; binz++) {
3831 else if (axis == 2) {
3835 for (
Int_t biny = lastBin; biny >= firstBin; biny--) {
3836 for (
Int_t binx = 1; binx <= nbinsx; binx++) {
3837 for (
Int_t binz = 1; binz <= nbinsz; binz++) {
3843 else if (axis == 3) {
3847 for (
Int_t binz = lastBin; binz >= firstBin; binz--) {
3848 for (
Int_t binx = 1; binx <= nbinsx; binx++) {
3849 for (
Int_t biny = 1; biny <= nbinsy; biny++) {
3906 linear= (
char*)strstr(fname,
"++");
3910 TF1 f1(fname, fname, xxmin, xxmax);
3914 TF2 f2(fname, fname);
3915 return Fit(&f2,
option,goption,xxmin,xxmax);
3918 TF3 f3(fname, fname);
3919 return Fit(&f3,
option,goption,xxmin,xxmax);
3924 if (!
f1) {
Printf(
"Unknown function: %s",fname);
return -1; }
4292 gROOT->MakeDefCanvas();
4295 Error(
"FitPanel",
"Unable to create a default canvas");
4302 if (handler && handler->
LoadPlugin() != -1) {
4304 Error(
"FitPanel",
"Unable to create the FitPanel");
4307 Error(
"FitPanel",
"Unable to find the FitPanel plug-in");
4364 asym->
Divide(top,bottom);
4378 for(
Int_t k=1; k<= zmax; k++){
4457 return (s[1] ? s[0]*s[0]/s[1] :
TMath::Abs(s[0]) );
4469 Info(
"SetHighlight",
"Supported only 1-D or 2-D histograms");
4486 return ((
TH1*)
this)->GetPainter()->GetObjectInfo(px,py);
4587 Error(
"GetQuantiles",
"Only available for 1-d histograms");
4597 Int_t nq = nprobSum;
4598 if (probSum ==
nullptr) {
4602 for (i=1;i<nq;i++) {
4607 for (i = 0; i < nq; i++) {
4609 while (ibin < nbins-1 &&
fIntegral[ibin+1] == prob[i]) {
4610 if (
fIntegral[ibin+2] == prob[i]) ibin++;
4618 if (!probSum)
delete [] prob;
4636 Double_t allcha, sumx, sumx2,
x, val, stddev, mean;
4647 allcha = sumx = sumx2 = 0;
4648 for (bin=hxfirst;bin<=hxlast;bin++) {
4651 if (val > valmax) valmax = val;
4656 if (allcha == 0)
return;
4658 stddev = sumx2/allcha - mean*mean;
4661 if (stddev == 0) stddev = binwidx*(hxlast-hxfirst+1)/4;
4668 Double_t constant = 0.5*(valmax+binwidx*allcha/(sqrtpi*stddev));
4676 if ((mean < xmin || mean >
xmax) && stddev > (
xmax-
xmin)) {
4697 Int_t nchanx = hxlast - hxfirst + 1;
4718 Int_t nchanx = hxlast - hxfirst + 1;
4721 if (nchanx <=1 || npar == 1) {
4744 const Int_t idim = 20;
4755 if (
m > idim ||
m >
n)
return;
4758 for (
l = 2;
l <=
m; ++
l) {
4760 b[
m +
l*20 - 21] = zero;
4767 for (k = hxfirst; k <= hxlast; ++k) {
4772 for (
l = 2;
l <=
m; ++
l) {
4775 da[
l-1] += power*yk;
4777 for (
l = 2;
l <=
m; ++
l) {
4779 b[
m +
l*20 - 21] += power;
4782 for (i = 3; i <=
m; ++i) {
4783 for (k = i; k <=
m; ++k) {
4784 b[k - 1 + (i-1)*20 - 21] =
b[k + (i-2)*20 - 21];
4789 for (i=0; i<
m; ++i)
a[i] = da[i];
4809 xbar = ybar = x2bar = xybar = 0;
4814 for (i = hxfirst; i <= hxlast; ++i) {
4818 if (yk <= 0) yk = 1
e-9;
4827 det = fn*x2bar - xbar*xbar;
4835 a0 = (x2bar*ybar - xbar*xybar) / det;
4836 a1 = (fn*xybar - xbar*ybar) / det;
4847 Int_t a_dim1, a_offset, b_dim1, b_offset;
4849 Int_t im1, jp1, nm1, nmi;
4855 b_offset = b_dim1 + 1;
4858 a_offset = a_dim1 + 1;
4861 if (idim <
n)
return;
4864 for (j = 1; j <=
n; ++j) {
4865 if (
a[j + j*a_dim1] <= 0) { ifail = -1;
return; }
4866 a[j + j*a_dim1] = one /
a[j + j*a_dim1];
4867 if (j ==
n)
continue;
4869 for (
l = jp1;
l <=
n; ++
l) {
4870 a[j +
l*a_dim1] =
a[j + j*a_dim1] *
a[
l + j*a_dim1];
4871 s1 = -
a[
l + (j+1)*a_dim1];
4872 for (i = 1; i <= j; ++i) {
s1 =
a[
l + i*a_dim1] *
a[i + (j+1)*a_dim1] +
s1; }
4873 a[
l + (j+1)*a_dim1] = -
s1;
4878 for (
l = 1;
l <= k; ++
l) {
4879 b[
l*b_dim1 + 1] =
a[a_dim1 + 1]*
b[
l*b_dim1 + 1];
4882 for (
l = 1;
l <= k; ++
l) {
4883 for (i = 2; i <=
n; ++i) {
4885 s21 = -
b[i +
l*b_dim1];
4886 for (j = 1; j <= im1; ++j) {
4887 s21 =
a[i + j*a_dim1]*
b[j +
l*b_dim1] + s21;
4889 b[i +
l*b_dim1] = -
a[i + i*a_dim1]*s21;
4892 for (i = 1; i <= nm1; ++i) {
4894 s22 = -
b[nmi +
l*b_dim1];
4895 for (j = 1; j <= i; ++j) {
4897 s22 =
a[nmi + nmjp1*a_dim1]*
b[nmjp1 +
l*b_dim1] + s22;
4899 b[nmi +
l*b_dim1] = -s22;
4937 if (binx < 0) binx = 0;
4938 if (binx > ofx) binx = ofx;
4953 binx = binglobal%nx;
4959 binx = binglobal%nx;
4960 biny = ((binglobal-binx)/nx)%ny;
4965 binx = binglobal%nx;
4966 biny = ((binglobal-binx)/nx)%ny;
4967 binz = ((binglobal-binx)/nx -biny)/ny;
4986 Error(
"GetRandom",
"Function only valid for 1-d histograms");
4996 integral = ((
TH1*)
this)->ComputeIntegral(
true);
4998 if (integral == 0)
return 0;
5037 if (bin < 0) bin = 0;
5063 Error(
"GetBinWithContent",
"function is only valid for 1-D histograms");
5069 if (firstx <= 0) firstx = 1;
5073 for (
Int_t i=firstx;i<=lastx;i++) {
5075 if (diff <= 0) {binx = i;
return diff;}
5076 if (diff < curmax && diff <= maxdiff) {curmax = diff, binminx=i;}
5111 return y0 + (
x-x0)*((
y1-y0)/(
x1-x0));
5120 Error(
"Interpolate",
"This function must be called with 1 argument for a TH1");
5129 Error(
"Interpolate",
"This function must be called with 1 argument for a TH1");