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)