20 def create(alignables, pedeDump, additionalData, outputFile, config):
21 logger = logging.getLogger(
"mpsvalidate")
24 with open(os.path.join(config.mpspath,
"templates",
25 "mpsvalidate_tex_template.tex"))
as template:
26 data = template.read()
37 out +=
"""\\begin{{titlepage}}
40 \Huge\\bfseries Alignment Validation\par
42 \scshape\huge Alignment Campaign\\\\ {{{0}}}\par
47 \\newpage""".
format(config.message)
49 out +=
"""\\begin{titlepage}
52 \Huge\\bfseries Alignment Validation\par
61 out +=
"\section{{General information}}\n"
64 out +=
"Project: {{{0}}}\\\\\n".
format(config.message)
65 out +=
"Input-Path:\n"
66 out +=
"\\begin{verbatim}\n"
67 out += config.jobDataPath+
"\n"
68 out +=
"\\end{verbatim}\n"
72 out +=
"\subsection{Alignment Configuration}\n"
73 out +=
"\\textbf{{PedeSteerer method:}} {{{0}}}\\\\\n".
format(
74 additionalData.pede_steerer_method)
75 out +=
"\\textbf{{PedeSteerer options:}}\\\\\n"
76 for line
in additionalData.pede_steerer_options:
77 out +=
"{{{0}}}\\\\\n".
format(line)
78 out +=
"\\textbf{{PedeSteerer command:}} {0}\\\\\n".
format(
79 additionalData.pede_steerer_command)
81 for i
in sorted(additionalData.selectors):
82 out +=
"\\textbf{{{0}:}}\n".
format(additionalData.selectors[i][
"name"])
83 out +=
"\\begin{verbatim}\n"
84 for line
in additionalData.selectors[i][
"selector"].
dumpPython().
split(
"\n"):
86 out +=
"\\end{verbatim}\n"
88 if len(additionalData.iov_definition) > 0:
89 out +=
"\\textbf{{IOV defintion:}}\n"
90 out +=
"\\begin{verbatim}\n"
91 for line
in additionalData.iov_definition.dumpPython().
split(
"\n"):
93 out +=
"\\end{verbatim}\n\n"
96 except Exception
as e:
97 logger.error(
"data not found - {0} {1}".
format(type(e), e))
100 if config.showmonitor:
101 out +=
"\subsection{Datasets with tracks}\n"
102 out +=
"""\\begin{table}[h]
104 \caption{Datasets with tracks}
105 \\begin{tabular}{ccc}
107 Dataset & Number of used tracks & Weight \\\\
109 for monitor
in mpsv_classes.MonitorData.monitors:
110 out +=
"{0} & {1} & {2}\\\\\n".
format(monitor.name, monitor.ntracks,
111 monitor.weight
if monitor.weight !=
None else "--")
114 out +=
"\hline\nNumber of records & {0}\\\\\n".
format(pedeDump.nrec)
115 except Exception
as e:
116 logger.error(
"data not found - {0} {1}".
format(type(e), e))
120 out +=
"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"
124 out +=
"\subsection{{Pede monitoring information}}\n"
125 if (pedeDump.sumValue != 0):
126 out +=
r"\begin{{align*}}Sum(Chi^2)/Sum(Ndf) &= {0}\\ &= {1}\end{{align*}}".
format(
127 pedeDump.sumSteps, pedeDump.sumValue)
129 out +=
r"\begin{{align*}}Sum(W*Chi^2)/Sum(Ndf)/<W> &= {0}\\ &= {1}\end{{align*}}".
format(
130 pedeDump.sumSteps, pedeDump.sumWValue)
131 out +=
r"with correction for down-weighting: {0}\\".
format(
133 out +=
r"Peak dynamic memory allocation: {0} GB\\".
format(
135 out +=
r"Total time: {0} h {1} m {2} s\\".
format(
136 pedeDump.time[0], pedeDump.time[1], pedeDump.time[2])
137 out +=
r"Number of records: {0}\\".
format(pedeDump.nrec)
138 out +=
r"Total number of parameters: {0}\\".
format(pedeDump.ntgb)
139 out +=
r"Number of variable parameters: {0}\\".
format(pedeDump.nvgb)
141 for line
in pedeDump.warning:
144 if line.replace(
r" ",
r""):
145 out +=
"\\begin{verbatim}\n"
147 out +=
"\\end{verbatim}\n"
149 out +=
"\section{{Parameter plots}}\n"
150 except Exception
as e:
151 logger.error(
"data not found - {0} {1}".
format(type(e), e))
154 if config.showhighlevel:
155 big = [x
for x
in config.outputList
if (x.plottype ==
"big")]
158 out +=
"\subsection{{High-level parameters}}\n"
160 out +=
"\includegraphics[width=\linewidth]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
161 config.outputPath, i.filename)
165 time = [x
for x
in config.outputList
if (x.plottype ==
"time")]
168 out +=
"\subsection{{High-level parameters versus time (IOV)}}\n"
170 for structure
in [x.name
for x
in time
if x.parameter ==
"xyz"]:
171 out +=
"\subsubsection{{{0}}}\n".
format(structure)
172 for mode
in [
"xyz",
"rot"]:
173 if any([x.filename
for x
in time
if (x.parameter == mode
and x.name == structure)]):
174 filename = [x.filename
for x
in time
if (x.parameter == mode
and x.name == structure)][0]
175 out +=
"\includegraphics[width=\linewidth]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
176 config.outputPath, filename)
179 if config.showmodule:
181 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"")):
182 out +=
"\subsection{{Module-level parameters}}\n"
185 for moduleName
in [x.name
for x
in alignables.structures]:
188 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName)):
189 out +=
"\subsubsection{{{0}}}\n".
format(moduleName)
191 for mode
in [
"xyz",
"rot",
"dist"]:
194 module = [x
for x
in config.outputList
if (
195 x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName
and x.parameter == mode)]
197 moduleSub = [x
for x
in config.outputList
if (
198 x.plottype ==
"subMod" and x.number !=
"" and x.name == moduleName
and x.parameter == mode)]
202 out +=
"\includegraphics[width=\linewidth]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
203 config.outputPath, module[0].filename)
204 if config.showsubmodule:
206 for plot
in moduleSub:
207 out +=
"\includegraphics[width=\linewidth]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
208 config.outputPath, plot.filename)
211 if config.showmonitor:
212 if any(x
for x
in config.outputList
if x.plottype ==
"monitor"):
213 out +=
"\section{{Monitor plots}}\n"
216 for plot
in [x
for x
in config.outputList
if x.plottype ==
"monitor"]:
218 if (lastdataset != plot.name):
219 out +=
"\subsection{{{0}}}\n".
format(plot.name)
220 lastdataset = plot.name
221 out +=
"\includegraphics[width=\linewidth]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
222 config.outputPath, plot.filename)
224 data = data.substitute(out=out)
226 with open(os.path.join(config.outputPath, outputFile),
"w")
as output:
232 os.system(
"pdflatex -output-directory={0} {1}/{2}".
format(
233 config.outputPath, config.outputPath, outputFile))
bool any(const std::vector< T > &v, const T &what)
const uint16_t range(const Frame &aFrame)