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 1510 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 1512 of file plotting.py.

1512  def __init__(self, x, y, text, size=None, bold=True, align="left", color=ROOT.kBlack, font=None):
1513  """Constructor.
1514 
1515  Arguments:
1516  x -- X coordinate of the text (in NDC)
1517  y -- Y coordinate of the text (in NDC)
1518  text -- String to draw
1519  size -- Size of text (None for the default value, taken from gStyle)
1520  bold -- Should the text be bold?
1521  align -- Alignment of text (left, center, right)
1522  color -- Color of the text
1523  font -- Specify font explicitly
1524  """
1525  self._x = x
1526  self._y = y
1527  self._text = text
1528 
1529  self._l = ROOT.TLatex()
1530  self._l.SetNDC()
1531  if not bold:
1532  self._l.SetTextFont(self._l.GetTextFont()-20) # bold -> normal
1533  if font is not None:
1534  self._l.SetTextFont(font)
1535  if size is not None:
1536  self._l.SetTextSize(size)
1537  if isinstance(align, str):
1538  if align.lower() == "left":
1539  self._l.SetTextAlign(11)
1540  elif align.lower() == "center":
1541  self._l.SetTextAlign(21)
1542  elif align.lower() == "right":
1543  self._l.SetTextAlign(31)
1544  else:
1545  raise Exception("Error: Invalid option '%s' for text alignment! Options are: 'left', 'center', 'right'."%align)
1546  else:
1547  self._l.SetTextAlign(align)
1548  self._l.SetTextColor(color)
1549 
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 1550 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.

1550  def Draw(self, options=None):
1551  """Draw the text to the current TPad.
1552 
1553  Arguments:
1554  options -- For interface compatibility, ignored
1555 
1556  Provides interface compatible with ROOT's drawable objects.
1557  """
1558  self._l.DrawLatex(self._x, self._y, self._text)
1559 
1560 

Member Data Documentation

◆ _l

plotting.PlotText._l
private

Definition at line 1529 of file plotting.py.

Referenced by plotting.PlotText.Draw().

◆ _text

plotting.PlotText._text
private

Definition at line 1527 of file plotting.py.

Referenced by plotting.PlotText.Draw().

◆ _x

plotting.PlotText._x
private

Definition at line 1525 of file plotting.py.

Referenced by plotting.PlotText.Draw().

◆ _y

plotting.PlotText._y
private

Definition at line 1526 of file plotting.py.

Referenced by plotting.PlotText.Draw().