creation of a Branch in a Tree Object from struct

From: Victor Golovko <vgolovko_at_comp.tamu.edu>
Date: Fri, 17 Feb 2006 13:37:18 -0600


Hello,

probably this is a quite stupid question, but I did not find the answer by myself (well, I am not an expert in C++ programming).

The following code illustrates my problem


typedef struct {

char name[100];

int value;

}HEADER_PAIRS1;
typedef struct {

HEADER_PAIRS1 hdr[6];

int val[500];

} dataBlock_t;

void initTree()

{

dataBlock_t dataBl;

TFile *dataFile;

TTree *dataTreeSpecHdr;

TTree *dataTreeSpctr;

const Text_t *title = "Ca38_data";

const Text_t *fname = "tree.root";

Option_t *option = "RECREATE";

Int_t comp = 1;

dataFile = new TFile(fname,option,title,comp);

if(dataFile->IsOpen())

cout << "\n ROOT file: " << fname << " opend" << endl;

else

{

cerr << "\n Couldn't open ROOT file: " << fname << endl;

exit (-2);

}

dataTreeSpctr = new TTree("TreeSpctr", "TAMU Ca38, Sep, 2005, Lifetime, Spectra");

// ???? dataTreeSpctr->Branch("spctr",&dataBl.val,"Data[500]/I");

}


I would like to store in the tree object all information that is defined as a dataBlock_t structure (variable dataBl) as a Branch? How it would be possible?

Thanks for helping me.

Victor.

February 17, 2006 Received on Fri Feb 17 2006 - 20:37:55 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET