Hi Malcom, If your branch contains strings (declared as name/C), then you can use the C function strstr in your cut. Example T->Draw(""rms","strstr(field,\"field_cut\")") More operators could be introduced to support the search functions in TString or C++ string. Rene Brun Malcolm Davidson wrote: > > Content-Type: text/plain; charset=us-ascii > Content-Transfer-Encoding: 7bit > > Hi Rene, > > Thanks for your reply but I'm afraid I didn't express the root of the problem clearly. > > What I actually wanted to ask is whether a cut could be made with the draw command > > using a branch containing strings. As an example: > > I have a tree T containing two branches one labelled "rms" and contaning floats and the other > > labeled "field" and containing strings, then it would be nice to be able to plot a histogram of > > all values having field == "Field1" with the commands > > TString field_cut = "Field1" > > T->Draw("rms","field == field_cut"); > > Even better of course would be the ability to use REGEXPs :) but I would be happy if the first > > case was already implemented. > > Kind regards > > Malcolm > > >Hi Malcom, > >There are two TTree::Draw functions: > > >Draw(const char* varexp, TCut selection, Option_t* option, ... > > Draw(const char* varexp, const char* selection, Option_t* option,...) > > >What you request with TString is implemented with TCut. > > >Rene Brun > > Malcolm Davidson wrote: > > > > Hello, > > > > I was wondering if the selection based on TStrings for the TTree->Draw() > > command had been implemented yet (based on my attempts not) or whether > > this useful feature (here I'm quoting from a 1999 email from Rene Brun) > > will soon be added ? > > > > Many thanks in advance > > > > Malcolm > > <>------------------------------------------------<> > > Malcolm W. J. Davidson > > > > Centre D'Etudes Spatiales de la Biosphere (CESBIO) > > UMR 5639 CNES-CNRS-UPS > > 18, Avenue Edouard Belin > > F-31401 Toulouse Cedex 4 > > FRANCE > > > > e-mail : davidson@cesbio.cnes.fr > > phone (33)(0)5.61.55.85.84 > > fax (33)(0)5.61.55.85.00 > > <>------------------------------------------------<>
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET