15#define PRINTRANGE(a, b, bn) \
16 Printf(" base: %f %f %d, %s: %f %f %d", a->GetXmin(), a->GetXmax(), a->GetNbins(), bn, b->GetXmin(), b->GetXmax(), \
20 Bool_t hasLimits =
h->GetXaxis()->GetXmin() <
h->GetXaxis()->GetXmax();
21 if (
h->GetDimension() > 1) hasLimits &=
h->GetYaxis()->GetXmin() <
h->GetYaxis()->GetXmax();
22 if (
h->GetDimension() > 2) hasLimits &=
h->GetZaxis()->GetXmin() <
h->GetZaxis()->GetXmax();
58 if (ret)
return kTRUE;
62 Error(
"TH1Merger",
"Unknown type of Merge for histogram %s",
fH0->GetName());
84 Error(
"AutoP2BuildAxes",
"undefined histogram: %p",
h);
90 Error(
"AutoP2BuildAxes",
"not in autobin-power-of-2 mode!");
98 Bool_t canextend = (
h->GetBinContent(0) > 0 ||
h->GetBinContent(a1->GetNbins() + 1) > 0) ?
kFALSE :
kTRUE;
102 a0->
Set(a1->GetNbins(), a1->GetXmin(), a1->GetXmax());
110 Double_t bwmin = (a1->GetXmax() - a1->GetXmin()) / a1->GetNbins();
113 std::swap(bwmax, bwmin);
118 Error(
"AutoP2BuildAxes",
"minimal bin width negative or null: %f", bwmin);
123 Double_t re = std::modf(bwmax / bwmin, &rt);
124 if (re > std::numeric_limits<Double_t>::epsilon()) {
126 Error(
"AutoP2BuildAxes",
"bin widths not in integer ratio: %f", re);
133 if (a0->
GetXmin() < a1->GetXmin()) {
134 if (a0->
GetXmax() < a1->GetXmin()) {
137 Error(
"AutoP2BuildAxes",
"ranges are disconnected and under/overflows: cannot merge");
140 xmax = a1->GetXmax();
144 if (a0->
GetXmax() >= a1->GetXmax()) {
145 xmax = a1->GetXmax();
146 xmin = a1->GetXmin();
150 xmin = a1->GetXmin();
155 if (a1->GetXmax() < a0->
GetXmin()) {
158 Error(
"AutoP2BuildAxes",
"ranges are disconnected and under/overflows: cannot merge");
162 xmin = a1->GetXmin();
165 if (a1->GetXmax() >= a0->
GetXmax()) {
170 xmax = a1->GetXmax();
178 re = std::modf(range / bwmax, &rt);
181 Error(
"MergeCompatibleHistograms",
"range smaller than bin width: %f %f %f", range, bwmax, rt);
184 if (re > std::numeric_limits<Double_t>::epsilon()) {
243 int dimension =
fH0->GetDimension();
257 if (
h->GetDimension() != dimension) {
258 Error(
"Merge",
"Cannot merge histogram - dimensions are different\n "
259 "%s has dim=%d and %s has dim=%d",
fH0->GetName(),dimension,
h->GetName(),
h->GetDimension());
265 haveWeights |=
h->GetSumw2N() != 0;
270 allHaveLimits = allHaveLimits && hasLimits;
271 allSameLimits &= allHaveLimits;
274 Error(
"Merge",
"Cannot merge histogram - some are in autobin-power-of-2 mode, but not %s!",
h->GetName());
278 Error(
"Merge",
"Cannot merge histogram - %s is in autobin-power-of-2 mode, but not the previous ones",
301 if (!initialLimitsFound) {
302 initialLimitsFound =
kTRUE;
303 if (
h->GetXaxis()->GetXbins()->GetSize() != 0)
304 fNewXAxis.Set(
h->GetXaxis()->GetNbins(),
h->GetXaxis()->GetXbins()->GetArray());
306 fNewXAxis.Set(
h->GetXaxis()->GetNbins(),
h->GetXaxis()->GetXmin(),
h->GetXaxis()->GetXmax());
308 if (
h->GetYaxis()->GetXbins()->GetSize() != 0)
309 fNewYAxis.Set(
h->GetYaxis()->GetNbins(),
h->GetYaxis()->GetXbins()->GetArray());
311 fNewYAxis.Set(
h->GetYaxis()->GetNbins(),
h->GetYaxis()->GetXmin(),
h->GetYaxis()->GetXmax());
314 if (
h->GetZaxis()->GetXbins()->GetSize() != 0)
315 fNewZAxis.Set(
h->GetZaxis()->GetNbins(),
h->GetZaxis()->GetXbins()->GetArray());
317 fNewZAxis.Set(
h->GetZaxis()->GetNbins(),
h->GetZaxis()->GetXmin(),
h->GetZaxis()->GetXmax());
329 Error(
"Merge",
"Cannot merge histograms - limits are inconsistent:\n "
330 "first: %s (%d, %f, %f), second: %s (%d, %f, %f)",
fH0->GetName(),
332 h->GetName(),
h->GetXaxis()->GetNbins(),
h->GetXaxis()->GetXmin(),
333 h->GetXaxis()->GetXmax());
344 Error(
"Merge",
"Cannot merge histograms - limits are inconsistent:\n "
345 "first: %s (%d, %f, %f), second: %s (%d, %f, %f)",
fH0->GetName(),
347 h->GetName(),
h->GetYaxis()->GetNbins(),
h->GetYaxis()->GetXmin(),
348 h->GetYaxis()->GetXmax());
352 if(dimension > 2 && !
fH0->SameLimitsAndNBins(
fNewZAxis, *(
h->GetZaxis()))) {
355 Error(
"Merge",
"Cannot merge histograms - limits are inconsistent:\n "
356 "first: %s (%d, %f, %f), second: %s (%d, %f, %f)",
fH0->GetName(),
358 h->GetName(),
h->GetZaxis()->GetNbins(),
h->GetZaxis()->GetXmin(),
359 h->GetZaxis()->GetXmax());
363 allSameLimits = sameLimitsX && sameLimitsY && sameLimitsZ;
368 Bool_t histoIsEmpty =
h->IsEmpty();
373 if (allHaveLabels && !histoIsEmpty) {
374 THashList* hlabelsX =
h->GetXaxis()->GetLabels();
375 THashList* hlabelsY = (dimension > 1) ?
h->GetYaxis()->GetLabels() :
nullptr;
376 THashList* hlabelsZ = (dimension > 2) ?
h->GetZaxis()->GetLabels() :
nullptr;
377 Bool_t haveOneLabelX = hlabelsX !=
nullptr;
378 Bool_t haveOneLabelY = hlabelsY !=
nullptr;
379 Bool_t haveOneLabelZ = hlabelsZ !=
nullptr;
380 Bool_t haveOneLabel = haveOneLabelX || haveOneLabelY || haveOneLabelZ;
382 if (foundLabelHist && allHaveLabels && !haveOneLabel) {
383 Warning(
"Merge",
"Not all histograms have labels. I will ignore labels,"
384 " falling back to bin numbering mode.");
387 allHaveLabels &= (haveOneLabel);
390 foundLabelHist =
kTRUE;
399 allHaveLabels &= consistentLabels;
400 if (!consistentLabels)
401 Warning(
"TH1Merger::ExamineHistogram",
"Histogram %s has inconsistent labels: %d is not consistent with %d",
402 h->GetName(), (
int)
type, (
int) labelAxisType );
403 if (
gDebug && consistentLabels)
404 Info(
"TH1Merger::ExamineHistogram",
"Histogram %s has consistent labels",
h->GetName() );
410 if (dimension > 1 &&
fH0->GetYaxis()->CanExtend()) extendAxisType |=
TH1::kYaxis;
411 if (dimension > 2 &&
fH0->GetZaxis()->CanExtend()) extendAxisType |=
TH1::kZaxis;
415 if (allHaveLabels && !labelAxisCanBeExtended) {
418 if (
fH0->IsEmpty() ) {
420 Info(
"TH1Merger::ExamineHistogram",
"Histogram %s to be merged is empty and we are merging with %s that has labels. Force the axis to be extended",
fH0->GetName(),
h->GetName());
421 fH0->SetCanExtend( labelAxisType );
425 Info(
"TH1Merger::ExamineHistogram",
"Histogram %s to be merged has labels but corresponding axis cannot be extended - using bin numeric mode to merge. Call TH1::SetCanExtend(TH1::kAllAxes) if want to merge using label mode",
fH0->GetName());
435 Info(
"TH1Merger::ExamineHistogram",
"Examine histogram %s - labels %d - same limits %d - axis found %d",
h->GetName(),allHaveLabels,allSameLimits,initialLimitsFound );
437 }
while ( (
h =
dynamic_cast<TH1*
> ( next() ) ) !=
nullptr );
439 if (!
h && (*next) ) {
440 Error(
"Merge",
"Attempt to merge object of class: %s to a %s",
441 (*next)->ClassName(),
fH0->ClassName());
446 if (haveWeights &&
fH0->GetSumw2N() == 0)
457 if (allHaveLabels && allSameLimits)
return kAllLabel;
459 if (!initialLimitsFound) {
492 if (!
fH0->IsEmpty() ) {
496 fHClone->SetDirectory(
nullptr);
510 fH0->fXaxis.SetRange(0,0);
511 if (
fNewXAxis.GetXbins()->GetSize() != 0)
517 fH0->fYaxis.SetRange(0,0);
518 if (
fNewYAxis.GetXbins()->GetSize() != 0)
524 fH0->fZaxis.SetRange(0,0);
525 if (
fNewZAxis.GetXbins()->GetSize() != 0)
532 fH0->fNcells =
fH0->fXaxis.GetNbins()+2;
533 if (
fH0->fDimension > 1)
fH0->fNcells *=
fH0->fYaxis.GetNbins()+2;
534 if (
fH0->fDimension > 2)
fH0->fNcells *=
fH0->fZaxis.GetNbins()+2;
535 fH0->SetBinsLength(
fH0->fNcells);
536 if (
fH0->fSumw2.fN)
fH0->fSumw2.Set(
fH0->fNcells);
538 if (
fH0->fDimension < 3)
fH0->fZaxis.Set(1,0,1);
539 if (
fH0->fDimension < 2)
fH0->fYaxis.Set(1,0,1);
542 if (newLimitsX)
Info(
"DefineNewAxis",
"A new X axis has been defined Nbins=%d , [%f,%f]",
fH0->fXaxis.GetNbins(),
543 fH0->fXaxis.GetXmin(),
fH0->fXaxis.GetXmax() );
544 if (newLimitsY)
Info(
"DefineNewAxis",
"A new Y axis has been defined Nbins=%d , [%f,%f]",
fH0->fYaxis.GetNbins(),
545 fH0->fYaxis.GetXmin(),
fH0->fYaxis.GetXmax() );
546 if (newLimitsZ)
Info(
"DefineNewAxis",
"A new Z axis has been defined Nbins=%d , [%f,%f]",
fH0->fZaxis.GetNbins(),
547 fH0->fZaxis.GetXmin(),
fH0->fZaxis.GetXmax() );
558 if (!hsrc || !hsrc->
fBuffer || !hdes ) {
559 void *p1 = hsrc ? hsrc->
fBuffer :
nullptr;
562 Warning(
"TH1Merger::CopyMerge",
"invalid inputs: %p, %p, %p, -> do nothing", hsrc, hdes, p1);
570 for (
Int_t i = 0;
i < nbentries;
i++)
574 auto h2 =
dynamic_cast<TH2 *
>(hdes);
576 for (
Int_t i = 0;
i < nbentries;
i++)
580 auto h3 =
dynamic_cast<TH3 *
>(hdes);
582 for (
Int_t i = 0;
i < nbentries;
i++)
591 TH1 *href =
nullptr, *hist =
nullptr;
596 while ((hist = (
TH1 *)nextref()) && !href) {
613 while ((hist = (
TH1 *)next())) {
616 Info(
"AutoP2BufferMerge",
"merging buffer of %s into %s", hist->GetName(), href->
GetName());
636 totstats[
i] = stats[
i] = 0;
643 if (!(
fH0->IsEmpty())) {
646 while ((hist = (
TH1 *)next())) {
654 Info(
"TH1Merger::AutoP2Merge",
"all histograms look empty!");
660 Error(
"TH1Merger::AutoP2Merge",
"cannot create axes from %s", hist->
GetName());
664 while ((
h = (
TH1 *)next())) {
666 Error(
"TH1Merger::AutoP2Merge",
"cannot merge histogram %s: not merge compatible",
h->GetName());
675 fH0->GetStats(totstats);
687 while ((hist = (
TH1 *)next())) {
692 Info(
"TH1Merger::AutoP2Merge",
"merging histogram %s into %s (entries: %f)", hist->
GetName(),
fH0->GetName(),
702 totstats[
i] += stats[
i];
717 fH0->AddBinContent(jbin, cu);
719 fH0->fSumw2.fArray[jbin] += e1sq;
723 fH0->PutStats(totstats);
733 while (
TH1* hist = (
TH1*)next()) {
738 Info(
"TH1Merger::BufferMerge",
"Merging histogram %s into %s",hist->GetName(),
fH0->GetName() );
750 if (
fH0->fBuffer)
fH0->BufferEmpty(1);
760 totstats[
i] = stats[
i] = 0;
762 fH0->GetStats(totstats);
766 while (
TH1* hist=(
TH1*)next()) {
771 Info(
"TH1Merger::SameAxesMerge",
"Merging histogram %s into %s",hist->GetName(),
fH0->GetName() );
774 if (hist->IsEmpty())
continue;
777 hist->GetStats(stats);
779 totstats[
i] += stats[
i];
784 for (
Int_t ibin = 0; ibin < hist->fNcells; ibin++) {
789 fH0->PutStats(totstats);
805 fH0->GetStats(totstats);
809 while (
TH1* hist=(
TH1*)next()) {
812 Info(
"TH1Merger::DifferentAxesMerge",
"Merging histogram %s into %s",hist->GetName(),
fH0->GetName() );
815 if (hist->IsEmpty())
continue;
818 hist->GetStats(stats);
820 totstats[
i] += stats[
i];
824 for (
Int_t ibin = 0; ibin < hist->fNcells; ibin++) {
829 Int_t binx,biny,binz;
830 hist->GetBinXYZ(ibin, binx, biny, binz);
833 if (binx <= 0 || binx >= hist->GetNbinsX() + 1) {
834 if (
fH0->fXaxis.CanExtend() || ( hist->fXaxis.GetBinCenter(binx) >
fH0->fXaxis.GetXmin() && hist->fXaxis.GetBinCenter(binx) <
fH0->fXaxis.GetXmax()) ) {
835 Error(
"TH1Merger::DifferentAxesMerge",
"Cannot merge histograms - the histograms %s can extend the X axis or have"
836 " different limits and underflows/overflows are present in the histogram %s.",
fH0->GetName(),hist->GetName());
840 if (biny <= 0 || biny >= hist->GetNbinsY() + 1) {
841 if (
fH0->fYaxis.CanExtend() || ( hist->fYaxis.GetBinCenter(biny) >
fH0->fYaxis.GetXmin() && hist->fYaxis.GetBinCenter(biny) <
fH0->fYaxis.GetXmax()) ) {
842 Error(
"TH1Merger::DifferentAxesMerge",
"Cannot merge histograms - the histograms %s can extend the Y axis or have"
843 " different limits and underflows/overflows are present in the histogram %s.",
fH0->GetName(),hist->GetName());
847 if (binz <= 0 || binz >= hist->GetNbinsZ() + 1) {
848 if (
fH0->fZaxis.CanExtend() || ( hist->fZaxis.GetBinCenter(binz) >
fH0->fZaxis.GetXmin() && hist->fZaxis.GetBinCenter(binz) <
fH0->fZaxis.GetXmax()) ) {
849 Error(
"TH1Merger::DifferentAxesMerge",
"Cannot merge histograms - the histograms %s can extend the Z axis or have"
850 " different limits and underflows/overflows are present in the histogram %s.",
fH0->GetName(),hist->GetName());
861 ix =
fH0->fXaxis.FindBin(hist->GetXaxis()->GetBinCenter(binx));
862 if (
fH0->fDimension > 1)
863 iy =
fH0->fYaxis.FindBin(hist->GetYaxis()->GetBinCenter(biny));
864 if (
fH0->fDimension > 2)
865 iz =
fH0->fZaxis.FindBin(hist->GetZaxis()->GetBinCenter(binz));
868 if (ib < 0 || ib >
fH0->fNcells) {
869 Fatal(
"TH1Merger::LabelMerge",
"Fatal error merging histogram %s - bin number is %d and array size is %d",
870 fH0->GetName(), ib,
fH0->fNcells);
878 fH0->PutStats(totstats);
889 if (!labels)
return kFALSE;
891 for (
const auto * obj: *labels) {
894 if (objList->GetSize() > 1 ) {
896 std::unordered_set<std::string> s;
897 for (
const auto * o: *objList) {
898 auto ret = s.insert(std::string(o->GetName() ));
899 if (!ret.second)
return kTRUE;
924 Warning(
"TH1Merger::CheckForDuplicateLabels",
"Histogram %s has duplicate labels in the x axis. "
925 "Bin contents will be merged in a single bin",hist->
GetName());
929 Warning(
"TH1Merger::CheckForDuplicateLabels",
"Histogram %s has duplicate labels in the y axis. "
930 "Bin contents will be merged in a single bin",hist->
GetName());
934 Warning(
"TH1Merger::CheckForDuplicateLabels",
"Histogram %s has duplicate labels in the z axis. "
935 "Bin contents will be merged in a single bin",hist->
GetName());
951 fH0->GetStats(totstats);
958 while (
TH1* hist=(
TH1*)next()) {
961 Info(
"TH1Merger::LabelMerge",
"Merging histogram %s into %s",hist->GetName(),
fH0->GetName() );
964 if (hist->IsEmpty())
continue;
967 hist->GetStats(stats);
969 totstats[
i] += stats[
i];
972 auto labelsX = hist->GetXaxis()->GetLabels();
973 auto labelsY = hist->GetYaxis()->GetLabels();
974 auto labelsZ = hist->GetZaxis()->GetLabels();
975 R__ASSERT(!( labelsX ==
nullptr && labelsY ==
nullptr && labelsZ ==
nullptr));
977 Bool_t mergeLabelsX = labelsX &&
fH0->fXaxis.CanExtend() && hist->fXaxis.CanExtend();
978 Bool_t mergeLabelsY = labelsY &&
fH0->fYaxis.CanExtend() && hist->fYaxis.CanExtend();
979 Bool_t mergeLabelsZ = labelsZ &&
fH0->fZaxis.CanExtend() && hist->fZaxis.CanExtend();
983 Info(
"TH1Merger::LabelMerge",
"Merging X axis in label mode");
985 Info(
"TH1Merger::LabelMerge",
"Merging X axis in numeric mode");
987 Info(
"TH1Merger::LabelMerge",
"Merging Y axis in label mode");
988 else if (hist->GetDimension() > 1)
989 Info(
"TH1Merger::LabelMerge",
"Merging Y axis in numeric mode");
991 Info(
"TH1Merger::LabelMerge",
"Merging Z axis in label mode" );
992 else if (hist->GetDimension() > 2)
993 Info(
"TH1Merger::LabelMerge",
"Merging Z axis in numeric mode");
1002 std::cout <<
"Bins of original histograms\n";
1003 for (
int ix = 1; ix <=
fH0->GetXaxis()->GetNbins(); ++ix) {
1004 for (
int iy = 1; iy <=
fH0->GetYaxis()->GetNbins(); ++iy) {
1005 for (
int iz = 1; iz <=
fH0->GetZaxis()->GetNbins(); ++iz) {
1006 int i =
fH0->GetBin(ix,iy,iz);
1007 std::cout <<
"bin" << ix <<
"," << iy <<
"," << iz
1008 <<
" : " <<
fH0->RetrieveBinContent(
i) << std::endl;
1013 for (
Int_t ibin = 0; ibin < hist->fNcells; ibin++) {
1018 Int_t binx,biny,binz;
1019 hist->GetBinXYZ(ibin, binx, biny, binz);
1022 const char * labelX = hist->GetXaxis()->GetBinLabel(binx);
1023 const char * labelY = (
fH0->fDimension > 1) ? hist->GetYaxis()->GetBinLabel(biny) :
nullptr;
1024 const char * labelZ = (
fH0->fDimension > 2) ? hist->GetYaxis()->GetBinLabel(binz) :
nullptr;
1030 Int_t iy = (
fH0->fDimension > 1) ? -1 : 0;
1031 Int_t iz = (
fH0->fDimension > 2) ? -1 : 0;
1040 if (binx <= 0 || binx >= hist->GetNbinsX() + 1) {
1042 ix = (binx <= 0) ? 0 :
fH0->fXaxis.GetNbins() +1;
1043 if (newLimits && !mergeLabelsX) {
1044 if (
fH0->fXaxis.CanExtend() || ( hist->fXaxis.GetBinCenter(binx) >
fH0->fXaxis.GetXmin() && hist->fXaxis.GetBinCenter(binx) <
fH0->fXaxis.GetXmax()) ) {
1045 Error(
"TH1Merger::LabelMerge",
"Cannot merge histograms - the histograms %s can extend the X axis or have"
1046 " different limits and underflows/overflows are present in the histogram %s.",
fH0->GetName(),hist->GetName());
1051 if (
fH0->fDimension > 1 ) {
1052 if (biny <= 0 || biny >= hist->GetNbinsY() + 1) {
1054 iy = (biny <= 0) ? 0 :
fH0->fYaxis.GetNbins() +1;
1055 if (newLimits && !mergeLabelsY) {
1056 if (
fH0->fYaxis.CanExtend() || ( hist->fYaxis.GetBinCenter(biny) >
fH0->fYaxis.GetXmin() && hist->fYaxis.GetBinCenter(biny) <
fH0->fYaxis.GetXmax()) ) {
1057 Error(
"TH1Merger::LabelMerge",
"Cannot merge histograms - the histograms %s can extend the Y axis or have"
1058 " different limits and underflows/overflows are present in the histogram %s.",
fH0->GetName(),hist->GetName());
1064 if (
fH0->fDimension > 2 ) {
1065 if (binz <= 0 || binz >= hist->GetNbinsZ() + 1) {
1067 iz = (binz <= 0) ? 0 :
fH0->fZaxis.GetNbins() +1;
1068 if (newLimits && !mergeLabelsZ) {
1069 if (
fH0->fZaxis.CanExtend() || ( hist->fZaxis.GetBinCenter(binz) >
fH0->fZaxis.GetXmin() && hist->fZaxis.GetBinCenter(binz) <
fH0->fZaxis.GetXmax()) ) {
1070 Error(
"TH1Merger::LabelMerge",
"Cannot merge histograms - the histograms %s can extend the Z axis or have"
1071 " different limits and underflows/overflows are present in the histogram %s.",
fH0->GetName(),hist->GetName());
1082 ix =
fH0->fXaxis.FindBin(labelX);
1089 if (iy == -1 &&
fH0->fDimension> 1 ) {
1091 iy=
fH0->fYaxis.FindBin(labelY);
1095 if (iz == -1 &&
fH0->fDimension> 2) {
1097 iz=
fH0->fZaxis.FindBin(labelZ);
1103 Info(
"TH1Merge::LabelMerge",
"Merge bin [%d,%d,%d] with label [%s,%s,%s] into bin [%d,%d,%d]",
1104 binx,biny,binz,labelX,labelY,labelZ,ix,iy,iz);
1108 if (ib < 0 || ib >=
fH0->fNcells) {
1109 Fatal(
"TH1Merger::LabelMerge",
"Fatal error merging histogram %s - bin number is %d and array size is %d",
1110 fH0->GetName(), ib,
fH0->fNcells);
1117 fH0->PutStats(totstats);
1128 return cu == 0 && e1sq == 0;
1136 fH0->AddBinContent(cbin, cu);
1137 if (
fH0->fSumw2.fN) {
1139 fH0->fSumw2.fArray[cbin] += e1sq;
1153template<
class TProfileType>
1156 TProfileType *p =
static_cast<TProfileType *
>(
fH0);
1157 p->fArray[pbin] +=
h->fArray[hbin];
1158 p->fSumw2.fArray[pbin] +=
h->fSumw2.fArray[hbin];
1159 p->fBinEntries.fArray[pbin] +=
h->fBinEntries.fArray[hbin];
1160 if (p->fBinSumw2.fN) {
1161 if (
h->fBinSumw2.fN)
1162 p->fBinSumw2.fArray[pbin] +=
h->fBinSumw2.fArray[hbin];
1164 p->fBinSumw2.fArray[pbin] +=
h->fArray[hbin];
1167 Info(
"TH1Merge::MergeProfileBin",
"Merge bin %d of profile %s with content %f in bin %d - result is %f", hbin,
1168 h->GetName(),
h->fArray[hbin], pbin, p->fArray[pbin]);
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
#define PRINTRANGE(a, b, bn)
Class to manage histogram axis.
void SetCanExtend(Bool_t canExtend)
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
Int_t GetLast() const
Return last bin on the axis i.e.
Int_t GetFirst() const
Return first bin on the axis i.e.
THashList * GetLabels() const
Bool_t AutoP2BufferMerge()
static Bool_t AxesHaveLimits(const TH1 *h)
static Int_t CheckForDuplicateLabels(const TH1 *hist)
Check if histogram has duplicate labels Return an integer with bit set correponding on the axis that ...
Bool_t AutoP2BuildAxes(TH1 *)
Determine final boundaries and number of bins for histograms created in power-of-2 autobin mode.
Bool_t DifferentAxesMerge()
Merged histogram when axis can be different.
TList fInputList
copy of fH0 - managed by this class
static Int_t FindFixBinNumber(Int_t ibin, const TAxis &inAxis, const TAxis &outAxis)
void CopyBuffer(TH1 *hsrc, TH1 *hdes)
Bool_t LabelMerge(bool newLimits=false)
Merge histograms with labels and if newLimits is set support the case that one of the axis can set ne...
static Bool_t IsBinEmpty(const TH1 *hist, Int_t bin)
helper function for merging
EMergerType ExamineHistograms()
Examine the list of histograms to find out which type of Merge we need to do Pass the input list cont...
static Bool_t HasDuplicateLabels(const THashList *labels)
Find a duplicate labels in an axis label list.
void MergeBin(const TH1 *hist, Int_t inbin, Int_t outbin)
Bool_t operator()()
Function performing the actual merge.
void DefineNewAxes()
Function to define new histogram axis when merging It is call only in case of merging with different ...
TH1 * fHClone
histogram on which the list is merged
void MergeProfileBin(const TProfileType *p, Int_t ibin, Int_t outbin)
TH1 is the base class of all histogram classes in ROOT.
Double_t * fBuffer
[fBufferSize] entry buffer
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
Int_t fNcells
Number of bins(1D), cells (2D) +U/Overflows.
virtual void GetStats(Double_t *stats) const
fill the array stats from the contents of this histogram The array stats must be correctly dimensione...
@ kAutoBinPTwo
different than 1.
static Bool_t RecomputeAxisLimits(TAxis &destAxis, const TAxis &anAxis)
Finds new limits for the axis for the Merge function.
static Bool_t SameLimitsAndNBins(const TAxis &axis1, const TAxis &axis2)
Same limits and bins.
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 Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual Double_t GetBinErrorSqUnchecked(Int_t bin) const
virtual Double_t GetEntries() const
Return the current number of entries.
Bool_t IsEmpty() const
Check if a histogram is empty (this is a protected method used mainly by TH1Merger )
@ kNstat
Size of statistics data (up to TProfile3D)
TArrayD fSumw2
Array of sum of squares of weights.
virtual Int_t BufferEmpty(Int_t action=0)
Fill histogram with all entries in the buffer.
@ kNoAxis
NOTE: Must always be 0 !!!
Service class for 2-D histogram classes.
The 3-D histogram classes derived from the 1-D histogram classes.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
const TList * GetListForObject(const char *name) const
Return the THashTable's list (bucket) in which obj can be found based on its hash; see THashTable::Ge...
const char * GetName() const override
Returns name of object.
Profile2D histograms are used to display the mean value of Z and its error for each cell in X,...
Profile3D histograms are used to display the mean value of T and its RMS for each cell in X,...
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.