Re: Error: Symbol myTree is not defined in current scope sphericalLEFS60.cc:14

From: Bruno Morgado <jb.morgado_at_gmail.com>
Date: Fri, 18 Dec 2009 18:27:07 +0000


It works now !

I tried to remove the gROOT->Reset(); but it doesn't make any difference.

But naming the macro void sphericalLEFS60() does !

I don't understand, since I've been using unnamed macros all the time, and in the manual the macro is also unnamed, but well, such a simple thing solved the problem ... I would still like to know why tough. Anybody can explain?

Anyway, thank you for your help,
Bruno

I send you the output with thetreeFile->ls() and myTree->Print() before I named the macro, in case it's of some interest.

root [0]
Processing sphericalLEFS60.cc...

Note: File "/sw/lib/root/libRIO.so" already loaded
Note: File "/sw/lib/root/libMatrix.so" already loaded
Note: File "/sw/lib/root/libMatrix.so" already loaded
Note: File "/sw/lib/root/libHist.so" already loaded
Note: File "/sw/lib/root/libGraf.so" already loaded
Note: File "/sw/lib/root/libRIO.so" already loaded
Note: File "/sw/lib/root/libMatrix.so" already loaded
Note: File "/sw/lib/root/libMatrix.so" already loaded
Note: File "/sw/lib/root/libHist.so" already loaded
Note: File "/sw/lib/root/libGraf.so" already loaded
TFile** sphericalLEFS60.root Geant4 ROOT analysis  TFile* sphericalLEFS60.root Geant4 ROOT analysis   KEY: TTree hiscaleSim;1 A Tree with Events Note: File "/sw/lib/root/libCore.so" already loaded

*Tree :hiscaleSim: A Tree with Events
*
*Entries : 50 : Total = 29845 bytes File Size = 5752
*

On Fri, Dec 18, 2009 at 5:23 PM, Rene Brun <Rene.Brun_at_cern.ch> wrote:

> We are interested by the root data file in addition to the script.
> my suggestions:
>  -make your macro a named macro
>  -remove the statement gROOT->Reset() (side-effects next time you run with
> you library).
>  -send us the result of treeFile->ls()
>
>
> Rene Brun
>
>
> Bruno Morgado wrote:
>
>> Here it goes in attachment (I hope ROOTTalk accepts attachments):
>>
>>
>> On Fri, Dec 18, 2009 at 2:00 PM, Axel Naumann <Axel.Naumann_at_cern.ch<mailto:
>> Axel.Naumann_at_cern.ch>> wrote:
>>
>>    Hi Bruno,
>>
>>    please send the actual file.
>>
>>    Cheers, Axel.
>>
>>    Bruno Morgado wrote on 12/18/2009 02:24 PM:
>>
>>        Oh, sorry I should have clarified that. sphericalLEFs60.cc is
>>        the macro file (the one I show the code in my 1st email). I
>>        run it using:
>>        root -l sphericalLEFs60.cc          My ROOT version is 5.22/00b.
>>
>>
>>        On Fri, Dec 18, 2009 at 1:22 PM, Rene Brun <Rene.Brun_at_cern.ch
>>        <mailto:Rene.Brun_at_cern.ch> <mailto:Rene.Brun_at_cern.ch
>>
>>        <mailto:Rene.Brun_at_cern.ch>>> wrote:
>>
>>           Your error report shows an error in your file
>>        sphericalLEFs60.cc
>>           file, not in your init script!
>>           Could you clarify which version of ROOT you use?
>>           Post the code in sphericalLEFs60.cc?
>>
>>           Rene Brun
>>
>>
>>           Bruno Morgado wrote:
>>
>>               Hello all,
>>
>>               I'm trying to analyse some data I created in GEANT4
>>        using ROOT
>>               and I'm using the ROOT book Trees chapter Example 4: A
>>        Tree with
>>               an Event Class.
>>
>>               The problem is that it doesn't work as expected. I get
>>        the error:
>>               Error: Symbol myTree is not defined in current scope
>>                sphericalLEFS60.cc:14:
>>               Error: Failed to evaluate myTree->SetCacheSize(100000000)
>>
>>               Whats bugging me here is that: myTree->Print(); works as
>>               expected and shows all my tree structure, but other
>>        operations
>>               in myTree simply don't work (that is, it's not just
>>               myTree->SetCacheSize(100000000); that gives my problems
>>        it's
>>               also many other things, like: TBranch* bEvent =
>>               myTree->GetBranch("EventBranch");) I really don't know
>>        what to
>>               do, since I cannot see any problem with the code and it's
>>               exactly as the example on the book.
>>
>>               { // init macro
>>
>>               gROOT->Reset();
>>
>>               if(!TClassTable::GetDict("hiscaleSimEventTree")) {
>>
>>               gSystem->Load("../libs/libhiscaleSimEventTree.so");
>>
>>               }
>>
>>
>>               // read the tree file generated in GEANT4
>>
>>               TFile* treeFile = new TFile("sphericalLEFS60.root");
>>
>>               treeFile->ls();
>>
>>               TTree *myTree = (TTree*)treeFile->Get("hiscaleSim");
>>
>>               myTree->Print();
>>
>>               myTree->SetCacheSize(100000000); // or many other stuuf
>>        like:
>>               TBranch* bEvent = myTree->GetBranch("EventBranch");
>>
>>               }
>>
>>
>>
>>
>>
>>
>>
>>
>
Received on Fri Dec 18 2009 - 19:27:32 CET

This archive was generated by hypermail 2.2.0 : Fri Dec 18 2009 - 23:50:02 CET