Re: TTree::Draw("???")

Rene Brun (Rene.Brun@cern.ch)
Mon, 05 Jan 1998 17:16:42 +0100


William J. Deninger wrote:

> Hello,
>
> How do I Draw a "Run_number" histogram in a TTree if I have used the
> following to book it? Is there a way similar to TNtuple, that being without
> needing to write a bunch of code to sort through the tree and book into a
> hist?
>
> class Event: public TObject
> {
> EventHeader header;
> ......
> }
> class EventHeader : public TObject
> {
> UInt_t Run_number;
> ......
> }
>
> {
> Event *event = new Event;
> TTree *t = new TTree("tree","example tree");
> tree->Branch("event","Event",&event,32000,0);
> for (Int_t i=0; i<100; i++)
> {
> event->Run_number = i;
> t->Fill();
> }
> }

In an interactive Root session, simply do:
Root > tree->Draw("Run_number")

I also suggest, you look at the URL:
http://root.cern.ch/root/HowtoReadTree.html

Rene Brun