Re: [ROOT] filling a tree

From: Eddy Offermann (
Date: Fri Feb 02 2001 - 15:25:00 MET

Hi Thomas,

Here an example of storing arrays:

#ifndef ROOT_TBOOK
#define ROOT_TBOOK

//                                                                      //
// TBOOK                                                                //
//                                                                      //

#include <TObject.h>
#include <Rtypes.h>
#include <TFile.h>
#include <TChain.h>
#include <TTree.h>
#include <TError.h>

class TBook : public TObject
  Char_t    fComm[8];
  Double_t  fTime;
  Double_t  fVol;
  Double_t  fVty;
  Int_t     fAskDepth;
  Int_t     fBidDepth;
  Int_t*    fAskSize;  //[fAskDepth]
  Double_t* fAskPrice; //[fAskDepth]
  Int_t*    fBidSize;  //[fBidDepth]
  Double_t* fBidPrice; //[fBidDepth]
  TBook(const TBook& b);

  virtual ~TBook();

  void Copy(TObject& obj);
  TBook &operator=(const TBook &b);

  ClassDef(TBook,1)  //TBook class


> X-Authentication-Warning: Host [] claimed to be
> Date: Fri, 02 Feb 2001 14:01:00 +0100
> From: Thomas Eberl <>
> X-Accept-Language: en, de
> MIME-Version: 1.0
> To:
> Subject: [ROOT] filling a tree
> Content-Transfer-Encoding: 7bit
> X-Filter-Version: 1.3 (wren)
> Dear rooters,
> I have a simple question.
> I have written a TObject derived class that is used to store arrays of
> fundamental type variables. I want to put these objects in a TTree
> branch on a event-by-event basis. Variables that are not arrays are
> correctly split and displayed in the TBrowser. The Int_t* and Double_t*
> type arrays do not appear in the tree at all. I have tried TArrays but
> it seems that they are ignored as well, as they do not inherit from
> TObject.
> What is the best way to write such a simple container class ? How do I
> get arrays of floats e.g. in my tree ?
> thanks 
> Thomas

Eddy A.J.M. Offermann
Renaissance Technologies Corp.
Route 25A, East Setauket NY 11733

This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET