Hi experts,
I am trying to run a “flattener” over a TTree I have made using my own event loop, but when I run tchain->GetEntry(X) I get a segfault. I have been smashing my head against this for way to long and can’t figure out what exactly is going wrong. I hope someone can help expand my knowledge.
Steps to recreate this bug.
Run Interacitvely
.L ShortTreeReader.C
TreeReader()
I may as well include ShortTreeReader.C here, as it is simple enough.
` 1 #include "EventRecord.h" `
2
3 #ifndef CalibTreeReader_H
4 #define CalibTreeReader_H
5
6 void TreeReader(){
7 //TFile* f = new TFile("CalibTree_RSources_wbkg_test.root");
8 string outname = "test";
9 TChain* ch = new TChain("calibTree/CalibrationRecordTree");
10 ch->Add("CalibTree_RSources_wbkg_test.root");
11 EventRecord::EventRecord* event;
12 ch->SetBranchAddress("event_records", &event);
13 std::cout<<"43\n";
14
15 Int_t mevt = ch->GetEntries();
16
17 for(int nevt=0; nevt<mevt; ++nevt){
18 ch->GetEntry(nevt);
19 std::cout<<"Successs. The Run Number is :"<<event->run<<"\n";
20 }
21
22
23 }
24
25 #endif
`
I have a single event available for use in testing, the event class, and the tree reader at
https://drive.google.com/open?id=1I8iFyqdXc3OFLt646joSDBt82RcPGjsJ
I have confirmed that it is in GetEntry that the segfault happens, but I am inexperienced with using gdb on interpreted root macros and have been unable to progress further.
The stack trace from the crash is
https://paste.fedoraproject.org/paste/nTS0H3Gq7XWDx1yQpQhA6A
Cheers, and thanks in advance for any help offered.
-Jason
ROOT Version (e.g. 6.12/02):
Fedora 27, gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)