Some hist-drawing issues

Hi all,

I have some question concerning THStack and the TH1 drawing option e4. I use the following code to generate a THStack and draw it:

// ... Loading tree with hists and setting colors and fill styles ... stack->Add(eHist, "e4"); stack->Add(wHist, "e4"); stack->Add(wHist, "pe0"); stack->Draw("nostack");
The result is the following picture:

So no magic at all. Here are my questions:

  1. Is it possible to combine the “e4” and “pe0” drawings, “pe0e3” seems not to work.
  2. Looking at the very right of the red and the blue error bands one can see some strange effect. The bands are kind of bent where they should not be (In fact the blue band should be nearly flat at the right end). I saw this in the past every time I tried to use “e4”. Is this a known problem or am I missing something important when using “e4”?
  3. I always thought that THStack would scale the graph in such a way that all parts of all histograms fit into the boundaries of the graph. Since the blue error band should be symmetric it seems to me that THStack does not care about error bars. This can also be seen in the red graph at the point at 4.7 where the negative part of the error is completely out of the plot. Again, am I missing something important here? Would be nice to have really all parts scaled into the graph.
  4. There seem to be some clipping problems that can be seen on the leftmost negative part of the blue error band. As I said this should be symmetric. Seems like that point is clipped from approx. -1.2 to the lower boundary of the graph. Its the same with the leftmost upper part and the rightmost lower part of the red band. What could I do to avoid this?

Sorry for buggin’ you with so many questions, nevertheless thanks for any help :unamused:

Cheers,

Mathias

E4 does a smoothing using splines which, in some cases, produces this bouncing effect. You can also see the same effect when you draw a TGraph with option “C”. This occurs when there is a big step between 2 points along Y. In your case should use E3 instead of E4. E3 simply connect the error bar ends with a straight line.

Hi,

First, thanks for the answer. Concerning the splines it looks to me as if the problem only occures at the first or the last point of the graph. As far as I remember there are some boundary conditions for these points that may vary from the choosen method of fixing the splines. These boundary conditions set constaints to the first, second or third derivation of the data at these points. So the question arises if there is the possibility to choose the boundary conditions that are used by the root-algorithms when calculating the splines. For me I guess the the best choice would be something like d/dx(f(x0)) = 0 and d/dx(f(xn)) = 0. Is it possible to do this, perhaps with some kind of global parameter in TStyle or so?

Thx, Mathias

yes it shows most on the fist and last error bars when they are large. It is what I told you, when there is a big gap between to point (bottom and top of the error bar) there is this bouncing effect.