77 :
TH1(
name,title,nbinsx,xlow,xup),
82 Warning(
"TH3",
"nbinsy is <=0 - set to nbinsy = 1");
86 Warning(
"TH3",
"nbinsz is <=0 - set to nbinsz = 1");
91 fNcells = (nbinsx+2)*(nbinsy+2)*(nbinsz+2);
107 if (nbinsy <= 0) {
Warning(
"TH3",
"nbinsy is <=0 - set to nbinsy = 1"); nbinsy = 1; }
108 if (nbinsz <= 0) nbinsz = 1;
113 fNcells = (nbinsx+2)*(nbinsy+2)*(nbinsz+2);
129 if (nbinsy <= 0) {
Warning(
"TH3",
"nbinsy is <=0 - set to nbinsy = 1"); nbinsy = 1; }
130 if (nbinsz <= 0) nbinsz = 1;
135 fNcells = (nbinsx+2)*(nbinsy+2)*(nbinsz+2);
147 ((
TH3&)
h).Copy(*
this);
188 if (!nbentries)
return 0;
191 if (action == 0)
return 0;
192 nbentries = -nbentries;
207 for (
Int_t i=1;i<nbentries;i++) {
215 if (z < zmin) zmin = z;
216 if (z > zmax) zmax = z;
235 for (
Int_t i=0;i<nbentries;i++) {
236 Fill(buffer[4*i+2],buffer[4*i+3],buffer[4*i+4],buffer[4*i+1]);
262 nbentries = -nbentries;
288 Error(
"Fill",
"Invalid signature - do nothing");
303 Int_t binx, biny, binz, bin;
308 if (binx <0 || biny <0 || binz<0)
return -1;
351 Int_t binx, biny, binz, bin;
356 if (binx <0 || biny <0 || binz<0)
return -1;
396 Int_t binx, biny, binz, bin;
401 if (binx <0 || biny <0 || binz<0)
return -1;
439 Int_t binx, biny, binz, bin;
444 if (binx <0 || biny <0 || binz<0)
return -1;
483 Int_t binx, biny, binz, bin;
488 if (binx <0 || biny <0 || binz<0)
return -1;
527 Int_t binx, biny, binz, bin;
532 if (binx <0 || biny <0 || binz<0)
return -1;
571 Int_t binx, biny, binz, bin;
576 if (binx <0 || biny <0 || binz<0)
return -1;
616 Int_t binx, biny, binz, bin;
621 if (binx <0 || biny <0 || binz<0)
return -1;
670 Int_t bin, binx, biny, binz, ibin, loop;
674 if (!fobj) {
Error(
"FillRandom",
"Unknown function: %s",fname);
return; }
675 TF3 *
f1 =
dynamic_cast<TF3*
>( fobj );
676 if (!
f1) {
Error(
"FillRandom",
"Function: %s is not a TF3, is a %s",fname,fobj->IsA()->
GetName());
return; }
686 Info(
"FillRandom",
"Using function axis and range ([%g,%g],[%g,%g],[%g,%g])",
xmin,
xmax,
ymin,
ymax,zmin,zmax);
696 Int_t nxy = nbinsx*nbinsy;
697 Int_t nbins = nbinsx*nbinsy*nbinsz;
703 for (binz=1;binz<=nbinsz;binz++) {
705 for (biny=1;biny<=nbinsy;biny++) {
707 for (binx=1;binx<=nbinsx;binx++) {
715 integral[ibin] = integral[ibin-1] + fint;
721 if (integral[nbins] == 0 ) {
723 Error(
"FillRandom",
"Integral = zero");
return;
725 for (bin=1;bin<=nbins;bin++) integral[bin] /= integral[nbins];
730 for (loop=0;loop<ntimes;loop++) {
734 biny = (ibin - nxy*binz)/nbinsx;
735 binx = 1 + ibin - nbinsx*(biny + nbinsy*binz);
761 if (!
h) {
Error(
"FillRandom",
"Null histogram");
return; }
763 Error(
"FillRandom",
"Histograms with different dimensions");
return;
766 if (
h->ComputeIntegral() == 0)
return;
771 for (loop=0;loop<ntimes;loop++) {
814 if (binminx < 1) binminx = 1;
815 if (binmaxx > nbinsx) binmaxx = nbinsx;
816 if (binmaxx < binminx) {binminx = 1; binmaxx = nbinsx;}
817 if (binminy < 1) binminy = 1;
818 if (binmaxy > nbinsy) binmaxy = nbinsy;
819 if (binmaxy < binminy) {binminy = 1; binmaxy = nbinsy;}
834 char name[80], title[80];
838 for (ipar=0;ipar<npar;ipar++) {
841 if (xbins->
fN == 0) {
859 Int_t bin,binx,biny,binz;
860 for (biny=binminy;biny<=binmaxy;biny++) {
862 for (binx=binminx;binx<=binmaxx;binx++) {
866 for (binz=1;binz<=nbinsz;binz++) {
867 bin =
GetBin(binx,biny,binz);
869 if (w == 0)
continue;
874 if (nfill < cut)
continue;
876 hpz->
Fit(fname,option);
878 if (npfits > npar && npfits >= cut) {
879 for (ipar=0;ipar<npar;ipar++) {
898 if (biny < 0) biny = 0;
899 if (biny > ofy) biny = ofy;
902 if (binz < 0) binz = 0;
903 if (binz > ofz) binz = ofz;
939 Error(
"GetBinWithContent3",
"function is only valid for 3-D histograms");
942 if (firstx <= 0) firstx = 1;
944 if (firsty <= 0) firsty = 1;
946 if (firstz <= 0) firstz = 1;
948 Int_t binminx = 0, binminy=0, binminz=0;
950 for (
Int_t k=firstz;k<=lastz;k++) {
951 for (
Int_t j=firsty;j<=lasty;j++) {
952 for (
Int_t i=firstx;i<=lastx;i++) {
954 if (diff <= 0) {binx = i; biny=j; binz=k;
return diff;}
955 if (diff < curmax && diff <= maxdiff) {curmax = diff, binminx=i; binminy=j;binminz=k;}
971 if (axis1 < 1 || axis2 < 1 || axis1 > 3 || axis2 > 3) {
972 Error(
"GetCorrelationFactor",
"Wrong parameters");
975 if (axis1 == axis2)
return 1;
977 if (stddev1 == 0)
return 0;
979 if (stddev2 == 0)
return 0;
989 if (axis1 < 1 || axis2 < 1 || axis1 > 3 || axis2 > 3) {
990 Error(
"GetCovariance",
"Wrong parameters");
1007 if (sumw == 0)
return 0;
1008 if (axis1 == 1 && axis2 == 1) {
1009 return TMath::Abs(sumwx2/sumw - sumwx*sumwx/sumw2);
1011 if (axis1 == 2 && axis2 == 2) {
1012 return TMath::Abs(sumwy2/sumw - sumwy*sumwy/sumw2);
1014 if (axis1 == 3 && axis2 == 3) {
1015 return TMath::Abs(sumwz2/sumw - sumwz*sumwz/sumw2);
1017 if ((axis1 == 1 && axis2 == 2) || (axis1 == 2 && axis2 == 1)) {
1018 return sumwxy/sumw - sumwx/sumw*sumwy/sumw;
1020 if ((axis1 == 1 && axis2 == 3) || (axis1 == 3 && axis2 == 1)) {
1021 return sumwxz/sumw - sumwx/sumw*sumwz/sumw;
1023 if ((axis1 == 2 && axis2 == 3) || (axis1 == 3 && axis2 == 2)) {
1024 return sumwyz/sumw - sumwy/sumw*sumwz/sumw;
1039 Int_t nxy = nbinsx*nbinsy;
1040 Int_t nbins = nxy*nbinsz;
1049 if (integral == 0 ) {
x = 0;
y = 0; z = 0;
return;}
1055 Int_t binz = ibin/nxy;
1056 Int_t biny = (ibin - nxy*binz)/nbinsx;
1057 Int_t binx = ibin - nbinsx*(biny + nbinsy*binz);
1085 Int_t bin, binx, biny, binz;
1089 for (bin=0;bin<11;bin++) stats[bin] = 0;
1100 if (firstBinX == 1) firstBinX = 0;
1104 if (firstBinY == 1) firstBinY = 0;
1108 if (firstBinZ == 1) firstBinZ = 0;
1112 for (binz = firstBinZ; binz <= lastBinZ; binz++) {
1114 for (biny = firstBinY; biny <= lastBinY; biny++) {
1116 for (binx = firstBinX; binx <= lastBinX; binx++) {
1117 bin =
GetBin(binx,biny,binz);
1123 stats[1] += err*err;
1177 return DoIntegral(binx1,binx2,biny1,biny2,binz1,binz2,err,option);
1193 return DoIntegral(binx1,binx2,biny1,biny2,binz1,binz2,error,option,
kTRUE);
1201 Error(
"Interpolate",
"This function must be called with 3 arguments for a TH3");
1211 Error(
"Interpolate",
"This function must be called with 3 arguments for a TH3");
1230 Int_t obx = ubx + 1;
1234 Int_t oby = uby + 1;
1238 Int_t obz = ubz + 1;
1243 if (ubx <=0 || uby <=0 || ubz <= 0 ||
1245 Error(
"Interpolate",
"Cannot interpolate outside histogram domain.");
1270 Double_t w1 = i1 * (1 - yd) + i2 * yd;
1271 Double_t w2 = j1 * (1 - yd) + j2 * yd;
1274 Double_t result = w1 * (1 - xd) + w2 * xd;
1307 if (h2 == 0)
return 0;
1323 Error(
"KolmogorovTest",
"Histograms must be 3-D\n");
1329 Error(
"KolmogorovTest",
"Number of channels in X is different, %d and %d\n",ncx1,ncx2);
1333 Error(
"KolmogorovTest",
"Number of channels in Y is different, %d and %d\n",ncy1,ncy2);
1337 Error(
"KolmogorovTest",
"Number of channels in Z is different, %d and %d\n",ncz1,ncz2);
1347 if (diff1 > difprec || diff2 > difprec) {
1348 Error(
"KolmogorovTest",
"histograms with different binning along X");
1353 if (diff1 > difprec || diff2 > difprec) {
1354 Error(
"KolmogorovTest",
"histograms with different binning along Y");
1359 if (diff1 > difprec || diff2 > difprec) {
1360 Error(
"KolmogorovTest",
"histograms with different binning along Z");
1365 Int_t ibeg = 1, jbeg = 1, kbeg = 1;
1366 Int_t iend = ncx1, jend = ncy1, kend = ncz1;
1367 if (opt.
Contains(
"U")) {ibeg = 0; jbeg = 0; kbeg = 0;}
1368 if (opt.
Contains(
"O")) {iend = ncx1+1; jend = ncy1+1; kend = ncz1+1;}
1375 for (i = ibeg; i <= iend; i++) {
1376 for (j = jbeg; j <= jend; j++) {
1377 for (k = kbeg; k <= kend; k++) {
1392 Error(
"KolmogorovTest",
"Integral is zero for h1=%s\n",
h1->
GetName());
1396 Error(
"KolmogorovTest",
"Integral is zero for h2=%s\n",h2->
GetName());
1404 esum1 = sum1 * sum1 / w1;
1409 esum2 = sum2 * sum2 / w2;
1413 if (afunc2 && afunc1) {
1414 Error(
"KolmogorovTest",
"Errors are zero for both histograms\n");
1420 int order[3] = {0,1,2};
1424 binbeg[0] = ibeg; binbeg[1] = jbeg; binbeg[2] = kbeg;
1425 binend[0] = iend; binend[1] = jend; binend[2] = kend;
1434 for (i = binbeg[order[0] ]; i <= binend[order[0] ]; i++) {
1435 for ( j = binbeg[order[1] ]; j <= binend[order[1] ]; j++) {
1436 for ( k = binbeg[order[2] ]; k <= binend[order[2] ]; k++) {
1437 ibin[ order[0] ] = i;
1438 ibin[ order[1] ] = j;
1439 ibin[ order[2] ] = k;
1440 bin =
h1->
GetBin(ibin[0],ibin[1],ibin[2]);
1447 vdfmax[icomb] = dmax;
1466 if (opt.
Contains(
"N") && !(afunc1 || afunc2 ) ) {
1470 Double_t chi2 = d12*d12/(esum1+esum2);
1473 if (prb > 0 && prb2 > 0) prb = prb*prb2*(1-
TMath::Log(prb*prb2));
1479 printf(
" Kolmo Prob h1 = %s, sum1=%g\n",
h1->
GetName(),sum1);
1480 printf(
" Kolmo Prob h2 = %s, sum2=%g\n",h2->
GetName(),sum2);
1481 printf(
" Kolmo Probabil = %f, Max Dist = %g\n",prb,dfmax);
1483 printf(
" Kolmo Probabil = %f for shape alone, =%f for normalisation alone\n",prb1,prb2);
1489 if (opt.
Contains(
"M"))
return dfmax;
1622 computeErrors =
kTRUE;
1627 originalRange =
kTRUE;
1631 TH1D *
h1 =
DoProject1D(
name, title, projAxis, &out1, &out2, computeErrors, originalRange,
true,
true);
1650 if (padsav) padsav->
cd();
1662 bool computeErrors,
bool originalRange,
1663 bool useUF,
bool useOF)
const
1672 Int_t nx = ixmax-ixmin+1;
1678 Error(
"DoProject1D",
"Histogram with name %s must be a TH1D and is a %s",
name,h1obj->
ClassName());
1685 if ( originalRange )
1687 if (bins->
fN == 0) {
1693 if (bins->
fN == 0) {
1703 if ( originalRange )
1705 if (bins->
fN == 0) {
1711 if (bins->
fN == 0) {
1741 if (out1 ==
nullptr && out2 ==
nullptr) {
1753 R__ASSERT(out1 !=
nullptr && out2 !=
nullptr);
1755 Int_t *refX = 0, *refY = 0, *refZ = 0;
1756 Int_t ixbin, out1bin, out2bin;
1772 R__ASSERT (refX != 0 && refY != 0 && refZ != 0);
1791 for (ixbin=0;ixbin<=1+projX->
GetNbins();ixbin++) {
1798 for (out1bin = out1min; out1bin <= out1max; out1bin++) {
1799 for (out2bin = out2min; out2bin <= out2max; out2bin++) {
1805 if (computeErrors) {
1823 bool resetStats =
true;
1824 double eps = 1.E-12;
1828 bool resetEntries = resetStats;
1830 resetEntries |= !useUF || !useOF;
1837 stats[2] = stats[4];
1838 stats[3] = stats[5];
1841 stats[2] = stats[7];
1842 stats[3] = stats[8];
1871 bool computeErrors,
bool originalRange,
1872 bool useUF,
bool useOF)
const
1882 Int_t nx = ixmax-ixmin+1;
1883 Int_t ny = iymax-iymin+1;
1891 Error(
"DoProject2D",
"Histogram with name %s must be a TH2D and is a %s",
name,h2obj->
ClassName());
1899 if ( originalRange ) {
1921 if ( originalRange )
1923 if (xbins->
fN == 0 && ybins->
fN == 0) {
1926 }
else if (ybins->
fN == 0) {
1929 }
else if (xbins->
fN == 0) {
1936 if (xbins->
fN == 0 && ybins->
fN == 0) {
1939 }
else if (ybins->
fN == 0) {
1941 ,nx,&xbins->
fArray[ixmin-1]);
1942 }
else if (xbins->
fN == 0) {
1986 const TAxis* out = 0;
1995 Int_t *refX = 0, *refY = 0, *refZ = 0;
1996 Int_t ixbin, iybin, outbin;
1997 if ( projX ==
GetXaxis() && projY ==
GetYaxis() ) { refX = &ixbin; refY = &iybin; refZ = &outbin; }
1998 if ( projX ==
GetYaxis() && projY ==
GetXaxis() ) { refX = &iybin; refY = &ixbin; refZ = &outbin; }
1999 if ( projX ==
GetXaxis() && projY ==
GetZaxis() ) { refX = &ixbin; refY = &outbin; refZ = &iybin; }
2000 if ( projX ==
GetZaxis() && projY ==
GetXaxis() ) { refX = &iybin; refY = &outbin; refZ = &ixbin; }
2001 if ( projX ==
GetYaxis() && projY ==
GetZaxis() ) { refX = &outbin; refY = &ixbin; refZ = &iybin; }
2002 if ( projX ==
GetZaxis() && projY ==
GetYaxis() ) { refX = &outbin; refY = &iybin; refZ = &ixbin; }
2003 R__ASSERT (refX != 0 && refY != 0 && refZ != 0);
2012 if (outmin == 0 && outmax == 0) { outmin = 1; outmax = out->
GetNbins(); }
2017 for (ixbin=0;ixbin<=1+projX->
GetNbins();ixbin++) {
2021 for (iybin=0;iybin<=1+projY->
GetNbins();iybin++) {
2029 for (outbin = outmin; outbin <= outmax; outbin++) {
2035 if (computeErrors) {
2053 bool resetStats =
true;
2054 double eps = 1.E-12;
2058 bool resetEntries = resetStats;
2060 resetEntries |= !useUF || !useOF;
2065 for (
Int_t i = 0; i <
kNstat; ++i) { oldst[i] = 0; }
2067 std::copy(oldst,oldst+
kNstat,stats);
2071 stats[4] = oldst[7];
2072 stats[5] = oldst[8];
2073 stats[6] = oldst[9];
2076 stats[2] = oldst[4];
2077 stats[3] = oldst[5];
2079 stats[4] = oldst[2];
2080 stats[5] = oldst[3];
2083 stats[4] = oldst[7];
2084 stats[5] = oldst[8];
2085 stats[6] = oldst[10];
2089 stats[2] = oldst[7];
2090 stats[3] = oldst[8];
2092 stats[4] = oldst[2];
2093 stats[5] = oldst[3];
2094 stats[6] = oldst[9];
2097 stats[4] = oldst[4];
2098 stats[5] = oldst[5];
2099 stats[6] = oldst[10];
2114 if (!computeErrors) entries =
TMath::Floor( entries + 0.5);
2177 if (opt.
Contains(
"x")) { pcase = 1; ptype =
"x"; }
2178 if (opt.
Contains(
"y")) { pcase = 2; ptype =
"y"; }
2179 if (opt.
Contains(
"z")) { pcase = 3; ptype =
"z"; }
2180 if (opt.
Contains(
"xy")) { pcase = 4; ptype =
"xy"; }
2181 if (opt.
Contains(
"yx")) { pcase = 5; ptype =
"yx"; }
2182 if (opt.
Contains(
"xz")) { pcase = 6; ptype =
"xz"; }
2183 if (opt.
Contains(
"zx")) { pcase = 7; ptype =
"zx"; }
2184 if (opt.
Contains(
"yz")) { pcase = 8; ptype =
"yz"; }
2185 if (opt.
Contains(
"zy")) { pcase = 9; ptype =
"zy"; }
2188 Error(
"Project3D",
"No projection axis specified - return a NULL pointer");
2195 computeErrors =
kTRUE;
2212 originalRange =
kTRUE;
2223 title +=
" "; title += ptype; title +=
" projection";
2229 computeErrors, originalRange, useUF, useOF);
2235 computeErrors, originalRange, useUF, useOF);
2241 computeErrors, originalRange, useUF, useOF);
2247 computeErrors, originalRange, useUF, useOF);
2253 computeErrors, originalRange, useUF, useOF);
2259 computeErrors, originalRange, useUF, useOF);
2265 computeErrors, originalRange, useUF, useOF);
2271 computeErrors, originalRange, useUF, useOF);
2277 computeErrors, originalRange, useUF, useOF);
2293 if (padsav) padsav->
cd();
2311 if (useWeights && binSumw2.
fN <= 0) useWeights =
false;
2318 if (outBin <0)
return;
2320 if ( useWeights ) tmp = binSumw2.
fArray[outBin];
2321 p2->
Fill( u ,
v, w, cont);
2331 bool originalRange,
bool useUF,
bool useOF)
const
2339 Int_t nx = ixmax-ixmin+1;
2340 Int_t ny = iymax-iymin+1;
2350 Error(
"DoProjectProfile2D",
"Histogram with name %s must be a TProfile2D and is a %s",
name,p2obj->
ClassName());
2358 if ( originalRange ) {
2379 if ( originalRange ) {
2380 if (xbins->
fN == 0 && ybins->
fN == 0) {
2383 }
else if (ybins->
fN == 0) {
2386 }
else if (xbins->
fN == 0) {
2393 if (xbins->
fN == 0 && ybins->
fN == 0) {
2396 }
else if (ybins->
fN == 0) {
2398 ,nx,&xbins->
fArray[ixmin-1]);
2399 }
else if (xbins->
fN == 0) {
2409 const TAxis* outAxis = 0;
2424 Int_t *refX = 0, *refY = 0, *refZ = 0;
2425 Int_t ixbin, iybin, outbin;
2426 if ( projX ==
GetXaxis() && projY ==
GetYaxis() ) { refX = &ixbin; refY = &iybin; refZ = &outbin; }
2427 if ( projX ==
GetYaxis() && projY ==
GetXaxis() ) { refX = &iybin; refY = &ixbin; refZ = &outbin; }
2428 if ( projX ==
GetXaxis() && projY ==
GetZaxis() ) { refX = &ixbin; refY = &outbin; refZ = &iybin; }
2429 if ( projX ==
GetZaxis() && projY ==
GetXaxis() ) { refX = &iybin; refY = &outbin; refZ = &ixbin; }
2430 if ( projX ==
GetYaxis() && projY ==
GetZaxis() ) { refX = &outbin; refY = &ixbin; refZ = &iybin; }
2431 if ( projX ==
GetZaxis() && projY ==
GetYaxis() ) { refX = &outbin; refY = &iybin; refZ = &ixbin; }
2432 R__ASSERT (refX != 0 && refY != 0 && refZ != 0);
2442 if (useWeights && binSumw2.
fN <= 0) useWeights =
false;
2446 for (ixbin=0;ixbin<=1+projX->
GetNbins();ixbin++) {
2448 for ( iybin=0;iybin<=1+projY->
GetNbins();iybin++) {
2453 if (poutBin <0)
continue;
2455 for (outbin = outmin; outbin <= outmax; outbin++) {
2462 if (!cont)
continue;
2466 if ( useWeights ) tmp = binSumw2.
fArray[poutBin];
2476 bool resetStats =
true;
2487 if (!useWeights) entries =
TMath::Floor( entries + 0.5);
2541 if (opt.
Contains(
"xy")) { pcase = 4; ptype =
"xy"; }
2542 if (opt.
Contains(
"yx")) { pcase = 5; ptype =
"yx"; }
2543 if (opt.
Contains(
"xz")) { pcase = 6; ptype =
"xz"; }
2544 if (opt.
Contains(
"zx")) { pcase = 7; ptype =
"zx"; }
2545 if (opt.
Contains(
"yz")) { pcase = 8; ptype =
"yz"; }
2546 if (opt.
Contains(
"zy")) { pcase = 9; ptype =
"zy"; }
2549 Error(
"Project3D",
"No projection axis specified - return a NULL pointer");
2567 originalRange =
kTRUE;
2576 title +=
" profile "; title += ptype; title +=
" projection";
2638 return Rebin3D(ngroup, 1, 1, newname);
2648 return Rebin3D(1, ngroup, 1, newname);
2658 return Rebin3D(1, 1, ngroup, newname);
2689 Int_t i,j,k,xbin,ybin,zbin;
2699 if ((nxgroup <= 0) || (nxgroup > nxbins)) {
2700 Error(
"Rebin",
"Illegal value of nxgroup=%d",nxgroup);
2703 if ((nygroup <= 0) || (nygroup > nybins)) {
2704 Error(
"Rebin",
"Illegal value of nygroup=%d",nygroup);
2707 if ((nzgroup <= 0) || (nzgroup > nzbins)) {
2708 Error(
"Rebin",
"Illegal value of nzgroup=%d",nzgroup);
2712 Int_t newxbins = nxbins/nxgroup;
2713 Int_t newybins = nybins/nygroup;
2714 Int_t newzbins = nzbins/nzgroup;
2732 if (newname && strlen(newname)) {
2740 bool resetStat =
false;
2744 if (newxbins*nxgroup != nxbins) {
2748 if (newybins*nygroup != nybins) {
2752 if (newzbins*nzgroup != nzbins) {
2794 if (nxgroup != 1 || nygroup != 1 || nzgroup != 1) {
2803 hnew->
SetBins(newxbins,xbins, newybins, ybins, newzbins, zbins);
2816 for (xbin = 1; xbin <= newxbins; xbin++) {
2819 for (ybin = 1; ybin <= newybins; ybin++) {
2821 for (zbin = 1; zbin <= newzbins; zbin++) {
2824 for (i = 0; i < nxgroup; i++) {
2825 if (oldxbin+i > nxbins)
break;
2826 for (j =0; j < nygroup; j++) {
2827 if (oldybin+j > nybins)
break;
2828 for (k =0; k < nzgroup; k++) {
2829 if (oldzbin+k > nzbins)
break;
2831 bin = oldxbin + i + (oldybin + j)*(nxbins + 2) + (oldzbin + k)*(nxbins + 2)*(nybins + 2);
2832 binContent += oldBins[bin];
2833 if (oldSumw2) binSumw2 += oldSumw2[bin];
2848 for (
Int_t xover = 0; xover <= 1; xover++) {
2849 for (
Int_t yover = 0; yover <= 1; yover++) {
2850 for (
Int_t zover = 0; zover <= 1; zover++) {
2854 for (xbin = xover*oldxbin; xbin <= xover*(nxbins+1); xbin++) {
2855 for (ybin = yover*oldybin; ybin <= yover*(nybins+1); ybin++) {
2856 for (zbin = zover*oldzbin; zbin <= zover*(nzbins+1); zbin++) {
2857 bin =
GetBin(xbin,ybin,zbin);
2858 binContent += oldBins[bin];
2859 if (oldSumw2) binSumw2 += oldSumw2[bin];
2864 yover*(newybins+1), zover*(newzbins+1) );
2871 Double_t binContent0, binContent2, binContent3, binContent4;
2872 Double_t binError0, binError2, binError3, binError4;
2873 Int_t oldxbin2, oldybin2, oldzbin2;
2874 Int_t ufbin, ofbin, ofbin2, ofbin3, ofbin4;
2880 for (xbin = 1; xbin<=newxbins; xbin++) {
2882 for (zbin = 1; zbin<=newzbins; zbin++) {
2883 binContent0 = binContent2 = 0;
2884 binError0 = binError2 = 0;
2885 for (i=0; i<nxgroup; i++) {
2886 if (oldxbin2+i > nxbins)
break;
2887 for (k=0; k<nzgroup; k++) {
2888 if (oldzbin2+k > nzbins)
break;
2890 ufbin = oldxbin2 + i + (nxbins+2)*(nybins+2)*(oldzbin2+k);
2891 binContent0 += oldBins[ufbin];
2892 if (oldSumw2) binError0 += oldSumw2[ufbin];
2893 for (ybin = oldybin; ybin <= nybins + 1; ybin++) {
2895 ofbin = ufbin + ybin*(nxbins+2);
2896 binContent2 += oldBins[ofbin];
2897 if (oldSumw2) binError2 += oldSumw2[ofbin];
2907 oldzbin2 += nzgroup;
2909 oldxbin2 += nxgroup;
2916 for (ybin = 1; ybin<=newybins; ybin++) {
2918 for (zbin = 1; zbin<=newzbins; zbin++) {
2919 binContent0 = binContent2 = 0;
2920 binError0 = binError2 = 0;
2921 for (j=0; j<nygroup; j++) {
2922 if (oldybin2+j > nybins)
break;
2923 for (k=0; k<nzgroup; k++) {
2924 if (oldzbin2+k > nzbins)
break;
2926 ufbin = (oldybin2 + j)*(nxbins+2) + (nxbins+2)*(nybins+2)*(oldzbin2+k);
2927 binContent0 += oldBins[ufbin];
2928 if (oldSumw2) binError0 += oldSumw2[ufbin];
2929 for (xbin = oldxbin; xbin <= nxbins + 1; xbin++) {
2931 ofbin = ufbin + xbin;
2932 binContent2 += oldBins[ofbin];
2933 if (oldSumw2) binError2 += oldSumw2[ofbin];
2943 oldzbin2 += nzgroup;
2945 oldybin2 += nygroup;
2952 for (xbin = 1; xbin<=newxbins; xbin++) {
2954 for (ybin = 1; ybin<=newybins; ybin++) {
2955 binContent0 = binContent2 = 0;
2956 binError0 = binError2 = 0;
2957 for (i=0; i<nxgroup; i++) {
2958 if (oldxbin2+i > nxbins)
break;
2959 for (j=0; j<nygroup; j++) {
2960 if (oldybin2+j > nybins)
break;
2962 ufbin = oldxbin2 + i + (nxbins+2)*(oldybin2+j);
2963 binContent0 += oldBins[ufbin];
2964 if (oldSumw2) binError0 += oldSumw2[ufbin];
2965 for (zbin = oldzbin; zbin <= nzbins + 1; zbin++) {
2967 ofbin = ufbin + (nxbins+2)*(nybins+2)*zbin;
2968 binContent2 += oldBins[ofbin];
2969 if (oldSumw2) binError2 += oldSumw2[ofbin];
2979 oldybin2 += nygroup;
2981 oldxbin2 += nxgroup;
2988 for (xbin = 1; xbin<=newxbins; xbin++) {
2997 for (i=0; i<nxgroup; i++) {
2998 if (oldxbin2+i > nxbins)
break;
2999 ufbin = oldxbin2 + i;
3000 binContent0 += oldBins[ufbin];
3001 if (oldSumw2) binError0 += oldSumw2[ufbin];
3002 for (ybin = oldybin; ybin <= nybins + 1; ybin++) {
3003 ofbin3 = ufbin+ybin*(nxbins+2);
3004 binContent3 += oldBins[ ofbin3 ];
3005 if (oldSumw2) binError3 += oldSumw2[ofbin3];
3006 for (zbin = oldzbin; zbin <= nzbins + 1; zbin++) {
3008 ofbin4 = oldxbin2 + i + ybin*(nxbins+2) + (nxbins+2)*(nybins+2)*zbin;
3009 binContent4 += oldBins[ofbin4];
3010 if (oldSumw2) binError4 += oldSumw2[ofbin4];
3013 for (zbin = oldzbin; zbin <= nzbins + 1; zbin++) {
3014 ofbin2 = ufbin+zbin*(nxbins+2)*(nybins+2);
3015 binContent2 += oldBins[ ofbin2 ];
3016 if (oldSumw2) binError2 += oldSumw2[ofbin2];
3022 hnew->
SetBinContent(xbin,newybins+1,newzbins+1,binContent4);
3029 oldxbin2 += nxgroup;
3036 for (zbin = 1; zbin<=newzbins; zbin++) {
3045 for (i=0; i<nzgroup; i++) {
3046 if (oldzbin2+i > nzbins)
break;
3047 ufbin = (oldzbin2 + i)*(nxbins+2)*(nybins+2);
3048 binContent0 += oldBins[ufbin];
3049 if (oldSumw2) binError0 += oldSumw2[ufbin];
3050 for (ybin = oldybin; ybin <= nybins + 1; ybin++) {
3051 ofbin3 = ufbin+ybin*(nxbins+2);
3052 binContent3 += oldBins[ ofbin3 ];
3053 if (oldSumw2) binError3 += oldSumw2[ofbin3];
3054 for (xbin = oldxbin; xbin <= nxbins + 1; xbin++) {
3056 ofbin4 = ufbin + xbin + ybin*(nxbins+2);
3057 binContent4 += oldBins[ofbin4];
3058 if (oldSumw2) binError4 += oldSumw2[ofbin4];
3061 for (xbin = oldxbin; xbin <= nxbins + 1; xbin++) {
3062 ofbin2 = xbin +(oldzbin2+i)*(nxbins+2)*(nybins+2);
3063 binContent2 += oldBins[ ofbin2 ];
3064 if (oldSumw2) binError2 += oldSumw2[ofbin2];
3070 hnew->
SetBinContent(newxbins+1,newybins+1,zbin,binContent4);
3077 oldzbin2 += nzgroup;
3084 for (ybin = 1; ybin<=newybins; ybin++) {
3093 for (i=0; i<nygroup; i++) {
3094 if (oldybin2+i > nybins)
break;
3095 ufbin = (oldybin2 + i)*(nxbins+2);
3096 binContent0 += oldBins[ufbin];
3097 if (oldSumw2) binError0 += oldSumw2[ufbin];
3098 for (xbin = oldxbin; xbin <= nxbins + 1; xbin++) {
3099 ofbin3 = ufbin+xbin;
3100 binContent3 += oldBins[ ofbin3 ];
3101 if (oldSumw2) binError3 += oldSumw2[ofbin3];
3102 for (zbin = oldzbin; zbin <= nzbins + 1; zbin++) {
3104 ofbin4 = xbin + (nxbins+2)*(nybins+2)*zbin+(oldybin2+i)*(nxbins+2);
3105 binContent4 += oldBins[ofbin4];
3106 if (oldSumw2) binError4 += oldSumw2[ofbin4];
3109 for (zbin = oldzbin; zbin <= nzbins + 1; zbin++) {
3110 ofbin2 = (oldybin2+i)*(nxbins+2)+zbin*(nxbins+2)*(nybins+2);
3111 binContent2 += oldBins[ ofbin2 ];
3112 if (oldSumw2) binError2 += oldSumw2[ofbin2];
3118 hnew->
SetBinContent(newxbins+1,ybin,newzbins+1,binContent4);
3125 oldybin2 += nygroup;
3168 if (!resetStat) hnew->
PutStats(stat);
3171 if (oldSumw2)
delete [] oldSumw2;
3202 if (bin < 0)
return;
3211void TH3::Streamer(
TBuffer &R__b)
3221 TH1::Streamer(R__b);
3222 TAtt3D::Streamer(R__b);
3264 :
TH3(
name,title,nbinsx,xlow,xup,nbinsy,ylow,yup,nbinsz,zlow,zup)
3279 :
TH3(
name,title,nbinsx,xbins,nbinsy,ybins,nbinsz,zbins)
3292 :
TH3(
name,title,nbinsx,xbins,nbinsy,ybins,nbinsz,zbins)
3323 if (newval > -128 && newval < 128) {
fArray[bin] =
Char_t(newval);
return;}
3324 if (newval < -127)
fArray[bin] = -127;
3325 if (newval > 127)
fArray[bin] = 127;
3393void TH3C::Streamer(
TBuffer &R__b)
3406 TH1::Streamer(R__b);
3407 TArrayC::Streamer(R__b);
3409 TAtt3D::Streamer(R__b);
3411 TH3::Streamer(R__b);
3412 TArrayC::Streamer(R__b);
3525 :
TH3(
name,title,nbinsx,xlow,xup,nbinsy,ylow,yup,nbinsz,zlow,zup)
3540 :
TH3(
name,title,nbinsx,xbins,nbinsy,ybins,nbinsz,zbins)
3553 :
TH3(
name,title,nbinsx,xbins,nbinsy,ybins,nbinsz,zbins)
3584 if (newval > -32768 && newval < 32768) {
fArray[bin] =
Short_t(newval);
return;}
3585 if (newval < -32767)
fArray[bin] = -32767;
3586 if (newval > 32767)
fArray[bin] = 32767;
3625void TH3S::Streamer(
TBuffer &R__b)
3638 TH1::Streamer(R__b);
3639 TArrayS::Streamer(R__b);
3641 TAtt3D::Streamer(R__b);
3643 TH3::Streamer(R__b);
3644 TArrayS::Streamer(R__b);
3757 :
TH3(
name,title,nbinsx,xlow,xup,nbinsy,ylow,yup,nbinsz,zlow,zup)
3772 :
TH3(
name,title,nbinsx,xbins,nbinsy,ybins,nbinsz,zbins)
3785 :
TH3(
name,title,nbinsx,xbins,nbinsy,ybins,nbinsz,zbins)
3816 if (newval > -2147483647 && newval < 2147483647) {
fArray[bin] =
Int_t(newval);
return;}
3817 if (newval < -2147483647)
fArray[bin] = -2147483647;
3818 if (newval > 2147483647)
fArray[bin] = 2147483647;
3956 :
TH3(
name,title,nbinsx,xlow,xup,nbinsy,ylow,yup,nbinsz,zlow,zup)
3971 :
TH3(
name,title,nbinsx,xbins,nbinsy,ybins,nbinsz,zbins)
3984 :
TH3(
name,title,nbinsx,xbins,nbinsy,ybins,nbinsz,zbins)
4035void TH3F::Streamer(
TBuffer &R__b)
4048 TH1::Streamer(R__b);
4049 TArrayF::Streamer(R__b);
4051 TAtt3D::Streamer(R__b);
4053 TH3::Streamer(R__b);
4054 TArrayF::Streamer(R__b);
4167 :
TH3(
name,title,nbinsx,xlow,xup,nbinsy,ylow,yup,nbinsz,zlow,zup)
4182 :
TH3(
name,title,nbinsx,xbins,nbinsy,ybins,nbinsz,zbins)
4195 :
TH3(
name,title,nbinsx,xbins,nbinsy,ybins,nbinsz,zbins)
4246void TH3D::Streamer(
TBuffer &R__b)
4259 TH1::Streamer(R__b);
4260 TArrayD::Streamer(R__b);
4262 TAtt3D::Streamer(R__b);
4264 TH3::Streamer(R__b);
4265 TArrayD::Streamer(R__b);
TH3C operator/(TH3C &h1, TH3C &h2)
Operator /.
TH3C operator*(Float_t c1, TH3C &h1)
Operator *.
TH3C operator-(TH3C &h1, TH3C &h2)
Operator -.
TH3C operator+(TH3C &h1, TH3C &h2)
Operator +.
R__EXTERN TRandom * gRandom
Array of chars or bytes (8 bits per element).
void Set(Int_t n)
Set size of this array to n chars.
void Copy(TArrayC &array) const
Array of doubles (64 bits per element).
void Copy(TArrayD &array) const
void Set(Int_t n)
Set size of this array to n doubles.
Array of floats (32 bits per element).
void Copy(TArrayF &array) const
void Set(Int_t n)
Set size of this array to n floats.
Array of integers (32 bits per element).
void Set(Int_t n)
Set size of this array to n ints.
void Copy(TArrayI &array) const
Array of shorts (16 bits per element).
void Set(Int_t n)
Set size of this array to n shorts.
void Copy(TArrayS &array) const
Use this attribute class when an object should have 3D capabilities.
virtual Color_t GetTitleColor() const
virtual Color_t GetLabelColor() const
virtual Int_t GetNdivisions() const
virtual Color_t GetAxisColor() const
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
virtual Style_t GetTitleFont() const
virtual Float_t GetLabelOffset() const
virtual void SetAxisColor(Color_t color=1, Float_t alpha=1.)
Set color of the line axis and tick marks.
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
virtual Style_t GetLabelFont() const
virtual void SetTitleFont(Style_t font=62)
Set the title font.
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels.
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
virtual void SetTitleSize(Float_t size=0.04)
Set size of axis title.
virtual void SetTitleColor(Color_t color=1)
Set color of axis title.
virtual Float_t GetTitleSize() const
virtual Float_t GetLabelSize() const
virtual Float_t GetTickLength() const
virtual Float_t GetTitleOffset() const
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
virtual void SetLabelColor(Color_t color=1, Float_t alpha=1.)
Set color of labels.
virtual Color_t GetFillColor() const
Return the fill area color.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual Color_t GetLineColor() const
Return the line color.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Style_t GetMarkerStyle() const
Return the marker style.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual Color_t GetMarkerColor() const
Return the marker color.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Class to manage histogram axis.
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
const TArrayD * GetXbins() const
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
virtual Int_t FindFixBin(Double_t x) const
Find bin number corresponding to abscissa x.
Int_t GetLast() const
Return last bin on the axis i.e.
virtual void ImportAttributes(const TAxis *axis)
Copy axis attributes to this.
const char * GetTitle() const
Returns title of object.
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis from bin first to last.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Int_t GetFirst() const
Return first bin on the axis i.e.
THashList * GetLabels() const
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
TObject * GetParent() const
Return pointer to parent of this buffer.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t GetVersionOwner() const =0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual TH1 * GetHistogram() const
Return a pointer to the histogram used to visualise the function.
virtual Double_t GetParError(Int_t ipar) const
Return value of parameter number ipar.
Double_t GetChisquare() const
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
virtual Int_t GetNpar() const
virtual Int_t GetNumberFitPoints() const
virtual Double_t * GetParameters() const
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters.
virtual void GetRange(Double_t *xmin, Double_t *xmax) const
Return range of a generic N-D function.
virtual const char * GetParName(Int_t ipar) const
virtual void SetParameters(const Double_t *params)
virtual Double_t GetParameter(Int_t ipar) const
A 3-Dim function with parameters.
1-D histogram with a double per channel (see TH1 documentation)}
virtual void Reset(Option_t *option="")
Reset.
virtual void Reset(Option_t *option="")
Reset.
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
Double_t * fBuffer
[fBufferSize] entry buffer
virtual Double_t GetEffectiveEntries() const
Number of effective entries of the histogram.
virtual Bool_t Multiply(TF1 *f1, Double_t c1=1)
Performs the operation:
Int_t fNcells
number of bins(1D), cells (2D) +U/Overflows
Double_t fTsumw
Total Sum of weights.
Double_t fTsumw2
Total Sum of squares of weights.
virtual Double_t DoIntegral(Int_t ix1, Int_t ix2, Int_t iy1, Int_t iy2, Int_t iz1, Int_t iz2, Double_t &err, Option_t *opt, Bool_t doerr=kFALSE) const
Internal function compute integral and optionally the error between the limits specified by the bin n...
Double_t fTsumwx2
Total Sum of weight*X*X.
virtual Double_t GetStdDev(Int_t axis=1) const
Returns the Standard Deviation (Sigma).
virtual Int_t GetNbinsY() const
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
virtual Double_t GetBinError(Int_t bin) const
Return value of error associated to bin number bin.
virtual Int_t GetNbinsZ() const
virtual Int_t GetDimension() const
@ kIsNotW
Histogram is forced to be not weighted even when the histogram is filled with weighted different than...
virtual Bool_t CanExtendAllAxes() const
Returns true if all axes are extendable.
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual Int_t GetNcells() const
virtual void PutStats(Double_t *stats)
Replace current statistics with the values in array stats.
TVirtualHistPainter * GetPainter(Option_t *option="")
Return pointer to painter.
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
Fit histogram with function fname.
virtual Int_t GetBin(Int_t binx, Int_t biny=0, Int_t binz=0) const
Return Global bin number corresponding to binx,y,z.
virtual Int_t GetNbinsX() const
virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="")
Performs the operation: this = this + c1*f1 if errors are defined (see TH1::Sumw2),...
Int_t fBufferSize
fBuffer size
virtual Double_t RetrieveBinContent(Int_t bin) const
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Int_t fDimension
!Histogram dimension (1, 2 or 3 dim)
virtual void SetBinError(Int_t bin, Double_t error)
Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empt...
static Int_t fgBufferSize
!default buffer size for automatic histograms
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Double_t * fIntegral
!Integral of bins used by GetRandom
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual void Copy(TObject &hnew) const
Copy this histogram structure to newth1.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void ResetStats()
Reset the statistics including the number of entries and replace with values calculates from bin cont...
virtual void SetBuffer(Int_t buffersize, Option_t *option="")
Set the maximum number of entries to be kept in the buffer.
Double_t fEntries
Number of entries.
virtual void SetName(const char *name)
Change the name of this histogram.
TAxis fZaxis
Z axis descriptor.
virtual void UpdateBinContent(Int_t bin, Double_t content)
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
TAxis fXaxis
X axis descriptor.
virtual void ExtendAxis(Double_t x, TAxis *axis)
Histogram is resized along axis such that x is in the axis range.
TArrayD fSumw2
Array of sum of squares of weights.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
virtual void Paint(Option_t *option="")
Control routine to paint any kind of histograms.
virtual Int_t GetSumw2N() const
virtual Int_t FindBin(Double_t x, Double_t y=0, Double_t z=0)
Return Global bin number corresponding to x,y,z.
Bool_t GetStatOverflowsBehaviour() const
virtual Bool_t Divide(TF1 *f1, Double_t c1=1)
Performs the operation: this = this/(c1*f1) if errors are defined (see