Hi,
I’ve a problem in reading a TTree: I’ve written the following code
void entropyf()
{
TTree friend_ch;
TFile f = TFile::Open(“data.root”);
friend_ch = (TTree*)f->Get(“T”);
friend_ch->Show(1);
friend_ch->SetMakeClass(1);
Double_t SS = -1;
TBranch *branch_entropyQP = 0;
cout<<friend_ch<<endl;
int ret = friend_ch->SetBranchAddress(“entropyQP”, &SS, &branch_entropyQP);
cout<<ret<<endl;
friend_ch->GetEntry(1);
cout<<"S entry 1 “<<SS<<” “<<branch_entropyQP->GetEntries()<<” "<<friend_ch->GetEntries()<<endl;
}
and it works ONLY if I add the line
friend_ch->Show(1);
otherwise it crashes :
0x8ca48f0 //friend_ch value
3 /ret value
Error: Symbol U��WVS��
�c����� is not defined in current scope (tmpfile):1:
signal(11) Error: Segmentation violation (tmpfile):1:
Press return or process will be terminated in 10 sec by timeout.
FILE:(tmpfile) LINE:1 cint>
entropyQP is a variable in my TTree. I’ve checked in the Tree and the value is correct.
However, when I add Show(1) and I try to exit ROOT, it crashes as well…
Can you help me to understand why, please?
Thank you
Cheers
Paola
PS I’m not able to read the right value of my variable even using t->MakeSelector()…