I’ve got myself in to an unfortunate predicament! (again!)
I have spent a lot of time preparing some root TTrees from CMS data. Here’s a simplified description of my problem:
I have a TTree which contains energy, eta and phi values from all particles over many events (let’s say 1000 events for now). As I looped through the events, I checked if any RecHit are greater than my energy threshold. If so, I flag the event as a pass, (EvtPass=1). Otherwise it is ‘0’.
The EvtPass status is written to my TTree at the end of that event loop, along with the arrays of energy, eta and phi.
What I need to do now (totally unforeseen!) is to find how many ‘EvtPass’ were flagged as ‘1’ due to energy>threshold in a particular eta and phi range, and only within that range (I am trying to remove the influence of a hot tower from my data).
If I look at the number of EvtPass with no special cuts,
I get something like 800.
If I try to find how many EvtPass==1 which include the unwanted eta and phi values,
T->Draw(“EvtPass”,“EvtPass==1 & eta==X & phi==Y”)
I get a larger number (~3000). I think I am counting each ‘EvtPass==1’ multiple times. How many times I count it is related to the number of times the hot tower, addressed by eta and phi, fired within that event.
Is there some kind of ‘unique’ command to prevent the multiple counting of my EvtPass, or way of getting around this problem? I know Root is very deep and have yet to come across something that it can’t do… if you know the commands or how to find them. I’m hoping that is the case here!
I am on the verge of modifying my analyzer code and running everything again but if anyone has any suggestions, I’d be very grateful to hear them.