5 from builtins
import range
9 import Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.classes
as mpsv_classes
25 self.
text +=
"\\begin{{frame}}[t]{{{0}}}\n".
format(head)
27 self.
text +=
"""\\vfill
28 \\rule{0.9\paperwidth}{1pt}
29 \insertnavigation{0.89\paperwidth}
33 self.
text +=
"\\begin{{frame}}[fragile=singleslide]{{{0}}}\n".
format(head)
35 self.
text +=
"""\\vfill
36 \\rule{0.9\paperwidth}{1pt}
37 \insertnavigation{0.89\paperwidth}
41 self.
text += text +
"\n"
44 def create(alignables, pedeDump, additionalData, outputFile, config):
45 logger = logging.getLogger(
"mpsvalidate")
48 with open(os.path.join(config.mpspath,
"templates",
49 "mpsvalidate_beamer_template.tex"))
as template:
50 data = template.read()
64 \Huge\\bfseries Alignment Validation\par
66 \scshape\huge Alignment Campaign\\\\ {{{0}}}\par
68 \large \\today\par""".
format(config.message)
72 \Huge\\bfseries Alignment Validation\par
75 out.addSlide(
"", text)
78 text =
"\\tableofcontents"
79 out.addSlide(
"Overview", text)
82 out.add(
"\section{General information}")
85 text =
"Project: {{{0}}}\\\\\n".
format(config.message)
86 text +=
"Input-Path:\n"
87 text +=
"\\begin{verbatim}\n"
88 text += config.jobDataPath+
"\n"
89 text +=
"\\end{verbatim}\n"
90 out.addSlide_fragile(
"General information", text)
94 out.add(
"\subsection{Alignment Configuration}")
95 text =
"\\textbf{{PedeSteerer method:}} {{{0}}}\\\\\n".
format(
96 additionalData.pede_steerer_method)
97 text +=
"\\textbf{{PedeSteerer options:}}\\\\\n"
98 for line
in additionalData.pede_steerer_options:
99 text +=
"{{{0}}}\\\\\n".
format(line)
100 text +=
"\\textbf{{PedeSteerer command:}} {0}\\\\\n".
format(
101 additionalData.pede_steerer_command)
102 out.addSlide(
"Alignment Configuration", text)
103 except Exception
as e:
104 logger.error(
"data not found - {0} {1}".
format(type(e), e))
107 if config.showmonitor:
108 out.add(
"\subsection{Datasets with tracks}")
109 text =
"""\\begin{table}[h]
111 \caption{Datasets with tracks}
112 \\begin{tabular}{ccc}
114 Dataset & Number of used tracks & Weight \\\\
117 for monitor
in mpsv_classes.MonitorData.monitors:
118 text +=
"{0} & {1} & {2}\\\\\n".
format(monitor.name, monitor.ntracks,
119 monitor.weight
if monitor.weight !=
None else "--")
120 except Exception
as e:
121 logger.error(
"data not found - {0} {1}".
format(type(e), e))
123 text +=
"\hline\nNumber of records & {0}\\\\\n".
format(pedeDump.nrec)
127 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"
128 out.addSlide(
"Datasets with tracks", text)
131 out.add(
"\subsection{Pede monitoring information}")
133 if (pedeDump.sumValue != 0):
134 text =
r"\begin{{align*}}Sum(Chi^2)/Sum(Ndf) &= {0}\\ &= {1}\end{{align*}}".
format(
135 pedeDump.sumSteps, pedeDump.sumValue)
137 text =
r"\begin{{align*}}Sum(W*Chi^2)/Sum(Ndf)/<W> &= {0}\\ &= {1}\end{{align*}}".
format(
138 pedeDump.sumSteps, pedeDump.sumWValue)
139 text +=
r"with correction for down-weighting: {0}\\".
format(
141 text +=
r"Peak dynamic memory allocation: {0} GB\\".
format(pedeDump.memory)
142 text +=
r"Total time: {0} h {1} m {2} s\\".
format(
143 pedeDump.time[0], pedeDump.time[1], pedeDump.time[2])
144 text +=
r"Number of records: {0}\\".
format(pedeDump.nrec)
145 text +=
r"Total number of parameters: {0}\\".
format(pedeDump.ntgb)
146 text +=
r"Number of variable parameters: {0}\\".
format(pedeDump.nvgb)
147 out.addSlide(
"Pede monitoring information", text)
148 except Exception
as e:
149 logger.error(
"data not found - {0} {1}".
format(type(e), e))
152 out.add(
"\section{Parameter plots}")
155 out.add(
"\subsection{High-level parameters}")
156 big = [x
for x
in config.outputList
if (x.plottype ==
"big")]
159 text =
"\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
160 config.outputPath, i.filename)
162 out.addSlide(
"High-level parameters", text)
165 out.add(
"\subsection{High-level parameters versus time (IOV)}")
166 time = [x
for x
in config.outputList
if (x.plottype ==
"time")]
170 for structure
in [x.name
for x
in time
if x.parameter ==
"xyz"]:
171 for mode
in [
"xyz",
"rot"]:
172 text =
"\\framesubtitle{{{0}}}\n".
format(structure)
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 text +=
"\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
176 config.outputPath, filename)
178 out.addSlide(
"High-level parameters versus time (IOV)", text)
181 out.add(
"\subsection{Module-level parameters}")
183 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"")):
186 for moduleName
in [x.name
for x
in alignables.structures]:
189 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName)):
192 for mode
in [
"xyz",
"rot",
"dist"]:
195 module = [x
for x
in config.outputList
if (
196 x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName
and x.parameter == mode)]
198 moduleSub = [x
for x
in config.outputList
if (
199 x.plottype ==
"subMod" and x.number !=
"" and x.name == moduleName
and x.parameter == mode)]
203 text =
"\\framesubtitle{{{0}}}\n".
format(moduleName)
204 text +=
"\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
205 config.outputPath, module[0].filename)
207 out.addSlide(
"Module-level parameters", text)
210 for plot
in moduleSub:
211 text =
"\\framesubtitle{{{0}}}\n".
format(
213 text +=
"\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
214 config.outputPath, plot.filename)
216 out.addSlide(
"Module-level parameters", text)
219 out.add(
"\section{Monitor plots}")
220 for plot
in [x
for x
in config.outputList
if x.plottype ==
"monitor"]:
221 text =
"\\framesubtitle{{{0}}}\n".
format(plot.name)
222 text +=
"\includegraphics[height=0.85\\textheight]{{{0}/plots/pdf/{1}.pdf}}\n".
format(
223 config.outputPath, plot.filename)
224 out.addSlide(
"Monitor", text)
226 data = data.substitute(out=out.text)
228 with open(os.path.join(config.outputPath, outputFile),
"w")
as output:
234 os.system(
"pdflatex -output-directory={0} {1}/{2}".
format(
235 config.outputPath, config.outputPath, outputFile))