| 247 | {{{#!Spoiler |
| 248 | {{{#!sql |
| 249 | CREATE TEMPORARY TABLE SimulatedSpectrum |
| 250 | ( |
| 251 | `.energy` SMALLINT UNSIGNED NOT NULL COMMENT 'Bin Index [MC Energy]', |
| 252 | CountN DOUBLE NOT NULL, |
| 253 | CountW DOUBLE NOT NULL, |
| 254 | CountW2 DOUBLE NOT NULL, |
| 255 | PRIMARY KEY (`.energy`) USING HASH |
| 256 | ) ENGINE=Memory |
| 257 | AS |
| 258 | ( |
| 259 | SELECT |
| 260 | INTERVAL(LOG10(Energy), %0:energyest) AS `.energy`, |
| 261 | COUNT(*) AS CountN, |
| 262 | SUM( (%2:spectrum)/pow(Energy, SpectralIndex) ) AS CountW, |
| 263 | SUM(POW((%2:spectrum)/pow(Energy, SpectralIndex),2)) AS CountW2 |
| 264 | FROM |
| 265 | MonteCarloFiles |
| 266 | LEFT JOIN |
| 267 | factmc.RunInfoMC USING (FileId) |
| 268 | LEFT JOIN |
| 269 | factmc.OriginalMC USING (FileId) |
| 270 | GROUP BY |
| 271 | `.energy` |
| 272 | ORDER BY |
| 273 | `.energy` |
| 274 | ) |
| 275 | }}} |
| 276 | }}} |
| 277 | |
| 278 | |