11 from Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.classes
import MonitorData, PedeDumpData
12 from Alignment.MillePedeAlignmentAlgorithm.mpsvalidate.geometry
import Alignables, Structure
22 def create(alignables, pedeDump, additionalData, outputFile, config):
23 logger = logging.getLogger(
"mpsvalidate")
26 with open(os.path.join(config.mpspath,
"html_template.html"),
"r") as template:
27 data = template.read()
38 out +=
"<h1>General information</h1>\n"
41 out +=
"Project: {0}\n<br>".
format(config.message)
42 out +=
"Input-Path: {0}\n<br>".
format(config.jobDataPath)
46 out +=
"<h2>Alignment Configuration</h2>\n"
47 out +=
"<b>PedeSteerer method:</b> {0}<br>\n".
format(
48 additionalData.pedeSteererMethod)
49 out +=
"<b>PedeSteerer options:</b>\n"
50 for line
in additionalData.pedeSteererOptions:
51 out +=
"{0}<br>\n".
format(line)
52 out +=
"<b>PedeSteerer command:</b> {0}<br>\n".
format(
53 additionalData.pedeSteererCommand)
55 for selector
in additionalData.pattern:
56 out +=
"<b>{0}:</b><br>\n".
format(additionalData.pattern[selector][3])
57 for line
in additionalData.pattern[selector][0]:
61 for line
in additionalData.pattern[selector][2]:
62 out +=
"{0} \n".
format(line)
64 except Exception
as e:
65 logger.error(
"data not found - {0} {1}".
format(type(e), e))
68 if (config.showmonitor):
69 out +=
"<h2>Datasets with tracks</h2>\n"
70 out +=
"""<table border="1">
73 <th>Number of used tracks</th>
75 for monitor
in MonitorData.monitors:
79 </tr>""".
format(monitor.name, monitor.ntracks)
83 <th>Number of records</th>
85 </tr>""".
format(pedeDump.nrec)
86 except Exception
as e:
87 logger.error(
"data not found - {0} {1}".
format(type(e), e))
89 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."
93 out +=
"<h2>Pede monitoring information</h2>\n"
94 if (pedeDump.sumValue != 0):
95 out +=
r"<b>Sum(Chi^2)/Sum(Ndf)</b> &= {0}<br> &= {1}".
format(
96 pedeDump.sumSteps, pedeDump.sumValue)
98 out +=
r"<b>Sum(W*Chi^2)/Sum(Ndf)/<W></b> &= {0}<br> &= {1}".
format(
99 pedeDump.sumSteps, pedeDump.sumWValue)
100 out +=
r"<b>with correction for down-weighting:</b> {0}<br>".
format(
102 out +=
r"<b>Peak dynamic memory allocation:</b> {0} GB<br>".
format(
104 out +=
r"<b>Total time:</b> {0} h {1} m {2} s<br>".
format(
105 pedeDump.time[0], pedeDump.time[1], pedeDump.time[2])
106 out +=
r"<b>Number of records:</b> {0}<br>".
format(pedeDump.nrec)
107 out +=
r"<b>Total number of parameters:</b> {0}<br>".
format(pedeDump.ntgb)
108 out +=
r"<b>Number of variable parameters:</b> {0}<br>".
format(pedeDump.nvgb)
109 out +=
r"<b>Warning:</b><br>"
110 for line
in pedeDump.warning:
113 if line.replace(
r" ",
r""):
114 out +=
"{0}<br>\n".
format(line)
115 except Exception
as e:
116 logger.error(
"data not found - {0} {1}".
format(type(e), e))
120 big = [x
for x
in config.outputList
if (x.plottype ==
"big")]
123 out +=
"<h1>High-level parameters</h1>\n"
125 out +=
"<a href='plots/pdf/{0}.pdf'><img src='plots/png/{0}.png'></a>\n".
format(
130 time = [x
for x
in config.outputList
if (x.plottype ==
"time")]
133 out +=
"<h1>High-level parameters versus time (IOV)</h1>\n"
135 for structure
in [x.name
for x
in time
if x.parameter ==
"xyz"]:
136 out +=
"<h2>{0}<h2>\n".
format(structure)
137 for mode
in [
"xyz",
"rot"]:
138 if any([x.filename
for x
in time
if (x.parameter == mode
and x.name == structure)]):
139 filename = [x.filename
for x
in time
if (x.parameter == mode
and x.name == structure)][0]
140 out +=
"<a href='plots/pdf/{0}.pdf'><img src='plots/png/{0}.png'></a>\n".
format(
146 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"")):
147 out +=
"<h1>Module-level parameters</h1>\n"
150 for moduleName
in [x.name
for x
in alignables.structures]:
153 if any(x
for x
in config.outputList
if (x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName)):
154 out +=
"<h2>{0}</h2>\n".
format(moduleName)
157 for mode
in [
"xyz",
"rot",
"dist"]:
160 module = [x
for x
in config.outputList
if (
161 x.plottype ==
"mod" and x.number ==
"" and x.name == moduleName
and x.parameter == mode)]
163 moduleSub = [x
for x
in config.outputList
if (
164 x.plottype ==
"subMod" and x.number !=
"" and x.name == moduleName
and x.parameter == mode)]
168 out +=
"<a href='plots/pdf/{0}.pdf'><img src='plots/png/{0}.png'></a>\n".
format(module[
172 for plot
in moduleSub:
173 out +=
"<a href='plots/pdf/{0}.pdf'><img src='plots/png/{0}.png'></a>\n".
format(
178 if any(x
for x
in config.outputList
if x.plottype ==
"monitor"):
179 out +=
"<h1>Monitor</h1>\n"
180 for plot
in [x
for x
in config.outputList
if x.plottype ==
"monitor"]:
181 out +=
"<h3>{0}</h3>\n".
format(plot.name)
182 out +=
"<a href='plots/pdf/{0}.pdf'><img src='plots/png/{0}.png'></a>\n".
format(
185 data = data.substitute(message=config.message, out=out)
187 with open(os.path.join(config.outputPath, outputFile),
"w")
as output:
bool any(const std::vector< T > &v, const T &what)