Splitlevel and vectors in classes

I have a custom class (inheriting from TObject) which has as a member a vector of another custom class, which itself has a member of a third custom class. See header file below:

#include <iostream>
#include <vector>
#include "TObject.h"

class sublevel:public TObject{
public:
   double one;
private:
   ClassDef(sublevel,1);
};

class toplevel:public TObject{
public:
   int a;
   std::vector<sublevel> b;
private:
   ClassDef(toplevel,1);
};


class testClass :public TObject
{

public:
   testClass();
   void ClearAll();
   int someNumber;
   std::vector<toplevel> tops;


private:
   ClassDef( testClass, 1 )
};

I make class dictionaries for all these things with a LinkDef:

#include <vector>
#include <string>
#ifdef __CINT__
#pragma link C++ nestedclasses;
#pragma link C++ class testClass+;
#pragma link C++ class sublevel+;
#pragma link C++ class vector<sublevel>+;
#pragma link C++ class toplevel+;
#pragma link C++ class vector<toplevel>+;
#endif

and I can compile an executable with this.

I then make a tree in my executable with one branch of type testClass, and splitlevel 99.

When I look at this tree on the root command line, I see:

[code]******************************************************************************
*Tree :tree : tree *
*Entries : 100 : Total = 14568 bytes File Size = 3944 *

  •    :          : Tree compression factor =   3.40                       *
    

*Branch :event *
*Entries : 100 : BranchElement (see below) *

*Br 0 :fUniqueID : UInt_t *
*Entries : 100 : Total Size= 970 bytes File Size = 99 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 4.81 *

*Br 1 :fBits : UInt_t *
*Entries : 100 : Total Size= 1358 bytes File Size = 286 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 3.08 *

*Br 2 :someNumber : Int_t *
*Entries : 100 : Total Size= 975 bytes File Size = 249 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 1.92 *

*Br 3 :tops : Int_t tops_ *
*Entries : 100 : Total Size= 4050 bytes File Size = 285 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 3.08 *

*Br 4 :tops.fUniqueID : UInt_t fUniqueID[tops_] *
*Entries : 100 : Total Size= 1477 bytes File Size = 294 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 3.02 *

*Br 5 :tops.fBits : UInt_t fBits[tops_] *
*Entries : 100 : Total Size= 1457 bytes File Size = 292 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 3.03 *

*Br 6 :tops.a : Int_t a[tops_] *
*Entries : 100 : Total Size= 1437 bytes File Size = 298 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 2.96 *

*Br 7 :tops.b : vector b[tops_] *
*Entries : 100 : Total Size= 4037 bytes File Size = 803 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 4.33 *

[/code]

That, is, the vector of the sublevel class doesn’t get split any further; there is no branch tops.b.one. (Nevertheless, the command tree->Draw(“tops.b.one”) works and draws the appropriate thing.)

Is there a way to get this splitting to happen down to the “tops.b.one” level? I would like this, as I want to be able to use MakeClass on this tree, and without that splitting, the sublevel information can’t be accessed with MakeClass.

I have tested that if I only have a single sublevel object within toplevel, the splitting does happen, so I assume that this has something to do with the edicts found in 14.10.1.3 Rules for Splitting, but I’m not quite sure if the vector is considered a pointer from the point of view of this issue—and if so, why does drawing tops.b.one work?

I am using ROOT 5.34/26; suggestions to go to ROOT 6 are not helpful, as the version is constrained by external factors.

Hi,

Unfortunately nested collection can not be split (so far the attempt to design meta-data necessary to support this having too complicated).

For this purpose, you can use MakeProxy instead, it should give access also to the nested collection.

Cheers,
Philippe.

Thank you for the swift and helpful reply!