Splitting a TTree with a custom class branch containing TClonesArrays

I have successfully defined an “Event” class which contains (pointers to) a TClonesArray.

class Event : public TObject{
  private:
    TClonesArray *fDetectorArray;  // this is contains objects of another custom class, DetT1
...
class DetT1 : public TObject{
  private:
    Int_t fEnergy;
    Int_t fTime;
...

I create a branch of my tree using the Event object - note the split level.

Event *event=0;
myTree->Branch("Events", "Event", &event, 256000, 99);

I then populate the tree, creating TClonesArrays of DetT1 objects, assigning them to the Event object and filling the tree. However, when I view the tree afterwards, I have no branches for the members of the DetT1 objects inside the TClonesArray, simply:

*............................................................................*
*Br    2 :fDetectorArray : TClonesArray*                                     *
*Entries :  6717662 : Total  Size=  634780291 bytes  File Size  =   61381598 *
*Baskets :      382 : Basket Size=   25600000 bytes  Compression=  10.21     *
*............................................................................*

My question is how can I split to view the members of the DetT1 objects? I think I’m pretty much following what is in the first section of this post https://root.cern.ch/root/roottalk/roottalk02/5076.html, which apparently does work (or did at least).

I’m also fairly certain that the DetT1 class itself is not to blame: if I directly create a branch containing a TClonesArray of DetT1 objects then all works as expected.

Any help is appreciated, let me know if you need more details or if anything is unclear etc.

Maybe @pcanal could comment on that…

How did you generate the dictionary for DetT1 (i.e. can you show the LinkDef file)?

Cheers,
Philippe.

Sure, here it is:

#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ nestedclasses;

#pragma link C++ class Event+;
#pragma link C++ class DetT1+;

//other custom classes used elsewhere
#pragma link C++ class Header+;
#pragma link C++ class Tagger+;

#endif

So it is nothing obvious and should have worked as you expected.

Can you provide a runnable reproducer so that we can investigate this further?

Thanks,
Philippe.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.