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 >
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET