Problem with passing color to histograms

Dear root/proof experts,

I’m having a problem with passing colors to my histograms filled up in a loop over events while using “light” proof. Namely, the color not only not always is passed to the final histograms (saved in an output file) but in addition, whether it is passed or not depends on, if the proof uses all cores of a CPU or just a subset and on the number of events over which to loop.

Let me explain what i’m doing in terms of my code. To make easier the explain I have simplified the code as much as possible. The code is contained in 3 files:
PROOF_SS2L_MC_Main.cxx
PROOF_SS2L_MC_Analysis_v34.h
PROOF_SS2L_MC_Analysis_v34.C
which can be found at /afs/cern.ch/work/m/maliev/public/proof/

PROOF_SS2L_MC_Main.cxx - runs the code defining proof’s options and controlling the analysis flow.
Here in the vector “Processes” I collect processes I consider for my analysis. A process is defined as a collection of close physics processes and relevant MC samples for each such a process are collected in the vector called “Samples” in the first “for” loop. The second “for” loop is over these samples to run the analysis selection over each such a sample separately and to collect all selected events into one single histogram defined for each process.

PROOF_SS2L_MC_Analysis_v34.C and PROOF_SS2L_MC_Analysis_v34.h are created, as normally, by MakeSelector class adding up some my analysis relevant stuff.

PROOF_SS2L_MC_Analysis_v34.h:
This file in addition contains declarations of some of my variables and histograms along with their initialization to zero.

PROOF_SS2L_MC_Analysis_v34.C:
In SlaveBegin():
-> I pass some relevant info to the analysis (defined in Process());
-> define my histograms and assign them colors depending on the process (MC_ttbar or MC_llX as defined in Process());
-> and add them to the output.
In Process():
-> I have my improvised simple analysis selection;
-> and fill up the histograms.
In Terminate():
-> I add up histograms filled up for each sample belonging to the same process (as defined in PROOF_SS2L_MC_Main()) and
save to the output file (first created in the beginning in PROOF_SS2L_MC_Main()).

What I get in this analysis is what you can see in the output root files
my_output_4Cores_60kEvents.root
my_output_4Cores_6kEvents.root
my_output_AllCores_60kEvents.root
my_output_AllCores_6kEvents.root

As mentioned in the beginning whether the color is passed to the histogram or not depends, as I observe, on
whether I use all cores in the processor or just subset of them and also on the number of events over which I loop for each sample (defined in PROOF_SS2L_MC_Main() in the line “if (Events2Process > 60000) Events2Process = 60000;” )

So I wonder if the problem can be solved and how?

The samples I’m using are available at
eos ls -l /eos/atlas/atlascerngroupdisk/phys-susy/stop2L/v34/ | grep 410009
eos ls -l /eos/atlas/atlascerngroupdisk/phys-susy/stop2L/v34/ | grep 361064
eos ls -l /eos/atlas/atlascerngroupdisk/phys-susy/stop2L/v34/ | grep 361065
eos ls -l /eos/atlas/atlascerngroupdisk/phys-susy/stop2L/v34/ | grep 361066

I’m using ROOT 6.04/02.

let me know, if you need me to copy these samples to somewhere or if you have any questions concerning understanding of my code/problem.

Thank you very much in advance,
Malik

Dear Malik,

I am not sure to understand the problem. The 4 files in the directory have the expected color settings, if I am not wrong. The attached macro dumps the following:

root [0] .x DumpColors.C
Processing ...my_output_4Cores_60kEvents.root
MC_ttbar_mll_elel: fill color is: 2
MC_ttbar_mll_mumu: fill color is: 2
MC_ttbar_mll_elmu: fill color is: 2
MC_llX_mll_elel: fill color is: 7
MC_llX_mll_mumu: fill color is: 7
MC_llX_mll_elmu: fill color is: 7
Processing ...my_output_4Cores_6kEvents.root
MC_ttbar_mll_elel: fill color is: 2
MC_ttbar_mll_mumu: fill color is: 2
MC_ttbar_mll_elmu: fill color is: 2
MC_llX_mll_elel: fill color is: 7
MC_llX_mll_mumu: fill color is: 7
MC_llX_mll_elmu: fill color is: 7
Processing ...my_output_AllCores_60kEvents.root
MC_ttbar_mll_elel: fill color is: 2
MC_ttbar_mll_mumu: fill color is: 2
MC_ttbar_mll_elmu: fill color is: 2
MC_llX_mll_elel: fill color is: 7
MC_llX_mll_mumu: fill color is: 7
MC_llX_mll_elmu: fill color is: 7
Processing ...my_output_AllCores_6kEvents.root
MC_ttbar_mll_elel: fill color is: 2
MC_ttbar_mll_mumu: fill color is: 2
MC_ttbar_mll_elmu: fill color is: 2
MC_llX_mll_elel: fill color is: 7
MC_llX_mll_mumu: fill color is: 7
MC_llX_mll_elmu: fill color is: 7

which correspond to the settings in SlaveBegin.
What is exactly is the problem that you observe?

G Ganis
DumpColors.C (789 Bytes)

Dear Gerardo,

Thank you very much for quick reply!
But if the colours are correctly passed to my output ntuples, why then:

  1. plotting the histograms in TBrowser I see:
    a) for the file my_output_AllCores_6kEvents.root correctly colors for all histograms but one like in the two attached plots, my_output_AllCores_6kEvents_MC_ttbar_mll_mumu.png and my_output_AllCores_6kEvents_MC_llx_mll_elmu.png, and don’t see the color for one plot also attached as my_output_AllCores_6kEvents_MC_llx_mll_mumu.png?
    b) don’t see colors for any histogram in the file my_output_4Cores_6kEvents.root?
    c) For the rest two files what I see is a mixture of the two above cases, i.e. for some histograms I see colors, for some I don’t.

  2. why I can’t use the histograms in the stack plotting on top of each other adding the bins’ contents (as one usually puts MC samples on top of each other for Data-MC comparison)? With these histograms what I get using stacked plotting is just overlaying of the histograms on top of each other (without adding the contents of the bins) and with no color presentation.

Thank you,
Malik






Dear Malik,

What you observe is the typical behaviour of ROOT when you have histograms with error bars. The histos are plotted by default with those bars, and TBrowser uses the default settings.
If you play in a macro with the TH1 drawing options (root.cern.ch/doc/master/classTH … .html#HP01), you should be able to obtain what you want.

Anyhow, that’s not really a PROOF problem and I am not very expert with that. Please redirect your questions or doubts to ‘ROOT support’ folder of this forum .

G Ganis

Dear Gerardo,

ok, I will redirect the question to teh root community, but for me anyway it’s strange, that filling of all the histograms and after plotting all of them in the same way, not only the plotting behaviour in single mode is different for them but in addition I can’t make them to be plotted stacked…
I don’t have this problem, when I don’t use proof, meaning plotting the same histograms in a single or stacked way they behave as expected.

Thanks,
Malik

In case, if anybody is interested to know the solution to the problem, here it is: Problem with passing color to histograms