TTree and vectors

Hi

I have the following class

VMEsysTEM class contains
–>int E1 : Energy from ADC
–>int E2 : Energy from ADC
–>Vector T1 : Time stamps from TDC
–>Vector T2 : Time stamps from TDC

Because the TDC’s deadtime is a couple order of magnitude smaller than the ADC, I am able to collect more than one hit T for each E, hence I have declared my time as a vector instead of a plain variable. When it comes to filling a TTree with this hypothetical class, how could I handle the vector branch? DO I have to make sure every vector has the same size before filling the tree? How does the splitting take place? Would every element in the vector be recognized as a leaf? I am a bit confused about this… Any help/suggestion/ideas are appreciated.

Krisfrajer

You will get 4 branches. Run the small test below and see the result:

[code]#include “TTree.h”
#include “TFile.h”
#include

class VME {
int E1;
int E2;
std::vector T1;
std::vector T2;
};

void tv() {
TTree *T = new TTree(“T”,“test”);
VME *v = new VME;
T->Branch(“VME”,&v);
T->Print();
}
[/code]

[code]******************************************************************************
*Tree :T : test *
*Entries : 0 : Total = 2828 bytes File Size = 0 *

  •    :          : Tree compression factor =   1.00                       *
    

*Branch :VME *
*Entries : 0 : BranchElement (see below) *

*Br 0 :E1 : *
*Entries : 0 : Total Size= 466 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 1 :E2 : *
*Entries : 0 : Total Size= 466 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 2 :T1 : *
*Entries : 0 : Total Size= 466 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 3 :T2 : *
*Entries : 0 : Total Size= 466 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

[/code]

Rene