Hi Arnd,
Yes, this is possible and documented in TTree::Draw.
Below, you will find the part of the doc corresponding to your request:
Rene Brun
How to obtain more info from TTree::Draw
========================================
Once TTree::Draw has been called, it is possible to access useful
information still stored in the TTree object via the following functions:
-GetSelectedRows() // return the number of entries accepted by the
//selection expression. In case where no selection
//was specified, returns the number of
entries processed.
-GetV1() //returns a pointer to the float array of V1
-GetV2() //returns a pointer to the float array of V2
-GetV3() //returns a pointer to the float array of V3
-GetW() //returns a pointer to the double array of Weights
//where weight equal the result of the
selection expression.
where V1,V2,V3 correspond to the expressions in
TTree::Draw("V1:V2:V3",selection);
Example:
Root > ntuple->Draw("py:px","pz>4");
Root > TGraph *gr = new TGraph(ntuple->GetSelectedRows(),
ntuple->GetV2(), ntuple->GetV1());
Root > gr->Draw("ap"); //draw graph in current pad
creates a TGraph object with a number of points corresponding to the
number of entries selected by the expression "pz>4", the x points of
the graph being the px values of the Tree and the y points the py
values.
Important note: By default TTree::Draw creates the arrays obtained
with GetV1, GetV2, GetV3, GetW with a length corresponding to the
parameter fEstimate. By default fEstimate=10000 and can be modified
via TTree::SetEstimate. A possible recipee is to do
tree->SetEstimate(tree->GetEntries());
You must call SetEstimate if the expected number of selected rows
is greater than 10000.
You can use the option "goff" to turn off the graphics output
of TTree::Draw in the above example.
"Arnd E. Specka" wrote:
>
> It's probably trivial and I apologize in advance for asking
> such a stupid question:
>
> I would like to plot two variables in a RooT Tree one against the other
> but NOT as a 2D (or profile) histogram, but rather as a TGraph (or
> something of this kind) . The point is that I do not want my data points
> end up in a binned distribution.
>
> As an application where this need may arise just imagine a plot like
> temperature v/s time where temperature is measured at irregular
> intervals and recorded in a tree together with a time stamp. Is there
> a way to do it simply (i.e. not looping over the tree and filling C
> arrays and making a TGraph out of them) ?
>
> Arnd
>
> ________________________________________________________
> Arnd E. Specka E-mail: specka@poly.in2p3.fr
> * DESY Hamburg, H1 +49 40 8998 2034 (Fax:4385)
> * Ecole Polytechnique, LLR +33 1 6933 3173 (Fax:3002)
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET