16 def plot(MillePedeUser, alignables, config):
17 logger = logging.getLogger(
"mpsvalidate")
20 ROOT.gStyle.SetPadBottomMargin(0.25)
21 ROOT.gStyle.SetOptStat(
"emrs")
23 for mode
in [
"xyz",
"rot"]:
24 big = mpsv_classes.PlotData(mode)
27 for line
in MillePedeUser:
30 if (
abs(line.Par[big.data[i]]) != 999999):
32 line.Par[big.data[i]] *= 10000
33 big.numberOfBins[i] += 1
34 if (
abs(line.Par[big.data[i]]) >
abs(big.maxShift[i])):
35 big.maxShift[i] = line.Par[big.data[i]]
39 big.histo.append(ROOT.TH1F(
"Big Structure {0} {1}".
format(big.xyz[i], mode),
"", big.numberOfBins[i], 0, big.numberOfBins[i]))
41 big.histo[i].SetYTitle(
"#Delta"+big.xyz[i]+
" ["+big.unit+
"]")
43 big.histo[i].SetYTitle(
"#Delta"+big.xyz[i])
44 big.histo[i].SetStats(0)
45 big.histo[i].SetMarkerStyle(21)
46 big.histoAxis.append(big.histo[i].GetXaxis())
48 big.histoAxis[i].SetLabelSize(0.06)
49 big.histo[i].GetYaxis().SetTitleOffset(1.6)
52 big.title = ROOT.TPaveLabel(
53 0.1, 0.8, 0.9, 0.9,
"High Level Structures {0}".
format(mode))
54 big.text = ROOT.TPaveText(0.05, 0.1, 0.95, 0.75)
55 big.text.SetTextAlign(12)
58 limit = config.limit[mode]
61 big.text.AddText(
"max. shift {0}: {1:.2} {2}".
format(big.xyz[i],
float(big.maxShift[i]), big.unit))
62 if (
abs(big.maxShift[i]) > limit):
63 big.text.AddText(
"! {0} shift bigger than {1} {2}".
format(big.xyz[i], limit, big.unit))
65 big.text.AddText(
"max. shift {0}: {1:.2}".
format(big.xyz[i],
float(big.maxShift[i])))
66 if (
abs(big.maxShift[i]) > limit):
67 big.text.AddText(
"! {0} shift bigger than {1}".
format(big.xyz[i], limit))
70 for line
in MillePedeUser:
73 if (
abs(line.Par[big.data[i]]) != 999999):
75 big.histoAxis[i].SetBinLabel(
77 str(line.Name)
if len(line.Name) <= 13
else str(line.Name)[:12]+
".")
81 big.histo[i].SetBinContent(
82 big.binPosition[i], 10000 * line.Par[big.data[i]])
84 big.histo[i].SetBinContent(
85 big.binPosition[i], line.Par[big.data[i]])
86 big.binPosition[i] += 1
90 big.histoAxis[i].LabelsOption(
"v")
96 if (config.rangemodeHL ==
"all"):
98 big.usedRange[i] = big.maxShift[i]
101 if (config.rangemodeHL ==
"given"):
105 valuelist = config.rangexyzHL
107 valuelist = config.rangerotHL
110 for value
in valuelist:
112 if (
abs(big.maxShift[i]) < value):
113 big.usedRange[i] = value
116 if (
abs(big.maxShift[i]) > valuelist[-1]):
117 big.usedRange[i] = valuelist[-1]
120 if (config.samerangeHL == 1):
123 big.usedRange[i] =
max(
map(abs, big.usedRange))
126 if (config.rangemodeHL ==
"given"):
128 for binNumber
in range(1, big.numberOfBins[i] + 1):
129 if (
abs(big.histo[i].GetBinContent(binNumber)) > big.usedRange[i]):
130 big.hiddenEntries[i] += 1
134 if (big.hiddenEntries[i] != 0):
135 big.text.AddText(
"! {0}: {1} outlier !".
format(
136 big.xyz[i],
int(big.hiddenEntries[i])))
139 cBig = ROOT.TCanvas(
"canvasBigStrucutres_{0}".
format(
140 mode),
"Parameter", 300, 0, 800, 600)
149 ident = mpsv_style.identification(config)
159 big.histo[i].SetLineColor(0)
160 big.histo[i].Draw(
"AXIS")
162 big.histo[i].GetYaxis().SetRangeUser(-1.1 *
163 abs(big.usedRange[i]), 1.1 *
abs(big.usedRange[i]))
166 copy[i] = ROOT.TGraph(big.histo[i])
168 copy[i].SetMaximum(1.1 *
abs(big.usedRange[i]))
169 copy[i].SetMinimum(-1.1 *
abs(big.usedRange[i]))
171 copy[i].Draw(
"PSAME")
177 "{0}/plots/pdf/structures_{1}.pdf".
format(config.outputPath, mode))
180 image = ROOT.TImage.Create()
183 "{0}/plots/png/structures_{1}.png".
format(config.outputPath, mode))
186 output = mpsv_classes.OutputData(plottype=
"big", parameter=mode,
187 filename=
"structures_{0}".
format(mode))
188 config.outputList.append(output)
191 ROOT.gStyle.SetPadBottomMargin(0.1)
192
def plot(MillePedeUser, alignables, config)
Abs< T >::type abs(const T &t)