4 import shutil, sys, os, re, valtools
6 from string
import Template
8 from optparse
import OptionParser
14 webpage.parser_.usage =
"usage: %prog. Run from your Benchmark directory" 15 webpage.parser_.add_option(
"-r",
"--recipe", dest=
"recipe",
16 help=
"url pointing to a recipe",
18 webpage.parser_.add_option(
"-t",
"--title", dest=
"title",
19 help=
"Benchmark title",
21 webpage.parser_.add_option(
"-g",
"--gensource", dest=
"pyGenSource",
22 help=
"python file for the CMSSW source of the generated events, which is used in input to your simulation and reconstruction process",
24 webpage.parser_.add_option(
"-s",
"--simulation", dest=
"pySim",
25 help=
"python file for your CMSSW simulation and/or reconstruction process.",
30 if len(webpage.args_)!=0:
31 webpage.parser_.print_help()
36 webpage.setOutputDir( benchmark.fullName() )
39 recipe = webpage.options_.recipe
40 genConfig = webpage.options_.pyGenSource
41 simConfig = webpage.options_.pySim
42 benchmarkConfig =
'benchmark_cfg.py' 45 cmssw = os.environ[
'CMSSW_VERSION']
46 showTags = os.popen(
'showtags -t -r -u').read()
48 title = webpage.benchmarkName_
50 templateFile =
'index.html' 52 outputDir = webpage.outputDir_
53 indexhtml =
"%s/%s" % (webpage.templates_,templateFile)
62 infonotfoundhtml =
"%s/%s" % (webpage.templates_,
"infoNotFound.html")
74 comments = webpage.options_.comments
75 images = webpage.readCaptions(
'captions.txt')
77 ifile = open( indexhtml )
78 indexTemplate = ifile.read()
79 s = Template(indexTemplate)
80 subst = s.substitute(title = title,
82 recipeLink = recipeLink,
83 genConfig = os.path.basename(genConfig),
84 genConfigLink = genConfigLink,
85 simConfig = os.path.basename(simConfig),
86 simConfigLink = simConfigLink,
87 benchmarkConfig = os.path.basename(benchmarkConfig),
88 benchmarkConfigLink = benchmarkConfigLink,
89 macro = os.path.basename(macro),
90 macroLink = macroLink,
91 rootFile = os.path.basename(webpage.rootFile_),
92 rootFileLink = rootFileLink,
97 username = os.environ[
'USER'],
101 ofile = open(
'%s/index.html' % outputDir,
'w' )
104 ifile = open( infonotfoundhtml )
105 infoNotFoundTemplate = ifile.read()
106 s2 = Template(infoNotFoundTemplate)
107 subst2 = s2.substitute( username = os.environ[
'USER'] )
108 ofile2 = open(
'%s/infoNotFound.html' % outputDir,
'w' )
109 ofile2.write( subst2 )
111 print 'webpage directory successfully created in', outputDir