CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
produceOfflineValidationTex.PageLayout Class Reference

Public Member Functions

def __init__ (self, pattern=[], width=1, height=1)
 
def fit (self, plots)
 

Public Attributes

 height
 
 pattern
 
 width
 

Detailed Description

Definition at line 47 of file produceOfflineValidationTex.py.

Constructor & Destructor Documentation

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

Definition at line 48 of file produceOfflineValidationTex.py.

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.
55 
def __init__(self, pattern=[], width=1, height=1)

Member Function Documentation

def produceOfflineValidationTex.PageLayout.fit (   self,
  plots 
)

Definition at line 58 of file produceOfflineValidationTex.py.

References produceOfflineValidationTex.PageLayout.height, svgfig.Plot.height, svgfig.Frame.height, svgfig.Dots.height, createfilelist.int, produceOfflineValidationTex.PageLayout.pattern, produceOfflineValidationTex.PageLayout.width, svgfig.Plot.width, svgfig.Frame.width, and svgfig.Dots.width.

Referenced by trackingPlots.Iteration.modules().

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 xrange(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(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(range(1, 1+residual))
83  self.pattern.extend(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.
95 # Returns the parsed script.

Member Data Documentation

produceOfflineValidationTex.PageLayout.height
produceOfflineValidationTex.PageLayout.pattern
produceOfflineValidationTex.PageLayout.width