TTree::ReadFile Problems

Hello, I am using a TTree and ReadFile to analyze a whitespace-separated text file with heterogeneous data. This part seems to work, but I am unable to get the right information back out of the tree for the analysis. Here is my code:

    TTree t("t","wire_type/C:number/I:diam/C:x/F:y/F:voltage/C");
    t.ReadFile("proto2_geom.txt","wire_type/C:number/I:diam/C:x/D:y/D:voltage/C");

    Char_t * wire_type = NULL;
    Int_t * number = NULL;
    Char_t diam[25];
    Double_t * x = NULL, * y = NULL;
    Char_t voltage[25];

    t.SetBranchAddress("wire_type",wire_type);
    t.SetBranchAddress("number",number);
    t.SetBranchAddress("diam",diam);
    t.SetBranchAddress("x",x);
    t.SetBranchAddress("y",y);
    t.SetBranchAddress("voltage",voltage);
    
    for(Int_t i=0;i<t.GetEntries();i++)
      {
	t.GetEntry(i);
	t.Show(i);
	cout << TString::Format("%d: %g,%g",i,*x,*y) << endl;
      }

attached is the text file which is read by the code. On my end (ROOT 5.34) the t.Show(i) properly shows the values, while the cout statement clearly shows that x and y are not pointing at the right values.

Thanks for assistance.

Jean-François
proto2_geom.txt (6.11 KB)

[code]{
TTree t(“t”, “a trial tree”);
t.ReadFile(“proto2_geom.txt”,
“wire_type/B:number/I:diam/C:x/D:y/D:voltage/C”);

Char_t wire_type;
Int_t number;
Char_t diam[25];
Double_t x, y;
Char_t voltage[25];

t.SetBranchAddress(“wire_type”, &wire_type);
t.SetBranchAddress(“number”, &number);
t.SetBranchAddress(“diam”, diam);
t.SetBranchAddress(“x”, &x);
t.SetBranchAddress(“y”, &y);
t.SetBranchAddress(“voltage”, voltage);

for(Int_t i = 0; i < t.GetEntries(); i++)
{
t.GetEntry(i);
t.Show(i);
std::cout << i << ": " << wire_type << " " << number << " "
<< diam << " " << x << " " << y << " " << voltage
<< std::endl;
}

t.ResetBranchAddresses();
}[/code]

Thanks, I probably should have read the TTree and TBranch documentation more carefully before asking here.