I’m having a very odd problem. I have the following code:
fSubEvents = new TChain("CMSJetSubTree", "sub tree");
fSubEvents->Add(Form("%s/%s", fDir->Data(), fEvent->GetSubFile()));
printf("Added %s/%s\n", fDir->Data(), fEvent->GetSubFile());
fSubEvents->Print();
fSubEvents->GetEntry(fSubEvents->LoadTree(0));
fSubEvents->SetBranchAddress("CMSJetEventInfo", &fEventInfo);
fSubEvents->SetBranchAddress("CMSJet", &fSubJet);
fSubEvents->SetBranchAddress("CMSJetInfo", &fSubJetInfo);
fSubEvents->GetEntry(fSubEvents->LoadTree(0)); // Crashes here
When originally tested, this code worked, but adding a friend to an unrelated tree (which stores the fEvent branch) causes it to crash.
I’ve verified that the same file is loaded in both cases and that the requested branches are in the chain.
Also interesting is that it crashes on the second GetEntry() rather than the first.
The tree that is having a friend added is stored in the same file as the tree loaded into
fSubEvents, but I can’t think of a reason that would matter.
Is there something I’m missing? What would make GetEntry() crash?