Dear rooters,
I have a code based on MakeClass, the code is designed to access a tree from a root file that has many trees,
I would like to access and process a second tree that contains few events to get a number, so in Notify function
{
vector *PDF4LHC15 = nullptr;
TTree inputtree = nullptr;
input->GetObject(“PDFsumWeights”, inputtree);
inputtree->SetBranchStatus("", 0);
inputtree->SetBranchStatus(“PDF4LHC15_nlo_30”, 1);
inputtree->SetBranchAddress(“PDF4LHC15_nlo_30”, &PDF4LHC15);
int lastEntry = inputtree->GetEntries();
for (int iEvent = 0; iEvent < lastEntry; ++iEvent) {
Long64_t ientry = inputtree->LoadTree(iEvent);
if (ientry < 0) {
break;
}
inputtree->GetEntry(iEvent);
//the following to extract a useful number
// if (Normalization.size() == 0) {
// Normalization.resize(PDF4LHC15->size());
// }
//
// for (size_t i = 0; i < PDF4LHC15->size(); i++) {
// Normalization[i] += (*PDF4LHC15)[i];
// cout << Normalization[i] << " ";
// }
}
PDF4LHC15 = nullptr;
inputtree = nullptr;
input = nullptr;
delete PDF4LHC15;
delete inputtree;
delete input;
return kTRUE;
}
The code compiles and works fine for one root file. However when it access the second root file it crashes and the crash occurs exactly at
inputtree->GetEntry(iEvent);
If I comment this line it runs without problem but the code turns useless.
Any idea how to solve this problem.
Cheers