From 6d786276781bedf62e477da1f005b9c7fb0d2fc5 Mon Sep 17 00:00:00 2001
From: Rene Brun <Rene.Brun@cern.ch>
Date: Tue, 25 Jan 2005 22:14:16 +0000
Subject: [PATCH] From Philippe: This patch insures that TFormula does modify
 the 'strings' that are embedded in an expression.

git-svn-id: http://root.cern.ch/svn/root/trunk@10985 27541ba8-7e3a-0410-8455-c3a389f83636
---
 hist/src/TFormula.cxx | 5 ++++-
 test/dt_DrawTest.C    | 1 +
 test/dt_MakeRef.C     | 4 ++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/hist/src/TFormula.cxx b/hist/src/TFormula.cxx
index e47905d7774..3086737854a 100644
--- a/hist/src/TFormula.cxx
+++ b/hist/src/TFormula.cxx
@@ -1,4 +1,4 @@
-// @(#)root/hist:$Name:  $:$Id: TFormula.cxx,v 1.81 2004/09/01 10:20:11 brun Exp $
+// @(#)root/hist:$Name:  $:$Id: TFormula.cxx,v 1.82 2005/01/19 17:00:07 rdm Exp $
 // Author: Nicolas Brun   19/08/95
 
 /*************************************************************************
@@ -1938,8 +1938,11 @@ Int_t TFormula::Compile(const char *expression)
 
 //*-*- Substitution of some operators to C++ style
 //*-*  ===========================================
+  bool inString = false;
   for (i=1; i<=chaine.Length(); i++) {
     lc =chaine.Length();
+    if (chaine(i-1,1) == "\"") inString = !inString;
+    if (inString) continue;
     if (chaine(i-1,2) == "**") {
        chaine = chaine(0,i-1) + "^" + chaine(i+1,lc-i-1);
        i=0;
diff --git a/test/dt_DrawTest.C b/test/dt_DrawTest.C
index f821c7c03a8..e0d6e284fd0 100644
--- a/test/dt_DrawTest.C
+++ b/test/dt_DrawTest.C
@@ -143,6 +143,7 @@ TDirectory* GenerateDrawHist(TTree *tree,int level = 2, int quietLevel = 0)
    DrawSkippable(tree,"fEvtHdr.fEvtNum","1 && strstr(fType,\"1\") ","+hString",(level>0));
    tree->SetAlias("typ","fType");
    DrawSkippable(tree,"strstr(typ,\"1\") ", "hAliasStr", 1);
+   DrawSkippable(tree,"fH.fTitle.fData==\"Event Histogram\"","hStringSpace",1);
 
    // Test binary operators
    DrawSkippable(tree,"fValid<<4","hShiftValid",(level>0));
diff --git a/test/dt_MakeRef.C b/test/dt_MakeRef.C
index 3f1fc9018af..99db796d91c 100644
--- a/test/dt_MakeRef.C
+++ b/test/dt_MakeRef.C
@@ -99,6 +99,7 @@ void MakeHisto(TTree *tree, TDirectory* To) {
    TH1F *refAndValid = RefClone(where,"hAndValid");
 
    TH1F *refString = RefClone(where,"hString");
+   TH1F *refStringSpace = RefClone(where,"hStringSpace");
    TH1F *refAliasStr = RefClone(where,"hAliasStr");
 
    TH1F *refPxBx = RefClone(where,"hPxBx");
@@ -148,6 +149,9 @@ void MakeHisto(TTree *tree, TDirectory* To) {
       if (strstr(event->GetType(),"1")) {
         refString->Fill(event->GetHeader()->GetEvtNum());
       }
+      if (strcmp("Event Histogram",event->GetHistogram()->GetTitle())==0) {
+         refStringSpace->Fill(1);
+      }
       refAliasStr->Fill(strstr(event->GetType(),"1")!=0);
       refBool->Fill(event->IsValid());
 
-- 
GitLab