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),
"Parameter {0}".
format(
43 big.xyz[i]), big.numberOfBins[i], 0, big.numberOfBins[i]))
44 big.histo[i].SetYTitle(big.unit)
45 big.histo[i].SetStats(0)
46 big.histo[i].SetMarkerStyle(21)
47 big.histoAxis.append(big.histo[i].GetXaxis())
49 big.histoAxis[i].SetLabelSize(0.06)
50 big.histo[i].GetYaxis().SetTitleOffset(1.6)
53 big.title = TPaveLabel(
54 0.1, 0.8, 0.9, 0.9,
"High Level Structures {0}".
format(mode))
55 big.text = TPaveText(0.05, 0.1, 0.95, 0.75)
56 big.text.SetTextAlign(12)
59 limit = config.limit[mode]
61 big.text.AddText(
"max. shift {0}: {1:.2}".
format(
62 big.xyz[i], float(big.maxShift[i])))
63 if (
abs(big.maxShift[i]) > limit):
65 "! {0} shift bigger than {1} !".
format(big.xyz[i], limit))
68 for line
in MillePedeUser:
71 if (
abs(line.Par[big.data[i]]) != 999999):
73 big.histoAxis[i].SetBinLabel(
74 big.binPosition[i], alignables.get_name_by_objid(line.ObjId))
78 big.histo[i].SetBinContent(
79 big.binPosition[i], 10000 * line.Par[big.data[i]])
81 big.histo[i].SetBinContent(
82 big.binPosition[i], line.Par[big.data[i]])
83 big.binPosition[i] += 1
87 big.histoAxis[i].LabelsOption(
"v")
93 if (config.rangemodeHL ==
"all"):
95 big.usedRange[i] = big.maxShift[i]
98 if (config.rangemodeHL ==
"given"):
102 valuelist = config.rangexyzHL
104 valuelist = config.rangerotHL
107 for value
in valuelist:
109 if (
abs(big.maxShift[i]) < value):
110 big.usedRange[i] = value
113 if (
abs(big.maxShift[i]) > valuelist[-1]):
114 big.usedRange[i] = valuelist[-1]
117 if (config.samerangeHL == 1):
120 big.usedRange[i] =
max(map(abs, big.usedRange))
123 if (config.rangemodeHL ==
"given"):
125 for binNumber
in range(1, big.numberOfBins[i] + 1):
126 if (
abs(big.histo[i].GetBinContent(binNumber)) > big.usedRange[i]):
127 big.hiddenEntries[i] += 1
131 if (big.hiddenEntries[i] != 0):
132 big.text.AddText(
"! {0} {1} outlier !".
format(
133 big.xyz[i], int(big.hiddenEntries[i])))
136 cBig = TCanvas(
"canvasBigStrucutres_{0}".
format(
137 mode),
"Parameter", 300, 0, 800, 600)
156 big.histo[i].SetLineColor(0)
157 big.histo[i].Draw(
"P")
159 big.histo[i].GetYaxis().SetRangeUser(-1.1 *
160 abs(big.usedRange[i]), 1.1 *
abs(big.usedRange[i]))
163 copy[i] = TGraph(big.histo[i])
165 copy[i].SetMaximum(1.1 *
abs(big.usedRange[i]))
166 copy[i].SetMinimum(-1.1 *
abs(big.usedRange[i]))
168 copy[i].Draw(
"PSAME")
174 "{0}/plots/pdf/structures_{1}.pdf".
format(config.outputPath, mode))
177 image = TImage.Create()
180 "{0}/plots/png/structures_{1}.png".
format(config.outputPath, mode))
183 output = OutputData(plottype=
"big", parameter=mode,
184 filename=
"structures_{0}".
format(mode))
185 config.outputList.append(output)
188 gStyle.SetPadBottomMargin(0.1)
def identification
creates the identification text in the top left corner
Abs< T >::type abs(const T &t)