CMS 3D CMS Logo

diffTwoXMLs.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 from __future__ import print_function
4 import sys, ROOT
5 ROOT.gROOT.SetBatch(1)
6 
7 execfile("geometryXMLparser.py")
8 execfile("plotscripts.py")
9 
10 
11 cargs = sys.argv[:]
12 
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")
20  print("")
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.")
23  print("Example:")
24  print("./diffTwoXMLs.py diffReport_label selector geom2.xml geom1.xml report.py")
25  sys.exit()
26 
27 
28 def ALL(dt, wheel, station, sector): return True
29 
30 def ALL(csc, endcap, station, ring, chamber): return True
31 
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
37 
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
41 
42 
43 label = cargs[1]
44 diffReport = False
45 if label.find("vsReport_") == 0: diffReport = True
46 
47 selection = cargs[2]
48 
49 if len(cargs) == 5:
50  xmlfile2 = cargs[3]
51  reportfile2 = cargs[4]
52  g1 = None
53  r1 = None
54 
55 if len(cargs) == 6:
56  xmlfile2 = cargs[3]
57  xmlfile1 = cargs[4]
58  reportfile2 = cargs[5]
59  g1 = MuonGeometry(xmlfile1)
60  r1 = None
61 
62 if len(cargs) == 7:
63  xmlfile2 = cargs[3]
64  xmlfile1 = cargs[4]
65  reportfile2 = cargs[5]
66  reportfile1 = cargs[6]
67  g1 = MuonGeometry(xmlfile1)
68  execfile(reportfile1)
69  r1 = reports
70 
71 g2 = MuonGeometry(xmlfile2)
72 execfile(reportfile2)
73 r2 = reports
74 
75 c1 = ROOT.TCanvas("c1","c1",1000,600)
76 
77 if not diffReport:
78  # normal XML diff mode
79  ranges = "window=10"
80  #if selection=="DT": ranges = "windows=[25.,5,1.,1.,5.,5.]"
81  eval("DBdiff(g2, g1, r2, r1, %s, selection=%s, phi=False, bins=251)" % (ranges, selection))
82 
83 else:
84  # Special consistency test mode with respect to corrections in the report:
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))
87 
88 
89 c1.Update()
90 c1.Print("diffTwoXMLs_%s_%s.png" % (label, selection))
diffTwoXMLs.CSCE2
def CSCE2(csc, endcap, station, ring, chamber)
Definition: diffTwoXMLs.py:40
diffTwoXMLs.ALL
def ALL(dt, wheel, station, sector)
Definition: diffTwoXMLs.py:28
diffTwoXMLs.DT_st3
def DT_st3(dt, wheel, station, sector)
Definition: diffTwoXMLs.py:35
diffTwoXMLs.DT_st2
def DT_st2(dt, wheel, station, sector)
Definition: diffTwoXMLs.py:34
diffTwoXMLs.DT_st4
def DT_st4(dt, wheel, station, sector)
Definition: diffTwoXMLs.py:36
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
diffTwoXMLs.DT
def DT(dt, wheel, station, sector)
Definition: diffTwoXMLs.py:32
diffTwoXMLs.DT_st1
def DT_st1(dt, wheel, station, sector)
Definition: diffTwoXMLs.py:33
diffTwoXMLs.CSCE1
def CSCE1(csc, endcap, station, ring, chamber)
Definition: diffTwoXMLs.py:39
diffTwoXMLs.CSC
def CSC(csc, endcap, station, ring, chamber)
Definition: diffTwoXMLs.py:38