Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TH1Merger Class Reference

Definition at line 20 of file TH1Merger.h.

Public Types

enum  EMergerType {
  kNotCompatible = -1 , kAllSameAxes = 0 , kAllNoLimits = 1 , kHasNewLimits = 2 ,
  kAllLabel = 3 , kLabelAndNewLimits = 4 , kAutoP2HaveLimits = 5 , kAutoP2NeedLimits = 6
}
 

Public Member Functions

 TH1Merger (TH1 &h, TCollection &l, Option_t *opt="")
 
 ~TH1Merger ()
 
Bool_t operator() ()
 Function performing the actual merge.
 

Static Public Member Functions

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 has duplicate labels e.g.
 
static Int_t FindBinNumber (Int_t ibin, const TAxis &inAxis, TAxis &outAxis)
 
static Int_t FindFixBinNumber (Int_t ibin, const TAxis &inAxis, const TAxis &outAxis)
 
static Bool_t HasDuplicateLabels (const THashList *labels)
 Find a duplicate labels in an axis label list.
 
static Bool_t IsBinEmpty (const TH1 *hist, Int_t bin)
 helper function for merging
 

Private Member Functions

Bool_t AutoP2BufferMerge ()
 
Bool_t AutoP2BuildAxes (TH1 *)
 Determine final boundaries and number of bins for histograms created in power-of-2 autobin mode.
 
Bool_t AutoP2Merge ()
 
Bool_t BufferMerge ()
 
void CopyBuffer (TH1 *hsrc, TH1 *hdes)
 
void DefineNewAxes ()
 Function to define new histogram axis when merging It is call only in case of merging with different axis or with the buffer (kHasNewLimits)
 
Bool_t DifferentAxesMerge ()
 Merged histogram when axis can be different.
 
EMergerType ExamineHistograms ()
 Examine the list of histograms to find out which type of Merge we need to do Pass the input list containing the histogram to merge and h0 which is the initial histogram on which all the histogram of the list will be merged This are the possible cases:
 
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 new limits, if the axes are compatible.
 
void MergeBin (const TH1 *hist, Int_t inbin, Int_t outbin)
 
void MergeBin (const TProfile *hist, Int_t inbin, Int_t outbin)
 
void MergeBin (const TProfile2D *hist, Int_t inbin, Int_t outbin)
 
void MergeBin (const TProfile3D *hist, Int_t inbin, Int_t outbin)
 
template<class TProfileType >
void MergeProfileBin (const TProfileType *p, Int_t ibin, Int_t outbin)
 
Bool_t SameAxesMerge ()
 

Private Attributes

TH1fH0
 
TH1fHClone
 histogram on which the list is merged
 
TList fInputList
 copy of fH0 - managed by this class
 
Bool_t fIsProfile1D = kFALSE
 
Bool_t fIsProfile2D = kFALSE
 
Bool_t fIsProfile3D = kFALSE
 
Bool_t fIsProfileMerge = kFALSE
 
UInt_t fNewAxisFlag
 
TAxis fNewXAxis
 
TAxis fNewYAxis
 
TAxis fNewZAxis
 
Bool_t fNoCheck = kFALSE
 
Bool_t fNoLabelMerge = kFALSE
 

#include </home/sftnight/build/workspace/root-makedoc-v630/rootspi/rdoc/src/v6-30-00-patches/hist/hist/src/TH1Merger.h>

Member Enumeration Documentation

◆ EMergerType

Enumerator
kNotCompatible 
kAllSameAxes 
kAllNoLimits 
kHasNewLimits 
kAllLabel 
kLabelAndNewLimits 
kAutoP2HaveLimits 
kAutoP2NeedLimits 

Definition at line 23 of file TH1Merger.h.

Constructor & Destructor Documentation

◆ TH1Merger()

TH1Merger::TH1Merger ( TH1 h,
TCollection l,
Option_t opt = "" 
)
inline

