CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
presentation Namespace Reference

Classes

class  PageLayout
 
class  SubsectionBase
 
class  SubsectionFromList
 
class  SubsectionOnePage
 
class  SummarySection
 
class  ValidationPlots
 

Functions

def plotSortKey
 
def validationclasses
 
def writePage
 
def writePageReg
 

Function Documentation

def presentation.plotSortKey (   plot)

Definition at line 182 of file presentation.py.

183 def plotSortKey(plot):
184  # Move normchi2 before chi2Prob
185  if plot.find('normchi2') != -1:
186  return 'chi2a'
187  if plot.find('chi2Prob') != -1:
188  return 'chi2b'
189  return plot
def presentation.validationclasses (   validations)

Definition at line 38 of file presentation.py.

Referenced by produceOfflineValidationTex.main().

38 
39 def validationclasses(validations):
40  from collections import OrderedDict
41  classes = [validation.validationclass for validation in validations]
42  #remove duplicates - http://stackoverflow.com/a/39835527/5228524
43  classes = list(OrderedDict.fromkeys(classes))
44  return classes
45 
# Layout of plots on a page:
def validationclasses
Definition: presentation.py:38
def presentation.writePage (   plots,
  title,
  layout 
)

Definition at line 166 of file presentation.py.

References join(), sistrip::SpyUtilities.range(), python.rootplot.root2matplotlib.replace(), and str.

Referenced by writePageReg().

167 def writePage(plots, title, layout):
168  plotrows = []
169  for row in layout.pattern:
170  plotrow = []
171  for i in range(len(row)):
172  plotrow.append(plotTemplate.replace('[width]', str(layout.width)).\
173  replace('[height]', str(layout.height)).\
174  replace('[path]', plots[row[i]-1]))
175  plotrows.append('\n'.join(plotrow))
176  script = ' \\\\\n'.join(plotrows)
177 
178  return frameTemplate.replace('[plots]', script).replace('[title]', title)
179 
180 
181 # Sort key to rearrange a plot list.
# Arguments: plot: to be sorted.
const uint16_t range(const Frame &aFrame)
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
#define str(s)
def presentation.writePageReg (   identifier,
  title,
  validations,
  layout = 0 
)

Definition at line 142 of file presentation.py.

References print(), and writePage().

Referenced by presentation.SubsectionOnePage.pages(), and presentation.SubsectionFromList.pages().

143 def writePageReg(identifier, title, validations, layout=0):
144  plots = []
145  for validation in validations:
146  valiplots = [validation.path+plot for plot in validation.plots
147  if re.search(identifier, plot)]
148  valiplots.sort(key=plotSortKey)
149  plots.append(valiplots)
150  if sum(len(p) for p in plots) == 0:
151  print('Warning: no plots matching ' + identifier)
152  return ''
153 
154  # Create layout, if not given.
155  if layout == 0:
156  layout = PageLayout()
157  layout.fit(plots)
158 
159  return writePage([p for vali in plots for p in vali], title, layout)
160 
161 
162 # Write the given plots on a page.
163 # Arguments: plots: paths of plots to be drawn on the page
164 # title: title of the plot type
165 # layout: a PageLayout object definig the layout.
# Returns the parsed script.
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47