Possible issue with TTree Draw?

Hello All,

I have been analyzing a rather large file (~6 Gb, 57m events) that consists of a TTree.
Inside, I have some int’s, some bool’s, and also some std::vectors.

Now, I do most of my analysis inside an event loop in code so I did not run into this problem until recently. I needed to check something really quick (number of triggers fired), so I did a quick Draw on my tree. For reference, I provide a segment of the tree structure.

*............................................................................*
*Br   31 :passed_HLT_mb_sptrk_L1MBTS_1 : passed_HLT_mb_sptrk_L1MBTS_1/O      *
*Entries : 57277967 : Total  Size=   61428237 bytes  File Size  =   13081503 *
*Baskets :    36086 : Basket Size=      32000 bytes  Compression=   4.64     *
*............................................................................*
*Br   32 :prescale_HLT_mb_sptrk_L1MBTS_1 : prescale_HLT_mb_sptrk_L1MBTS_1/F  *
*Entries : 57277967 : Total  Size=  233334324 bytes  File Size  =   19137777 *
*Baskets :    36086 : Basket Size=      32000 bytes  Compression=  12.15     *
*............................................................................*

When I draw passed_HLT_mb_sptrk_L1MBTS_1, which is just a bool, I see a histogram with two bins, 0->1 and 1->2. I see the number of entries is 5.72780e+07, which is fine. However, the integral of that histogram is 2.26782e+07. This can’t be right. However, when I draw the prescale_HLT_mb_sptrk_L1MBTS_1, I get 5.72780e+07 for the integral and number of entries. Note how the prescale_HLT_mb_sptrk_L1MBTS_1 variable has higher compression than the passed_HLT_mb_sptrk_L1MBTS_1 one.

Now, when I try to Draw the passed_HLT_mb_sptrk_L1MBTS_1 for 15M events, it works fine. Number of entries is 15M, and integral is 15M. Whene I draw 20M events, number of entries is 20M, but integral is 1.92218e+07. Now, what if there is something wrong in memory somewhere between 19M and 20M event. Ok… I draw 15M from the 5M event. This should cover the same as drawing 20M from 0. When I do this, there is no problem. Integral is 15M and number of entries is 15M.

Now, I have some other variables (note the compression).

*............................................................................*
*Br    1 :LBN       : LBN/I                                                  *
*Entries : 57277967 : Total  Size=  232359894 bytes  File Size  =    4988100 *
*Baskets :    36086 : Basket Size=      32000 bytes  Compression=  46.44     *
*............................................................................*
*Br    2 :runNumber : runNumber/I                                            *
*Entries : 57277967 : Total  Size=  232576434 bytes  File Size  =    5275057 *
*Baskets :    36086 : Basket Size=      32000 bytes  Compression=  43.95     *
*............................................................................*

When I do draw on these, for some reason, the LBN has Integral = Number of Events.
However, the integral of the histogram after drawing runNumber gives me 5.44075e+07. This is close, but not 57M.

Why do some of these variables get filled correctly and some don’t? Also, why does it work below ~19M but not with 20M+ events? I do not have this problem with another file with ~8M events and size ~3Gb. Also, I do not have this problem filling my own histograms in an event loop. Also, I tried this on a couple different computers both with Root5 and Root6.

I usually only use tree->Draw() to do some quick things so this does not cause a problem for me, but I am curious why this isnt working. Hope someone can explain this to me.

Cheers,

-Yakov

I am not sure it will solve your problem but may be you need to call SetEstimate ?

Could you provide access to your ROOT file so that we can investigate what is going on?

Thanks,
Philippe.

Hello Oliver,

I tried to call SetEstimate(-1) and SetEstimate(25e6) and ran over the whole tree and also 25e6 events, still same result. Integral() !- GetEntries().

-Yakov

Hello Philippe,

How is it best to do this? The file is 6Gb.

-Yakov

Any website where I can download it from or if you have access to shared resource at FNAL or CERN, you could leave it there (for example in /var/tmp of one the lxplus node).

Cheers,
Philippe.

Hello Philippe, it is in /var/tmp/ykulinic. Specifically, /var/tmp/ykulinic/pPb.root

Cheers,

-Yakov

Without looking at the file: are you drawing TH1Fs? That largest float where f < f+1.f is 16777216. Thus you should probably be using TH1Ds.

(by the way: double-clicking in the browser creates TH1Fs, so I recommend to patch TSelectorDraw.cxx to create TH1D "htemp"s when you have files with >16M events)

1 Like

@behrenhoff is likely right. In which case you will need to specify the histogram

TH1D * h = new TH1D("histo", .....);
tree->Draw("...>>histo" ....);

it is in /var/tmp/ykulinic. Specifically, /var/tmp/ykulinic/pPb.root

On which node(name)?

Cheers,
Philippe.

@behrenhoff, that is a very good point. I usually do everything in a loop and all my local histograms are TH1D so I did not realize this. So by default Draw() puts things into a TH1F. Doing what @pcanal suggested works just fine.

I put the file in on lxplus0050. It makes sense why when I drew runNumber it only had 54M. One of the runs had > 16777216 events and it got “cut” off there. For LBN, there was more spread among the bins so no bin content came clsoe to 1.6e7.

Good thing to keep in mind! Thanks!

-Yakov

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