Hello all,
i am using a TTree called output. I also have some TH1D declared earlier in the code:
TH1D *DirTheta_resto = new TH1D("DirTheta_resto","Theta Distribution;Theta [deg]; # events", 180, 0,180.);
Later I used SetBranchAddress as follows:
TString* reactores;
double px_neutrao_r;
double py_neutrao_r;
double pz_neutrao_r;
output->SetBranchAddress("parentMeta1",&reactores);
output->SetBranchAddress("mcmom2x",&px_neutrao_r);
output->SetBranchAddress("mcmom2y",&py_neutrao_r);
output->SetBranchAddress("mcmom2z",&pz_neutrao_r);
and finally i iterated over the ttree:
for(int i = 0; i<nentries; i++) // iterar sobre a TTree
{
cout << SEPARATOR << "\naddress " << 4+i << " before = " << DirTheta_resto << endl;
output->GetEntry(i);
cout << "\naddress " << 4+i << " after = " << DirTheta_resto << endl;
(...)
}
The program crashes when i try to fill the TH1D, and the output for those prints is:
address 4 before = 0x7fa397ad9990
address 4 after = 0x0
ENTRY 0: reactor = BRUCE 4; px = 3.54902; py = 5.53718; pz = 4.0301
Can anyone help me? Why is the function GetEntry wiping the pointer to my histogram?
Thank you