Histogram Inscriptions

When a histogram is made in the upper right corner it is written "Entries, Mean, Std Dev ". What is it?


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


That’s the histogram’s statistics. See:
https://root.cern/doc/master/classTHistPainter.html#HP07

One more question. I create 2 histograms and want to place them in 3 (empty for now) so that they do not sum, simply both were. How to do it?

May be THStack is what you are looking for ?

What library is needed for it? I have a connection , but for some reason the compiler complains: ‘THStack’ was not declared in this scope.

Can you post a macro reproducing your problem ? I guess you are missing the include file.

I work in bean.MyFirst.cxx (2.8 KB)

Try to add:

#include <THStack.h>

Yes, the error disappeared, but does not save the result. Do you need this as a result of histogram format?

What do you mean by “save the result” ? I see you do:

   THStack *multiplicity = new THStack("multiplicity","");
   multiplicity->Add(his[2]);
   multiplicity->Add(his[4]);

After this lines the THStack multiplicity contains the two histograms you added in. You can then draw the stack using:

multiplicity->Draw();

The two histograms are in the same container (THStack) called multiplicity, but they are not added. That’s what you were looking for ? right ?

See: I run the program and the data file in the command line (dst format), it launches a single event in a cycle, after all the events it stores the histograms. As I understand it, the problem here is that THStack has no histogram format, so at the output I get only 4 histograms, which I then look through the root. Therefore, I need one histogram to be the result of overlaying one over the other. In the description of TH1 I find only operations with them, addition, subtraction, multiplication, finding the mean, etc., but not just superimposing one on the other and saving.

That’s exactly what THStack is doing (look at the reference guide). THStack groups as many histograms as you need and handle them as a “collection”. For instance you can draw all of them in one go: the axis ranges will be computing automatically to make sure all the histograms are visible. The option you’ll give to the Draw() method will allow you to define the way the histogram will be presented (again see the help).

In particular the option “NOSTACK” will produce the overlaying result you are looking for.

If, for some reason, you really insist to have the final result as an histogram looking like the “NOSTACK” plot produced by THSTack, you will need to loop on all the histograms, for each bin figure out what is the largest bin content and fill the corresponding bin of the result histogram with that maximum.

Bean don’t save THSack

Let’s try another way. In the root object browser can somehow manually do it?

what is Bean ??

Do what ? … create a THStack ?

bean_cmake_feb12.pdf (130.1 KB)

I see.
If you create the THStack in your program you can save it yourself in a ROOT file and then open it in ROOT visualise it. You can also save the histograms in a ROOT file and create the THStack from these saved histograms in a macro you will execute in interactive ROOT. If you strictly want to use this “Bean” layer then you will have to ask the Bean developper for more help.

well thank you :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.