Automatically getting mean and sigma

Hi all,

I am new to root and still trying to learn the syntax. Thus I imagine this question is very simple:

I am taking a tree file and fitting a Gaussian to it, and I have to get the mean and sigma from that Gaussian (sometimes there are multiple peaks in the histogram). Right now now I am oping the file and drawing it and finding the mean and sigma on the canvas but it’s evidently very tedious. How do I automate this?

TFile *f = new TFile("tree01334.root);
Output->Draw(“det.TIC15>>(1000,0,1000)”);

Hi,

You can interrogate the histogram produced by TTree::Draw programatically:TFile *f = new TFile("tree01334.root); Output->Draw("det.TIC15>>(1000,0,1000)"); TH1F *htemp = (TH1F*)gROOT->FindObject("htemp"); if(htemp) htemp->GetMean();

Cheers,
Philippe.