Hallo, im sure, there is an easy solution, i checked already the manual and didnt find it. i hope someone can halp me here!
i have an .root file. inside is a Tree that has 10 Branches. every Branch has about 100 integers.
i would like to add integers to this Branches. Here my code:
TreeExists is a bool, it just check, if the tree already exists;
if (!TreeExists)
{
Tree=new TTree(“T1”,“Tsample”);
}
Create another Tree in the same file or (better) in a different file and declare the second Tree to be a friend of the original Tree. See TTree::AddFriend
ok, it works, but its not a good solution, because i have very huge files, and if i use that method, it copies all the files+new files to a new tree and rewrite the old one. i would like to keep the old one and just add the new leafs.
i tried it with TChain, but it will not work )-;
NOOOOOOOOOOOOOOOO!
It should not copy the old Tree. Read carefully my message.
The new Tree should contain only the new branches. The old Tree and old file remains untouched.
[quote]hmm, it doent work, kan u check my code?[/quote]How does it fail?
To make it easier to distinguish them you should call your new TTree and your new leaves with a different name. i.e.[code]int a;
int b;
{
TFile *File=new TFile("~/T1.root",“recreate”);
TTree *Tree=new TTree(“T1”,“Tsample”);
Tree->Branch(“a”,&a,“a/I”);
Tree->Branch(“b”,&b,“b/I”);