We are slowly making progress. Stephane Plaszczynski wrote: > > --On Thursday, September 18, 2003 12:02:44 PM +0200 Rene Brun > <Rene.Brun@cern.ch> wrote: > > > I don't know what you mean by sigma_y? > > If you just want to draw a set of points with eerrors, use TGraphErrors > > TGraphErrors(n,x,y,ex,ey) > > OK. So I guess my question is whether there is an "automated" way of > creating this Graph directly from the ntuple entries (I am used to a tool > that can do it): something like Draw("y:x") but where each point displayed > would have an error bar given by two other ntuple entries "sigmax,sigmay"? > You can do the following nt->Draw("x:y:sigmax","sigmay","goff"); TGraphErrors g(nt->GetSelectedRows(),nt->GetV1(),nt->GetV2(),nt->V3(), nt->GetW()); g.Draw("ap"); see TTree::Draw doc section "How to obtain more info from TTree::Draw" > > > II tried the following unamed script (following your suggestion). It is in > "myscript.C" > I log in interactively to root and type > .x myscript.C > but the ntuple points do not appear.... > You should move the c1->Update() statement immediatly after having drawn the histogram. See change below Rene Brun > I can send you the root file but it is very basic. > > Could it be because I draw a TH1 and try to project a TH2-like onto it? but > why does it work interactively?... > > { > TFile *f = new TFile("wmap_fisher.root"); > TH1 *hfcl = (TH1*)f->Get("hfcl"); > TTree *cl = (TTree*)f->Get("cl"); > > c1 = new TCanvas("c1","plots",600,600); > gPad->SetBottomMargin(0.15); > gPad->SetLeftMargin(0.16); > > hfcl->SetStats(kFALSE); > > //titre > hfcl->SetTitleSize(0.05, "x"); > hfcl->SetTitleOffset(1., "x"); > hfcl->SetTitleSize(0.05, "y"); > hfcl->SetTitleOffset(1.5, "y"); > hfcl->GetXaxis()->SetTitle("l"); > hfcl->GetYaxis()->SetTitle("l(l+1)C_{l}/2#pi (#muK^{2})"); > > hfcl->SetLineStyle(1); > hfcl->SetLineWidth(1); > hfcl->SetLineColor(13); > hfcl->SetFillColor(13); > > hfcl->Draw(); c1->Update(); //<================== > hcl->SetLineColor(16); > > cl->Draw("y:x","","same"); > //////////////////// > > //c1->Update(); //<=====not necessary > } > > ------------------------------------------------------------------- > S. Plaszczynski > Laboratoire de l'accélérateur linéaire tel: 01 64 46 85 38 > Centre d'Orsay- bat 200 fax: 01 64 46 83 97 > BP34- 91989 ORSAY cedex > -------------------------------------------------------------------
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET