Re: [ROOT] How to use vector in Event?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Sep 03 2003 - 08:59:43 MEST


Hi Alexander,

It looks like you have generated an analysis function via 
TTree::MakeClass or MakeSelector.
The maximum dimension for [count] in the generated header file
is based on the maximum value of count for the file used to generate the 
code. Simply extend this dimension when using it with a TChain
such that the maximum value of [count] can be digested.

Rene Brun

On Wed, 3 
Sep 2003, Alexander Bürger 
wrote:

> Hi,
> 
> to put my Events into a Tree I have a class similar to the following:
> 
> class TEvent {
> 	int count;
> 	float *time; //[count];
> };
> 
> I like this, because in the tree viewer I can click and I get a nice time
> spectrum. Unfortunately, I made some mistake in memory allocation so that
> when I used TChain to chain several files, I did not get spectra, but only
> segfaults, while with a single TFile it was working.
> 
> Before fixing the problem I tried to use a class like
> 
> class TEvent {
> 	int count;
> 	std::vector<float> time; //[count]
> };
> 
> to circumvent manual memory allocation and also to avoid re-allocation of
> the array for each event in reading from the tree. But I did not get this
> to work in the tree viewer: the time spectrum just showed zeroes.
> 
> How can I use the vector<> in a way compatible with the tree viewer?
> 
> Best wishes, and thanks for your help,
> 
> Alexander
> 
> 



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