CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
presentation.PageLayout Class Reference
Inheritance diagram for presentation.PageLayout:

Public Member Functions

def __init__
 
def fit
 

Public Attributes

 height
 
 pattern
 
 width
 

Detailed Description

Definition at line 46 of file presentation.py.

Constructor & Destructor Documentation

def presentation.PageLayout.__init__ (   self,
  pattern = [],
  width = 1,
  height = 1 
)

Definition at line 47 of file presentation.py.

47 
48  def __init__(self, pattern=[], width=1, height=1):
49  self.pattern = [] # List of rows; row contains the order numbers
50  # of its plots; e.g. [[1,2,3], [4,5,6]]
51  self.width = width # Maximum width of one plot,
52  # with respect to textwidth.
53  self.height = height # Maximum height of one plot,
54  # with respect to textheight.

Member Function Documentation

def presentation.PageLayout.fit (   self,
  plots 
)

Definition at line 57 of file presentation.py.

References presentation.PageLayout.height, svgfig.Plot.height, svgfig.Frame.height, svgfig.Dots.height, presentation.PageLayout.pattern, sistrip::SpyUtilities.range(), presentation.PageLayout.width, svgfig.Plot.width, svgfig.Frame.width, and svgfig.Dots.width.

Referenced by trackingPlots.Iteration.modules().

57 
58  def fit(self, plots):
59  rowlengths = []
60  # First, try to place plots in a square.
61  nplots = sum(len(p) for p in plots)
62  length = int(math.ceil(math.sqrt(nplots)))
63  # Then, fill the square from the bottom and remove extra rows.
64  fullRows = int(nplots/length)
65  residual = nplots - length*fullRows
66  nrows = fullRows
67  if residual != 0:
68  rowlengths.append(residual)
69  nrows += 1
70  for _ in range(fullRows):
71  rowlengths.append(length)
72 
73  # Now, fill the pattern.
74  self.pattern = []
75  if residual == 0 and len(plots[0])%length != 0 and\
76  len(plots[0])%nrows == 0:
77  # It's better to arrange plots in columns, not rows.
78  self.pattern.extend(list(range(i, i+nrows*(length-1)+1, nrows))
79  for i in range(1, nrows+1))
80  else:
81  if residual != 0:
82  self.pattern.append(list(range(1, 1+residual)))
83  self.pattern.extend(list(range(i, i+length)) for i in
84  range(residual+1, nplots-length+2, length))
85 
86  self.width = 1.0/length
87  self.height = 0.8/nrows
88 
89 
90 # Write a set of pages, one for each subdetector.
91 # Arguments: identifier: regular expression to get the wanted plots,
92 # used together with subdetector name
93 # title: title of the plot type
94 # validations: list of relevant ValidationPlots objects.
# Returns the parsed script.
const uint16_t range(const Frame &aFrame)

Member Data Documentation

presentation.PageLayout.height

Definition at line 52 of file presentation.py.

Referenced by TkAlMap.TkAlMap.draw_cms_prelim(), presentation.PageLayout.fit(), and TkAlMap.TkAlMap.load_geometry().

presentation.PageLayout.pattern

Definition at line 48 of file presentation.py.

Referenced by presentation.PageLayout.fit(), and dataset.BaseDataset.printFiles().

presentation.PageLayout.width

Definition at line 50 of file presentation.py.

Referenced by python.rootplot.utilities.Hist.__init_TGraph(), python.rootplot.root2matplotlib.Hist.bar(), python.rootplot.root2matplotlib.Hist.barh(), TkAlMap.TkAlMap.draw_cms_prelim(), presentation.PageLayout.fit(), and TkAlMap.TkAlMap.load_geometry().