18 def create(alignables, pedeDump, additionalData, outputFile, config):
19 logger = logging.getLogger(
"mpsvalidate")
22 with open(os.path.join(config.mpspath,
"templates",
23 "mpsvalidate_html_template.html"))
as template:
24 data = template.read()
35 out +=
"<h1>General information</h1>\n" 38 out +=
"Project: {0}\n<br>".
format(config.message)
39 out +=
"Input-Path: {0}\n<br>".
format(config.jobDataPath)
43 out +=
"<h2>Alignment Configuration</h2>\n" 44 out +=
"<b>PedeSteerer method:</b> {0}<br>\n".
format(
45 additionalData.pede_steerer_method)
46 out +=
"<b>PedeSteerer options:</b>\n" 47 for line
in additionalData.pede_steerer_options:
48 out +=
"{0}<br>\n".
format(line)
49 out +=
"<b>PedeSteerer command:</b> {0}<br>\n".
format(
50 additionalData.pede_steerer_command)
52 for i
in sorted(additionalData.selectors):
53 out +=
"<b>{0}:</b><br>\n".
format(additionalData.selectors[i][
"name"])
54 for line
in additionalData.selectors[i][
"selector"].
dumpPython().
split(
"\n"):
55 out += line +
"<br>\n" 57 if len(additionalData.iov_definition) > 0:
58 out +=
"<b>IOV defintion:</b><br>\n" 59 for line
in additionalData.iov_definition.dumpPython().
split(
"\n"):
60 out += line +
"<br>\n" 62 except Exception
as e:
63 logger.error(
"data not found - {0} {1}".
format(type(e), e))
66 if config.showmonitor:
67 out +=
"<h2>Datasets with tracks</h2>\n" 68 out +=
"""<table border="1"> 71 <th>Number of used tracks</th> 74 for monitor
in mpsv_classes.MonitorData.monitors:
79 </tr>""".
format(monitor.name, monitor.ntracks,
80 monitor.weight
if monitor.weight !=
None else "–")
84 <th>Number of records</th> 86 </tr>""".
format(pedeDump.nrec)
87 except Exception
as e:
88 logger.error(
"data not found - {0} {1}".
format(type(e), e))
90 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." 94 out +=
"<h2>Pede monitoring information</h2>\n" 95 if (pedeDump.sumValue != 0):
96 out +=
r"<b>Sum(Chi^2)/Sum(Ndf)</b> &= {0}<br> &= {1}".
format(
97 pedeDump.sumSteps, pedeDump.sumValue)
99 out +=
r"<b>Sum(W*Chi^2)/Sum(Ndf)/<W></b> &= {0}<br> &= {1}".
format(
100 pedeDump.sumSteps, pedeDump.sumWValue)
101 out +=
r"<b>with correction for down-weighting:</b> {0}<br>".
format(
103 out +=
r"<b>Peak dynamic memory allocation:</b> {0} GB<br>".
format(
105 out +=
r"<b>Total time:</b> {0} h {1} m {2} s<br>".
format(
106 pedeDump.time[0], pedeDump.time[1], pedeDump.time[2])
107 out +=
r"<b>Number of records:</b> {0}<br>".
format(pedeDump.nrec)
108 out +=
r"<b>Total number of parameters:</b> {0}<br>".
format(pedeDump.ntgb)
109 out +=
r"<b>Number of variable parameters:</b> {0}<br>".
format(pedeDump.nvgb)
110 out +=
r"<b>Warning:</b><br>" 111 for line
in pedeDump.warning:
114 if line.replace(
r" ",
r""):
115 out +=
"{0}<br>\n".
format(line)
116 except Exception
as e:
117 logger.error(
"data not found - {0} {1}".
format(type(e), e))
121 big = [x
for x
in config.outputList
if (x.plottype ==
"big")]
124 out +=
"<h1>High-level parameters</h1>\n" 126 out +=
"<a href='plots/pdf/{0}.pdf'><img src='plots/png/{0}.png'></a>\n".
format(
131 time = [x
for x
in config.outputList
if (x.plottype ==
"time")]
134 out +=
"<h1>High-level parameters versus time (IOV)</h1>\n" 136 for structure
in [x.name
for x
in time
if x.parameter ==
"xyz"]:
137 out +=
"<h2>{0}<h2>\n".
format(structure)
138 for mode
in [
"xyz",
"rot"]:
139 if any([x.filename
for x
in time
if (x.parameter == mode
and x.name == structure)]):
140 filename = [x.filename
for x
in time
if (x.parameter == mode
and x.name == structure)][0]
141 out +=
"<a href='plots/pdf/{0}.pdf'><img src='plots/png/{0}.png'></a>\n".
format(
147 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"")):
148 out +=
"<h1>Module-level parameters</h1>\n" 151 for moduleName
in [x.name
for x
in alignables.structures]:
154 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName)):
155 out +=
"<h2>{0}</h2>\n".
format(moduleName)
158 for mode
in [
"xyz",
"rot",
"dist"]:
161 module = [x
for x
in config.outputList
if (
162 x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName
and x.parameter == mode)]
164 moduleSub = [x
for x
in config.outputList
if (
165 x.plottype ==
"subMod" and x.number !=
"" and x.name == moduleName
and x.parameter == mode)]
169 out +=
"<a href='plots/pdf/{0}.pdf'><img src='plots/png/{0}.png'></a>\n".
format(module[
173 for plot
in moduleSub:
174 out +=
"<a href='plots/pdf/{0}.pdf'><img src='plots/png/{0}.png'></a>\n".
format(
179 if any(x
for x
in config.outputList
if x.plottype ==
"monitor"):
180 out +=
"<h1>Monitor</h1>\n" 181 for plot
in [x
for x
in config.outputList
if x.plottype ==
"monitor"]:
182 out +=
"<h3>{0}</h3>\n".
format(plot.name)
183 out +=
"<a href='plots/pdf/{0}.pdf'><img src='plots/png/{0}.png'></a>\n".
format(
186 data = data.substitute(message=config.message, out=out)
188 with open(os.path.join(config.outputPath, outputFile),
"w")
as output:
190
def create(alignables, pedeDump, additionalData, outputFile, config)
bool any(const std::vector< T > &v, const T &what)
def dumpPython(process, name)