TTree::MakeClass() and std::vector

Hi,

I’m trying to implement an analysis using an analysis class made with TTree::MakeClass(). A data member of this class is a vector<vector> *, and this is apparently causing problems. While this datamember is included, the analysis segfaults at TTree::GetEntry(), which can be traced down to TBranchElement::ReadLeavesMakeClass (). When I try to do TTree::SetMakeClass(0) a new problem emerges, which I do not understand (see below):

#5 0x000000010d86fdd4 in TClass::Size () #6 0x000000010e82ce3e in TBufferFile::ReadFastArray () #7 0x000000010e882d3e in TStreamerInfoActions::ReadSTL<&(TStreamerInfoActions::ReadSTLMemberWiseSameClass(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*, short)), &(TStreamerInfoActions::ReadSTLObjectWiseFastArray(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*, short, unsigned int))> () #8 0x000000010e83121d in TBufferFile::ApplySequence () #9 0x000000010f65722c in TBranchElement::ReadLeavesMember () #10 0x000000010f641630 in TBranch::GetEntry () #11 0x000000010f652567 in TBranchElement::GetEntry () #12 0x000000010f6896ba in TTree::GetEntry () #13 0x000000010d79667e in MyAnalysis::Loop () #14 0x000000010d7992a2 in main ()

Any suggestions on how to solve this would be greatly appreciated.

Hi,

The skeleton created by MakeClass sets the TTree (via the call fChain->SetMakeClass(1) ) which does not support reading in any object (i.e. including std::vector). You will need to remove the call to SetMakeClass (but this will also disable the reading of the content of other object via their decomposition in ints and floats).

Cheers,
Philippe.

Thanks for your reply. With that recommendation in mind, the problem is now solved.