Dear experts,
I hava a root file with many trees. I used MakeClass
to get the header file using one of Trees where I have n number of branches. In other trees, I have less than n branches.
When I read the other branches, with the same header file, it gives me messages for the branch which is not present in the current tree like:
Error in <TTree::SetBranchAddress>: unknown branch -> ElectronRecoWeightUp01sigma
How I can skip this warning messages?
Also, I can see for each Trees there are two entries. I am unable to get rid of duplicates.
For now I am using hadd to get rid of duplicates on the output of current root file. But, for large root file it does not removes all duplicate trees. I need to do hadd two times to get rid of all duplicates.
I am doing the following
#include "interface/flashgg_MC.h" // got from Make class
#include "interface/output.h" // variables need to append in output root file.
.
.
.
// grab all trees from input root files.
// loop over all trees:
for (std::vector<TString>::iterator OldTreeName = Vec_ListOfAllTrees.begin(); OldTreeName != Vec_ListOfAllTrees.end(); ++OldTreeName)
{
TTree *OldTree = (TTree*)OldRootFile->Get(TString(*OldTreeName));
flashgg_MC flashggReader(OldTree);
auto newtree = OldTree->CloneTree(0);
output outputVars = output(newtree);
.
.
for (Long64_t jentry=0; jentry<OldTree->GetEntries();;jentry++)
{
.
.
// Filling some additional variables.
newtree->Fill();
}
}
newtree->Write("",TObject::kOverwrite);
newfile->Write();
delete OldTree;
You can see my full code here: ReRunFHJetSelection.C, flashgg_MC.h
ROOT Version: 6.14/09
Platform: Lxplus
Compiler: Not Provided