Hi… I am trying to run the code:
///
void y_h3()
{
# define n 1
Int_t irun[] ={902,903,904};
TFile *f[n];
TTree *tree[n];
Double_t epr1, epr2, eclk, ebcm, ebcm_up, eclk_r, etime, etrack, epion1, epion2, et2, en1, ecer, eytar, edelta,eth,ephi;
for (Int_t i=0; i<n; i++) {
f[i] = new TFile(Form("file.root",irun[i]),"read");
tree[i] = (TTree*)f[i]->Get("T");
tree_TS[i] = (TTree*)f[i]->Get("TSLeft");
tree[i]->SetBranchAddress("L.prl1.e",&epr1);
tree[i]->SetBranchAddress("L.prl2.e", &epr2);
}
for(Int_t i=0; i<n; i++){
in =tree[i]->GetEntries();
for(Int_t j=0; j<1000; j++){
tree[i]->GetEntry(j);}
}
}
The code crashing in the j-loop with the following error:
*** glibc detected *** /u/apps/root/5.34.36/root/bin/root.exe: double free or corruption (out): 0x0000000002907c10 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3759c75e66]
/lib64/libc.so.6[0x3759c789b3]
/u/apps/root/5.34.36/root/lib/libCint.so(G__destroy_upto+0x2ca)[0x7f48e63223ca]
/u/apps/root/5.34.36/root/lib/libCint.so(G__interpret_func+0x4084)[0x7f48e6291da4]
/u/apps/root/5.34.36/root/lib/libCint.so(G__getfunction+0x192b)[0x7f48e627df7b]
/u/apps/root/5.34.36/root/lib/libCint.so(G__getitem+0x86e)[0x7f48e625c8ae]
/u/apps/root/5.34.36/root/lib/libCint.so(G__getexpr+0x4048)[0x7f48e6261428]
/u/apps/root/5.34.36/root/lib/libCint.so(G__calc_internal+0x3f8)[0x7f48e626a938]
/u/apps/root/5.34.36/root/lib/libCint.so(G__process_cmd+0x4ea3)[0x7f48e62e6b53]
/u/apps/root/5.34.36/root/lib/libCore.so(_ZN5TCint11ProcessLineEPKcPN12TInterpreter10EErrorCodeE+0x536)[0x7f48e6d28246]
/u/apps/root/5.34.36/root/lib/libCore.so(_ZN5TCint16ProcessLineSynchEPKcPN12TInterpreter10EErrorCodeE+0x103)[0x7f48e6d25893]
/u/apps/root/5.34.36/root/lib/libCore.so(_ZN12TApplication11ExecuteFileEPKcPib+0x848)[0x7f48e6d73848]
/u/apps/root/5.34.36/root/lib/libCore.so(_ZN12TApplication11ProcessLineEPKcbPi+0x8f6)[0x7f48e6d72cd6]
/u/apps/root/5.34.36/root/lib/libRint.so(_ZN5TRint15HandleTermInputEv+0x21b)[0x7f48e751b66b]
/u/apps/root/5.34.36/root/lib/libCore.so(_ZN11TUnixSystem16CheckDescriptorsEv+0x14e)[0x7f48e6d652fe]
/u/apps/root/5.34.36/root/lib/libCore.so(_ZN11TUnixSystem16DispatchOneEventEb+0xd3)[0x7f48e6d655e3]
/u/apps/root/5.34.36/root/lib/libCore.so(_ZN7TSystem9InnerLoopEv+0x16)[0x7f48e6dcae66]
/u/apps/root/5.34.36/root/lib/libCore.so(_ZN7TSystem3RunEv+0x7b)[0x7f48e6dcc8eb]
/u/apps/root/5.34.36/root/lib/libCore.so(_ZN12TApplication3RunEb+0x1f)[0x7f48e6d6fabf]
/u/apps/root/5.34.36/root/lib/libRint.so(_ZN5TRint3RunEb+0x294)[0x7f48e751cbd4]
/u/apps/root/5.34.36/root/bin/root.exe(main+0x4c)[0x40107c]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x3759c1ed5d]
/u/apps/root/5.34.36/root/bin/root.exe[0x400f49]
What is going wrong with my code?
When I remove:
tree[i]->GetEntry(j);
the code does not crash. But I need to call the values of each entry.
Thanks
Sharey