Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:56

0001 from __future__ import print_function
0002 import sys
0003 if len(sys.argv) !=3 :
0004   print("usage:" + sys.argv[0] + "   bla bla")
0005   exit
0006 # go
0007 mm=0.
0008 n=0
0009 ave=0
0010 tot=0
0011 ln=0
0012 ml=0
0013 file1 = open(sys.argv[1])
0014 file2 = open(sys.argv[2])
0015 for l1 in file1.readlines() :
0016     ln+=1
0017     l2 = file2.readline()
0018     a1 =l1.split('(')
0019     a2 = l2.split('(')
0020     if len(a1)<2 :
0021         continue
0022     p1 = a1[1].split(',')
0023     p1[2] = p1[2].rstrip(') \n')
0024     p2 = a2[1].split(',')
0025     p2[2] = p2[2].rstrip(') \n')
0026     f1 = [float(i) for i in p1]
0027     f2 = [float(i) for i in p2]
0028     diff = []
0029     tot+=1
0030     for i in range(len(f1)):
0031         diff.append(f1[i]-f2[i])
0032     for x in diff:
0033         if (abs(x)>mm):
0034             mm=x
0035             ml=ln
0036         if (x!=0) :
0037             n+=1
0038             ave+=abs(x)
0039 print(tot, mm, n, ave/n)
0040 #
0041 ml = ml-5
0042 file1.seek(0)
0043 file2.seek(0)
0044 l1 = file1.readlines()
0045 l2 = file2.readlines()
0046 for i in range(10) :
0047     print(l1[ml+i].rstrip('\n'))
0048     print(l2[ml+i].rstrip('\n'))