18 def plot(MillePedeUser, alignables, config):
19 logger = logging.getLogger(
"mpsvalidate")
22 ROOT.gStyle.SetPadBottomMargin(0.25)
23 ROOT.gStyle.SetOptStat(
"emrs")
25 for mode
in [
"xyz",
"rot"]:
26 big = mpsv_classes.PlotData(mode)
29 for line
in MillePedeUser:
32 if (
abs(line.Par[big.data[i]]) != 999999):
34 line.Par[big.data[i]] *= 10000
35 big.numberOfBins[i] += 1
36 if (
abs(line.Par[big.data[i]]) >
abs(big.maxShift[i])):
37 big.maxShift[i] = line.Par[big.data[i]]
41 big.histo.append(ROOT.TH1F(
"Big Structure {0} {1}".
format(big.xyz[i], mode),
"", big.numberOfBins[i], 0, big.numberOfBins[i]))
43 big.histo[i].SetYTitle(
"#Delta"+big.xyz[i]+
" ["+big.unit+
"]")
45 big.histo[i].SetYTitle(
"#Delta"+big.xyz[i])
46 big.histo[i].SetStats(0)
47 big.histo[i].SetMarkerStyle(21)
48 big.histoAxis.append(big.histo[i].GetXaxis())
50 big.histoAxis[i].SetLabelSize(0.06)
51 big.histo[i].GetYaxis().SetTitleOffset(1.6)
54 big.title = ROOT.TPaveLabel(
55 0.1, 0.8, 0.9, 0.9,
"High Level Structures {0}".
format(mode))
56 big.text = ROOT.TPaveText(0.05, 0.1, 0.95, 0.75)
57 big.text.SetTextAlign(12)
60 limit = config.limit[mode]
63 big.text.AddText(
"max. shift {0}: {1:.2} {2}".
format(big.xyz[i], float(big.maxShift[i]), big.unit))
64 if (
abs(big.maxShift[i]) > limit):
65 big.text.AddText(
"! {0} shift bigger than {1} {2}".
format(big.xyz[i], limit, big.unit))
67 big.text.AddText(
"max. shift {0}: {1:.2}".
format(big.xyz[i], float(big.maxShift[i])))
68 if (
abs(big.maxShift[i]) > limit):
69 big.text.AddText(
"! {0} shift bigger than {1}".
format(big.xyz[i], limit))
72 for line
in MillePedeUser:
75 if (
abs(line.Par[big.data[i]]) != 999999):
77 big.histoAxis[i].SetBinLabel(
79 str(line.Name)
if len(line.Name) <= 13
else str(line.Name)[:12]+
".")
83 big.histo[i].SetBinContent(
84 big.binPosition[i], 10000 * line.Par[big.data[i]])
86 big.histo[i].SetBinContent(
87 big.binPosition[i], line.Par[big.data[i]])
88 big.binPosition[i] += 1
92 big.histoAxis[i].LabelsOption(
"v")
98 if (config.rangemodeHL ==
"all"):
100 big.usedRange[i] = big.maxShift[i]
103 if (config.rangemodeHL ==
"given"):
107 valuelist = config.rangexyzHL
109 valuelist = config.rangerotHL
112 for value
in valuelist:
114 if (
abs(big.maxShift[i]) < value):
115 big.usedRange[i] = value
118 if (
abs(big.maxShift[i]) > valuelist[-1]):
119 big.usedRange[i] = valuelist[-1]
122 if (config.samerangeHL == 1):
125 big.usedRange[i] =
max(map(abs, big.usedRange))
128 if (config.rangemodeHL ==
"given"):
130 for binNumber
in range(1, big.numberOfBins[i] + 1):
131 if (
abs(big.histo[i].GetBinContent(binNumber)) > big.usedRange[i]):
132 big.hiddenEntries[i] += 1
136 if (big.hiddenEntries[i] != 0):
137 big.text.AddText(
"! {0}: {1} outlier !".
format(
138 big.xyz[i], int(big.hiddenEntries[i])))
141 cBig = ROOT.TCanvas(
"canvasBigStrucutres_{0}".
format(
142 mode),
"Parameter", 300, 0, 800, 600)
151 ident = mpsv_style.identification(config)
161 big.histo[i].SetLineColor(0)
162 big.histo[i].Draw(
"AXIS")
164 big.histo[i].GetYaxis().SetRangeUser(-1.1 *
165 abs(big.usedRange[i]), 1.1 *
abs(big.usedRange[i]))
168 copy[i] = ROOT.TGraph(big.histo[i])
170 copy[i].SetMaximum(1.1 *
abs(big.usedRange[i]))
171 copy[i].SetMinimum(-1.1 *
abs(big.usedRange[i]))
173 copy[i].Draw(
"PSAME")
179 "{0}/plots/pdf/structures_{1}.pdf".
format(config.outputPath, mode))
182 image = ROOT.TImage.Create()
185 "{0}/plots/png/structures_{1}.png".
format(config.outputPath, mode))
188 output = mpsv_classes.OutputData(plottype=
"big", parameter=mode,
189 filename=
"structures_{0}".
format(mode))
190 config.outputList.append(output)
193 ROOT.gStyle.SetPadBottomMargin(0.1)
const uint16_t range(const Frame &aFrame)
Abs< T >::type abs(const T &t)