Rewrite a branch of a tree

Hi all,
I have a question:
Now , I want to rewrite a branch of a tree. So I made a try like this :

     .... TTree m_Tree = fChain->CloneTree(0);

Then I loop all the entries.

for ( long64_t i=0;i < N;i++) {
  Weight_mc = 1; // for instance, Weight_mc is a branch

then I tries to store m_Tree :


But there is no entries in the output root file.
So ,Could you tell me what is the wrong ?

Thank you very much!

1 Like

See here how to post code in the forum.

maybe the tree tutorials can help. There are a few that show how to clone or copy a tree. Once you can correctly copy the tree, you can modify the code to call tree->SetBranchAddress before the loop over events to set the branch you need to modify to read a new variable that you can set to the desired values.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.