I have several root files with many histograms and the histograms have different name. I want to copy all these histogram in one root file.
Please notice that I do not want to add the histogram, I want to keep them separate, and have all of them in a single root file.
Is there an option to do that, or do you have an idea on how I can achieve that?
$ rootcp -h
usage: rootcp [-h] [-c COMPRESS] [--recreate] [-r] [--replace]
SOURCE [SOURCE ...] DEST
Copy objects from ROOT files into an other
positional arguments:
SOURCE Source file
DEST Destination file
optional arguments:
-h, --help show this help message and exit
-c COMPRESS, --compress COMPRESS
change the compression settings of the destination
file (if not already existing).
--recreate recreate the destination file.
-r, --recursive recurse inside directories
--replace replace object if already existing
Examples:
- roocp source.root:hist* dest.root
Copy all histograms whose named starts with 'hist' from 'source.root' to 'dest.root'.
- roocp source1.root:hist1 source2.root:hist2 dest.root
Copy histograms 'hist1' from 'source1.root' and 'hist2' from 'source2.root' to 'dest.root'.
- roocp --recreate source.root:hist dest.root
Recreate the destination file 'dest.root' and copy the histogram named 'hist' from 'source.root' into it.
- roocp -c 1 source.root:hist dest.root
Change the compression factor of the destination file 'dest.root' if not existing and copy the histogram named 'hist' from 'source.root' into it.
than you for your answer, but when I doing “rootcp -h” I have the error message “rools: command not found”.
I’m using ROOT 6.02/05. Do you know how I can solve this?
I did not see it in my $ROOTSYS/bin/, shouldn’t it been automatically install with root?
I did not find many tutorial on this, can you please tell me (or point my a web site) how to install it?
From where do you get ROOT version 6.02/05?
By the way the command line tools are only available from master branch. The first version to include them is 6.05.
I was confused by one of your comments that ‘rootcp’ was there and not ‘roots’. It seems that you have nothing since you are using 6.02. So in this case you have two options:
Install latest version of ROOT (6.05.02) and the follow the suggestion from Olivier
I noticed a mistake today and already correct it in the master. The new commands line programs were installed in the wrong place. Please use $ROOTSYS/bin/bin/rootcp -h
positional arguments:
SOURCE Source file
DEST Destination file
optional arguments:
-h, --help show this help message and exit
-c COMPRESS, --compress COMPRESS
change the compression settings of the destination
file (if not already existing).
–recreate recreate the destination file.
-r, --recursive recurse inside directories
–replace replace object if already existing
Examples:
roocp source.root:hist* dest.root
Copy all histograms whose named starts with ‘hist’ from ‘source.root’ to ‘dest.root’.
roocp source1.root:hist1 source2.root:hist2 dest.root
Copy histograms ‘hist1’ from ‘source1.root’ and ‘hist2’ from ‘source2.root’ to ‘dest.root’.
roocp --recreate source.root:hist dest.root
Recreate the destination file ‘dest.root’ and copy the histogram named ‘hist’ from ‘source.root’ into it.
roocp -c 1 source.root:hist dest.root
Change the compression factor of the destination file ‘dest.root’ if not existing and copy the histogram named ‘hist’ from ‘source.root’ into it.
WARNING: Same name objects aren't supported: 'some_name_with_pattern' of 'source.root' won't be processed
The object some_name_with_pattern usually has multiple versions: ;1, ;2 etc. I would like to copy just the latest version but I don’t want to hardcode the version and would like to use just *pattern* while copying.