19 def plot(MillePedeUser, alignables, mode, struct, parentPlot, config):
20 logger = logging.getLogger(
"mpsvalidate")
25 if(parentPlot.histo[i].GetEntries() == 0):
41 for subStructNumber, subStruct
in enumerate(struct.get_children()):
42 plots.append(PlotData(mode))
45 plot = plots[subStructNumber]
49 plot.histo.append(TH1F(
"{0} {1} {2}".
format(struct.get_name() +
" " + subStruct.get_name(), plot.xyz[
50 i], mode),
"Parameter {0}".
format(plot.xyz[i]), numberOfBins, -1000, 1000))
52 plot.histo.append(TH1F(
"{0} {1} {2}".
format(struct.get_name() +
" " + subStruct.get_name(), plot.xyz[
53 i], mode),
"Parameter {0}".
format(plot.xyz[i]), numberOfBins, -0.1, 0.1))
55 plot.histo[i].SetLineColor(6)
56 plot.histo[i].SetStats(0)
59 plot.title = TPaveLabel(
60 0.1, 0.8, 0.9, 0.9,
"Module: {0} {1}".
format(struct.get_name(), mode))
61 plot.text = TPaveText(0.05, 0.1, 0.95, 0.75)
62 plot.text.SetTextAlign(12)
63 plot.text.SetTextSizePixels(20)
66 plots[subStructNumber] = plot
72 for line
in MillePedeUser:
75 for subStructNumber, subStruct
in enumerate(struct.get_children()):
77 plot = plots[subStructNumber]
80 if (subStruct.contains_detid(line.Id)):
82 if (
abs(line.Par[plot.data[i]]) != 999999):
86 10000 * line.Par[plot.data[i]])
88 plot.histo[i].
Fill(line.Par[plot.data[i]])
91 plots[subStructNumber] = plot
96 for subStructNumber, subStruct
in enumerate(struct.get_children()):
98 plot = plots[subStructNumber]
100 if (plot.histo[i].GetEntries() != 0
and plot.histo[i].GetStdDev() != 0):
102 binShift = parentPlot.usedRange[i]
106 for j
in range(1, numberOfBins / 2 - binShift):
107 plot.hiddenEntries[i] += plot.histo[i].GetBinContent(j)
109 for j
in range(numberOfBins / 2 + binShift, plot.histo[i].GetNbinsX()):
110 plot.hiddenEntries[i] += plot.histo[i].GetBinContent(j)
113 mergeNumberBins = binShift
115 if (mergeNumberBins != 0):
117 mergeNumberBins = int(
118 2. * mergeNumberBins / config.numberofbins)
121 if (mergeNumberBins == 0):
123 while (numberOfBins % mergeNumberBins != 0
and mergeNumberBins != 1):
127 plot.histo[i] = plot.histo[i].
Rebin(mergeNumberBins)
132 plot.histo[i].GetXaxis().SetRange(int(numberOfBins / (2 * mergeNumberBins) - binShift /
133 mergeNumberBins), int(numberOfBins / (2 * mergeNumberBins) + binShift / mergeNumberBins))
136 plots[subStructNumber] = plot
142 canvas = TCanvas(
"SubStruct_{0}_{1}".
format(
143 struct.get_name(), mode),
"Parameter", 300, 0, 800, 600)
147 parentPlot.title.Draw()
149 legend = TLegend(0.05, 0.1, 0.95, 0.75)
157 if (parentPlot.histo[i].GetEntries() == 0):
161 parentPlot.histo[i].Scale(1. / parentPlot.histo[i].Integral())
162 maximum.append(parentPlot.histo[i].GetMaximum())
164 for subStructNumber, subStruct
in enumerate(struct.get_children()):
166 plot = plots[subStructNumber]
168 if (plot.histo[i].GetEntries() > 0):
169 plot.histo[i].Scale(1. / plot.histo[i].Integral())
170 maximum.append(plot.histo[i].GetMaximum())
173 plots[subStructNumber] = plot
176 parentPlot.histo[i].GetYaxis().SetRangeUser(0., 1.1 *
max(maximum))
177 parentPlot.histo[i].SetYTitle(
"normalized")
178 parentPlot.histo[i].Draw()
180 for subStructNumber, subStruct
in enumerate(struct.get_children()):
182 plot = plots[subStructNumber].histo[i]
184 plot.SetLineColorAlpha(subStructNumber + 2, 0.5)
187 legend.AddEntry(plot, subStruct.get_name(),
"l")
200 "{0}/plots/pdf/subModules_{1}_{2}.pdf".
format(config.outputPath, mode, struct.get_name()))
203 image = TImage.Create()
204 image.FromPad(canvas)
206 "{0}/plots/png/subModules_{1}_{2}.png".
format(config.outputPath, mode, struct.get_name()))
209 output = OutputData(plottype=
"subMod", name=struct.get_name(), number=subStructNumber + 1,
210 parameter=mode, filename=
"subModules_{0}_{1}".
format(mode, struct.get_name()))
211 config.outputList.append(output)
def identification
creates the identification text in the top left corner
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Abs< T >::type abs(const T &t)