88 :
TH1(
name,title,nbinsx,xlow,xup)
93 if (nbinsy <= 0) {
Warning(
"TH2",
"nbinsy is <=0 - set to nbinsy = 1"); nbinsy = 1; }
122 if (nbinsy <= 0) {
Warning(
"TH2",
"nbinsy is <=0 - set to nbinsy = 1"); nbinsy = 1; }
145 :
TH1(
name,title,nbinsx,xlow,xup)
150 if (nbinsy <= 0) {
Warning(
"TH2",
"nbinsy is <=0 - set to nbinsy = 1"); nbinsy = 1; }
179 if (nbinsy <= 0) {
Warning(
"TH2",
"nbinsy is <=0 - set to nbinsy = 1"); nbinsy = 1; }
209 if (nbinsy <= 0) {
Warning(
"TH2",
"nbinsy is <=0 - set to nbinsy = 1"); nbinsy = 1; }
251 if (nbentries == 0)
return 0;
252 if (nbentries < 0 && action == 0)
return 0;
256 nbentries = -nbentries;
271 for (
Int_t i=1;i<nbentries;i++) {
294 for (
Int_t i=0;i<nbentries;i++) {
295 Fill(buffer[3*i+2],buffer[3*i+3],buffer[3*i+1]);
322 nbentries = -nbentries;
360 Error(
"Fill",
"Invalid signature - do nothing");
384 Int_t binx, biny, bin;
388 if (binx <0 || biny <0)
return -1;
428 Int_t binx, biny, bin;
432 if (binx <0 || biny <0)
return -1;
472 Int_t binx, biny, bin;
476 if (binx <0 || biny <0)
return -1;
519 Int_t binx, biny, bin;
523 if (binx <0 || biny <0)
return -1;
564 Int_t binx, biny, bin;
568 if (binx <0 || biny <0)
return -1;
611 Int_t binx, biny, bin, i;
618 for (i=0;i<ntimes;i+=stride) {
631 for (i=ifirst;i<ntimes;i+=stride) {
635 if (binx <0 || biny <0)
continue;
679 Int_t bin, binx, biny, ibin, loop;
683 if (!fobj) {
Error(
"FillRandom",
"Unknown function: %s",fname);
return; }
684 TF2 *
f1 =
dynamic_cast<TF2*
>(fobj);
685 if (!
f1) {
Error(
"FillRandom",
"Function: %s is not a TF2, is a %s",fname,fobj->IsA()->
GetName());
return; }
704 Int_t nbins = nbinsx*nbinsy;
710 for (biny=1;biny<=nbinsy;biny++) {
711 for (binx=1;binx<=nbinsx;binx++) {
714 integral[ibin] = integral[ibin-1] + fint;
719 if (integral[nbins] == 0 ) {
721 Error(
"FillRandom",
"Integral = zero");
return;
723 for (bin=1;bin<=nbins;bin++) integral[bin] /= integral[nbins];
726 for (loop=0;loop<ntimes;loop++) {
730 binx = 1 + ibin - nbinsx*biny;
758 if (!
h) {
Error(
"FillRandom",
"Null histogram");
return; }
760 Error(
"FillRandom",
"Histograms with different dimensions");
return;
763 if (
h->ComputeIntegral() == 0)
return;
768 for (loop=0;loop<ntimes;loop++) {
793 if (firstbin == 0 && lastbin == 0) {
798 if (firstbin < 0) firstbin = 0;
799 if (lastbin < 0 || lastbin > nbins + 1) lastbin = nbins + 1;
800 if (lastbin < firstbin) {firstbin = 0; lastbin = nbins + 1;}
807 if (i1>=0 && i2>i1) {
808 proj_opt += opt(i1,i2-i1+1);
819 Int_t nstep = ngroup;
829 if (npar <= 0)
return;
841 char *
name =
new char[2000];
842 char *title =
new char[2000];
848 Int_t nOutBins = lastOutBin-firstOutBin+1;
850 if (bins->
fN == 0) nOutBins /= nstep;
851 for (ipar=0;ipar<npar;ipar++) {
858 hlist[ipar] =
new TH1D(
name,title, nOutBins, &bins->
fArray[firstOutBin-1]);
862 (*arr)[ipar] = hlist[ipar];
870 hchi2 =
new TH1D(
name,
"chisquare", nOutBins, &bins->
fArray[firstOutBin-1]);
874 (*arr)[npar] = hchi2;
884 for (bin=firstbin;bin+ngroup-1<=lastbin;bin += nstep) {
886 hp=
ProjectionX(
"_temp",bin,bin+ngroup-1,proj_opt);
888 hp=
ProjectionY(
"_temp",bin,bin+ngroup-1,proj_opt);
889 if (hp == 0)
continue;
894 Info(
"DoFitSlices",
"Slice %d skipped, the number of entries is zero or smaller than the given cut value, n=%f",bin,
nentries);
903 if (npfits > npar && npfits >= cut) {
904 for (ipar=0;ipar<npar;ipar++) {
912 Info(
"DoFitSlices",
"Fitted slice %d skipped, the number of fitted points is too small, n=%d",bin,npfits);
981 DoFitSlices(
true,
f1, firstybin, lastybin, cut, option, arr);
1046 DoFitSlices(
false,
f1, firstxbin, lastxbin, cut, option, arr);
1053 if (biny < 0) biny = 0;
1054 if (biny > ofy) biny = ofy;
1086 Error(
"GetBinWithContent2",
"function is only valid for 2-D histograms");
1089 if (firstxbin < 0) firstxbin = 1;
1091 if (firstybin < 0) firstybin = 1;
1094 for (
Int_t j = firstybin; j <= lastybin; j++) {
1095 for (
Int_t i = firstxbin; i <= lastxbin; i++) {
1097 if (diff <= 0) {binx = i; biny=j;
return diff;}
1098 if (diff < curmax && diff <= maxdiff) {curmax = diff, binx=i; biny=j;}
1110 if (axis1 < 1 || axis2 < 1 || axis1 > 2 || axis2 > 2) {
1111 Error(
"GetCorrelationFactor",
"Wrong parameters");
1114 if (axis1 == axis2)
return 1;
1116 if (stddev1 == 0)
return 0;
1118 if (stddev2 == 0)
return 0;
1128 if (axis1 < 1 || axis2 < 1 || axis1 > 2 || axis2 > 2) {
1129 Error(
"GetCovariance",
"Wrong parameters");
1142 if (sumw == 0)
return 0;
1143 if (axis1 == 1 && axis2 == 1) {
1144 return TMath::Abs(sumwx2/sumw - sumwx/sumw*sumwx/sumw);
1146 if (axis1 == 2 && axis2 == 2) {
1147 return TMath::Abs(sumwy2/sumw - sumwy/sumw*sumwy/sumw);
1149 return sumwxy/sumw - sumwx/sumw*sumwy/sumw;
1166 Int_t nbins = nbinsx*nbinsy;
1175 if (integral == 0 ) {
x = 0;
y = 0;
return;}
1182 Int_t biny = ibin/nbinsx;
1183 Int_t binx = ibin - nbinsx*biny;
1221 std::fill(stats, stats + 7, 0);
1230 if (firstBinX == 1) firstBinX = 0;
1234 if (firstBinY == 1) firstBinY = 0;
1242 for (
Int_t biny = firstBinY; biny <= lastBinY; ++biny) {
1244 for (
Int_t binx = firstBinX; binx <= lastBinX; ++binx) {
1296 return DoIntegral(firstxbin,lastxbin,firstybin,lastybin,-1,0,err,option);
1309 return DoIntegral(firstxbin,lastxbin,firstybin,lastybin,-1,0,error,option,
kTRUE);
1317 Error(
"Interpolate",
"This function must be called with 2 arguments for a TH2");
1336 Error(
"Interpolate",
"Cannot interpolate outside histogram domain.");
1378 if(bin_x1<1) bin_x1=1;
1382 if(bin_y1<1) bin_y1=1;
1394 f = 1.0*q11/
d*(
x2-
x)*(y2-
y)+1.0*q21/
d*(
x-
x1)*(y2-
y)+1.0*q12/
d*(
x2-
x)*(
y-y1)+1.0*q22/
d*(
x-
x1)*(
y-y1);
1404 Error(
"Interpolate",
"This function must be called with 2 arguments for a TH2");
1439 if (h2 == 0)
return 0;
1451 Error(
"KolmogorovTest",
"Histograms must be 2-D\n");
1457 Error(
"KolmogorovTest",
"Number of channels in X is different, %d and %d\n",ncx1,ncx2);
1461 Error(
"KolmogorovTest",
"Number of channels in Y is different, %d and %d\n",ncy1,ncy2);
1471 if (diff1 > difprec || diff2 > difprec) {
1472 Error(
"KolmogorovTest",
"histograms with different binning along X");
1477 if (diff1 > difprec || diff2 > difprec) {
1478 Error(
"KolmogorovTest",
"histograms with different binning along Y");
1483 Int_t ibeg = 1, jbeg = 1;
1484 Int_t iend = ncx1, jend = ncy1;
1485 if (opt.
Contains(
"U")) {ibeg = 0; jbeg = 0;}
1486 if (opt.
Contains(
"O")) {iend = ncx1+1; jend = ncy1+1;}
1493 for (i = ibeg; i <= iend; i++) {
1494 for (j = jbeg; j <= jend; j++) {
1507 Error(
"KolmogorovTest",
"Integral is zero for h1=%s\n",
h1->
GetName());
1511 Error(
"KolmogorovTest",
"Integral is zero for h2=%s\n",h2->
GetName());
1519 esum1 = sum1 * sum1 / w1;
1524 esum2 = sum2 * sum2 / w2;
1528 if (afunc2 && afunc1) {
1529 Error(
"KolmogorovTest",
"Errors are zero for both histograms\n");
1538 for (i=ibeg;i<=iend;i++) {
1539 for (j=jbeg;j<=jend;j++) {
1549 for (j=jbeg;j<=jend;j++) {
1550 for (i=ibeg;i<=iend;i++) {
1561 else factnm =
TMath::Sqrt(esum1*sum2/(esum1+esum2));
1564 Double_t dfmax = 0.5*(dfmax1+dfmax2);
1571 if (opt.
Contains(
"N") && !(afunc1 || afunc2 ) ) {
1575 Double_t chi2 = d12*d12/(esum1+esum2);
1578 if (prb > 0 && prb2 > 0) prb = prb*prb2*(1-
TMath::Log(prb*prb2));
1584 printf(
" Kolmo Prob h1 = %s, sum1=%g\n",
h1->
GetName(),sum1);
1585 printf(
" Kolmo Prob h2 = %s, sum2=%g\n",h2->
GetName(),sum2);
1586 printf(
" Kolmo Probabil = %f, Max Dist = %g\n",prb,dfmax);
1588 printf(
" Kolmo Probabil = %f for shape alone, =%f for normalisation alone\n",prb1,prb2);
1594 if(opt.
Contains(
"M"))
return dfmax;
1606 return Rebin2D(ngroup, 1, newname);
1616 return Rebin2D(1, ngroup, newname);
1627 if (xbins !=
nullptr) {
1628 Error(
"Rebin",
"Rebinning a 2-d histogram into variable bins is not supported (it is possible only for 1-d histograms). Return a nullptr");
1631 Info(
"Rebin",
"Rebinning only the x-axis. Use Rebin2D for rebinning both axes");
1632 return RebinX(ngroup, newname);
1664 Int_t nx = nxbins + 2;
1665 Int_t ny = nybins + 2;
1672 Error(
"Rebin2D",
"Histogram must be TH2. This histogram has %d dimensions.",
GetDimension());
1675 if ((nxgroup <= 0) || (nxgroup > nxbins)) {
1676 Error(
"Rebin2D",
"Illegal value of nxgroup=%d",nxgroup);
1679 if ((nygroup <= 0) || (nygroup > nybins)) {
1680 Error(
"Rebin2D",
"Illegal value of nygroup=%d",nygroup);
1684 Int_t newxbins = nxbins / nxgroup;
1685 Int_t newybins = nybins / nygroup;
1686 Int_t newnx = newxbins + 2;
1687 Int_t newny = newybins + 2;
1701 if (newname && strlen(newname)) {
1706 bool resetStat =
false;
1709 if(newxbins * nxgroup != nxbins) {
1713 if(newybins * nygroup != nybins) {
1745 if (nxgroup != 1 || nygroup != 1) {
1752 hnew->
SetBins(newxbins, xbins, newybins, ybins);
1761 if (oldErrors) hnew->
fSumw2[0] = 0;
1764 for(
Int_t binx = 1, oldbinx = 1; binx < newnx; ++binx, oldbinx += nxgroup){
1765 Double_t binContent = 0.0, binErrorSq = 0.0;
1766 for (
Int_t i = 0; i < nxgroup && (oldbinx + i) < nx; ++i) {
1767 Int_t bin = oldbinx + i;
1768 binContent += oldBins[bin];
1769 if(oldErrors) binErrorSq += oldErrors[bin];
1771 Int_t newbin = binx;
1773 if (oldErrors) hnew->
fSumw2[newbin] = binErrorSq;
1777 for(
Int_t biny = 1, oldbiny = 1; biny < newny; ++biny, oldbiny += nygroup){
1778 Double_t binContent = 0.0, binErrorSq = 0.0;
1779 for (
Int_t j = 0; j < nygroup && (oldbiny + j) < ny; ++j) {
1780 Int_t bin = (oldbiny + j) * nx;
1781 binContent += oldBins[bin];
1782 if(oldErrors) binErrorSq += oldErrors[bin];
1784 Int_t newbin = biny * newnx;
1786 if (oldErrors) hnew->
fSumw2[newbin] = binErrorSq;
1790 for (
Int_t binx = 1, oldbinx = 1; binx < newnx; ++binx, oldbinx += nxgroup) {
1791 for (
Int_t biny = 1, oldbiny = 1; biny < newny; ++biny, oldbiny += nygroup) {
1792 Double_t binContent = 0.0, binErrorSq = 0.0;
1793 for (
Int_t i = 0; i < nxgroup && (oldbinx + i) < nx; ++i) {
1794 for (
Int_t j = 0; j < nygroup && (oldbiny + j) < ny; ++j) {
1795 Int_t bin = oldbinx + i + (oldbiny + j) * nx;
1796 binContent += oldBins[bin];
1797 if (oldErrors) binErrorSq += oldErrors[bin];
1800 Int_t newbin = binx + biny * newnx;
1802 if (oldErrors) hnew->
fSumw2[newbin] = binErrorSq;
1835 if (oldErrors)
delete [] oldErrors;
1850 cut = opt(i1,i2-i1+1);
1853 bool originalRange = opt.
Contains(
"o");
1858 const char *expectedName = ( onX ?
"_pfx" :
"_pfy" );
1871 if (firstbin == 0 && lastbin == 0)
1877 if (firstbin < 0) firstbin = 1;
1878 if (lastbin < 0) lastbin = inN;
1879 if (lastbin > inN+1) lastbin = inN;
1882 char *pname = (
char*)
name;
1883 if (
name && strcmp(
name, expectedName) == 0) {
1885 pname =
new char[nch];
1893 if (h1obj->IsA() != TProfile::Class() ) {
1894 Error(
"DoProfile",
"Histogram with name %s must be a TProfile and is a %s",
name,h1obj->
ClassName());
1903 if (xbins->fN == 0) {
1904 if ( originalRange )
1913 h1->
SetBins(lastOutBin-firstOutBin+1,&xbins->fArray[firstOutBin-1]);
1919 ((
TH2 *)
this)->GetPainter();
1925 if (bins->
fN == 0) {
1926 if ( originalRange )
1940 if (pname !=
name)
delete [] pname;
1951 TArrayD & binSumw2 = *(
h1->GetBinSumw2());
1964 for (
Int_t outbin = 0; outbin <= outAxis.
GetNbins() + 1; ++outbin) {
1970 if (binOut <0)
continue;
1972 for (
Int_t inbin = firstbin ; inbin <= lastbin ; ++inbin) {
1974 if (onX) { binx = outbin; biny=inbin; }
1975 else { binx = inbin; biny=outbin; }
1987 if ( useWeights ) tmp = binSumw2.
fArray[binOut];
2014 if (padsav) padsav->
cd();
2125 const char *expectedName = 0;
2127 const TAxis* outAxis;
2128 const TAxis* inAxis;
2135 cut = opt(i1,i2-i1+1);
2138 bool originalRange = opt.
Contains(
"o");
2142 expectedName =
"_px";
2149 expectedName =
"_py";
2166 if (firstbin == 0 && lastbin == 0)
2172 if (firstbin < 0) firstbin = 0;
2173 if (lastbin < 0) lastbin = inNbin + 1;
2174 if (lastbin > inNbin+1) lastbin = inNbin + 1;
2177 char *pname = (
char*)
name;
2178 if (
name && strcmp(
name,expectedName) == 0) {
2180 pname =
new char[nch];
2189 if (h1obj->IsA() != TH1D::Class() ) {
2190 Error(
"DoProjection",
"Histogram with name %s must be a TH1D and is a %s",
name,h1obj->
ClassName());
2199 if (xbins->fN == 0) {
2200 if ( originalRange )
2209 h1->
SetBins(lastOutBin-firstOutBin+1,&xbins->fArray[firstOutBin-1]);
2215 ((
TH2 *)
this)->GetPainter();
2221 if (bins->
fN == 0) {
2222 if ( originalRange )
2236 if (pname !=
name)
delete [] pname;
2264 for (
Int_t outbin = 0; outbin <= outAxis->
GetNbins() + 1; ++outbin) {
2269 for (
Int_t inbin = firstbin ; inbin <= lastbin ; ++inbin) {
2271 if (onX) { binx = outbin; biny=inbin; }
2272 else { binx = inbin; biny=outbin; }
2279 if (computeErrors) {
2293 bool reuseStats =
false;
2299 double eps = 1.E-12;
2300 if (IsA() == TH2F::Class() ) eps = 1.E-6;
2304 if (ncuts) reuseStats =
false;
2306 bool reuseEntries = reuseStats;
2308 reuseEntries &= (firstbin==0 && lastbin == inNbin+1);
2313 stats[2] = stats[4];
2314 stats[3] = stats[5];
2349 if (padsav) padsav->
cd();
2482 const TAxis *outAxis = 0;
2491 if (qname.
IsNull() || qname ==
"_qx" || qname ==
"_qy") {
2492 const char * qtype = (onX) ?
"qx" :
"qy";
2500 h1 =
dynamic_cast<TH1D*
>(h1obj);
2502 Error(
"DoQuantiles",
"Histogram with name %s must be a TH1D and is a %s",qname.
Data(),h1obj->
ClassName());
2519 h1->
SetBins(lastOutBin-firstOutBin+1,&xbins->fArray[firstOutBin-1]);
2526 for (
int ibin = outAxis->
GetFirst() ; ibin <= outAxis->
GetLast() ; ++ibin) {
2531 if (slice->
GetSum() == 0)
continue;
2545 if (slice)
delete slice;
2573 if (bin < 0)
return;
2617 return (
TH1*)
gROOT->ProcessLineFast(
Form(
"TSpectrum2::StaticBackground((TH1*)0x%zx,%d,\"%s\")",
2618 (
size_t)
this, niter, option));
2633 return (
Int_t)
gROOT->ProcessLineFast(
Form(
"TSpectrum2::StaticSearch((TH1*)0x%zx,%g,\"%s\",%g)",
2634 (
size_t)
this,
sigma, option, threshold));
2664 Double_t k5a[5][5] = { { 0, 0, 1, 0, 0 },
2668 { 0, 0, 1, 0, 0 } };
2669 Double_t k5b[5][5] = { { 0, 1, 2, 1, 0 },
2673 { 0, 1, 2, 1, 0 } };
2674 Double_t k3a[3][3] = { { 0, 1, 0 },
2679 Warning(
"Smooth",
"Currently only ntimes=1 is supported");
2686 if (opt.
Contains(
"k5b")) kernel = &k5b[0][0];
2688 kernel = &k3a[0][0];
2703 Int_t bufSize = (nx+2)*(ny+2);
2710 for (i=ifirst; i<=ilast; i++){
2711 for (j=jfirst; j<=jlast; j++){
2719 Int_t x_push = (ksize_x-1)/2;
2720 Int_t y_push = (ksize_y-1)/2;
2723 for (i=ifirst; i<=ilast; i++){
2724 for (j=jfirst; j<=jlast; j++) {
2733 if ( (xb >= 1) && (xb <= nx) && (yb >= 1) && (yb <= ny) ) {
2739 content += k*buf[bin];
2740 if (ebuf) error += k*k*ebuf[bin]*ebuf[bin];
2746 if ( norm != 0.0 ) {
2749 error /= (norm*norm);
2765void TH2::Streamer(
TBuffer &R__b)
2775 TH1::Streamer(R__b);
2820 :
TH2(
name,title,nbinsx,xlow,xup,nbinsy,ylow,yup)
2835 :
TH2(
name,title,nbinsx,xbins,nbinsy,ylow,yup)
2848 :
TH2(
name,title,nbinsx,xlow,xup,nbinsy,ybins)
2861 :
TH2(
name,title,nbinsx,xbins,nbinsy,ybins)
2874 :
TH2(
name,title,nbinsx,xbins,nbinsy,ybins)
2906 if (newval > -128 && newval < 128) {
fArray[bin] =
Char_t(newval);
return;}
2907 if (newval < -127)
fArray[bin] = -127;
2908 if (newval > 127)
fArray[bin] = 127;
2946void TH2C::Streamer(
TBuffer &R__b)
2958 TH1::Streamer(R__b);
2959 TArrayC::Streamer(R__b);
2966 TH2::Streamer(R__b);
2967 TArrayC::Streamer(R__b);
3080 :
TH2(
name,title,nbinsx,xlow,xup,nbinsy,ylow,yup)
3095 :
TH2(
name,title,nbinsx,xbins,nbinsy,ylow,yup)
3108 :
TH2(
name,title,nbinsx,xlow,xup,nbinsy,ybins)
3121 :
TH2(
name,title,nbinsx,xbins,nbinsy,ybins)
3134 :
TH2(
name,title,nbinsx,xbins,nbinsy,ybins)
3166 if (newval > -32768 && newval < 32768) {
fArray[bin] =
Short_t(newval);
return;}
3167 if (newval < -32767)
fArray[bin] = -32767;
3168 if (newval > 32767)
fArray[bin] = 32767;
3206void TH2S::Streamer(
TBuffer &R__b)
3218 TH1::Streamer(R__b);
3219 TArrayS::Streamer(R__b);
3226 TH2::Streamer(R__b);
3227 TArrayS::Streamer(R__b);
3340 :
TH2(
name,title,nbinsx,xlow,xup,nbinsy,ylow,yup)
3355 :
TH2(
name,title,nbinsx,xbins,nbinsy,ylow,yup)
3368 :
TH2(
name,title,nbinsx,xlow,xup,nbinsy,ybins)
3381 :
TH2(
name,title,nbinsx,xbins,nbinsy,ybins)
3394 :
TH2(
name,title,nbinsx,xbins,nbinsy,ybins)
3426 if (newval > -INT_MAX && newval < INT_MAX) {
fArray[bin] =
Int_t(newval);
return;}
3427 if (newval < -INT_MAX)
fArray[bin] = -INT_MAX;
3428 if (newval > INT_MAX)
fArray[bin] = INT_MAX;
3565 :
TH2(
name,title,nbinsx,xlow,xup,nbinsy,ylow,yup)
3580 :
TH2(
name,title,nbinsx,xbins,nbinsy,ylow,yup)
3593 :
TH2(
name,title,nbinsx,xlow,xup,nbinsy,ybins)
3606 :
TH2(
name,title,nbinsx,xbins,nbinsy,ybins)
3619 :
TH2(
name,title,nbinsx,xbins,nbinsy,ybins)
3631:
TH2(
"TMatrixFBase",
"",
m.GetNcols(),
m.GetColLwb(),1+
m.GetColUpb(),
m.GetNrows(),
m.GetRowLwb(),1+
m.GetRowUpb())
3634 Int_t ilow =
m.GetRowLwb();
3635 Int_t iup =
m.GetRowUpb();
3636 Int_t jlow =
m.GetColLwb();
3637 Int_t jup =
m.GetColUpb();
3638 for (
Int_t i=ilow;i<=iup;i++) {
3639 for (
Int_t j=jlow;j<=jup;j++) {
3690void TH2F::Streamer(
TBuffer &R__b)
3702 TH1::Streamer(R__b);
3703 TArrayF::Streamer(R__b);
3710 TH2::Streamer(R__b);
3711 TArrayF::Streamer(R__b);
3836 :
TH2(
name,title,nbinsx,xlow,xup,nbinsy,ylow,yup)
3851 :
TH2(
name,title,nbinsx,xbins,nbinsy,ylow,yup)
3864 :
TH2(
name,title,nbinsx,xlow,xup,nbinsy,ybins)
3877 :
TH2(
name,title,nbinsx,xbins,nbinsy,ybins)
3890 :
TH2(
name,title,nbinsx,xbins,nbinsy,ybins)
3902:
TH2(
"TMatrixDBase",
"",
m.GetNcols(),
m.GetColLwb(),1+
m.GetColUpb(),
m.GetNrows(),
m.GetRowLwb(),1+
m.GetRowUpb())
3905 Int_t ilow =
m.GetRowLwb();
3906 Int_t iup =
m.GetRowUpb();
3907 Int_t jlow =
m.GetColLwb();
3908 Int_t jup =
m.GetColUpb();
3909 for (
Int_t i=ilow;i<=iup;i++) {
3910 for (
Int_t j=jlow;j<=jup;j++) {
3962void TH2D::Streamer(
TBuffer &R__b)
3974 TH1::Streamer(R__b);
3975 TArrayD::Streamer(R__b);
3982 TH2::Streamer(R__b);
3983 TArrayD::Streamer(R__b);
static const double x2[5]
static const double x1[5]
TH2C operator-(TH2C &h1, TH2C &h2)
Operator -.
TH2C operator+(TH2C &h1, TH2C &h2)
Operator +.
TH2C operator/(TH2C &h1, TH2C &h2)
Operator /.
TH2C operator*(Float_t c1, TH2C &h1)
Operator *.
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
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
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.
Bool_t IsAlphanumeric() const
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 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
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 WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual TH1 * GetHistogram() const
Return a pointer to the histogram used to visualise the function Note that this histogram is managed ...
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 Double_t Integral(Double_t a, Double_t b, Double_t epsrel=1.e-12)
IntegralOneDim or analytical integral.
virtual Int_t GetNumberFitPoints() const
virtual Double_t * GetParameters() const
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 2-Dim function with parameters.
1-D histogram with a double per channel (see TH1 documentation)}
virtual void Reset(Option_t *option="")
Reset.
TH1 is the base class of all histogram classes in ROOT.
virtual void SetDirectory(TDirectory *dir)
By default, when a 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 Int_t GetQuantiles(Int_t nprobSum, Double_t *q, const Double_t *probSum=0)
Compute Quantiles for this histogram Quantile x_q of a probability distribution Function F is defined...
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 Double_t GetMean(Int_t axis=1) const
For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis.
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.
virtual Double_t GetBinErrorSqUnchecked(Int_t bin) const
UInt_t GetAxisLabelStatus() const
Internal function used in TH1::Fill to see which axis is full alphanumeric i.e.
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 Double_t GetBinLowEdge(Int_t bin) const
Return bin lower edge for 1D histogram.
virtual Double_t GetEntries() const
Return the current number of entries.
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 calculated from bin cont...
virtual void SetBuffer(Int_t buffersize, Option_t *option="")
Set the maximum number of entries to be kept in the buffer.
@ kNstat
Size of statistics data (up to TProfile3D)
Double_t fEntries
Number of entries.
virtual void SetName(const char *name)
Change the name of this histogram.
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 TH1::Sumw2),...
TAxis fYaxis
Y axis descriptor.
TVirtualHistPainter * fPainter
! Pointer to histogram painter
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
virtual void SetEntries(Double_t n)
static Bool_t fgDefaultSumw2
! Flag to call TH1::Sumw2 automatically at histogram creation time
Double_t fTsumwx
Total Sum of weight*X.
virtual Double_t ComputeIntegral(Bool_t onlyPositive=false)
Compute integral (cumulative sum of bins) The result stored in fIntegral is used by the GetRandom fun...
2-D histogram with a byte per channel (see TH1 documentation)
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
virtual ~TH2C()
Destructor.
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
TH2C & operator=(const TH2C &h1)
Operator =.
virtual void Copy(TObject &hnew) const
Copy.
2-D histogram with a double per channel (see TH1 documentation)}
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
virtual ~TH2D()
Destructor.
virtual void Copy(TObject &hnew) const
Copy.
TH2D & operator=(const TH2D &h1)
Operator =.
2-D histogram with a float per channel (see TH1 documentation)}
TH2F & operator=(const TH2F &h1)
Operator =.
virtual ~TH2F()
Destructor.
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
virtual void Copy(TObject &hnew) const
Copy.
2-D histogram with an int per channel (see TH1 documentation)}
virtual void Copy(TObject &hnew) const
Copy.
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
virtual ~TH2I()
Destructor.
TH2I & operator=(const TH2I &h1)
Operator =.
2-D histogram with a short per channel (see TH1 documentation)
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
TH2S & operator=(const TH2S &h1)
Operator =.
virtual ~TH2S()
Destructor.
virtual void Copy(TObject &hnew) const
Copy.
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
Service class for 2-D histogram classes.
virtual void PutStats(Double_t *stats)
Replace current statistics with the values in array stats.
TH1D * ProjectionY(const char *name="_py", Int_t firstxbin=0, Int_t lastxbin=-1, Option_t *option="") const
Project a 2-D histogram into a 1-D histogram along Y.
virtual Int_t BufferEmpty(Int_t action=0)
Fill histogram with all entries in the buffer.
virtual Double_t GetCorrelationFactor(Int_t axis1=1, Int_t axis2=2) const
Return correlation factor between axis1 and axis2.
virtual TProfile * DoProfile(bool onX, const char *name, Int_t firstbin, Int_t lastbin, Option_t *option) const
virtual Double_t GetBinWithContent2(Double_t c, Int_t &binx, Int_t &biny, Int_t firstxbin=1, Int_t lastxbin=-1, Int_t firstybin=1, Int_t lastybin=-1, Double_t maxdiff=0) const
compute first cell (binx,biny) in the range [firstxbin,lastxbin][firstybin,lastybin] for which diff =...
TProfile * ProfileX(const char *name="_pfx", Int_t firstybin=1, Int_t lastybin=-1, Option_t *option="") const
Project a 2-D histogram into a profile histogram along X.
TH1D * QuantilesY(Double_t prob=0.5, const char *name="_qy") const
Compute the Y distribution of quantiles in the other variable X name is the name of the returned hist...
TProfile * ProfileY(const char *name="_pfy", Int_t firstxbin=1, Int_t lastxbin=-1, Option_t *option="") const
Project a 2-D histogram into a profile histogram along Y.
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
virtual TH1D * DoQuantiles(bool onX, const char *name, Double_t prob) const
Implementation of quantiles for x or y.
Double_t fTsumwxy
Total Sum of weight*X*Y.
Int_t Fill(Double_t)
Invalid Fill method.
virtual TH1 * ShowBackground(Int_t niter=20, Option_t *option="same")
This function calculates the background spectrum in this histogram.
virtual Int_t ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05)
Interface to TSpectrum2::Search the function finds peaks in this histogram where the width is > sigma...
virtual void DoFitSlices(bool onX, TF1 *f1, Int_t firstbin, Int_t lastbin, Int_t cut, Option_t *option, TObjArray *arr)
TH1D * QuantilesX(Double_t prob=0.5, const char *name="_qx") const
Compute the X distribution of quantiles in the other variable Y name is the name of the returned hist...
virtual TH2 * RebinX(Int_t ngroup=2, const char *newname="")
Rebin only the X axis see Rebin2D.
virtual void SetShowProjectionY(Int_t nbins=1)
When the mouse is moved in a pad containing a 2-d view of this histogram a second canvas shows the pr...
virtual TH2 * Rebin(Int_t ngroup=2, const char *newname="", const Double_t *xbins=0)
Override TH1::Rebin as TH2::RebinX Rebinning in variable binning as for TH1 is not allowed If a non-n...
Double_t fScalefactor
Scale factor.
virtual void GetStats(Double_t *stats) const
Fill the array stats from the contents of this histogram The array stats must be correctly dimensione...
virtual void FillRandom(const char *fname, Int_t ntimes=5000, TRandom *rng=nullptr)
Fill histogram following distribution in function fname.
virtual TH1D * DoProjection(bool onX, const char *name, Int_t firstbin, Int_t lastbin, Option_t *option) const
Internal (protected) method for performing projection on the X or Y axis called by ProjectionX or Pro...
Double_t fTsumwy2
Total Sum of weight*Y*Y.
virtual void GetRandom2(Double_t &x, Double_t &y, TRandom *rng=nullptr)
Return 2 random numbers along axis x and y distributed according to the cell-contents of this 2-D his...
virtual Double_t GetCovariance(Int_t axis1=1, Int_t axis2=2) const
Return covariance between axis1 and axis2.
virtual void Smooth(Int_t ntimes=1, Option_t *option="")
Smooth bin contents of this 2-d histogram using kernel algorithms similar to the ones used in the ras...
virtual void FillN(Int_t, const Double_t *, const Double_t *, Int_t)
Fill this histogram with an array x and weights w.
TH1D * ProjectionX(const char *name="_px", Int_t firstybin=0, Int_t lastybin=-1, Option_t *option="") const
Project a 2-D histogram into a 1-D histogram along X.
virtual void FitSlicesX(TF1 *f1=0, Int_t firstybin=0, Int_t lastybin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray *arr=0)
Project slices along X in case of a 2-D histogram, then fit each slice with function f1 and make a hi...
virtual Int_t GetBin(Int_t binx, Int_t biny, Int_t binz=0) const
Return Global bin number corresponding to binx,y,z.
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
virtual Double_t IntegralAndError(Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Double_t &err, Option_t *option="") const
Return integral of bin contents in range [firstxbin,lastxbin],[firstybin,lastybin] for a 2-D histogra...
virtual Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const
Statistical test of compatibility in shape between THIS histogram and h2, using Kolmogorov test.
Double_t fTsumwy
Total Sum of weight*Y.
TH2()
2-D histogram default constructor.
virtual void SetShowProjectionX(Int_t nbins=1)
When the mouse is moved in a pad containing a 2-d view of this histogram a second canvas shows the pr...
virtual Double_t Interpolate(Double_t x) const
illegal for a TH2
virtual void FitSlicesY(TF1 *f1=0, Int_t firstxbin=0, Int_t lastxbin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray *arr=0)
Project slices along Y in case of a 2-D histogram, then fit each slice with function f1 and make a hi...
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual TH2 * Rebin2D(Int_t nxgroup=2, Int_t nygroup=2, const char *newname="")
Rebin this histogram grouping nxgroup/nygroup bins along the xaxis/yaxis together.
virtual Int_t BufferFill(Double_t x, Double_t y, Double_t w)
accumulate arguments in buffer.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content.
virtual ~TH2()
Destructor.
virtual TH2 * RebinY(Int_t ngroup=2, const char *newname="")
Rebin only the Y axis see Rebin2D.
virtual void Copy(TObject &hnew) const
Copy.
static THLimitsFinder * GetLimitsFinder()
Return pointer to the current finder.
virtual Int_t FindGoodLimits(TH1 *h, Double_t xmin, Double_t xmax)
Compute the best axis limits for the X axis.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
Collectable string class.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
This is the base class for the ROOT Random number generators.
virtual Double_t Rndm()
Machine independent random number generator.
void ToLower()
Change string to lower-case.
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
void ToUpper()
Change string to upper case.
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual void SetShowProjection(const char *option, Int_t nbins)=0
virtual Int_t MakeCuts(char *cutsopt)=0
virtual Bool_t IsInside(Int_t x, Int_t y)=0
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual TVirtualPad * GetSelectedPad() const =0
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
Calculate a gaussian function with mean and sigma.
Short_t Max(Short_t a, Short_t b)
Double_t Prob(Double_t chi2, Int_t ndf)
Computation of the probability for a certain Chi-squared (chi2) and number of degrees of freedom (ndf...
Double_t QuietNaN()
Returns a quiet NaN as defined by IEEE 754
Double_t Floor(Double_t x)
Double_t Sqrt(Double_t x)
Double_t KolmogorovProb(Double_t z)
Calculates the Kolmogorov distribution function,.
Long64_t BinarySearch(Long64_t n, const T *array, T value)