TTree pointer initialization

I was given a root file WZmc.root with data produced using MadGraph and Delphes. I want to use the MakeClass function but first I need to read the root file. To do so I typed:

TFile f (“WZmc.root”);
TTree* t;

But when tried any further step I get null pointer error so I tried to initialize the t TTree pointer by typing:

TTree *t = new TTree(“t”,“staff data from ascii file”);

instead of just TTree* t;
I dont get error but its not working properly since my t TTree is emply when I Scan() it.
Please I need some help on how to do this properly.
P.S. when I was learning about trees I had created some very simple ones which I would read by creating a null TTree pointe (as I tried now at first place) with no errors, so I dont;t know what happed this time.
Thanks for helping me.
WZmc.root (1.9 MB)

The tree’s name inside the file is “tree”, not “t”, so you need to do:

1 Like