I’m trying to create a TTree with a couple of branches. It’s difficult for me to include my code (too many lines and depends on other structures), so I’ll try to describe the situation as best I can.
I have classes
all derived from TObject, with private data members and public functions.
I have in my code
[code]MyEvent *mEvent = new MyEvent();
TClonesArray array1 = new TClonesArray(“MyTrack1”,100);
TClonesArray array2 = new TClonesArray(“MyTrack2”,100);
TTree *mTree = new TTree(“MyTree”,“Tree”)
There’s a loop where I assign values to the members of mEvent and fill array1 and array2 with MyTrack1 and MyTrack2 objects whose members’ values are also assigned in this loop. At the end of every iteration, TTree::Fill and TTree::Write is called.
It doesn’t complain when it runs but when I check the output, I don’t actually get MyEvent and MyTrack1 objects. In their leaf list I only see fUniqueID and fBits. I get blanks when I do a TTree::Scan on any MyEvent or MyTrack1 member. Trying to call TTree::Draw on any member results in error messages of the following form:
Error in <TTreeFormula::DefinedVariable> MyEventMember is not a datamember of MyEvent
Error in <TTreeFormula::Compile>: Bad numerical expression : "MyEvent.MyEventMember"
What I can’t understand is how it’s working fine for Track2 branch. I see all the data members of MyTrack2 as the leaves. MyTrack1 and MyTrack2 essentially have the same structures, just different members. MyEvent has similar structure as well.
I’ve made such a TTree before (just slightly different classes), and have the same steps to initialize, set branches, fill, write, etc. This is the first time the class members don’t show up.
Having different results for essentially the same process leaves me with no idea what the problem is or how to fix it.
Any insight on what’s going on here?