11 from Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.classes
import MonitorData, PedeDumpData
12 from Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.geometry
import Alignables, Structure
28 self.
text +=
"\\begin{{frame}}[t]{{{0}}}\n".
format(head)
30 self.
text +=
"""\\vfill
31 \\rule{0.9\paperwidth}{1pt}
32 \insertnavigation{0.89\paperwidth}
36 self.
text +=
"\\begin{{frame}}[fragile=singleslide]{{{0}}}\n".
format(head)
38 self.
text +=
"""\\vfill
39 \\rule{0.9\paperwidth}{1pt}
40 \insertnavigation{0.89\paperwidth}
44 self.
text += text +
"\n"
47 def create(alignables, pedeDump, additionalData, outputFile, config):
48 logger = logging.getLogger(
"mpsvalidate")
51 with open(os.path.join(config.mpspath,
"beamer_template.tex"),
"r") as template:
52 data = template.read()
66 \Huge\\bfseries Alignment Validation\par
68 \scshape\huge Alignment Campaign\\\\ {{{0}}}\par
70 \large \\today\par""".
format(config.message)
74 \Huge\\bfseries Alignment Validation\par
77 out.addSlide(
"", text)
80 text =
"\\tableofcontents"
81 out.addSlide(
"Overview", text)
84 out.add(
"\section{General information}")
87 text =
"Project: {{{0}}}\\\\\n".
format(config.message)
88 text +=
"Input-Path:\n"
89 text +=
"\\begin{verbatim}\n"
90 text += config.jobDataPath+
"\n"
91 text +=
"\\end{verbatim}\n"
92 out.addSlide_fragile(
"General information", text)
96 out.add(
"\subsection{Alignment Configuration}")
97 text =
"\\textbf{{PedeSteerer method:}} {{{0}}}\\\\\n".
format(
98 additionalData.pedeSteererMethod)
99 text +=
"\\textbf{{PedeSteerer options:}}\\\\\n"
100 for line
in additionalData.pedeSteererOptions:
101 text +=
"{{{0}}}\\\\\n".
format(line)
102 text +=
"\\textbf{{PedeSteerer command:}} {0}\\\\\n".
format(
103 additionalData.pedeSteererCommand)
104 out.addSlide(
"Alignment Configuration", text)
105 except Exception
as e:
106 logger.error(
"data not found - {0} {1}".
format(type(e), e))
109 if (config.showmonitor):
110 out.add(
"\subsection{Datasets with tracks}")
111 text =
"""\\begin{table}[h]
113 \caption{Datasets with tracks}
116 Dataset & Number of used tracks \\\\
119 for monitor
in MonitorData.monitors:
120 text +=
"{0} & {1}\\\\\n".
format(monitor.name, monitor.ntracks)
121 except Exception
as e:
122 logger.error(
"data not found - {0} {1}".
format(type(e), e))
124 text +=
"Number of records & {0}\\\\\n".
format(pedeDump.nrec)
128 text +=
"The information in this table is based on the monitor root files. Note that the number of tracks which where used in the pede step can differ from this table.\n"
129 out.addSlide(
"Datasets with tracks", text)
132 out.add(
"\subsection{Pede monitoring information}")
134 if (pedeDump.sumValue != 0):
135 text =
r"\begin{{align*}}Sum(Chi^2)/Sum(Ndf) &= {0}\\ &= {1}\end{{align*}}".
format(
136 pedeDump.sumSteps, pedeDump.sumValue)
138 text =
r"\begin{{align*}}Sum(W*Chi^2)/Sum(Ndf)/<W> &= {0}\\ &= {1}\end{{align*}}".
format(
139 pedeDump.sumSteps, pedeDump.sumWValue)
140 text +=
r"with correction for down-weighting: {0}\\".
format(
142 text +=
r"Peak dynamic memory allocation: {0} GB\\".
format(pedeDump.memory)
143 text +=
r"Total time: {0} h {1} m {2} s\\".
format(
144 pedeDump.time[0], pedeDump.time[1], pedeDump.time[2])
145 text +=
r"Number of records: {0}\\".
format(pedeDump.nrec)
146 text +=
r"Total number of parameters: {0}\\".
format(pedeDump.ntgb)
147 text +=
r"Number of variable parameters: {0}\\".
format(pedeDump.nvgb)
148 out.addSlide(
"Pede monitoring information", text)
149 except Exception
as e:
150 logger.error(
"data not found - {0} {1}".
format(type(e), e))
153 out.add(
"\section{Parameter plots}")
156 out.add(
"\subsection{High-level parameters}")
157 big = [x
for x
in config.outputList
if (x.plottype ==
"big")]
160 text =
"\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
161 config.outputPath, i.filename)
163 out.addSlide(
"High-level parameters", text)
166 out.add(
"\subsection{High-level parameters versus time (IOV)}")
167 time = [x
for x
in config.outputList
if (x.plottype ==
"time")]
171 for structure
in [x.name
for x
in time
if x.parameter ==
"xyz"]:
172 for mode
in [
"xyz",
"rot"]:
173 text =
"\\framesubtitle{{{0}}}\n".
format(structure)
174 if any([x.filename
for x
in time
if (x.parameter == mode
and x.name == structure)]):
175 filename = [x.filename
for x
in time
if (x.parameter == mode
and x.name == structure)][0]
176 text +=
"\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
177 config.outputPath, filename)
179 out.addSlide(
"High-level parameters versus time (IOV)", text)
182 out.add(
"\subsection{Module-level parameters}")
184 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"")):
187 for moduleName
in [x.name
for x
in alignables.structures]:
190 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName)):
193 for mode
in [
"xyz",
"rot",
"dist"]:
196 module = [x
for x
in config.outputList
if (
197 x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName
and x.parameter == mode)]
199 moduleSub = [x
for x
in config.outputList
if (
200 x.plottype ==
"subMod" and x.number !=
"" and x.name == moduleName
and x.parameter == mode)]
204 text =
"\\framesubtitle{{{0}}}\n".
format(moduleName)
205 text +=
"\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
206 config.outputPath, module[0].filename)
208 out.addSlide(
"Module-level parameters", text)
211 for plot
in moduleSub:
212 text =
"\\framesubtitle{{{0}}}\n".
format(
214 text +=
"\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
215 config.outputPath, plot.filename)
217 out.addSlide(
"Module-level parameters", text)
220 out.add(
"\section{Monitor plots}")
221 for plot
in [x
for x
in config.outputList
if x.plottype ==
"monitor"]:
222 text =
"\\framesubtitle{{{0}}}\n".
format(plot.name)
223 text +=
"\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
224 config.outputPath, plot.filename)
225 out.addSlide(
"Monitor", text)
227 data = data.substitute(out=out.text)
229 with open(os.path.join(config.outputPath, outputFile),
"w")
as output:
235 os.system(
"pdflatex -output-directory={0} {1}/{2}".
format(
236 config.outputPath, config.outputPath, outputFile))
bool any(const std::vector< T > &v, const T &what)