(T)string members and TClonesArray branches

From: Philip Rodrigues <p.rodrigues1_at_physics.ox.ac.uk>
Date: Mon, 21 Feb 2011 12:00:08 -0500


Hi,
I have a TClonesArray containing a class with a TString member variable (although I see the same behaviour with std::string), and I'm storing the TClonesArray as a TTree Branch.

What I want to do in the end is read the values of the TString branch without having to read any other branches, but I couldn't manage it using branches and leaves directly, or with TTreeFormula.

So I took a step back, and looked at the output of TTree::Scan, which I don't understand: for every instance it shows the value of the TString from the first instance. Is this intended behaviour? (For an int, the values between instances do vary). If so, is there a way I can get at the individual TString instances without reading the whole object off of disk?

I've attached a minimal example: load it up and run createTree() to create the tree, and readTree() to run a TTree::Scan that shows the issue.

Thanks,
Phil

Received on Mon Feb 21 2011 - 18:00:13 CET

This archive was generated by hypermail 2.2.0 : Mon Feb 21 2011 - 23:50:01 CET