Re: [ROOT] merging trees (split 99)

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Sep 16 2002 - 14:53:46 MEST


Hi Colin,

Write your Trees with a more recent version (3.03/08) and what you want
to do will work.
Note that when opening a file containg classes and you do not have the
corresponding shared library, you will see the warning message.

Rene Brun

On Mon, 16 Sep 2002, Colin Bernet wrote:

> 
> Hi all, 
> 
> I created a large number of TFiles containing a tree with splitlevel =
> 99. The tree was generated using a mother event class MEvent :
> 
> class MEvent : public TObject {
> 
>  public:  
>   enum ETypes {INCLUS, D0, DStar, UNKNOWN};
> 
>   static const int MAXNTRA;
>   static const int MAXNVER;
>   static const int MAXNK0;
>   static const int MAXND0;
> 
>   int number; 
>   int run;
>   int type;
>   int trmsk;
> 
>   double mD0;
> 
>   double thetakmin;
> 
>   int nver;
>   TClonesArray *vertex;
>   int ntra;
>   TClonesArray *track;
>   int nk0;
>   TClonesArray *k0s; 
>   int nd0;
>   TClonesArray *d0s; 
>   int npi;
>   TClonesArray *pis;
>   int nk;
>   TClonesArray *ks;
>   int ndstar;
>   TClonesArray *dstars;
> ...
> 
> each TClonesArray contains instances of a class that has only basic data
> types as attributes.
> 
> 
> I now face 2 problems, which are kind of related : 
> 
> - MakeClass seems to understand this structure, and one branch is
> created for
> each variable, which gets the address of a basic variable (unsigned, int,
> float, double, or arrays of these data types). The generated code does not
> depend anymore on the classes used to create the tree.
> 
> Therefore, I was assuming that I had all I need to read this tree again,
> using the generated code. Yet when trying, I get these error messages :
> 
> Warning in <TClass::TClass>: no dictionary for class MEvent is available
> Warning in <TClass::TClass>: no dictionary for class MVertex is available
> Warning in <TClass::TClass>: no dictionary for class MTrack is available
> Warning in <TClass::TClass>: no dictionary for class MK0 is available
> Warning in <TClass::TClass>: no dictionary for class MParticle is
> available
> Warning in <TClass::TClass>: no dictionary for class MD0 is available
> Warning in <TClass::TClass>: no dictionary for class MPi is available
> Warning in <TClass::TClass>: no dictionary for class MK is available
> Warning in <TClass::TClass>: no dictionary for class MDStar is available
> 
> These are classes which should not be necessary anymore, cause split = 99
> creates one branch in the tree for each data type contained in these
> classes. 
> 
> With root 3.00, this leads to a segmentation violation, but with root
> 3.03/07 there is no problem... so I upgraded the reading part (the
> trees are still created by root 3.00/06 - tell me if this is a
> problem... I could try to update the writing part)
> 
> 
> 
> - Now the number of TFiles gets really large (~ 3000), and I would like to
> merge them together in about 10 files, in order to speed up looping a
> bit, and to handle them more easily. To do that I used
> TChain::Merge. 
> 
> Thinking my tree is containing only simple data types I first didn't set
> the branch addresses before merging. As a result, I only the very
> simple branches are filled in the output tree (basic data types of the
> event
> class, data stored in TClonesArrrays has disappeared)
> 
> Then I tried to set the branch address of the mother class "event". This
> seems to work : the tree can be drawn, and some cuts can be applied. But
> now, when I chain these 10 output files together, the following messages
> are printed when going to a new file : 
> 
> Warning in <TBranchClones::Streamer>: Unknow class: MVertex. Cannot read
> BranchClones: vertex
> Warning in <TBranchClones::Streamer>: Unknow class: MTrack. Cannot read
> BranchClones: track
> Warning in <TBranchClones::Streamer>: Unknow class: MK0. Cannot read
> BranchClones: k0s
> Warning in <TBranchClones::Streamer>: Unknow class: MD0. Cannot read
> BranchClones: d0s
> Warning in <TBranchClones::Streamer>: Unknow class: MPi. Cannot read
> BranchClones: pis
> Warning in <TBranchClones::Streamer>: Unknow class: MK. Cannot read
> BranchClones: ks
> Warning in <TBranchClones::Streamer>: Unknow class: MDStar. Cannot read
> BranchClones: dstars
> 
> Despite that I can use the chain interactively. 
> 
> Now, unlike the first one, this chain cannot be read by the MakeClass
> generated macro !
> 
> root [14] mdst.Loop()                                          
> Warning in <TBranchObject::GetEntry>: Cannot get class: MEvent
> 
>  *** Break *** segmentation violation
> 
> 
> I've been stuck on that for a while. Split 99 is really what fits my
> needs, and it would be nice to be able to merge the trees together
> easily. I obviously miss something crucial about how split mode works. 
> Why are the classes used to generate the tree still necessary for reading
> ? 
> 
> Really sorry for this long email...
> cheers,
> 
> Colin
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:09 MET