CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
diff_provenance.py
Go to the documentation of this file.
1 from __future__ import print_function
2 from builtins import range
3 class difference :
4 
5  def __init__(self,v):
6  self.verbose = v
7 
8  def list_diff(self,aList1, aList2, string1, string2):
9  "Searches for differences between two modules of the same kind"
10  for i in range(2,len(aList1)):
11  for j in range(2,len(aList2)):
12  if (i==j) and (aList1[i]!=aList2[j]):
13  if aList1[i][:(aList1[i].index('=')+1)] == aList2[j][:(aList2[j].index('=')+1)]:
14  if self.verbose==str(2) or self.verbose==str(1):
15  print(aList1[i][2:aList1[i].index('=')+1] + aList1[i][aList1[i].index('=')+1:]+' ['+ string1+']')
16  print(len(aList1[i][2:aList1[i].index('=')+1])*' '+aList2[j][aList2[j].index('=')+1:]+' ['+string2+']')
17  print('')
18 
19 
20  def module_diff(self,module1,module2, string1, string2):
21  "Searches for modules which are in both the files but whose parameters are setted at different values"
22  modulesfile1=[]
23  modulesfile2=[]
24  print('\nList of modules present in both the files with different parameter values\n')
25  for i in module1.keys():
26  for j in module2.keys():
27  if (i==j) and (module1[i]!=module2[j]):
28  print('Module: '+'"'+i+'"')
29  d=difference(self.verbose)
30  d.module=i
31  d.firstvalue=module1[i]
32  d.secondvalue=module2[j]
33  self.list_diff(d.firstvalue,d.secondvalue, string1, string2)
34  else: pass
35 
36  self.onefilemodules(module1,module2,'first')
37  self.onefilemodules(module2,module1,'second')
38 
39 
40  def onefilemodules(self,module1,module2,string):
41  "Searches for modules present only in one of the two files"
42  onlyonefile=False
43  for i in module1.keys():
44  if i not in module2:
45  if not onlyonefile:
46  print('\nModule present only in the '+string+ ' file:'+'\n')
47  onlyonefile = True
48  print('Module: '+'"'+i+'"')
49  if self.verbose==str(2):
50  for k in range(1,len(module1[i])):
51  print(module1[i][k])
52 
53 
const uint16_t range(const Frame &aFrame)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)