[ROOT] merge histograms with Alphanumeric labels

From: Weijiang Dong (wjdong@physics.ucla.edu)
Date: Sat Aug 02 2003 - 08:08:18 MEST


Hi,
I want to plot the histogram of number of emc points for each runid
to check bad runs. 
The runid is an integer. However, the runid has 7 digits. For a
whole year's experiment, there would be only like a hundred of different
runids. To make it worse, the last 6 digits of the integer runid can be
anything. So, by using TH1F with 1000000 bins, each bin will be slim as a
line on the plot. 
I found I can convert the integer runid to string and fill the
histogram with the string and a weight(hlabel1.C and hlabel2.C in root
tutorial). It worked fine. I submitted hundreds of jobs and each
job generated a root file containing a histogram like that. But finally I
want to merge these root files. 
I ever used the example macro hadd.C to do it. But root
complained histograms in each root file have different bin size. It's
true. Because not every runid would present for a job, so not every
runid string would fill the histogram. Later I found hadd.C used
TH1->Add(TH1 *) method and the "Add" method requires each histogram should
have the same bin size.  Then I changed the hadd.C macro a little
bit. This time I used TH1->Merge(TList *). Root didn't complain anything
this time, but the result is strange and not correct. 
Am I doing right or I missed something? Is there any other simple way to
do this?
Thanks.
Weijiang



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET