Hi Robert,
The keywords "left" and "right" are manipulators used by C++ iostream
see: http://www.cplusplus.com/ref/iostream/ios_base/_internal_left_right.html
Rene Brun
Robert Michaels wrote:
>
> Using ROOT 3.10/02 compiled with gcc 3.2.3 on a RHEL 3WS.
> The following example illustrates my problem. It is minor
> but I am wondering why this occured for this newer version
> of root ? For some earlier versions of root it was not a
> problem. Is it a new bug ?
>
> thanks
> Robert Michaels
> Jefferson Lab
>
> {
> // This macro: tsimple.C
> //
> // Why in this example must I have "R" instead
> // of "right" as the 1st argument of TTree ?
> // right->Print`() fails
> // but if I replace "right" by "R", then
> // R->Print() succeeds
>
> // This problem occurs on a RH enterprise 3WS
> // with ROOT version 3.10/02 compiled with gcc 3.2.3
> // kernel 2.4.21-9.0.1.EL
> //
> // Most relevant is ROOT version, since 3.05/07
> // compiled with same compiler on same system
> // right->Print() works fine.
> // Some earlier versions also work (3.02/07, 3.03/06).
>
> gROOT->Reset();
>
> Double_t px, py, ev, bb;
> Int_t kout = 5000;
>
> TFile *hfile = new TFile("t.root","RECREATE","Demo");
>
> // The following works ok -- can do "R->Print()"
> // TTree *tree = new TTree("R","simple tree");
>
> // But this does not work:
> TTree *tree = new TTree("right","simple tree");
>
> // Failure:
> // root [0] .x tsimple.C
> // root [1] right->Print()
> //Error: non class,struct,union object right used with . or -> FILE:(tmpfile) LINE:1
> //*** Interpreter error recovered ***
> // So you must:
> // root [2] TTree *R = (TTree*)gROOT.FindObject("right")
> // root [3] R->Print()
> // (no error now)
>
> tree->Branch("px",&px,"px/D",kout);
> tree->Branch("py",&py,"py/D",kout);
> tree->Branch("ev",&ev,"ev/D",kout);
> tree->Branch("bb",&bb,"bb/D",kout);
>
>
> // Fill tree randomly
> gRandom->SetSeed();
>
> for (Int_t i = 0; i < 5000; i++) {
> gRandom->Rannor(px,py);
> ev = ev+1;
> bb = 40*ev+1000;
> tree->Fill();
> }
>
> tree->Write();
>
> }
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET