TTree trivial problem

Hi,

I work with TTrees since some time and wanted just to present the idea to somebody and… I have failed;-( I must be missing some important thing.

The class is defined in file Coil2.h:
#ifndef ROOT_Coil2
#define ROOT_Coil2

#include “TObject.h”

class Coil2 : public TObject {
private:
Double_t T; // coil temperature
public:

Coil2()  { T=0.; };
~Coil2() { };

void SetT(Double_t temp) {  T=temp;  }   
Double_t GetT()   {  return T; } 
Double_t p;

};
#endif

I write a TTree, normally, setting the temperature:
coil->SetT(100.);
It is still fine, the Tree can be browsed with TBrowser, the temperature is OK.

Now I read the class:

.L Coil2.h
TFile f(“file.root”)
TTree *tree;
tree = (TTree)f->Get(“T”);
Coil2 *coil = 0;
tree->SetBranchAddress(“coil”,&coil);
tree->GetEntry(23)
(Int_t)28
root [8] coil->GetT()
(Double_t)5.33566866155532549e-315

some crazy number instead of 100.!
Why it does not work?

 Mariusz

Replace
.L Coil2.h
by
.L Coil2.h+

Rene