Re: Something Strange

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Aug 07 1998 - 14:35:21 MEST


Hi Sven,
You do not need this procedure. Simply do:
 TH1F signalX("signalX","signalX",.....);
        signalX.Sumw2();
        signalX.Add(....
 If Sumw2 is called before the operation, errors will be correctly
calculated. I have updated the development version to automatically
call Sumw2 when one of the operand histograms has Sumw2 set.

My suspicion is that two of your histograms have funny errors.
Check for Overflows/Underflows/NaN, etc. Incorrect errors of this type
will certainly crash the draw function.

Rene Brun

>Hello Rooters,

>During my analysis I ran into something which I find really hard to
>understand (in fact, I dont understand it at all) and I hope that
>someone knows where this problem comes from.
>
>The problem is the following:
>
>I have 15 data-files which contain a couple of TH1F histograms.
>One of these histograms, called signalX (where X = 1...15), has errors
>that are not the default sqrt(N) but some other number. I have
>calculated this number for all the bins, and set all the errors. I know

>for sure that this is done correctly, because when I look at the files
>interactively, I get error-bars of the size that one would expect for
>this data.
>However, I want to plot all these 15 signal histograms in a certain
>fashion on one pad. To do this i divide the pad (6 x 6) and I extract
>the histograms from the file with a line like:
>
> TH1F signalX("signalX","signalX",.....);
> signalX.Add((TH1F *)(TFile("binX.root")->Get("SignalX")),1.0);
>
>But, of course, then the errors dont get copied, so I had to change
this
>code somewhat. What was encouraging was the fact that I could plot all
>the signals in the way that I wanted to.
>
>To take the errors into account, I changed the above code into:
>
> TH1F signalX("signalX","signalX",....);
> PrepSignal(signalX,X,number_of_bins);
>
>with:
>
> void PrepSignal(TH1F& signal, int bin, int num_bins)
> {
>    cout << "doing cycle " << bin << endl;
>    TFile myfile(GetDaNameToo(bin),"READ");
>    TH1F *data = (TH1F *)(myfile.Get(GetSignal(bin)));
>
>    signal.Add(data,1.0);
>    for(int i = 1; i < num_bins; i++){
>      signal.SetBinError(i,data->GetBinError(i));
>    }
> }
>
>the 'GetDaNameToo' and 'GetSignal' return the names of the appropriate
>file and Signal for the bin.
>This code workes all in all very nice, expect for the fact that I can
>not plot two of my 15 bins. When I try to plot one of them, the program

>starts hanging, and I don't get an update of my canvas or pad.
>When I exclude them, I get a nice plot, with the rest of the signals
and
>with the correct errors.
>I checked the Dump's of the original signal's of these two bins
>(produced them while running root interactively) and compared them with

>the ones that are produced by the above procedure. According to the
data
>that I then get, both of them are completly identical.

>So, my question is: what can cause this strange behaviour, and more
>important, how can I solve this ?

>Sven Schagen



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:36 MET