[ROOT] problem tree definition case A with double's

From: Eddy Offermann (eddy@rentec.com)
Date: Fri Jun 02 2000 - 05:09:33 MEST


Dear Rooters,

I have a problem with the following macro:

{ // a macro

typedef struct {
  Int_t pos;
  Int_t filler;
  Double_t price;
} REC;

REC rec;

TTree *tree = new TTree("T", "table");
tree->Branch("rec", &rec, "pos/I:filler/I:price/D",1000);

rec.pos = 12345;
rec.filler = -2;;
rec.price= 12345/12.3;
tree->Fill();

tree->Show(0);

}

This will print out:
======> EVENT:0
 pos             = 12345
 filler          = -2
 price           = 1003.66

So far so good but now change the macro to (taking out Int_t filler):

{ // a macro

typedef struct {
  Int_t pos;
  Double_t price;
} REC;

REC rec;

TTree *tree = new TTree("T", "table");
tree->Branch("rec", &rec, "pos/I:price/D",1000);

rec.pos = 12345;
rec.price= 12345/12.3;
tree->Fill();

tree->Show(0);

}

and you get :

======> EVENT:0
 pos             = 12345
 price           = 5.35141e-315

It seems there is some alignment problem and only the non-significant
bytes of price are shown ???

Eddy



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:27 MET