Again referring to this previous topic, I’m now trying something like this:
TFile recoverFullSumFile(fullSumPath, "update");
recoverFullSumFile.Write();
recoverFullSumFile.Close();
TFile fullSumFile(fullSumPath, "update");
TTree * fullSumTree = 0;
summaryClass * fullSum = 0;
unsigned int entryCount;
if (!fullSumFile.GetNkeys()) {
fullSumTree = new TTree("treeName", "treeName");
fullSumTree -> SetAutoSave(377625 / 10);
fullSumTree -> Branch("summary", & fullSum);
entryCount = 0;
} else {
fullSumTree = (TTree *) fullSumFile.Get("treeName");
fullSumTree -> SetBranchAddress("summary", & fullSum);
entryCount = fullSumTree -> GetEntries();
}
I think this should work. But if not, why? Calling the same file twice like this, should I replace recoverFullSumFile.Close()
with recoverFullSumFile.Close("R")
?