CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
plotting.PlotTextBox Class Reference

Public Member Functions

def __init__ (self, xmin, ymin, xmax, ymax, lineheight=0.04, fillColor=ROOT.kWhite, transparent=True, kwargs)
 
def addText (self, text)
 
def Draw (self, options="")
 
def move (self, dx=0, dy=0, dw=0, dh=0)
 
def width (self)
 

Private Attributes

 _currenty
 
 _fillColor
 
 _lineheight
 
 _pave
 
 _textArgs
 
 _texts
 
 _transparent
 
 _xmax
 
 _xmin
 
 _ymax
 
 _ymin
 

Detailed Description

Class for drawing text and a background box.

Definition at line 1561 of file plotting.py.

Constructor & Destructor Documentation

◆ __init__()

def plotting.PlotTextBox.__init__ (   self,
  xmin,
  ymin,
  xmax,
  ymax,
  lineheight = 0.04,
  fillColor = ROOT.kWhite,
  transparent = True,
  kwargs 
)
Constructor

Arguments:
xmin        -- X min coordinate of the box (NDC)
ymin        -- Y min coordinate of the box (NDC) (if None, deduced automatically)
xmax        -- X max coordinate of the box (NDC)
ymax        -- Y max coordinate of the box (NDC)
lineheight  -- Line height
fillColor   -- Fill color of the box
transparent -- Should the box be transparent? (in practive the TPave is not created)

Keyword arguments are forwarded to constructor of PlotText

Definition at line 1563 of file plotting.py.

1563  def __init__(self, xmin, ymin, xmax, ymax, lineheight=0.04, fillColor=ROOT.kWhite, transparent=True, **kwargs):
1564  """Constructor
1565 
1566  Arguments:
1567  xmin -- X min coordinate of the box (NDC)
1568  ymin -- Y min coordinate of the box (NDC) (if None, deduced automatically)
1569  xmax -- X max coordinate of the box (NDC)
1570  ymax -- Y max coordinate of the box (NDC)
1571  lineheight -- Line height
1572  fillColor -- Fill color of the box
1573  transparent -- Should the box be transparent? (in practive the TPave is not created)
1574 
1575  Keyword arguments are forwarded to constructor of PlotText
1576  """
1577  # ROOT.TPave Set/GetX1NDC() etc don't seem to work as expected.
1578  self._xmin = xmin
1579  self._xmax = xmax
1580  self._ymin = ymin
1581  self._ymax = ymax
1582  self._lineheight = lineheight
1583  self._fillColor = fillColor
1584  self._transparent = transparent
1585  self._texts = []
1586  self._textArgs = {}
1587  self._textArgs.update(kwargs)
1588 
1589  self._currenty = ymax
1590 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)
#define update(a, b)

Member Function Documentation

◆ addText()

def plotting.PlotTextBox.addText (   self,
  text 
)
Add text to current position

Definition at line 1591 of file plotting.py.

References plotting.PlotTextBox._currenty, plotting.PlotTextBox._lineheight, plotting.PlotTextBox._textArgs, plotting.PlotTextBox._texts, MEGeom._xmin, HistoParams< T >._xmin, HistoParams< TH2F >._xmin, HistoParams< TProfile2D >._xmin, plotting.PlotTextBox._xmin, and mps_setup.append.

1591  def addText(self, text):
1592  """Add text to current position"""
1593  self._currenty -= self._lineheight
1594  self._texts.append(PlotText(self._xmin+0.01, self._currenty, text, **self._textArgs))
1595 

◆ Draw()

def plotting.PlotTextBox.Draw (   self,
  options = "" 
)
Draw the box and the text to the current TPad.

Arguments:
options -- Forwarded to ROOT.TPave.Draw(), and the Draw() of the contained objects

Definition at line 1625 of file plotting.py.

References plotting.PlotTextBox._transparent, fftjetcms::LookupTable2d.ymin(), PixelClusterizerBase::AccretionCluster.ymin, MTDClusterizerBase::AccretionCluster.ymin, dqmoffline::l1t::HistDefinition.ymin, Exhume::Event.ymin, cscdqm::AddressBox.ymin, and TrackerMap.ymin.

1625  def Draw(self, options=""):
1626  """Draw the box and the text to the current TPad.
1627 
1628  Arguments:
1629  options -- Forwarded to ROOT.TPave.Draw(), and the Draw() of the contained objects
1630  """
1631  if not self._transparent:
1632  ymin = self.ymin
1633  if ymin is None:
1634  ymin = self.currenty - 0.01
1635  self._pave = ROOT.TPave(self.xmin, self.ymin, self.xmax, self.ymax, 0, "NDC")
1636  self._pave.SetFillColor(self.fillColor)
1637  self._pave.Draw(options)
1638  for t in self._texts:
1639  t.Draw(options)
1640 

◆ move()

def plotting.PlotTextBox.move (   self,
  dx = 0,
  dy = 0,
  dw = 0,
  dh = 0 
)
Move the box and the contained text objects

Arguments:
dx -- Movement in x (positive is to right)
dy -- Movement in y (positive is to up)
dw -- Increment of width (negative to decrease width)
dh -- Increment of height (negative to decrease height)

dx and dy affect to both box and text objects, dw and dh
affect the box only.

Definition at line 1599 of file plotting.py.

References plotting.PlotTextBox._texts, MEGeom._xmax, HistoParams< T >._xmax, HistoParams< TH2F >._xmax, HistoParams< TProfile2D >._xmax, plotting.PlotTextBox._xmax, MEGeom._xmin, HistoParams< T >._xmin, HistoParams< TH2F >._xmin, HistoParams< TProfile2D >._xmin, plotting.PlotTextBox._xmin, MEGeom._ymax, HistoParams< T >._ymax, HistoParams< TH2F >._ymax, HistoParams< TProfile2D >._ymax, plotting.PlotTextBox._ymax, MEGeom._ymin, HistoParams< T >._ymin, HistoParams< TH2F >._ymin, HistoParams< TProfile2D >._ymin, and plotting.PlotTextBox._ymin.

1599  def move(self, dx=0, dy=0, dw=0, dh=0):
1600  """Move the box and the contained text objects
1601 
1602  Arguments:
1603  dx -- Movement in x (positive is to right)
1604  dy -- Movement in y (positive is to up)
1605  dw -- Increment of width (negative to decrease width)
1606  dh -- Increment of height (negative to decrease height)
1607 
1608  dx and dy affect to both box and text objects, dw and dh
1609  affect the box only.
1610  """
1611  self._xmin += dx
1612  self._xmax += dx
1613  if self._ymin is not None:
1614  self._ymin += dy
1615  self._ymax += dy
1616 
1617  self._xmax += dw
1618  if self._ymin is not None:
1619  self._ymin -= dh
1620 
1621  for t in self._texts:
1622  t._x += dx
1623  t._y += dy
1624 
def move(src, dest)
Definition: eostools.py:511

◆ width()

def plotting.PlotTextBox.width (   self)

Member Data Documentation

◆ _currenty

plotting.PlotTextBox._currenty
private

Definition at line 1589 of file plotting.py.

Referenced by plotting.PlotTextBox.addText().

◆ _fillColor

plotting.PlotTextBox._fillColor
private

Definition at line 1583 of file plotting.py.

◆ _lineheight

plotting.PlotTextBox._lineheight
private

Definition at line 1582 of file plotting.py.

Referenced by plotting.PlotTextBox.addText().

◆ _pave

plotting.PlotTextBox._pave
private

Definition at line 1635 of file plotting.py.

◆ _textArgs

plotting.PlotTextBox._textArgs
private

Definition at line 1586 of file plotting.py.

Referenced by plotting.PlotTextBox.addText().

◆ _texts

plotting.PlotTextBox._texts
private

Definition at line 1585 of file plotting.py.

Referenced by plotting.PlotTextBox.addText(), and plotting.PlotTextBox.move().

◆ _transparent

plotting.PlotTextBox._transparent
private

Definition at line 1584 of file plotting.py.

Referenced by plotting.PlotTextBox.Draw().

◆ _xmax

plotting.PlotTextBox._xmax
private

Definition at line 1579 of file plotting.py.

Referenced by plotting.PlotTextBox.move(), and plotting.PlotTextBox.width().

◆ _xmin

plotting.PlotTextBox._xmin
private

◆ _ymax

plotting.PlotTextBox._ymax
private

Definition at line 1581 of file plotting.py.

Referenced by plotting.PlotTextBox.move().

◆ _ymin

plotting.PlotTextBox._ymin
private

Definition at line 1580 of file plotting.py.

Referenced by plotting.PlotTextBox.move().