19 def plot(MillePedeUser, alignables, config):
20 logger = logging.getLogger(
"mpsvalidate")
23 gStyle.SetPadBottomMargin(0.25)
24 gStyle.SetOptStat(
"emrs")
26 for mode
in [
"xyz",
"rot"]:
30 for line
in MillePedeUser:
33 if (
abs(line.Par[big.data[i]]) != 999999):
35 line.Par[big.data[i]] *= 10000
36 big.numberOfBins[i] += 1
37 if (
abs(line.Par[big.data[i]]) >
abs(big.maxShift[i])):
38 big.maxShift[i] = line.Par[big.data[i]]
42 big.histo.append(TH1F(
"Big Structure {0} {1}".
format(big.xyz[i], mode),
"", big.numberOfBins[i], 0, big.numberOfBins[i]))
44 big.histo[i].SetYTitle(
"#Delta"+big.xyz[i]+
" ["+big.unit+
"]")
46 big.histo[i].SetYTitle(
"#Delta"+big.xyz[i])
47 big.histo[i].SetStats(0)
48 big.histo[i].SetMarkerStyle(21)
49 big.histoAxis.append(big.histo[i].GetXaxis())
51 big.histoAxis[i].SetLabelSize(0.06)
52 big.histo[i].GetYaxis().SetTitleOffset(1.6)
55 big.title = TPaveLabel(
56 0.1, 0.8, 0.9, 0.9,
"High Level Structures {0}".
format(mode))
57 big.text = TPaveText(0.05, 0.1, 0.95, 0.75)
58 big.text.SetTextAlign(12)
61 limit = config.limit[mode]
64 big.text.AddText(
"max. shift {0}: {1:.2} {2}".
format(big.xyz[i], float(big.maxShift[i]), big.unit))
65 if (
abs(big.maxShift[i]) > limit):
66 big.text.AddText(
"! {0} shift bigger than {1} {2}".
format(big.xyz[i], limit, big.unit))
68 big.text.AddText(
"max. shift {0}: {1:.2}".
format(big.xyz[i], float(big.maxShift[i])))
69 if (
abs(big.maxShift[i]) > limit):
70 big.text.AddText(
"! {0} shift bigger than {1}".
format(big.xyz[i], limit))
73 for line
in MillePedeUser:
76 if (
abs(line.Par[big.data[i]]) != 999999):
78 big.histoAxis[i].SetBinLabel(
79 big.binPosition[i], alignables.get_name_by_objid(line.ObjId))
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 = TCanvas(
"canvasBigStrucutres_{0}".
format(
142 mode),
"Parameter", 300, 0, 800, 600)
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] = 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 = TImage.Create()
185 "{0}/plots/png/structures_{1}.png".
format(config.outputPath, mode))
188 output = OutputData(plottype=
"big", parameter=mode,
189 filename=
"structures_{0}".
format(mode))
190 config.outputList.append(output)
193 gStyle.SetPadBottomMargin(0.1)
def identification
creates the identification text in the top left corner
Abs< T >::type abs(const T &t)