Hi!
Ok. I can reproduce your error.
What I always did, was running the plotDemo.C and then directly afterwards the Browser. Then it works.
What also works (and I really suggest this as the best way to work) is to do the following:
sneubert@dimbula:/afs/e18/panda/SIM/sneubert/pandaroot$ root -l
root [0] .x recotasks/demo/loadRecoLibs.C
- RTDB container factory CbmBaseContFact
- RTDB container factory PndFieldContFact
- RTDB container factory PndPassiveContFact
- RTDB container factory PndMvdContFact
- RTDB container factory PndEmcContFact
- RTDB container factory PndDrcContFact
PSaid instance created... access via gSaid->f()
- RTDB container factory PndTpcContFact
root [1] TFile *_file0 = TFile::Open("demo.mcreco.root")
root [2] cbmsim->Draw("Track.getMom().Mag()")
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
root [3]
This behaviour of the Browser I have observed also in other contexts. It has to do with the way ROOT is reading in the objects from the file. Different things are happening behind the scenes when you access the tree directly or in the browser. The browser only reads part of the object into memory and when you have a bit more complicated functions it may not read all parts of the object that are necessary to perform the operation. The Tree seems to be more intelligent in that regard.
I think I once solved that in another case by setting the split level of the branch that I wanted to read to 1 or 2. So that you force ROOT to always load the complete object.
Cheers! Sebastian.