Accessing branches with different entries

Dear all,
I am trying to access TTree data i obtained from Madgraph(total entries: 1000000) for my masters project.

It contains 3 branches, the branch i need is the ‘Particle’ one(total entries: 4991948), which has different sub branches : Particle.PT, Particle.Eta and so on…

I tried using TTree->Draw(“Particle.Pt”,“Particle.PID==11”) for electron case; on terminal; which works…
But i want to perform different operations on the particle data to obtain invariant mass after applying different cuts…

I tried using MakeClass function that gave me LHEF.h and LHEF.C files; after reading them i got names and branches that are defined in ‘fchain’…
I tried to edit the LHEF.C file in order to extract all the sub-branches of ‘Particle’ branch but i think I’m missing some elements…
The ‘tree’ i obtained from Madgraph stores the particle data in form of an array of 5 dimensions.
I tried using TClonesArray but i couldn’t properly grasp its mechanism…

An example of how to properly extract those sub-branches would help a lot.

Thanks in advance,
Dharmender

LHEF.h (9.9 KB)
LHEF.C (2.2 KB)

Instead of:

       if (Particle_PT(ientry) >20) continue;
h->Fill(Particle_PT(ientry));

try:

      for (Int_t i = 0; i < Particle_; i++) {
         if (Particle_PT[i] > 20.) continue;
         h->Fill(Particle_PT[i]);
      }

Thanks for the quick reply, I tried to do that but the Canvas comes out blank…
Here’s the tree outlook and the updated code :


LHEF.C (2.3 KB)

Try with: TH1D *h1 = new TH1D("h1", "", 100, 0., 0.); // automatic bins

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