Definition at line 64 of file TH1Merger.h.

◆ ~TH1Merger()

TH1Merger::~TH1Merger ( )
inline

Definition at line 91 of file TH1Merger.h.

Member Function Documentation

◆ AutoP2BufferMerge()

Bool_t TH1Merger::AutoP2BufferMerge ( )
private

Definition at line 588 of file TH1Merger.cxx.

◆ AutoP2BuildAxes()

Bool_t TH1Merger::AutoP2BuildAxes ( TH1 h)
private

Determine final boundaries and number of bins for histograms created in power-of-2 autobin mode.

Return kTRUE if compatible, updating fNewXaxis accordingly; return kFALSE if something wrong.

The histograms are not merge-compatible if

  1. have different variable-size bins
  2. larger bin size is not an integer multiple of the smaller one
  3. the final estimated range is smalle then the bin size

Definition at line 80 of file TH1Merger.cxx.

◆ AutoP2Merge()

Bool_t TH1Merger::AutoP2Merge ( )
private

Definition at line 631 of file TH1Merger.cxx.

◆ AxesHaveLimits()

Bool_t TH1Merger::AxesHaveLimits ( const TH1 h)
static

Definition at line 19 of file TH1Merger.cxx.

◆ BufferMerge()

Bool_t TH1Merger::BufferMerge ( )
private

Definition at line 729 of file TH1Merger.cxx.

◆ CheckForDuplicateLabels()

Int_t TH1Merger::CheckForDuplicateLabels ( const TH1 hist)
static

Check if histogram has duplicate labels Return an integer with bit set correponding on the axis that has duplicate labels e.g.

duplicate labels on x axis : return 1 duplicate labels on x and z axis : return 5

Definition at line 914 of file TH1Merger.cxx.

◆ CopyBuffer()

void TH1Merger::CopyBuffer ( TH1 hsrc,
TH1 hdes 
)
private

Definition at line 554 of file TH1Merger.cxx.

◆ DefineNewAxes()

void TH1Merger::DefineNewAxes ( )
private

Function to define new histogram axis when merging It is call only in case of merging with different axis or with the buffer (kHasNewLimits)

Definition at line 488 of file TH1Merger.cxx.

◆ DifferentAxesMerge()

Bool_t TH1Merger::DifferentAxesMerge ( )
private

Merged histogram when axis can be different.

Histograms are merged looking at bin center positions

Definition at line 801 of file TH1Merger.cxx.

◆ ExamineHistograms()

TH1Merger::EMergerType TH1Merger::ExamineHistograms ( )
private

Examine the list of histograms to find out which type of Merge we need to do Pass the input list containing the histogram to merge and h0 which is the initial histogram on which all the histogram of the list will be merged This are the possible cases:

  • 1. All histogram have the same axis (allSameLimits = true)
  • 2. Histogram have different axis but compatible (allSameLimits = false) and sameLimitsX,Y,Z specifies which axis has different limits
  • 3. Histogram do not have limits (so the Buffer is used) allHaveLimits = false
  • 3b. One histogram has limits the other not : allHaveLimits = false AND initialLimitsFound = true
  • 4. Histogram Have labels = allHaveLabels = true

Definition at line 219 of file TH1Merger.cxx.

◆ FindBinNumber()

static Int_t TH1Merger::FindBinNumber ( Int_t  ibin,
const TAxis inAxis,
TAxis outAxis 
)
inlinestatic

Definition at line 45 of file TH1Merger.h.

◆ FindFixBinNumber()

static Int_t TH1Merger::FindFixBinNumber ( Int_t  ibin,
const TAxis inAxis,
const TAxis outAxis 
)
inlinestatic

Definition at line 36 of file TH1Merger.h.

◆ HasDuplicateLabels()

Bool_t TH1Merger::HasDuplicateLabels ( const THashList labels)
static

Find a duplicate labels in an axis label list.

Definition at line 887 of file TH1Merger.cxx.

