Hello,
I am trying to loop over a TTree containing a vector branch and a vector. I defined some TTreeFormula-s and everything works fine for one file. However, as soon as the loop loads the second file, I end up getting the following error:
Fatal in : At> Logic error - no proxy object set.
aborting
I am calling UpdateFormulaLeaves when the tree switches. I’ll try to prepare a minimal example, but I was hoping someone can tell me what I’ve missed. The sort of code I have is like this:
TTreeFormula* boolSelection = new TTreeFormula("f","boolBranch",chain);
TTreeFormula* doubleVar = new TTreeFormula("f","doubleBranch",chain);
int cTreeNum = -1;
long nEntries = chain->GetEntries();
for(long i=0;i<nEntries;i++) {
chain->LoadTree(i);
if(cTreeNum != chain->GetTreeNumber()) {
boolSelection->UpdateFormulaLeaves();
doubleVar->UpdateFormulaLeaves();
cTreeNum=chain->GetTreeNumber();
cout << "update" << endl;
}
for(int j=0;j<boolSelection->GetNdata();j++) {
if(boolSelection->GetNdim()==0) continue;
if(boolSelection->EvalInstance(j)!=1) continue;
doubleVar->EvalInstance(j); //I do something with this value. If I comment this out, I don't have problems
}
}
Can anyone see what I’ve missed here?