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

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


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