CMS 3D CMS Logo

Functions | Variables

dqm_diff Namespace Reference

Functions

def collect_directory_filenames
def dqm_diff
def get_content

Variables

string dest = 'show_exec_time'
tuple parser = OptionParser(usage='usage: %prog <root_file1> <root_file2> [options]')
 Define commandline options.
tuple start = datetime.now()
 Check for commandline option errors.

Function Documentation

def dqm_diff::collect_directory_filenames (   directory,
  names_list 
)
Adds current directory file (histogram) names to ``names_list``. Then
recursively calls itself for every current directory sub-directories.

Definition at line 11 of file dqm_diff.py.

00012                                                       :
00013     """Adds current directory file (histogram) names to ``names_list``. Then
00014     recursively calls itself for every current directory sub-directories."""
00015     for key in directory.GetListOfKeys():
00016         subdir = directory.Get(key.GetName())
00017         if subdir:
00018             if subdir.IsFolder():
00019                 collect_directory_filenames(subdir, names_list)
00020             else:
00021                 filename = directory.GetPath().split(':')[1] + ': ' + subdir.GetName()
00022                 names_list.add(filename)

def dqm_diff::dqm_diff (   filename1,
  filename2 
)
Prints file (histogram) names that are in <file1> and not in <file2>.

Definition at line 33 of file dqm_diff.py.

00034                                   :
00035     """Prints file (histogram) names that are in <file1> and not in <file2>."""
00036     print "Missing files:"
00037     content1 = get_content(filename1)
00038     content2 = get_content(filename2)
00039     printed = False
00040     for name in content1:
00041         if name not in content2:
00042             print "  ->", name
00043             printed = True
00044     if not printed:
00045         print "    All files match."
00046 

def dqm_diff::get_content (   root_file_name)
Returns all file (histogram) names, which are found in <root_file_name>.

Definition at line 23 of file dqm_diff.py.

00024                                :
00025     """Returns all file (histogram) names, which are found in <root_file_name>."""
00026     from ROOT import TFile
00027     root_file = TFile(root_file_name)
00028     root_directory = root_file.GetDirectory("DQMData")
00029     filename_set = set()
00030     collect_directory_filenames(root_directory, filename_set)
00031     root_file.Close()
00032     return filename_set


Variable Documentation

string dqm_diff::dest = 'show_exec_time'

Definition at line 50 of file dqm_diff.py.

tuple dqm_diff::parser = OptionParser(usage='usage: %prog <root_file1> <root_file2> [options]')

Define commandline options.

Definition at line 48 of file dqm_diff.py.

tuple dqm_diff::start = datetime.now()

Check for commandline option errors.

Execute the search of dismatches in two root fies.

Definition at line 58 of file dqm_diff.py.