Hi,
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.