4 from __future__
import print_function
5 import shutil, sys, os, re, valtools
7 from string
import Template
9 from optparse
import OptionParser
15 webpage.parser_.usage =
"usage: %prog. Run from your Benchmark directory"
16 webpage.parser_.add_option(
"-r",
"--recipe", dest=
"recipe",
17 help=
"url pointing to a recipe",
19 webpage.parser_.add_option(
"-t",
"--title", dest=
"title",
20 help=
"Benchmark title",
22 webpage.parser_.add_option(
"-g",
"--gensource", dest=
"pyGenSource",
23 help=
"python file for the CMSSW source of the generated events, which is used in input to your simulation and reconstruction process",
25 webpage.parser_.add_option(
"-s",
"--simulation", dest=
"pySim",
26 help=
"python file for your CMSSW simulation and/or reconstruction process.",
31 if len(webpage.args_)!=0:
32 webpage.parser_.print_help()
37 webpage.setOutputDir( benchmark.fullName() )
40 recipe = webpage.options_.recipe
41 genConfig = webpage.options_.pyGenSource
42 simConfig = webpage.options_.pySim
43 benchmarkConfig =
'benchmark_cfg.py'
46 cmssw = os.environ[
'CMSSW_VERSION']
47 showTags = os.popen(
'showtags -t -r -u').
read()
49 title = webpage.benchmarkName_
51 templateFile =
'index.html'
53 outputDir = webpage.outputDir_
54 indexhtml =
"%s/%s" % (webpage.templates_,templateFile)
63 infonotfoundhtml =
"%s/%s" % (webpage.templates_,
"infoNotFound.html")
75 comments = webpage.options_.comments
76 images = webpage.readCaptions(
'captions.txt')
78 ifile = open( indexhtml )
79 indexTemplate = ifile.read()
80 s = Template(indexTemplate)
81 subst = s.substitute(title = title,
83 recipeLink = recipeLink,
84 genConfig = os.path.basename(genConfig),
85 genConfigLink = genConfigLink,
86 simConfig = os.path.basename(simConfig),
87 simConfigLink = simConfigLink,
88 benchmarkConfig = os.path.basename(benchmarkConfig),
89 benchmarkConfigLink = benchmarkConfigLink,
90 macro = os.path.basename(macro),
91 macroLink = macroLink,
92 rootFile = os.path.basename(webpage.rootFile_),
93 rootFileLink = rootFileLink,
98 username = os.environ[
'USER'],
102 ofile = open(
'%s/index.html' % outputDir,
'w' )
105 ifile = open( infonotfoundhtml )
106 infoNotFoundTemplate = ifile.read()
107 s2 = Template(infoNotFoundTemplate)
108 subst2 = s2.substitute( username = os.environ[
'USER'] )
109 ofile2 = open(
'%s/infoNotFound.html' % outputDir,
'w' )
110 ofile2.write( subst2 )
112 print(
'webpage directory successfully created in', outputDir)