RE: [ROOT] RE: tree selection on string variable with special characters

From: Philippe Canal (pcanal@fnal.gov)
Date: Tue Dec 18 2001 - 17:45:24 MET


Hi Rob,

In ROOT 3.03.00 (or the CVS repository) you will also be able to do:

   tree->Scan("tname","strstr(tname,\"L1_EM12_\") && tname[8]==38");

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Philippe Canal
Sent: Tuesday, December 18, 2001 9:38 AM
To: Rob Snihur; roottalk@pcroot.cern.ch; about-root@fnal.gov
Subject: [ROOT] RE: tree selection on string variable with special
characters


Hi Rob,

Currently it is not possible to escape special characters, such as '&'
in a TFormula.  Your best alternative is to use MakeClass or MakeSelector
for the time being.

Cheers,
Philippe.

-----Original Message-----
From: owner-about-root@listserv.fnal.gov
[mailto:owner-about-root@listserv.fnal.gov]On Behalf Of Rob Snihur
Sent: Monday, December 17, 2001 7:17 PM
To: roottalk@pcroot.cern.ch; about-root@fnal.gov
Subject: tree selection on string variable with special characters


Hi,
I am using root 3.01/06 on linux.
I have a root tree with string-type variables.
Some of the strings have special characters, such as '&'.
How can I use these characters in a selection in,
for example, the Draw or Scan commands?
My problems are illustrated below.
Thanks,
-rob



root [15] tree->Scan("tname");
************************
*    Row   *     tname *
************************
*        0 *  L1_EM12_ *
*        1 * L1_EM12_& *
************************
root [16] tree->Scan("tname","tname==\"L1_EM12_\" ");
************************
*    Row   *     tname *
************************
*        0 *  L1_EM12_ *
************************
==> 1 selected entry
root [17] tree->Scan("tname","tname==\"L1_EM12_&\" ");

*ERROR 26 :
 Unknown name : ""L1_EM12_"
root [18] tree->Scan("tname","tname==\"L1_EM12_\&\" ");

*ERROR 26 :
 Unknown name : ""L1_EM12_"
root [19] tree->Scan("tname","strstr(tname,\"L1_EM12_\")");
************************
*    Row   *     tname *
************************
*        0 *  L1_EM12_ *
*        1 * L1_EM12_& *
************************
==> 2 selected entries
root [20] tree->Scan("tname","strstr(tname,\"L1_EM12_&\")");

*ERROR 26 :
 Unknown name : ""L1_EM12_"
root [21] tree->Scan("tname","strstr(tname,\"L1_EM12_\&\")");

*ERROR 26 :
 Unknown name : ""L1_EM12_"



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:12 MET