◆ IsBinEmpty()

Bool_t TH1Merger::IsBinEmpty ( const TH1 hist,
Int_t  bin 
)
static

helper function for merging

Definition at line 1125 of file TH1Merger.cxx.

◆ LabelMerge()

Bool_t TH1Merger::LabelMerge ( bool  newLimits = false)
private

Merge histograms with labels and if newLimits is set support the case that one of the axis can set new limits, if the axes are compatible.

Definition at line 945 of file TH1Merger.cxx.

◆ MergeBin() [1/4]

void TH1Merger::MergeBin ( const TH1 hist,
Int_t  inbin,
Int_t  outbin 
)
private

Definition at line 1132 of file TH1Merger.cxx.

◆ MergeBin() [2/4]

void TH1Merger::MergeBin ( const TProfile hist,
Int_t  inbin,
Int_t  outbin 
)
inlineprivate

Definition at line 129 of file TH1Merger.h.

◆ MergeBin() [3/4]

void TH1Merger::MergeBin ( const TProfile2D hist,
Int_t  inbin,
Int_t  outbin 
)
inlineprivate

Definition at line 130 of file TH1Merger.h.

◆ MergeBin() [4/4]

void TH1Merger::MergeBin ( const TProfile3D hist,
Int_t  inbin,
Int_t  outbin 
)
inlineprivate

Definition at line 131 of file TH1Merger.h.

◆ MergeProfileBin()

template<class TProfileType >
void TH1Merger::MergeProfileBin ( const TProfileType *  p,
Int_t  ibin,
Int_t  outbin 
)
private

Definition at line 1154 of file TH1Merger.cxx.

◆ operator()()

Bool_t TH1Merger::operator() ( )

Function performing the actual merge.

Definition at line 27 of file TH1Merger.cxx.

◆ SameAxesMerge()

Bool_t TH1Merger::SameAxesMerge ( )
private

Definition at line 755 of file TH1Merger.cxx.

Member Data Documentation

◆ fH0

TH1* TH1Merger::fH0
private

Definition at line 139 of file TH1Merger.h.

◆ fHClone

TH1* TH1Merger::fHClone
private

histogram on which the list is merged

Definition at line 140 of file TH1Merger.h.

◆ fInputList

TList TH1Merger::fInputList
private

copy of fH0 - managed by this class

Definition at line 141 of file TH1Merger.h.

◆ fIsProfile1D

Bool_t TH1Merger::fIsProfile1D = kFALSE
private

Definition at line 136 of file TH1Merger.h.

◆ fIsProfile2D

Bool_t TH1Merger::fIsProfile2D = kFALSE
private

Definition at line 137 of file TH1Merger.h.

◆ fIsProfile3D

Bool_t TH1Merger::fIsProfile3D = kFALSE
private

Definition at line 138 of file TH1Merger.h.

◆ fIsProfileMerge

Bool_t TH1Merger::fIsProfileMerge = kFALSE
private

Definition at line 135 of file TH1Merger.h.

◆ fNewAxisFlag

UInt_t TH1Merger::fNewAxisFlag
private

Definition at line 145 of file TH1Merger.h.

◆ fNewXAxis

TAxis TH1Merger::fNewXAxis
private

Definition at line 142 of file TH1Merger.h.

◆ fNewYAxis

TAxis TH1Merger::fNewYAxis
private

Definition at line 143 of file TH1Merger.h.

◆ fNewZAxis

TAxis TH1Merger::fNewZAxis
private

Definition at line 144 of file TH1Merger.h.

◆ fNoCheck

Bool_t TH1Merger::fNoCheck = kFALSE
private

Definition at line 134 of file TH1Merger.h.

◆ fNoLabelMerge

Bool_t TH1Merger::fNoLabelMerge = kFALSE
private

Definition at line 133 of file TH1Merger.h.

  • hist/hist/src/TH1Merger.h
  • hist/hist/src/TH1Merger.cxx