Reading TObjString Leaf with Selector

Hello ROOTers,

I have a tree which contains a TClonesArray of a simple object that contains an integer and a TObjString. When I execute tree->Show(event_number) or tree->Scan(“”) I can see that the string is correctly written into the tree. However, if I use MakeClass or MakeSelector and attempt to print the same information, the TObjString in the selector is empty- the leaf in the class is not connected to the data on the disk for some reason. I am using a very ancient version of ROOT, v4.00/08, and I would prefer not to change it if possible. Does anybody know how I should modify the branch address setting to read this data correctly? A small example tree and analysis script are attached.

Thanks in advance,
ExampleAna.h (11.8 KB)
ExampleAna.C (1.56 KB)
example.root (15.3 KB)


In order to see the content of object as is with MakeSelector you will need to
[ul]Generate and load the dictionary for the class you originally stored in the TClonesArray
Replace the lines Int_t trig_; UInt_t trig_fUniqueID[kMaxtrig]; //[trig_] UInt_t trig_fBits[kMaxtrig]; //[trig_] Int_t trig_l3num[kMaxtrig]; //[trig_] TObjString trig_name[kMaxtrig];by a single TClonesArray* data member.
add the proper code in the constructor and destructor to set this data member
replace the SetBranchAddress referencing the trig_… branches by a single call for the branch name 'trig.'
remove the call to fChain->SetMakeClass(1);
access the content of the TClonesArray with the usual TClonesArray interface.


PS. With newer version of ROOT, I would recommend using MakeProxy.