Avoiding Over-counting when Filling Histograms Multiple Times

I am studying multiple jet combinations from the same set of events, call them A, B and C (so, for example, A is where you plot invariant mass of jets 1 and 2 on one axis and invariant mass of jets of 3 and 4 on the other axis of a 2D histogram).

I then count the number of events where A is in a particular mass range just by filling a histogram and imposing relevant selection, then fill again to find the number of times B is in the same range and again for C. The issue is that the total number of events in the histogram is then too large, as I only want to count the number of events where 1 or more combinations are in the range and don’t want to count the same event twice if combinations A and B both meet the criteria in the same event. Is there some way of counting or filling the histogram with the number of entries such that A or B or C meet the criterion without over-counting if A or B both meet the criterion.

One way which occurs is to count or ask the histogram to fill if A meets the criterion and/or B and/or C, but I am not sure if you can do an and/or condition of this kind.

I do not know the structure of your program but seems to me the logic of filling or not the histogram should be done before calling the Fill method.
You would like the Fill method does the job ?

Not to worry, I’ve found a way to do it now.

1 Like

From the description that you give, it seems to me that you need to apply “weights” when you fill your histograms (on an event-by-event basis, i.e. different “weights” for different events). Something like “weight = 1. / number_of_repetitions” would be fine (but note that you need to calculate the “number_of_repetitions” before you actually fill the histogram with this event).

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