RE: [ROOT] TTree::Scan Distinct-option

From: Rene Brun (brun@pcbrun.cern.ch)
Date: Mon Jun 28 2004 - 19:50:28 MEST


Bernd,

To complement Philippe's mail, when you want to make correlations
between different variables of different entries, use the
arrays generated by TTree::Draw and available via TTree::GetV1, V2, V3, 
V4 and W
see doc of TTree::Draw
see also TTree::GetMaximum/GetMinimum.
To get mean/std of a variable, it is simpler to generate
a histogram and use TH1::GetMean, GetRMS, GetEntries, etc.

Rene Brun

On Mon, 
28 Jun 2004, Philippe Canal wrote:

> > 2. Is there something like a "LIKE"-function for the selector in
> > TTree::Draw? 
> 
> You can could 'strstr' from a TTreeFormula (i.e from draw and scan).
> For example:
> 	tree->Draw("...","strstr(column1,\"AB\")");
> However this is equivalent to "column1 like \"%AB%\")
> 
> > 1. TTree::Scan("column1"); returns me all values of column1. Is there an
> > option "DISTINCT", which returns each value in column1 exactly once?
> > 3. Is there a GROUP BY-clause (along with some basic aggregate-functions:
> > avg, std, min, max, count), when you think of the selector as the
> > WHERE-clause?
> 
> Neither are available because TTree::Draw and TTree::Scan works on entry by
> entry basis.
> 
> Cheers,
> Philippe.
> 
> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
> [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Bernd Reinhold
> Sent: Monday, June 28, 2004 6:50 AM
> To: roottalk@pcroot.cern.ch
> Subject: [ROOT] TTree::Scan Distinct-option
> 
> 
> Hi!
> 
> I'm filling a TTree from a SQL-recordset. This made me wonder, if there are
> some options in TTree, that exist in SQL:
> 1. TTree::Scan("column1"); returns me all values of column1. Is there an
> option "DISTINCT", which returns each value in column1 exactly once?
> 2. Is there something like a "LIKE"-function for the selector in
> TTree::Draw? If column1 is of type C-string. Then I might want to have all
> the entries, whose column1 starts with "AB". In SQL one could use something
> like: "column1 like \"AB%\"" Is something like that possible in a
> TTree-selector
> 3. Is there a GROUP BY-clause (along with some basic aggregate-functions:
> avg, std, min, max, count), when you think of the selector as the
> WHERE-clause?
> 
> Thank you,
> 
> Bernd.
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET