CMS 3D CMS Logo

Functions | Variables
dqm_diff Namespace Reference

Functions

def collect_directory_filenames (directory, names_list)
 
def dqm_diff (filename1, filename2)
 
def get_content (root_file_name)
 

Variables

 action
 
 args
 
 default
 
 dest
 
 help
 
 options
 
 parser
 Define commandline options. More...
 
 seconds
 
 start
 Check for commandline option errors. More...
 
 usage
 

Detailed Description

Script prints out histogram names that are in one ROOT file but not in another.

Author:  Albertas Gimbutas,  Vilnius University (LT)
e-mail:  albertasgim@gmail.com

Function Documentation

◆ collect_directory_filenames()

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 12 of file dqm_diff.py.

12 def collect_directory_filenames(directory, names_list):
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())
17  if subdir:
18  if subdir.IsFolder():
19  collect_directory_filenames(subdir, names_list)
20  else:
21  filename = directory.GetPath().split(':')[1] + ': ' + subdir.GetName()
22  names_list.add(filename)
23 

References cms::dd.split().

Referenced by get_content().

◆ dqm_diff()

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

Definition at line 34 of file dqm_diff.py.

34 def dqm_diff(filename1, filename2):
35  """Prints file (histogram) names that are in <file1> and not in <file2>."""
36  print("Missing files:")
37  content1 = get_content(filename1)
38  content2 = get_content(filename2)
39  printed = False
40  for name in content1:
41  if name not in content2:
42  print(" ->", name)
43  printed = True
44  if not printed:
45  print(" All files match.")
46 
47 

References get_content(), and edm.print().

◆ get_content()

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

Definition at line 24 of file dqm_diff.py.

24 def get_content(root_file_name):
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")
29  filename_set = set()
30  collect_directory_filenames(root_directory, filename_set)
31  root_file.Close()
32  return filename_set
33 

References collect_directory_filenames().

Referenced by dqm_diff().

Variable Documentation

◆ action

dqm_diff.action

Definition at line 50 of file dqm_diff.py.

◆ args

dqm_diff.args

Definition at line 52 of file dqm_diff.py.

◆ default

dqm_diff.default

Definition at line 50 of file dqm_diff.py.

◆ dest

dqm_diff.dest

Definition at line 51 of file dqm_diff.py.

◆ help

dqm_diff.help

Definition at line 51 of file dqm_diff.py.

◆ options

dqm_diff.options

Definition at line 52 of file dqm_diff.py.

◆ parser

dqm_diff.parser

Define commandline options.

Definition at line 49 of file dqm_diff.py.

◆ seconds

dqm_diff.seconds

Definition at line 62 of file dqm_diff.py.

◆ start

dqm_diff.start

Check for commandline option errors.

Execute the search of dismatches in two root fies.

Definition at line 59 of file dqm_diff.py.

◆ usage

dqm_diff.usage

Definition at line 49 of file dqm_diff.py.

cms::dd::split
std::vector< std::string_view > split(std::string_view, const char *)
dqm_diff.dqm_diff
def dqm_diff(filename1, filename2)
Definition: dqm_diff.py:34
dqm_diff.get_content
def get_content(root_file_name)
Definition: dqm_diff.py:24
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
dqm_diff.collect_directory_filenames
def collect_directory_filenames(directory, names_list)
Definition: dqm_diff.py:12