Merge histograms with different bin size and numbers


It is probably an easy question (I am new to root) by I cannot find a "quick"
way to merge/add histograms with different bin size and number…
(Add() in TH1 seems to require that the x-axis of the histograms be the same)

After googeling and going through the doc I could find

1.- use TTree and hadd.c but I think that requires to write root files??
2.- use TTree and Draw()??
3.- use TChain and TChain::Merge??
4.- use TProfile which also has a merge method??
5.- use h->SetBit(TH1::kCanRebin)??;

I am a bit lost here…

Thank you in advance,

Bertrand Roessli

see doc of TH1::Merge at

If your histograms are such that you can use TH1::Merge, then you can also use the hadd tool merging histogram files.

hadd -f result.root file1.root file2.root ... fileN.root where hadd is in $ROOTSYS/bin/hadd