CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
valtools.webpage Class Reference

Public Member Functions

def __init__
 
def parseArgs
 
def readCaption
 
def readCaptions
 
def setOutputDir
 

Public Attributes

 benchmarkName_
 
 date_
 
 dirPlots_
 
 outputDir_
 
 parser_
 
 rootFile_
 
 templates_
 

Detailed Description

Definition at line 10 of file valtools.py.

Constructor & Destructor Documentation

def valtools.webpage.__init__ (   self)

Definition at line 13 of file valtools.py.

13 
14  def __init__(self):
15  self.parser_ = OptionParser()
16  self.parser_.add_option("-c", "--comments", dest="comments",
17  help="name of another release",
18  default=None)
19  self.parser_.add_option("-f", "--force", dest="force",
20  action="store_true",
21  help="overwrites the local benchmark page.",
22  default=False)
23  self.rootFile_ = 'benchmark.root'
24  self.dirPlots_ = './'
25  self.templates_ = '../Tools/templates'
26  self.date_ = os.popen( 'date' ).read()
27  self.benchmarkName_ = os.path.basename( os.getcwd() )

Member Function Documentation

def valtools.webpage.parseArgs (   self)

Definition at line 28 of file valtools.py.

References reco::parser::MethodInvoker.args_, reco::parser::ExpressionQuaterOperator< Op >.args_, ExternalLHEProducer.args_, Json::Path.args_, pftools::CalibCompare.options_, and pftools::Exercises3.options_.

28 
29  def parseArgs(self):
30  (self.options_, self.args_) = self.parser_.parse_args()
def valtools.webpage.readCaption (   self,
  line 
)

Definition at line 71 of file valtools.py.

References if(), and match().

Referenced by valtools.webpage.readCaptions().

71 
72  def readCaption( self, line ):
73 
74  if( re.compile('^\s*$').match(line) ):
75  raise Exception
76 
77  p = re.compile('^\s*(\S+)\s*\"(.*)\"');
78  m = p.match(line)
79  if m:
80  pic = m.group(1)
81  caption = m.group(2)
82  return (pic, caption)
83  else:
84  print 'bad caption format: "%s"' % line
85  raise Exception
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
if(conf.exists("allCellsPositionCalc"))
def valtools.webpage.readCaptions (   self,
  captions 
)

Definition at line 47 of file valtools.py.

References valtools.webpage.outputDir_, L1GtVhdlWriter.outputDir_, batchmanager.BatchManager.outputDir_, L1GtVhdlWriterCore.outputDir_, LaserSorter.outputDir_, and valtools.webpage.readCaption().

47 
48  def readCaptions(self, captions):
49  imgTemplate = '<IMG src="%s" width="500" align="left" border="0"><br clear="ALL">'
50  images = ''
51  captionsContents = open( captions )
52  for line in captionsContents:
53  try:
54  (picfile, caption) = self.readCaption( line )
55  img = imgTemplate % os.path.basename(picfile)
56  images = "%s<h3>%s:</h3>\n%s\n" % (images, caption, img)
57  # what to do if the file's not there?
58  # : print a warning
59  shutil.copy(picfile, self.outputDir_)
60  except Exception:
61  print 'File %s does not exist. Did you generate the comparison plots?' % picfile
62  print 'Aborting the script.\n'
63  print 'Solution 1: run without the -m "" option, to run the compare.C macro'
64  print 'Solution 2: run with the -m "myMacro.C" option, to run another macro'
65  sys.exit(1)
66  raise
67  return images
def valtools.webpage.setOutputDir (   self,
  outputDir 
)

Definition at line 32 of file valtools.py.

32 
33  def setOutputDir(self, outputDir ):
34 
35  self.outputDir_ = outputDir
36  if os.path.isdir( outputDir ):
37  print outputDir, "already exists"
38  if self.options_.force == False:
39  print 'sorry... run the script with the -h option for more information'
40  sys.exit(3)
41  else:
42  print 'overwriting local output directory...'
43  else:
44  os.makedirs( outputDir )

Member Data Documentation

valtools.webpage.benchmarkName_

Definition at line 26 of file valtools.py.

valtools.webpage.date_

Definition at line 25 of file valtools.py.

valtools.webpage.dirPlots_

Definition at line 23 of file valtools.py.

valtools.webpage.outputDir_

Definition at line 34 of file valtools.py.

Referenced by valtools.webpage.readCaptions().

valtools.webpage.parser_

Definition at line 14 of file valtools.py.

valtools.webpage.rootFile_

Definition at line 22 of file valtools.py.

valtools.webpage.templates_

Definition at line 24 of file valtools.py.