Accessing Delphes Tree leaf variables without delphes installation

Hi,
I have a Delphes style tree in which there are branches with leaves that appear to be arrays of their own right. I would like to access the leaf variables using a TChain, but can not figure out how to do so.

Here is the structure of the tree:

And here is my code attempting to access a leaf using the TChain:

TChain chain("Delphes");
chain.AddFile("qcd_sqrtshatTeV_13TeV_PU20_1.root"); 
int size=-1, eventNumber=-1; 
chain.SetBranchAddress("Jet_size", &size);
chain.SetBranchAddress("Event.Number", &eventNumber);

int i = 123; // random number for testing
chain.GetEvent(i)
cout << size << endl;
cout << eventNumber << endl; 

When running this code, with any event, I am able to get the size branch for the ith event, but the eventNumber is always -1.

Hi,

I propose to use RDataFrame to analyse this dataset.

ROOT::RDataFrame rdf("Delphes", "qcd_sqrtshatTeV_13TeV_PU20_1.root");
h = rdf.Histo1D("Jet_size") //for example!
hfiltered = rdf.Filter("Event.Number % 2 == 0").Histo1D("Jet_size") //for example!
h->Draw();
hfiltered->Draw("Same");

Cheers,
D

1 Like

Hi Danilo,
Thank you very much for your response. Unfortunately I need to do more with the data than filtering it; I will have many data components which in turn create compound variables, etc, while looping through each event.

How exactly could you use the RDataFrame to access directly the value for Event.Number, on an event by event basis?

Thanks!
Luc

See also the result of MakeSelector to facilitate access.

Cheers,
Philippe.

Ps. to make you original example work you can also use chain.SetMakeClass(1);