Hello ROOT experts,
I am trying to read a tree “reco” from a file.root.
I am using the script beneath:
#include "TFile.h
#include "TH1F.h
#include "TTreeReader.h
#include "TTreeReaderValue.h
{
TH1F *h1 = new TH1F(“h1”, “h1 title”, 1000, -100, 100);
TFile *myFile = TFile::Open("$ROOTSYS/macros/crazy.10.root");
TTreeReader reader(“reco”, &myfile);
TTreeReaderValue<Float_t> llratio(reader, “llratio”);
TTreeReaderValue<Float_t> llratioE(reader, “llratioE”);
TTreeReaderValue<Float_t> enew(reader, “enew”);
TH1F *hpx = new TH1F(“hpx”,“px distribution”,100,-3,3);
TH2F *hpxpy = new TH2F(“hpxpy”,“py vs px”,30,-3,3,30,-3,3);
while (reader.Next()) {
h1->Fill(*enew + *llratio);
}
h1->Draw();
}
But root isn’t drawing the histogram. What am I doing wrong? :\