CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Attributes
python.diffProv.difference Class Reference

Public Member Functions

def __init__
 
def list_diff
 
def module_diff
 
def onefilemodules
 

Public Attributes

 verbose
 

Private Attributes

 _diffprocess
 
 _sameprocess
 

Detailed Description

Definition at line 2 of file diffProv.py.

Constructor & Destructor Documentation

def python.diffProv.difference.__init__ (   self,
  v 
)

Definition at line 4 of file diffProv.py.

4 
5  def __init__(self,v):
6  self.verbose = v
7  self._diffprocess=[]
self._sameprocess=()

Member Function Documentation

def python.diffProv.difference.list_diff (   self,
  aList1,
  aList2,
  string1,
  string2 
)

Definition at line 8 of file diffProv.py.

References getHLTprescales.index, python.diff_provenance.difference.verbose, python.diffProv.difference.verbose, CSCTFanalyzer.verbose, DQMGenericTnPClient.verbose, dqmTnP::AbstractFitter.verbose, ElectronStudy.verbose, MuonMillepedeAlgorithm.verbose, DeviationsFromFileSensor2D.verbose, HIPAlignmentAlgorithm.verbose, FFTJetLookupTableESProducer< CT >.verbose, FFTJetCorrectionESProducer< CT >.verbose, and OpticalObject.verbose.

Referenced by python.diffProv.difference.module_diff().

8 
9  def list_diff(self,aList1, aList2, string1, string2):
10  "Searches for differences between two modules of the same kind"
11  differences=[]
12  for i in range(2,len(aList1)):
13  for j in range(2,len(aList2)):
14  if (i==j) and (aList1[i]!=aList2[j]):
15  if aList1[i][:(aList1[i].index('=')+1)] == aList2[j][:(aList2[j].index('=')+1)]:
16  if self.verbose==str(2) or self.verbose==str(1):
17  str1 = aList1[i][2:aList1[i].index('=')+1] + aList1[i][aList1[i].index('=')+1:]+' ['+ string1+']'
18  str2 = len(aList1[i][2:aList1[i].index('=')+1])*' '+aList2[j][aList2[j].index('=')+1:]+' ['+string2+']'
19  print str1,'\n',str2,'\n'
20  differences.append(str1)
21  differences.append(str2)
22 
23  return differences
def python.diffProv.difference.module_diff (   self,
  module1,
  module2,
  string1,
  string2 
)

Definition at line 24 of file diffProv.py.

References python.diffProv.difference._diffprocess, python.diffProv.difference._sameprocess, python.diff_provenance.difference.list_diff(), python.diffProv.difference.list_diff(), python.diff_provenance.difference.onefilemodules(), python.diffProv.difference.onefilemodules(), split, python.diff_provenance.difference.verbose, python.diffProv.difference.verbose, CSCTFanalyzer.verbose, DQMGenericTnPClient.verbose, dqmTnP::AbstractFitter.verbose, ElectronStudy.verbose, MuonMillepedeAlgorithm.verbose, DeviationsFromFileSensor2D.verbose, HIPAlignmentAlgorithm.verbose, FFTJetLookupTableESProducer< CT >.verbose, FFTJetCorrectionESProducer< CT >.verbose, and OpticalObject.verbose.

24 
25  def module_diff(self,module1,module2, string1, string2):
26  "Searches for modules which are in both the files but whose parameters are setted at different values"
27  print '\nList of modules present in both the files with different parameter values\n'
28  for i in module1.keys():
29  for j in module2.keys():
30  if (i==j) and (i=='Processing'):
31  list= module1[i]
32  for k in range(len(list)):
33  process1=module1[i][k].split()
34  process2=module2[i][k].split()
35  if process1[0]!= process2[0]:
36  key1=process1[0]
37  key2=process2[0]
38  self._diffprocess.append( (key1,key2) )
39 
40  if len(self._diffprocess)>1:
41  print 'Differences in the processing history'
42  for l,m in self._diffprocess:
43  print l+' ['+string1+']'
44  print m+' ['+string2+']'
45  print ''
46  if len(self._diffprocess)==1:
47  self._sameprocess=self._diffprocess[0]
48 
49  elif ( (i==j)or (i,j)==self._sameprocess ) and (i!='Processing'):
50  for name1,value1 in module1[i]:
51  for name2,value2 in module2[j]:
52  if (name1==name2) and (value1[1:]!=value2[1:]):
53  print 'Process: '+'"'+i+'"'+'\n'+'Module: '+'"'+name1+'"'+'\n'
54  d=difference(self.verbose)
55  d.firstvalue=value1
56  d.secondvalue=value2
57  self.list_diff(d.firstvalue,d.secondvalue, string1, string2)
58 
59  self.onefilemodules(module1,module2,'first')
60  self.onefilemodules(module2,module1,'second')
61 
double split
Definition: MVATrainer.cc:139
def python.diffProv.difference.onefilemodules (   self,
  module1,
  module2,
  string 
)

Definition at line 62 of file diffProv.py.

References python.diffProv.difference._sameprocess, python.diff_provenance.difference.verbose, python.diffProv.difference.verbose, CSCTFanalyzer.verbose, DQMGenericTnPClient.verbose, dqmTnP::AbstractFitter.verbose, ElectronStudy.verbose, MuonMillepedeAlgorithm.verbose, DeviationsFromFileSensor2D.verbose, HIPAlignmentAlgorithm.verbose, FFTJetLookupTableESProducer< CT >.verbose, FFTJetCorrectionESProducer< CT >.verbose, and OpticalObject.verbose.

Referenced by python.diffProv.difference.module_diff().

62 
63  def onefilemodules(self,module1,module2,string):
64  "Searches for modules present only in one of the two files"
65  print '\nModules run only on the '+string+ ' edmfile:'+'\n'
66  for i in module1.keys():
67  labelList=[]
68  if (i not in module2.keys())and (i not in self._sameprocess):
69  print '\n Process '+i+' not run on edmfile '+string +'\n'
70  elif i!='Processing':
71  k=i
72  if i in self._sameprocess:
73  if i==self._sameprocess[0]:
74  k= self._sameprocess[1]
75  elif i==self._sameprocess[1]:
76  k= self._sameprocess[0]
77  labelList2=[module[0] for module in module2[k]]
78  labelList1=[module[0] for module in module1[i]]
79  for name, value in module1[i] :
80  if (name not in labelList2):
81  print 'Process: '+'"'+i+'"'+'\n'+'Module: '+'"'+name+'"'
82  if self.verbose==str(2):
83  for k in value[1:]:
84  print k
85 
86 
87 

Member Data Documentation

python.diffProv.difference._diffprocess
private

Definition at line 6 of file diffProv.py.

Referenced by python.diffProv.difference.module_diff().

python.diffProv.difference._sameprocess
private

Definition at line 7 of file diffProv.py.

Referenced by python.diffProv.difference.module_diff(), and python.diffProv.difference.onefilemodules().

python.diffProv.difference.verbose

Definition at line 5 of file diffProv.py.

Referenced by python.diffProv.difference.list_diff(), python.diffProv.difference.module_diff(), and python.diffProv.difference.onefilemodules().