Hi, all
I am a beginner, now I encounter an “easy” problem, I don’t know which dirrective I can use when I what to merge two histograms into one. Just reading them , then use h1->Draw(“same”) ?
Any help will be appreciated!
Thank you!
Xuebing
Hi, all
I am a beginner, now I encounter an “easy” problem, I don’t know which dirrective I can use when I what to merge two histograms into one. Just reading them , then use h1->Draw(“same”) ?
Any help will be appreciated!
Thank you!
Xuebing
Use TH1::Add
, eg
TH1 *h1, *h2;
h1->Add(h2);
see also TH1::Merge
to merge a list of histograms
and $ROOTSYS/bin/hadd
to merge a list of ROOT files
Rene
Hi brun,
I used your response to merge two histograms plots into single plot. When i typed these commands i got an error(see screenshot).
Any kind of help will meant me alot!!
Screenshot from 2020-07-27 23-17-01|690x387
The code in @brun post was just showing the “idea”.
The following is real C++:
auto h1 = new TH1F();
auto h2 = new TH1F();
h1->Add(h2);
of course it is a bit useless as h1
and h2
are empty.