Using ROOT 3.05/02 on Red Hat Linux 8.0 with
gcc version 3.2 20020903 (Dell laptop C840).
After executing the root macro example below, my problem
is trying to Draw("A.B")
root [2] T->Draw("A")
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
root [3] T->Draw("A.B")
*ERROR 26 :
Unknown name : "A.B"
I think the reason for this is that in
TTreeFormula::DefinedVariable(TString &name)
at line 1787 there is a check
if (cname[i] == '.' || cname[i] == '[' || cname[i] == '\0' ) {
// A delimiter happened let's see if what we have seen
// so far does point to a leaf.
and then it proceeds to corrupt the string "A.B".
I can make it work by eliminating the check for '.'
Incidentally, for an older version of ROOT (3.02/06)
the T->Draw("A.B") draws something, but it is the
same data as T->Draw("A"), which is wrong since "A" is
connected to arr1 and "A.B" to arr2. I don't want to
worry about old ROOT versions, but I offer this info to
hint at what has changed.
Another point: T->Draw("X.B") works fine (for any
version of ROOT I tried).
Now, my questions: Is this a bug in TTreeFormula, or should
I be doing something else ? Perhaps my choice of variable
names ("A" and "A.B") is poor and should be avoided ?
{ // This example script illustrates my problem
mytree = new TTree("T","My Tree");
Int_t ndat = 50;
Double_t *arr1 = new Double_t[ndat];
Double_t *arr2 = new Double_t[ndat];
mytree->Branch("ndata",&ndat,"ndat/I");
mytree->Branch("A",arr1,"arr1[ndat]/D");
mytree->Branch("A.B",arr2,"arr2[ndat]/D");
mytree->Branch("X.B",arr2,"arr2[ndat]/D");
for (Int_t iev = 0; iev < 100; iev++) {
for (Int_t i = 0; i < ndat; i++) {
arr1[i] = (Double_t) (i + 100*iev);
arr2[i] = 2*arr1[i];
}
mytree->Fill();
}
}
Thanks a bunch for reading this LONG inquiry !
------------------------------------------------------
Robert W. Michaels
www.jlab.org/~rom
Thomas Jefferson National Accelerator Facility
12000 Jefferson Ave, Newport News, VA 23606 USA
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET