3 from __future__
import print_function
4 from builtins
import range
9 for i
in range(len(copyargs)):
10 if copyargs[i] ==
"": copyargs[i] =
"\"\""
11 if copyargs[i].
find(
" ") != -1: copyargs[i] =
"\"%s\"" % copyargs[i]
12 commandline =
" ".
join(copyargs)
18 %(prog)s [options] reportX.py reportY.py
20 Draws a scatterplot of delta corrections from reportX vs. from reportY.
23 parser = optparse.OptionParser(usage)
24 parser.add_option(
"-o",
"--output",
25 help=
"plots' file name. If not give, an automatic file name would be given as reportVsReport_label_selection.png",
29 parser.add_option(
"-l",
"--label",
30 help=
"label for an automatic filename",
34 parser.add_option(
"-s",
"--selection",
35 help=
"is one of the following: ALL, DT, CSC, CSCE1, CSCE2",
39 parser.add_option(
"-x",
"--xlabel",
40 help=
"prefix to add to plots' X axis",
44 parser.add_option(
"-y",
"--ylabel",
45 help=
"prefix to add to plots' Y axis",
49 parser.add_option(
"-w",
"--which",
50 help=
"binary mask for which variables to draw, defauls is 110011",
55 options, args = parser.parse_args(sys.argv[1:])
57 if len(args)!=2:
print(usage); sys.exit()
62 def DT(dt, wheel, station, sector):
return dt ==
"DT"
64 def CSC(csc, endcap, station, ring, chamber):
65 if csc !=
"CSC":
return False
67 if station==1
and ring==4:
return False
69 if station==4
and ring==2
and ( (endcap==1
and (chamber<9
or chamber >13))
or endcap==2 ) :
return False
72 def CSCE1(csc, endcap, station, ring, chamber):
return CSC(csc, endcap, station, ring, chamber)
and endcap==1
74 def CSCE2(csc, endcap, station, ring, chamber):
return CSC(csc, endcap, station, ring, chamber)
and endcap==2
79 execfile(
"plotscripts.py")
81 ROOT.gROOT.SetBatch(1)
83 selection = options.selection
84 if selection ==
'ALL': selection =
None
91 if options.which.count(
'1')>4: c1 = ROOT.TCanvas(
"c1",
"c1",1000,800)
92 else: c1 = ROOT.TCanvas(
"c1",
"c1",760,800)
94 print(
"corrections2D(reportsX=rx, reportsY=ry, selection=%s, pre_title_x='%s', pre_title_y='%s', which='%s' )" % (
95 selection, options.xlabel, options.ylabel, options.which ))
96 eval(
"corrections2D(reportsX=rx, reportsY=ry, selection=%s, pre_title_x='%s', pre_title_y='%s', which='%s', canvas=c1 )" % (
97 selection, options.xlabel, options.ylabel, options.which) )
100 if len(options.filename)>0: filename = options.filename
101 else: filename =
"reportVsReport_"+options.label+
"_"+options.selection+
".png"