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