How to store and plot an array embedded into a vector

Hello, I am a bit lost about how to store into a TTree a vector of array and how to access it in order to plot the data inside each array.

Basically, I have a set of array of 8192 unsigned short.
So I store each array in a vector defined as

Than I define a TTree with a branch like that

TTree *t = new TTree("t","t"); t->Branch("A","std::vector <unsigned short>","&(A)[8192])
I am not sure if it is the good way to define the branch but if so, how to access to the data contained in A in order to draw them?
I would like to do something like

and get an histogram of 8192 bins relative to the 10th box of the vector A.

I hope it is pretty clear. If not, please tell me; I will try to explain better.

Have a look at the ${ROOTSYS}/tutorials/tree/hvector.C (simple vectors) and $ROOTSYS/tutorials/tree/tree2.C (fixed and variable length arrays, see also ROOT User’s Guide -> Trees -> Example 2: A Tree with a C Structure) and ${ROOTSYS}/tutorials/tree/tree3.C (variable length arrays) tutorials.

Thanks for the reply. So if I understood correctly hvector.C, the way to draw an histogram that contains what is stored in a vector is to fill the histogram bin by bin

[code]for (UInt_t j = 0; j < vpx->size(); ++j) {



Is there another way to draw directly the content of an array? Maybe I should attach in the TTree a vector of TH1S …