Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:47

0001 #! /usr/bin/env python3
0002 
0003 from __future__ import print_function
0004 import sys, ROOT
0005 ROOT.gROOT.SetBatch(1)
0006 
0007 execfile("geometryXMLparser.py")
0008 execfile("plotscripts.py")
0009 
0010 
0011 cargs = sys.argv[:]
0012 
0013 if len(cargs) < 5 or len(cargs) > 7:
0014   print("Draws differences between two xml geometries (or between single xml geometry and ideal) for all six variables.")
0015   print("usage: ./diffTwoXMLs.py label selector geom2.xml geom1.xml report2.py report1.py")
0016   print("or     ./diffTwoXMLs.py label selector geom2.xml geom1.xml report.py")
0017   print("or     ./diffTwoXMLs.py label selector geom.xml report.py")
0018   print("where selector is one of ALL, DT, CSC, CSCE1, CSCE2")
0019   print("The label will be included into the filename as diffTwoXMLs_label_selector.png")
0020   print("")
0021   print("Special consistency test mode with respect to corrections in the report:")
0022   print("If the label starts with \"vsReport_\", the delta corrections from report2 would be substracted from the XML differences.")
0023   print("Example:")
0024   print("./diffTwoXMLs.py diffReport_label selector geom2.xml geom1.xml report.py")
0025   sys.exit()
0026 
0027 
0028 def ALL(dt, wheel, station, sector): return True
0029 
0030 def ALL(csc, endcap, station, ring, chamber): return True
0031 
0032 def DT(dt, wheel, station, sector): return dt == "DT"
0033 def DT_st1(dt, wheel, station, sector): return dt == "DT" and station == 1
0034 def DT_st2(dt, wheel, station, sector): return dt == "DT" and station == 2
0035 def DT_st3(dt, wheel, station, sector): return dt == "DT" and station == 3
0036 def DT_st4(dt, wheel, station, sector): return dt == "DT" and station == 4
0037 
0038 def CSC(csc, endcap, station, ring, chamber): return csc == "CSC"
0039 def CSCE1(csc, endcap, station, ring, chamber): return csc == "CSC" and endcap==1
0040 def CSCE2(csc, endcap, station, ring, chamber): return csc == "CSC" and endcap==2
0041 
0042 
0043 label = cargs[1]
0044 diffReport = False
0045 if label.find("vsReport_") == 0: diffReport = True
0046 
0047 selection = cargs[2]
0048 
0049 if len(cargs) == 5:
0050   xmlfile2 = cargs[3]
0051   reportfile2 = cargs[4]
0052   g1 = None
0053   r1 = None
0054 
0055 if len(cargs) == 6:
0056   xmlfile2 = cargs[3]
0057   xmlfile1 = cargs[4]
0058   reportfile2 = cargs[5]
0059   g1 = MuonGeometry(xmlfile1)
0060   r1 = None
0061 
0062 if len(cargs) == 7:
0063   xmlfile2 = cargs[3]
0064   xmlfile1 = cargs[4]
0065   reportfile2 = cargs[5]
0066   reportfile1 = cargs[6]
0067   g1 = MuonGeometry(xmlfile1)
0068   execfile(reportfile1)
0069   r1 = reports
0070 
0071 g2 = MuonGeometry(xmlfile2)
0072 execfile(reportfile2)
0073 r2 = reports
0074 
0075 c1 = ROOT.TCanvas("c1","c1",1000,600)
0076 
0077 if not diffReport: 
0078   # normal XML diff mode
0079   ranges = "window=10"
0080   #if selection=="DT": ranges = "windows=[25.,5,1.,1.,5.,5.]"
0081   eval("DBdiff(g2, g1, r2, r1, %s, selection=%s, phi=False, bins=251)" % (ranges, selection))
0082 
0083 else:
0084   # Special consistency test mode with respect to corrections in the report:
0085   ranges = "window=0.02"
0086   eval("DBdiff(g2, g1, r2, r1, %s, selection=%s, phi=False, bins=1001, reportdiff=True, inlog=True)" % (ranges, selection))
0087 
0088 
0089 c1.Update()
0090 c1.Print("diffTwoXMLs_%s_%s.png" % (label, selection))