TTree Viewer data access

Hi again.

So, I have created the following

class A {
var1
}

class Event : public A {

}

Then I create a tree, set the branch to an instance of the Event, loop a gazillion times and fill A.var1 and then write/close.

When I open the root file I have a problem viewing the data in var1. If I browse to var1 using a TBrowser, I can double-click and it shows a histogram filled with data. If I use the TTree viewer and double-click on var1 there doesn’t appear to be any data (although, the histogram clearly shows there are a gazillion entries).

What am I doing wrong?

Thanks
Adam

Hi,

I can not reproduce this problem (and do not see anything wrong with what you are doing). Can you send your ROOT file so that I can try to reproduce the problem? Also which version of ROOT are you using?

Cheers,
Philippe.

Hi Phillipe. Thanks so much for your reply.

Attached is a root file. It appears that this problem is only with the member variables that are in my most base class.

My explanation above was too simplistic. Let me show you my real class structure and then you can look at my root file.

class EdwEventBase {
fRunNumber
fEdwGlobalEventTime
fRunStartTime
etc…
}

class EdwDataEventBase {
fGSEventNumber
fDetectorStatusWord
fBlindnessWord
}

class EdwHLAEvent : public EdwEventBase {
… (empty so far)
}

class EdwHLADataEvent : public EdwHLAEvent, public EdwDataEventBase {
fDataCleaningBits
}

So, then I run

fillEvents(){

TFile f(“new.root”);
TTree t = new TTree(“EdwT”,“EdwEventTree”);
EdwHLADataEvent mEv = new EdwHLADataEvent();
t->Branch(“EdwHLADataEventBranch”,“EdwHLADataEvent”,&mEv,32000,99);
for(Int_t i = 0; i < 100000; i++){
mEv->SetRunNumber(i);
mEv->SetDataCleaning(4);
mEv->SetEventTime(10.023432
i);
mEv->SetDataCleaning(0x2);
mEv->SetGSEventNumber(3
i+1994);
t->Fill();
}
t->Write();
f.Close();
delete mEv;
}

(Sorry - I don’t know how to properly format my text here so that its more readable for you).

When I use the TBrowser (or when I use my library of classes), I can successfully read the EdwEventBase.fRunNumber member variable and I see a histogram of numbers from 0 to 100000. But, when I am in the TreeViewer and I double click EdwEventBase.fRunNumber, I see 10000 entries of the value of 0. The same is true for EdwEventBase.fEdwGlobalEventTime.

However, I get the proper behavior for the EdwDataEventBase.fGSEventNumber and EdwHLADataEvent.fDataCleaningBits (I see the data from the Browser and the TreeViewer). These, as you’ll notice, are derived classes and thus higher up in the Branch structure.

Thanks again for your help.

Adam Cox
new.root (940 KB)

Hi,

I can indeed reproduce the problem. I am looking into possible solution.

Thanks,
Philippe

Hi,

This fixed in the trunk by revision 32772.

Cheers,
Philippe.