Hello,
I have a root containing a tree and other histograms, I want to copy the tree to a new file. This sounds very normal and general task. I am using
“TopologicalVariables” is the tree name. However, when I open the created file, and try to tree->Scan(), ROOT crashes and exits with errors:
I try to open the test.root and no problem to tree->Scan(), but I still doubt the problem is from my test.root, I don’t know why. I have tried the root versions:
v5_12_00_treftable_glibc_232_dzero
v4_04_02b_fbits_trefarray7_eh-GCC_3_4_3-opt
Here I want to uploaded my test files, but they are big 12 MB and 2.3 MB. I cannot upload them here. But fermilab people can look into my dir at D0 clued0 cluster:
[quote=“brun”]With your code you copy only the Tree header not the Tree baskets.
See examples of copying Trees in tutorials/tree, eg
TFile f("test.root");
TFile g("new.root", "RECREATE");
TTree *T = (TTree*)f.Get("TopologicalVariables");
T->CloneTree()->Write();
g.Close();
Rene[/quote]
Thanks. The approach above what I use is from slac.stanford.edu/BFROOT/www … reeCopy.cc
(SLAC’s root information center)
And I tried the approach you provided, it is not working with errors:
Error in TTree::Fill: Failed filling branch:TopologicalVariables.Tau_emcl_eta1, nbytes=-1
…
Each error is corresponding to each branch name in the tree and the last error is:
which is very weird, because I have full permission to the directory and each file.
By the way, as far as I can tell, the input root ‘test.root’ had another problem. It is created by merging from small root files by means of ‘hadd’ (‘hadd’ is in the root version v4_04_02b_fbits_trefarray7_eh-GCC_3_4_3-opt, D0 version), and then use new root version to split it into sub-root files. If I use lower root version (v4_04_02) to scan its tree data, everything looks good, however, once I use newer version, say v05-12 to scan tree data, I was told that
[quote=“brun”]Did you really execute the 5 statements that I was suggesting? it cannot be.
To save us time please send the complete script that you are executing.
[quote]where ‘/room/fun/project/zhiyil/my.root’ is the root file location before splitting. Actually, I have asked this problem here: root.cern.ch/phpBB2/viewtopic.ph … highlight= [/quote]I thought this problem was resolved?
[quote]Error in TFile::TFile: file /room/fun/project/zhiyil/my.root does not exist[/quote]There is only 3 things I could think of that would lead to this error message.[ul]You have a friend tree declared by name
You wrote a TChain
You redirected one of the branches (of the original tree) to a different file (my.root)[/ul].
Without a complete running (and failing ) example, I doubt we will be able to make much further progress in understanding this problem.