3 from __future__
import print_function
7 execfile(
"geometryXMLparser.py")
8 execfile(
"plotscripts.py")
13 if len(cargs) < 5
or len(cargs) > 7:
14 print(
"Draws differences between two xml geometries (or between single xml geometry and ideal) for all six variables.")
15 print(
"usage: ./diffTwoXMLs.py label selector geom2.xml geom1.xml report2.py report1.py")
16 print(
"or ./diffTwoXMLs.py label selector geom2.xml geom1.xml report.py")
17 print(
"or ./diffTwoXMLs.py label selector geom.xml report.py")
18 print(
"where selector is one of ALL, DT, CSC, CSCE1, CSCE2")
19 print(
"The label will be included into the filename as diffTwoXMLs_label_selector.png")
21 print(
"Special consistency test mode with respect to corrections in the report:")
22 print(
"If the label starts with \"vsReport_\", the delta corrections from report2 would be substracted from the XML differences.")
24 print(
"./diffTwoXMLs.py diffReport_label selector geom2.xml geom1.xml report.py")
28 def ALL(dt, wheel, station, sector):
return True
30 def ALL(csc, endcap, station, ring, chamber):
return True
32 def DT(dt, wheel, station, sector):
return dt ==
"DT"
33 def DT_st1(dt, wheel, station, sector):
return dt ==
"DT" and station == 1
34 def DT_st2(dt, wheel, station, sector):
return dt ==
"DT" and station == 2
35 def DT_st3(dt, wheel, station, sector):
return dt ==
"DT" and station == 3
36 def DT_st4(dt, wheel, station, sector):
return dt ==
"DT" and station == 4
38 def CSC(csc, endcap, station, ring, chamber):
return csc ==
"CSC"
39 def CSCE1(csc, endcap, station, ring, chamber):
return csc ==
"CSC" and endcap==1
40 def CSCE2(csc, endcap, station, ring, chamber):
return csc ==
"CSC" and endcap==2
45 if label.find(
"vsReport_") == 0: diffReport =
True
51 reportfile2 = cargs[4]
58 reportfile2 = cargs[5]
59 g1 = MuonGeometry(xmlfile1)
65 reportfile2 = cargs[5]
66 reportfile1 = cargs[6]
67 g1 = MuonGeometry(xmlfile1)
71 g2 = MuonGeometry(xmlfile2)
75 c1 = ROOT.TCanvas(
"c1",
"c1",1000,600)
81 eval(
"DBdiff(g2, g1, r2, r1, %s, selection=%s, phi=False, bins=251)" % (ranges, selection))
85 ranges =
"window=0.02"
86 eval(
"DBdiff(g2, g1, r2, r1, %s, selection=%s, phi=False, bins=1001, reportdiff=True, inlog=True)" % (ranges, selection))
90 c1.Print(
"diffTwoXMLs_%s_%s.png" % (label, selection))