Scan/Draw of "Event" branches: different behavior of Track and EventHeader objects

Dear ROOters,

I am following the example “Event” in the test directory in order to write my own data layout and see the features of objects saved in a TTree. I am using ROOT v6.02.12.

I generated a ROOT file with 20 events using the maximum splitting (99) option to test which queries are allowed in TTree::Scan() or TTree::Draw().

I noticed that they have access to methods of the class ‘‘Track’’, embedded in ‘‘Event’’ via a ‘‘TClonesArray’’, while they have no access to the methods of the class ‘‘EventHeader’’, directly embedded in ‘‘Event’’.

In other words:

root [4] T->Scan("GetPx()") //I do not even need the full "fTracks.GetPx()"
*    Row   * Instance *   GetPx() *
*        0 *        0 * 0.8419713 *
*        0 *        1 * 2.3338847 *

root [8] T->Scan("fEvtHdr.GetEvtNum()")
Error in <TTreeFormula::Compile>:  Bad numerical expression : "fEvtHdr.GetEvtNum()"
*    Row   * fEvtHdr.G *
*        0 *           *
*        1 *           *

What is preventing the method access for the class ''EventHeader"? What is the “rule”?

  • The fact that it is not deriving from TObject? (In a quick test I does not seem the case)
  • Some declaration in the LinkDef file? (but the #pragma instruction is the same)
  • Just the fact that it is a direct member of the ‘‘Event’’ class instead or being embedded via a TClonesArray? What is the workaround if this is the case?

Thanks in advance for the clarifications,