Filling histograms in a loop

Greetings,

I have two set histograms which have similar properties so I defined them as an array and declared them in a loop. This has worked out fine, however now when I try to fill them I am getting empty histograms back. I have checked and there is data to be filled so I assume my problem is with the array. I have included my declarations and filling code in the attached text file. Does anyone have any suggestions?

Brian
pleasehelp.txt (1.63 KB)

Hi,
excitE is never set, and thus the Fill methods are never called.
Axel.

I am sorry I was not more clear. I only included part of the code (it is 1000+ lines). excitE is set earlier in the code and has worked in previous iterations of this project. I have also run diagnostics to make sure the code is getting inside the if statements.

Brian

Hi Brian,

The portion of code you sent seems alright but we do not have enough of it to really decipher the end result.

You mentioned:

What you should do (and maybe already have (partially?) done) is to check that:
[ul]the code is run
the histogram pointer has the value you expect and the name you expect
the value passed to Fill is the value you expect
When you see that “I am getting empty histograms”, check that the value of the pointer are the same as previously
Make sure that there is not open file that is closed before looking at the histo (check hist->GetDirectory() in the fill loop).
[/ul]
Cheers,
Philippe.