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 11 of file valtools.py.

Constructor & Destructor Documentation

◆ __init__()

def valtools.webpage.__init__ (   self)

Definition at line 14 of file valtools.py.

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() )
28 

Member Function Documentation

◆ parseArgs()

def valtools.webpage.parseArgs (   self)

◆ readCaption()

def valtools.webpage.readCaption (   self,
  line 
)

Definition at line 72 of file valtools.py.

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
86 

References match(), and edm.print().

Referenced by valtools.webpage.readCaptions().

◆ readCaptions()

def valtools.webpage.readCaptions (   self,
  captions 
)

Definition at line 48 of file valtools.py.

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
68 

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

◆ setOutputDir()

def valtools.webpage.setOutputDir (   self,
  outputDir 
)

Definition at line 33 of file valtools.py.

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 )
45 

Member Data Documentation

◆ benchmarkName_

valtools.webpage.benchmarkName_

Definition at line 27 of file valtools.py.

◆ date_

valtools.webpage.date_

Definition at line 26 of file valtools.py.

◆ dirPlots_

valtools.webpage.dirPlots_

Definition at line 24 of file valtools.py.

◆ outputDir_

valtools.webpage.outputDir_

Definition at line 35 of file valtools.py.

Referenced by valtools.webpage.readCaptions().

◆ parser_

valtools.webpage.parser_

Definition at line 15 of file valtools.py.

Referenced by valtools.webpage.parseArgs().

◆ rootFile_

valtools.webpage.rootFile_

Definition at line 23 of file valtools.py.

◆ templates_

valtools.webpage.templates_

Definition at line 25 of file valtools.py.

match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
main.parse_args
def parse_args(args)
Definition: main.py:63
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
readEcalDQMStatus.read
read
Definition: readEcalDQMStatus.py:38