I saved a class, XEvent, in a tree
XEvent *event = new XEvent; // inherits from TNamed
TFile *output= new TFile("events.root","recreate");
TTree *xtree = new TTree("xtree","xtree");
xtree->Branch("events","XEvent",&event,32000,2);
It contains a TClonesArray of hits:
xtree
|
+--events (XEvent)
|
+--fIDData (XData)
|
+--fHits (XHits)
|
+--fArray (TClonesArray of XHit)
XData, XHits, TClonesArray are all data members instead of pointers. Class, XHit, has members like, fNPEs, fPMTId, etc. I can draw the number of photoelectrons in PMT 1 using the following command:
xtree->Draw("fIDData.fHits.fArray.fNPEs","fIDData.fHits.fArray.fPMTId==1");
However, this only works if the splitting level is 2. If I change the level to any number other than 2, say, 1 or 3 or 99, the draw command complains
Error in <TTreeFormula::Compile>: Bad numerical expression : "fIDData.fHits.fArray.fNPEs"
Why is that?