Number of Particles in an Entry

This question might seem really dumb, but here goes:

I have a dataset from a delphes output with the final product being muons. However, I’m not sure how many muons actually were created. I’ve been looking through the documentation as well as I could (I’m not too good at it) but I couldn’t find anything like a variable or method that returns how many particles are in each event/entry of a collision. Does anyone have any ideas what I could do?

The following is what I have right now, but the three should be replaced with something that actually shows the right number of particles in each entry.

for i in range(numEvents):
    entry = tree.GetEntry(i)
    collision = SimCol()
    for a in range(3):
        pt = tree.GetLeaf("Muon.PT").GetValue(a)
        eta = tree.GetLeaf("Muon.Eta").GetValue(a)
        phi = tree.GetLeaf("Muon.Phi").GetValue(a)
        collision.muons[-1].SetPtEtaPhiM(pt, eta, phi, 0.1)

ROOT Version: 6.26

Print the tree structure (tree.Print()) and see if there’s any “number of muons” (or whatever you want) branch/leaf. If not, you have to figure out how to count them --maybe make a histogram with the ones you want and get the number of entries (histo.GetEntries()), or just make a counter in the code.
I don’t know delphes, but searching the web there’s this:

1 Like

Thanks! Sorry for the late reply, but how would I properly fill the histogram with all the muons? I feel like that rests on me actually knowing how many muons there are. As for when I printed the structure, it said there were 21 “baskets” in each Muon branch.

*Br  362 :Muon.PT   : Float_t PT[Muon_]                                      *
*Entries :    10000 : Total  Size=     109968 bytes  File Size  =      80865 *
*Baskets :       21 : Basket Size=      16384 bytes  Compression=   1.35     *

I know there are 10,000 entries because that’s how many collisions I set in the delphes run card, but I still don’t see anything telling me how many muons are actually produced in each entry.

That’s telling you PT is an array of Float_t with size Muon_, so there’s probably another branch called Muon_ which tells you how many per entry.

Well the MuonPT parent directory is just the following branch:

*Br  359 :Muon      : Int_t Muon_                                            *
*Entries :    10000 : Total  Size=      97713 bytes  File Size  =      21914 *
*Baskets :       21 : Basket Size=      64000 bytes  Compression=   3.73     *

Is there something else I should be looking for?

Just a bump, still need some help trying to figure this out.