Hi,
Thank you for the quick reply. I have changed it
and it works. Now I tried to do a gaussian fitting and
get the Mean value for the fit. When I do it as shown
below, it gives me the Mean value of the histo before
the fitting. It does not give the Mean value of
fitting. How can I get this fixed?
Thanks,
Ginn
I use RH 8.0 and ROOT 3.05
================= Program ===================
{
Double_t ave;
Int_t i;
TFile f("mpeak.root");
TH1F *h2= new TH1F("h2","",50,0.,1000);
gStyle->SetOptFit();
for( i=6480; i<6500; i++){
ntuple->Draw("bpul>>h2",Form("btub==55611&&ctub==%d",i);
h2->Fit("gaus","R","same",0.,1000);
ave = h2->GetMean();
cout<<" average : "<<ave<<endl;
}
}
--- Rene Brun <brun@pcbrun.cern.ch> wrote:
> Hi,
>
> Replace the line:
>
> ntuple->Draw("bpul>>h2","btub==55611&&ctub==i");
> by
>
>
ntuple->Draw("bpul>>h2",Form("btub==55611&&ctub==%d",i));
>
> Rene Brun
>
> On Wed, 27 Aug 2003,
> ginn gin wrote:
>
> > Hi,
> > I need to open a root file and look for
> histograms
> > and get the mean value of each histogram. One of
> the
> > cut is each time changing. I need to put this as i
> and
> > initialize i in a for loop. Then i is the one of
> the
> > value in ntuple->Draw(.....). When I gave ctub ==
> 6480
> > without for loop it works. With the for loop i
> need to
> > give values for i= 6480,6481 etc. If I run
> following
> > it complains about i. How can I get this fixed.
> Any
> > hint or help is appreciated.
> >
> > Thank you,
> > gin
> > =========Here is the program and what is wrong ===
> >
> > {
> > Double_t ave;
> > Int_t i;
> >
> > TFile f("mpeak.root");
> > TH1F *h2= new TH1F("h2","",50,0.,1000);
> >
> > for( i=6480; i<6500; i++){
> >
> ntuple->Draw("bpul>>h2","btub==55611&&ctub==i");
> > ave = h2->GetMean();
> > cout<<" average : "<<ave<<endl;
> > }
> > }
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> > http://sitebuilder.yahoo.com
> >
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET