Re: [ROOT] STL, split trees and TTree::Draw() -- part 1

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Apr 21 2003 - 11:58:34 MEST


Hi Walter,

As indicated in the mail you are quoting:


  "Note that when a class contains STL objects, you cannot use the split
    mode for the branch supporting this class."
In addition, TTree::Draw has never been able to digest an STL vector.

We are now introducing an extension to the Trees to support STL 
collections (thanks Victor). With this extension, STL vectors
and lists will be split like a TClonesArray and TTree::Draw
will understand STL collections. This new code will be part of 3.06
in a few weeks.

Rene Brun


On 
Sun, 20 Apr 2003, Walter F.J. 
Mueller wrote:

> Dear ROOTer's				using 3.05/03
> 
> sorry for bringing up STL issues up again. I'm trying to figure out
> whether Objects containing STL vectors, split tree  and tree->Draw()
> now work as one would expect. I started out with the little example
> given by Rene on Nov 24 1999 on ROOTtalk, see
> 
> http://root.cern.ch/cgi-bin/print_hit_bold.pl/root/roottalk/roottalk99/2746.html
> 
> To have a STL and a non-STL member variable I added an Int_t member
> variable 'nh' in EventSTL. See attached sources for details. After a
> 
>    rootcint -f STLcint.cxx -c EventSTL.h EventSTL.LinkDef.h
>    g++ -g -fPIC -I$ROOTSYS/include -c STLcint.cxx EventSTL.cxx
>    g++ -g -Wl,-soname,EventSTL.so -shared STLcint.o EventSTL.o \
>          -o EventSTL.so
> 
> I get with
> 
>    root -q -l STLw.C
>    root -q -l STLr.C
> 
> exactly what onw would expect, proving that object branches with STL
> vectors work fine.
> 
> Now lets turn to split trees with STL vectors and use in STLw.C
> 
>    mytree->Branch("abc","EventSTL",&CC,16000,2);
> 
> Again STLw.C and STLr.C work and produce what one expects.
> 
> Finaly lets try to process the split tree with the TTree::Draw():
> 
>    file = new TFile("STL.root");
>    T->Draw("nh");
> 
> gives the correct distribution for 'nh'. However a
> 
>    T->Draw("A");
> 
> produces for each processed event two messages
> 
>     Error in <TBuffer::CheckByteCount>: object of class TStreamerInfo
>         read too few bytes: 2 instead of 6
>     Warning in <TBuffer::CheckByteCount>: TStreamerInfo::Streamer()
>         not in sync with data on file, fix Streamer()
> 
> and one gets a histogram with 40 entries at 0.
> 
> If one loads the EventSTL code with
> 
>    gSystem->Load("EventSTL");
> 
> before the TFile is opened no Warnings and Errors appear, but the
> 'A' histogram is still wrong (40 entries @ 0).
> 
> So storing an object with a STL vector a split tree seems to work,
> but the TTree::Draw() seems to have problems in processing it.
> 
> It this expected behaviour, or am I'm missing something ?
> 
> 
> 		Cheers and happy Easter,
> 	
> 			 Walter
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET