Filling a 2D Histogram Twice

I am aware that you normally fill a 2D histogram with two variables at the same time with each one going to an axis, but this is a bit awkward for me because of the code I am working with. I basically have something which goes ‘if one condition, fill a 1D histogram, if another condition, fill this 1D histogram’.

Is there a way I can do this same thing but this time I fill one axis of a 2D histogram the first time and then fill the other axis of that same 2D histogram when the other condition applies?

You can define your 2D histogram with one axis keeping your event “code” based on your “condition”. For example, if you have a “condition” which gives two “values” 0 and 1, define one histogram axis as “2, 0., 2.” (2 bins, 0. <= the first bin < 1. and then 1. <= the second bin < 2.). Then you can fill your 2D histogram using your “condition” as one of the histogram’s variables.

Yes, I see how that would work. One other question: let’s say I have a set of jets in an event, I am trying to find jet pairs in the event such that the two jets are close in eta and match them with other pairs which have the same delta eta between them.

Is there a DeltaEta type object in ROOT which can be used to stipulate an eta difference between two jets?

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