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

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Fri, 18 Dec 2009 19:32:03 +0100


Hi,

this might be caused by your library being linked against libTree (and all the other libraries). This will cause a re-load of libTree in the middle of your script, and its dictionary will be in a funny state. We were already planning to tackle this one, hopefully in January.

I'm glad you found a work-around for now. Thanks for sending the detailed output!

Cheers, Axel.

On 2009-12-18 19:27, Bruno Morgado wrote:
> 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 *
> * : : Tree compression factor = 5.28
> *
> ******************************************************************************
> *Branch :EventBranch
> *
> *Entries : 50 : BranchElement (see below)
> *
> *............................................................................*
> *Br 0 :fUniqueID :
> *
> *Entries : 50 : Total Size= 776 bytes File Size =
> 103 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 2.74
> *
> *............................................................................*
> *Br 1 :fBits :
> *
> *Entries : 50 : Total Size= 964 bytes File Size =
> 216 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 2.25
> *
> *............................................................................*
> *Br 2 :fNumberHits :
> *
> *Entries : 50 : Total Size= 786 bytes File Size =
> 105 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 2.70
> *
> *............................................................................*
> *Br 3 :fSourceEnergy :
> *
> *Entries : 50 : Total Size= 796 bytes File Size =
> 110 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 2.60
> *
> *............................................................................*
> *Br 4 :fSourceTime :
> *
> *Entries : 50 : Total Size= 786 bytes File Size =
> 105 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 2.70
> *
> *............................................................................*
> *Br 5 :fSourceMomentumDirection[3] :
> *
> *Entries : 50 : Total Size= 1471 bytes File Size =
> 825 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 1.10
> *
> *............................................................................*
> *Br 6 :fSourcePosition[3] :
> *
> *Entries : 50 : Total Size= 1426 bytes File Size =
> 817 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 1.10
> *
> *............................................................................*
> *Br 7 :fIncidentEnergy :
> *
> *Entries : 50 : Total Size= 806 bytes File Size =
> 109 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 2.64
> *
> *............................................................................*
> *Br 8 :fTotalDepositedEnergy[9] :
> *
> *Entries : 50 : Total Size= 2656 bytes File Size =
> 266 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 7.91
> *
> *............................................................................*
> *Br 9 :fDetectorHit[9] :
> *
> *Entries : 50 : Total Size= 1261 bytes File Size =
> 228 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 3.27
> *
> *............................................................................*
> *Br 10 :fHitTime[9] :
> *
> *Entries : 50 : Total Size= 2591 bytes File Size =
> 253 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 8.27
> *
> *............................................................................*
> *Br 11 :fHitPosition[9][3] :
> *
> *Entries : 50 : Total Size= 6223 bytes File Size =
> 294 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 19.38
> *
> *............................................................................*
> *Br 12 :fHitMomentum[9][3] :
> *
> *Entries : 50 : Total Size= 6223 bytes File Size =
> 294 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 19.38
> *
> *............................................................................*
> *Br 13 :fIsValid :
> *
> *Entries : 50 : Total Size= 621 bytes File Size =
> 102 *
> *Baskets : 1 : Basket Size= 32000 bytes Compression= 1.28
> *
> *............................................................................*
> Error: Symbol myTree is not defined in current scope sphericalLEFS60.cc:18:
> Error: Failed to evaluate myTree->GetBranch("EventBranch")
> *** Interpreter error recovered ***
>
>
> On Fri, Dec 18, 2009 at 5:23 PM, Rene Brun <Rene.Brun_at_cern.ch
> <mailto: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>
> <mailto: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>>
> <mailto: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:32:10 CET

This archive was generated by hypermail 2.2.0 : Sat Dec 19 2009 - 23:50:01 CET