TTree plotting histogram with error bars

ROOTers

If I have stored some data in a tree that contains the following leaves:
–a name str
–a value
–an error associated to the value

[code]void sample(){

char str[16];
float value=0;
float error=0;

TTree *tr = new TTree(“test”, “test”);
tr->Branch(“str”,str,“str/C”);
tr->Branch(“value”, &value, “value/F”);
tr->Branch(“error”, &error, “error/F”);

sprintf(str,“entry1”);
value=5;
error=0.1;
tr->Fill();
sprintf(str,“entry2”);
value=6;
error=0.7;
tr->Fill();
sprintf(str,“entry3”);
value=7;
error=1.0;
tr->Fill();

tr->Draw(“value:str>>my_histo_no_erros”,"","*");
}[/code]

Is it possible to associate the error leaf to the histogram so when I call TTree:Draw() it draws also the value’s associated error? How could I do this?

Thank you,

A Tree is not designed for this type of query. You better fill a TGraphErrors directly.
However you can still do something like:

root > tr->Draw("str>>hvalue","value","goff"); root > tr->Draw("str","sqrt(error)","goff"); root > hvalue->SetError(tr->GetW()); root > hvalue->Draw();
Rene