It’s my first couple of days using ROOT.
I’ve been instructed to make a histogram (I think it’s a histogram), make a gaussian fit to a peak, and then integrate it to get a value.
Here’s what I’ve tried:
TFile* f = new TFile(“file_name”)
TTree* tree = (TTree*)f->Get(“r”)
tree->Draw(“fadc_channel:ftimestamp>>hist”,"",“colz”)
Doing that gives me this histogram:
However, what I’m looking for is something more like this:https://imgur.com/JfL1eYw, which I can see in the browser but not reach programatically. The second picture looks more like something I can curve fit and integrate over. How can I get there?

Can you explain what gROOT->cd(); does? When I run this histogram creation code on multiple files, every histogram past the first is blank, and if I delete this line, all histograms are blank, leading me to believe that this line changes something thatI need to “reset” between files

I got it:
This screenshot shows that it’s stuck in the last file’s directory for some reason, so the hist is made there so when I use gROOT-> cd, the hist isn’t there. I just added a gROOT->cd at the beginning too so that the hist would be guaranteed to be made there.

The data is there (nonzero) and can be seen in TBrowser, the problem, at least in my observations, was that the histogram wasn’t in the right place to be fit to. I fixed the problem by putting gROOT->cd a the beginning of the histogram macro