Hi,
I have an annoying problem when I try to copy a tree…
My aim is to copy/clone a tree from a ntuple and add some additional branches with reprocessed data. Copying most of the original tree and adding the additional branches works, but of all things the branches used for reprocessing are empty in the output file?!
The original tree is cloned and several branches are pointed to variables to use them while looping over the events
TFile outputFile(sOutputName,"recreate");
TTree * outputTree = inputTree.CloneTree(0);
...
Double_t BranchInUse1 = 0.;
inputTree.SetBranchAddress("BranchInUse1",&BranchInUse1);
...
I add branches to held the reprocessed elements
Double_t BranchReprocessed1 = 0.;
outputTree->Branch("BranchReprocessed1",&BranchReprocessed1,"/BranchReprocessed1/D");
and loop over my ntuple calculating the reprocessed elements from the original ones. For each event the output tree is filled with outputTree->Fill() and I also tried to add an additional AutoSave() every 100000 events.
The tree in my output file contains now the new branches BranchReprocessed1 etc plus the original branches that have not been used.
But all branches are empty when they have been approached with SetBranchAddress?! I guess that something went wrong with my CloneTree() but at the moment I do not see, where I have messed my code up
Maybe somebody has an idea?
Cheers & Thanks,
Thomas