CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, x, y, text, size=None, bold=True, align="left", color=ROOT.kBlack, font=None)
 
def Draw (self, options=None)
 

Private Attributes

 _l
 
 _text
 
 _x
 
 _y
 

Detailed Description

Abstraction on top of TLatex

Definition at line 1532 of file plotting.py.

Constructor & Destructor Documentation

◆ __init__()

def plotting.PlotText.__init__ (   self,
  x,
  y,
  text,
  size = None,
  bold = True,
  align = "left",
  color = ROOT.kBlack,
  font = None 
)
Constructor.

Arguments:
x     -- X coordinate of the text (in NDC)
y     -- Y coordinate of the text (in NDC)
text  -- String to draw
size  -- Size of text (None for the default value, taken from gStyle)
bold  -- Should the text be bold?
align -- Alignment of text (left, center, right)
color -- Color of the text
font  -- Specify font explicitly

Definition at line 1534 of file plotting.py.

1534  def __init__(self, x, y, text, size=None, bold=True, align="left", color=ROOT.kBlack, font=None):
1535  """Constructor.
1536 
1537  Arguments:
1538  x -- X coordinate of the text (in NDC)
1539  y -- Y coordinate of the text (in NDC)
1540  text -- String to draw
1541  size -- Size of text (None for the default value, taken from gStyle)
1542  bold -- Should the text be bold?
1543  align -- Alignment of text (left, center, right)
1544  color -- Color of the text
1545  font -- Specify font explicitly
1546  """
1547  self._x = x
1548  self._y = y
1549  self._text = text
1550 
1551  self._l = ROOT.TLatex()
1552  self._l.SetNDC()
1553  if not bold:
1554  self._l.SetTextFont(self._l.GetTextFont()-20) # bold -> normal
1555  if font is not None:
1556  self._l.SetTextFont(font)
1557  if size is not None:
1558  self._l.SetTextSize(size)
1559  if isinstance(align, str):
1560  if align.lower() == "left":
1561  self._l.SetTextAlign(11)
1562  elif align.lower() == "center":
1563  self._l.SetTextAlign(21)
1564  elif align.lower() == "right":
1565  self._l.SetTextAlign(31)
1566  else:
1567  raise Exception("Error: Invalid option '%s' for text alignment! Options are: 'left', 'center', 'right'."%align)
1568  else:
1569  self._l.SetTextAlign(align)
1570  self._l.SetTextColor(color)
1571 
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)

Member Function Documentation

◆ Draw()

def plotting.PlotText.Draw (   self,
  options = None 
)
Draw the text to the current TPad.

Arguments:
options -- For interface compatibility, ignored

Provides interface compatible with ROOT's drawable objects.

Definition at line 1572 of file plotting.py.

References plotting.PlotText._l, plotting.PlotText._text, PGeometricDet::Item._x, SpecificationBuilder_cfi.Specification._x, hitfit::Fourvec_Event._x, plotting.PlotText._x, PGeometricDet::Item._y, contrib::CMSBoostedTauSeedingAlgorithmStructure._y, SpecificationBuilder_cfi.Specification._y, and plotting.PlotText._y.

1572  def Draw(self, options=None):
1573  """Draw the text to the current TPad.
1574 
1575  Arguments:
1576  options -- For interface compatibility, ignored
1577 
1578  Provides interface compatible with ROOT's drawable objects.
1579  """
1580  self._l.DrawLatex(self._x, self._y, self._text)
1581 
1582 

Member Data Documentation

◆ _l

plotting.PlotText._l
private

Definition at line 1551 of file plotting.py.

Referenced by plotting.PlotText.Draw().

◆ _text

plotting.PlotText._text
private

Definition at line 1549 of file plotting.py.

Referenced by plotting.PlotText.Draw().

◆ _x

plotting.PlotText._x
private

Definition at line 1547 of file plotting.py.

Referenced by plotting.PlotText.Draw().

◆ _y

plotting.PlotText._y
private

Definition at line 1548 of file plotting.py.

Referenced by plotting.PlotText.Draw().