3 Script prints out histogram names that are in one ROOT file but not in another.
5 Author: Albertas Gimbutas, Vilnius University (LT)
6 e-mail: albertasgim@gmail.com
8 from __future__
import print_function
9 from datetime
import datetime, timedelta
10 from optparse
import OptionParser
13 """Adds current directory file (histogram) names to ``names_list``. Then
14 recursively calls itself for every current directory sub-directories."""
15 for key
in directory.GetListOfKeys():
16 subdir = directory.Get(key.GetName())
21 filename = directory.GetPath().
split(
':')[1] +
': ' + subdir.GetName()
22 names_list.add(filename)
25 """Returns all file (histogram) names, which are found in <root_file_name>."""
26 from ROOT
import TFile
27 root_file = TFile(root_file_name)
28 root_directory = root_file.GetDirectory(
"DQMData")
35 """Prints file (histogram) names that are in <file1> and not in <file2>."""
36 print(
"Missing files:")
41 if name
not in content2:
45 print(
" All files match.")
49 parser = OptionParser(usage=
'usage: %prog <root_file1> <root_file2> [options]')
50 parser.add_option(
'-t',
'--time', action=
'store_true', default=
False,
51 dest=
'show_exec_time', help=
'Show execution time.')
52 (options, args) = parser.parse_args()
56 parser.error(
"You have to specify two root files. e.g. ``dqm_diff.py file1.root file2.root``.")
59 start = datetime.now()
61 if options.show_exec_time:
62 print(
'Execution time:',
str(timedelta(seconds=(datetime.now() - start).seconds)))
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def collect_directory_filenames