- #1
ChrisVer
Gold Member
- 3,378
- 464
Suppose I have a collection of 40 directories, each containing 1, 2 ,3 ,4 or 5 .root files with histograms and trees.
What is an optimal way to merge those .root files so I would end up with 40 directories and 40 root files with the histos added together?
One way I thought of was to start typing for the 40 different directories an "hadd" command in the terminal.
"hadd sum1.root dir1/*.root"
"hadd sum2.root dir2/*.root"
...
"hadd sum40.root dir40/*.root"
However I find this kind of tiring and stupid. Do you have any better solution?
My problem with a macro is that I am not sure if it understands the *.root notation (so I cannot think of iterating).
Finally I am not sure if a TChain can, apart from Trees in different root files, merge TH1s (histograms) too.
THanks :)
What is an optimal way to merge those .root files so I would end up with 40 directories and 40 root files with the histos added together?
One way I thought of was to start typing for the 40 different directories an "hadd" command in the terminal.
"hadd sum1.root dir1/*.root"
"hadd sum2.root dir2/*.root"
...
"hadd sum40.root dir40/*.root"
However I find this kind of tiring and stupid. Do you have any better solution?
My problem with a macro is that I am not sure if it understands the *.root notation (so I cannot think of iterating).
Finally I am not sure if a TChain can, apart from Trees in different root files, merge TH1s (histograms) too.
THanks :)