I have a ROOT file with a number of histograms. I want to run analysis code that can read information from these histograms. However when I run these commands I get an error:
TFile* f = TFile::Open(“epKpKm_IN.root”)
TH1F* h = (TH1F*)f->Get(“RunNum”)
h->Draw()
RunNum is the title of the histogram, but the name of the histogram that shows above the statistics box is htemp. I don’t know if that is the name I should be using instead.
Thank you for your response. However, I am not sure this is the answer I am looking for. Won’t this command just list the contents of the file? I want to be able to work with the histograms; for example, I want to get the maximum bin of one of the histograms using h->GetMaximumBin();
You will see the names (and types) of histograms (and other objects) available in your file. You can then “Get” them and perform any actions on them you want.