Re: [ROOT] filling a tree

From: Eddy Offermann (eddy@rentec.com)
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
{
public:
  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]
public:
  TBook();
  TBook(const TBook& b);

  virtual ~TBook();

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

  ClassDef(TBook,1)  //TBook class
};

#endif

> X-Authentication-Warning: newmint.cern.ch: Host 
pigpen.bl.physik.uni-muenchen.de [129.187.160.7] claimed to be 
mailhost.physik.uni-muenchen.de
> Date: Fri, 02 Feb 2001 14:01:00 +0100
> From: Thomas Eberl <Thomas.Eberl@ph.tum.de>
> X-Accept-Language: en, de
> MIME-Version: 1.0
> To: roottalk@pcroot.cern.ch
> 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
e-mail: eddy@rentec.com
http://www.rentec.com



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