Trouble selecting events from a tree and filling histograms

Hi Lorenzo,
I have been working with the same data file that I sent you before. This
time I need to select the events which has a proper signal and fill and fit
only those corresponding histograms. In my code I have nested for loops for
creating,filling and fitting histograms. If you look at my data file, there
is a variable named adc1,adc2…adc12. These are the integral values for
the adc distribution. I need to select the events for which the adc1>6000.
I have put this condition right before filling the histograms in my code.
So that the events for which the above condition is satified could be
selected and the filling of histograms could be done accordingly. But my
code is saving histograms which has no entries as well. I mean its not
saving the specific histograms for which the above condition is valid.
Instead it is saving all histograms. How do I modify my code so that only
those histograms are saved for which the adc1>6000 is satisfied. Please

timewalk2bset2.h (6.11 KB)
timewalk2bset2.C (6.59 KB)