4 ROOT.PyConfig.IgnoreCommandLineOptions =
True
14 return 1.37 <= aeta <= 1.55
17 inputs = ROOT.StdCalibrationInputs()
29 '2011_alt_with_layer2',
'2012_alt_with_layer2',
'es2017_20.7_improved',
'es2017_20.7_final',
31 'layer2_alt_2011_v5',
"ps_2011",
32 "ps_HV1",
"layer2_alt_2012_v5",
"ps_2012",
33 "pileup_20.7",
"run2_alt_with_layer2_modif",
34 "2012_alt_with_layer2_modif",
35 "ps_EMECHV1",
"layer2_alt_run2_v1",
"ps_2016",
65 'es2017_20.7_final__vs__es2017_20.7_improved.png',
66 (
'es2017_20.7_final',
'es2017_20.7_improved'))
68 def plot_tune(self, tools, canvas_name, names=None):
69 canvas = ROOT.TCanvas(canvas_name, canvas_name)
75 legend = ROOT.TLegend(0.2, 0.6, 0.8, 0.8)
77 if type(tools)
is not tuple:
79 legend_names = names
or [
""] * len(tools)
81 for itool, (tool, name)
in enumerate(zip(tools, legend_names)):
91 inputs.eta = i * 0.05 - 2.5
97 tool.scale_inputs(inputs)
99 h0.SetPoint(i, inputs.eta, inputs.E0raw)
100 h1.SetPoint(i, inputs.eta, inputs.E1raw)
101 h2.SetPoint(i, inputs.eta, inputs.E2raw)
102 h3.SetPoint(i, inputs.eta, inputs.E3raw)
104 grs = (h0, h1, h2, h3)
105 for ig, g
in enumerate(grs):
107 g.SetTitle(
'layer %d' % ig)
108 g.SetLineColor(itool + 1)
109 g.SetMarkerColor(itool + 1)
110 g.GetXaxis().SetTitle(
"#eta")
111 g.GetYaxis().SetTitle(
"(E_{%d})-corrected / (E_{%d})-non-corrected" % (ig, ig))
113 g.GetYaxis().SetTitleOffset(1.5)
114 g.Draw(
"APL" if not itool
else "PLsame")
115 g.GetYaxis().SetRangeUser(0.92, 1.08)
116 if ig == 3
and legend:
117 legend.AddEntry(g, name)
122 canvas.SaveAs(canvas_name)
127 canvas = ROOT.TCanvas()
131 h0 = ROOT.TH2F(
"h0",
"h0", nbins_eta, -2.5, 2.5, nbins_phi, -3.1415, 3.1415)
132 h1 = ROOT.TH2F(
"h1",
"h1", nbins_eta, -2.5, 2.5, nbins_phi, -3.1415, 3.1415)
133 h2 = ROOT.TH2F(
"h2",
"h2", nbins_eta, -2.5, 2.5, nbins_phi, -3.1415, 3.1415)
134 h3 = ROOT.TH2F(
"h3",
"h3", nbins_eta, -2.5, 2.5, nbins_phi, -3.1415, 3.1415)
136 for iphi
in range(nbins_phi):
138 inputs.RunNumber = run_number
139 for ieta
in range(nbins_eta):
140 inputs.eta = h0.GetXaxis().GetBinCenter(ieta)
141 inputs.phi = h0.GetYaxis().GetBinCenter(iphi)
147 tool.scale_inputs(inputs)
149 h0.SetBinContent(ieta, iphi, inputs.E0raw)
150 h1.SetBinContent(ieta, iphi, inputs.E1raw)
151 h2.SetBinContent(ieta, iphi, inputs.E2raw)
152 h3.SetBinContent(ieta, iphi, inputs.E3raw)
154 grs = (h0, h1, h2, h3)
156 for i, g
in enumerate(grs):
158 g.GetXaxis().SetTitle(
"#eta")
159 g.GetYaxis().SetTitle(
"#phi")
160 g.SetTitle(
"(E_{%d})-corrected / E_{%d}-non-corrected" % (i, i))
162 g.GetZaxis().SetRangeUser(0.93,
169 canvas.SaveAs(canvas_name)
171 if __name__ ==
'__main__':
172 ROOT.gROOT.ProcessLine(
".x $ROOTCOREDIR/scripts/load_packages.C")
173 ROOT.gStyle.SetCanvasDefH(800)
174 ROOT.gStyle.SetCanvasDefW(800)
175 ROOT.gStyle.SetPadTickX(1)
176 ROOT.gStyle.SetPadTickY(1)
181 plotter.plot_compare()