23 def create(alignables, pedeDump, additionalData, outputFile, config):
24 logger = logging.getLogger(
"mpsvalidate")
27 with open(os.path.join(config.mpspath,
"tex_template.tex"),
"r") as template:
28 data = template.read()
39 out +=
"""\\begin{{titlepage}}
42 \Huge\\bfseries Alignment Validation\par
44 \scshape\huge Alignment Campaign\\\\ {{{0}}}\par
49 \\newpage""".
format(config.message)
51 out +=
"""\\begin{titlepage}
54 \Huge\\bfseries Alignment Validation\par
63 out +=
"\section{{General information}}\n"
66 out +=
"Project: {{{0}}}\\\\\n".
format(config.message)
67 out +=
"Input-Path:\n"
68 out +=
"\\begin{verbatim}\n"
69 out += config.jobDataPath+
"\n"
70 out +=
"\\end{verbatim}\n"
74 out +=
"\subsection{Alignment Configuration}\n"
75 out +=
"\\textbf{{PedeSteerer method:}} {{{0}}}\\\\\n".
format(
76 additionalData.pedeSteererMethod)
77 out +=
"\\textbf{{PedeSteerer options:}}\\\\\n"
78 for line
in additionalData.pedeSteererOptions:
79 out +=
"{{{0}}}\\\\\n".
format(line)
80 out +=
"\\textbf{{PedeSteerer command:}} {0}\\\\\n".
format(
81 additionalData.pedeSteererCommand)
83 for selector
in additionalData.pattern:
84 out +=
"\\textbf{{{0}:}}\\\\\n".
format(additionalData.pattern[selector][3])
85 for line
in additionalData.pattern[selector][0]:
89 for line
in additionalData.pattern[selector][2]:
90 out +=
"{0}\\\\\n".
format(line)
92 except Exception
as e:
93 logger.error(
"data not found - {0} {1}".
format(type(e), e))
96 if (config.showmonitor):
97 out +=
"\subsection{Datasets with tracks}\n"
98 out +=
"""\\begin{table}[h]
100 \caption{Datasets with tracks}
103 Dataset & Number of used tracks \\\\
105 for monitor
in MonitorData.monitors:
106 out +=
"{0} & {1}\\\\\n".
format(monitor.name, monitor.ntracks)
109 out +=
"Number of records & {0}\\\\\n".
format(pedeDump.nrec)
110 except Exception
as e:
111 logger.error(
"data not found - {0} {1}".
format(type(e), e))
115 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"
118 if (config.showdump == 1):
119 out +=
"\subsection{{Pede monitoring information}}\n"
120 if (pedeDump.sumValue != 0):
121 out +=
r"\begin{{align*}}Sum(Chi^2)/Sum(Ndf) &= {0}\\ &= {1}\end{{align*}}".
format(
122 pedeDump.sumSteps, pedeDump.sumValue)
124 out +=
r"\begin{{align*}}Sum(W*Chi^2)/Sum(Ndf)/<W> &= {0}\\ &= {1}\end{{align*}}".
format(
125 pedeDump.sumSteps, pedeDump.sumWValue)
126 out +=
r"with correction for down-weighting: {0}\\".
format(
128 out +=
r"Peak dynamic memory allocation: {0} GB\\".
format(
130 out +=
r"Total time: {0} h {1} m {2} s\\".
format(
131 pedeDump.time[0], pedeDump.time[1], pedeDump.time[2])
132 out +=
r"Number of records: {0}\\".
format(pedeDump.nrec)
133 out +=
r"Total number of parameters: {0}\\".
format(pedeDump.ntgb)
134 out +=
r"Number of variable parameters: {0}\\".
format(pedeDump.nvgb)
136 for line
in pedeDump.warning:
139 if line.replace(
r" ",
r""):
140 out +=
"\\begin{verbatim}\n"
142 out +=
"\\end{verbatim}\n"
144 out +=
"\section{{Parameter plots}}\n"
145 except Exception
as e:
146 logger.error(
"data not found - {0} {1}".
format(type(e), e))
149 if (config.showhighlevel == 1):
150 big = [x
for x
in config.outputList
if (x.plottype ==
"big")]
153 out +=
"\subsection{{High-level parameters}}\n"
155 out +=
"\includegraphics[width=\linewidth]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
156 config.outputPath, i.filename)
159 if (config.showtime == 1):
160 time = [x
for x
in config.outputList
if (x.plottype ==
"time")]
163 out +=
"\subsection{{High-level parameters versus time (IOV)}}\n"
165 for structure
in [x.name
for x
in time
if x.parameter ==
"xyz"]:
166 out +=
"\subsubsection{{{0}}}\n".
format(structure)
167 for mode
in [
"xyz",
"rot"]:
168 if any([x.filename
for x
in time
if (x.parameter == mode
and x.name == structure)]):
169 filename = [x.filename
for x
in time
if (x.parameter == mode
and x.name == structure)][0]
170 out +=
"\includegraphics[width=\linewidth]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
171 config.outputPath, filename)
174 if (config.showmodule == 1):
176 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"")):
177 out +=
"\subsection{{Module-level parameters}}\n"
180 for moduleName
in [x.name
for x
in alignables.structures]:
183 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName)):
184 out +=
"\subsubsection{{{0}}}\n".
format(moduleName)
186 for mode
in [
"xyz",
"rot",
"dist"]:
189 module = [x
for x
in config.outputList
if (
190 x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName
and x.parameter == mode)]
192 moduleSub = [x
for x
in config.outputList
if (
193 x.plottype ==
"subMod" and x.number !=
"" and x.name == moduleName
and x.parameter == mode)]
197 out +=
"\includegraphics[width=\linewidth]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
198 config.outputPath, module[0].filename)
199 if (config.showsubmodule):
201 for plot
in moduleSub:
202 out +=
"\includegraphics[width=\linewidth]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
203 config.outputPath, plot.filename)
206 if (config.showmonitor):
207 if any(x
for x
in config.outputList
if x.plottype ==
"monitor"):
208 out +=
"\section{{Monitor plots}}\n"
211 for plot
in [x
for x
in config.outputList
if x.plottype ==
"monitor"]:
213 if (lastdataset != plot.name):
214 out +=
"\subsection{{{0}}}\n".
format(plot.name)
215 lastdataset = plot.name
216 out +=
"\includegraphics[width=\linewidth]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
217 config.outputPath, plot.filename)
219 data = data.substitute(out=out)
221 with open(os.path.join(config.outputPath, outputFile),
"w")
as output:
227 os.system(
"pdflatex -output-directory={0} {1}/{2}".
format(
228 config.outputPath, config.outputPath, outputFile))
bool any(const std::vector< T > &v, const T &what)