CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
valtools.webpage Class Reference

Public Member Functions

def __init__ (self)
 
def parseArgs (self)
 
def readCaption (self, line)
 
def readCaptions (self, captions)
 
def setOutputDir (self, outputDir)
 

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

Member Function Documentation

def valtools.webpage.parseArgs (   self)
def valtools.webpage.readCaption (   self,
  line 
)

Definition at line 71 of file valtools.py.

References reco.if(), and match().

Referenced by valtools.webpage.readCaptions().

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

Definition at line 47 of file valtools.py.

References valtools.webpage.outputDir_, dqmoffline::l1t::L1TDiffHarvesting::L1TDiffPlotHandler.outputDir_, MillePedeFileExtractor.outputDir_, L1GtVhdlWriter.outputDir_, dqmoffline::l1t::L1TEfficiencyPlotHandler.outputDir_, batchmanager.BatchManager.outputDir_, L1GtVhdlWriterCore.outputDir_, LaserSorter.outputDir_, and valtools.webpage.readCaption().

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

Definition at line 32 of file valtools.py.

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

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.