ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | Static Private Attributes | List of all members
MuonValR4::detail::DrawCanvasObject Class Referenceabstract

#include <DrawCanvasObject.h>

Inheritance diagram for MuonValR4::detail::DrawCanvasObject:
Collaboration diagram for MuonValR4::detail::DrawCanvasObject:

Public Types

using PrimitivePtr_t = IRootVisualizationService::PrimitivePtr_t
 
using PrimitiveVec_t = std::vector< std::pair< PrimitivePtr_t, std::string > >
 
using Range_t = std::array< double, 2 >
 
using Range2D_t = std::array< Range_t, 2 >
 
enum  AxisRanges : std::uint8_t { AxisRanges::xLow, AxisRanges::xHigh, AxisRanges::yLow, AxisRanges::yHigh }
 Enum to select the corner coordinates shown by the plot. More...
 

Public Member Functions

 DrawCanvasObject (const std::string &canvasName, const std::size_t evtNumber)
 
virtual ~DrawCanvasObject ()=default
 
virtual void expandPad (const double x, const double y) override final
 Expands the axes of the pad such that the coordinates are guaranteed to appear at least at the Canvas edges. More...
 
virtual void add (PrimitivePtr_t &&drawMe, const std::string &drawOpt="") override final
 Add a TObject to the ICanvasObject for later drawing onto a TCanvas. More...
 
virtual void add (std::vector< PrimitivePtr_t > &&drawMe) override final
 
virtual double corner (const AxisRanges r) const override final
 Retrieves a corner coordinate of the drawn canvas. More...
 
virtual void setRangeScale (const double s, bool quadCan) override final
 To ensure that the drawn objects are not cut by the axis limits, a flat scale-factor on the drawn axis intervals can be applied. More...
 
virtual void trash () override final
 If no object has been drawn mark the plot as junk. More...
 
const PrimitiveVec_tprimitives () const
 
PrimitiveVec_tprimitives ()
 
virtual void setAxisTitles (const std::string &xTitle, const std::string &yTitle, const std::string &zTitle) override final
 Define the titles of the Canvas axes. More...
 
const std::string & xTitle () const
 Returns the title of the x-axis. More...
 
const std::string & yTitle () const
 Returns the title of the y-axis. More...
 
const std::string & zTitle () const
 Returns the title of the z-axis. More...
 
std::size_t event () const
 Event number in which the canvas has been created. More...
 
const std::string & name () const
 Name of the canvas. More...
 
bool trashed () const
 Returns whether the canvas has been trashed. More...
 
virtual void add (PrimitiveVec_t &&drawMe)=0
 Add a vector of TObjects to the ICanvasObject for later drawing onto a TCanvas. More...
 

Private Attributes

Range2D_t m_axisRanges {Acts::filledArray<Range_t, 2>(Range_t{s_dblMax, -s_dblMax})}
 
double m_axisScale {1.}
 
PrimitiveVec_t m_primitives {}
 
std::string m_name {}
 
std::size_t m_evt {}
 
std::string m_xTitle {}
 
std::string m_yTitle {}
 
std::string m_zTitle {}
 
bool m_quadCan {false}
 
std::atomic< bool > m_isTrashed {false}
 

Static Private Attributes

static constexpr double s_dblMax = std::numeric_limits<double>::max()
 

Detailed Description

Definition at line 14 of file DrawCanvasObject.h.

Member Typedef Documentation

◆ PrimitivePtr_t

Definition at line 16 of file DrawCanvasObject.h.

◆ PrimitiveVec_t

using MuonValR4::detail::DrawCanvasObject::PrimitiveVec_t = std::vector<std::pair<PrimitivePtr_t, std::string> >

Definition at line 17 of file DrawCanvasObject.h.

◆ Range2D_t

Definition at line 19 of file DrawCanvasObject.h.

◆ Range_t

using MuonValR4::detail::DrawCanvasObject::Range_t = std::array<double, 2>

Definition at line 18 of file DrawCanvasObject.h.

Member Enumeration Documentation

◆ AxisRanges

enum MuonValR4::IRootVisualizationService::ICanvasObject::AxisRanges : std::uint8_t
stronginherited

Enum to select the corner coordinates shown by the plot.

Enumerator
xLow 
xHigh 
yLow 
yHigh 

Definition at line 66 of file IRootVisualizationService.h.

66  : std::uint8_t{
67  xLow, xHigh, yLow, yHigh
68  };

Constructor & Destructor Documentation

◆ DrawCanvasObject()

MuonValR4::detail::DrawCanvasObject::DrawCanvasObject ( const std::string &  canvasName,
const std::size_t  evtNumber 
)

Definition at line 21 of file DrawCanvasObject.cxx.

22  :
23  m_name{canvasName},
24  m_evt{evtNumber}{}

◆ ~DrawCanvasObject()

virtual MuonValR4::detail::DrawCanvasObject::~DrawCanvasObject ( )
virtualdefault

Member Function Documentation

◆ add() [1/3]

void MuonValR4::detail::DrawCanvasObject::add ( PrimitivePtr_t &&  drawMe,
const std::string &  drawOpt = "" 
)
finaloverridevirtual

Add a TObject to the ICanvasObject for later drawing onto a TCanvas.

Parameters
drawMeUnique_ptr to the object to be drawn
drawOptOption to be parsed to the draw command later (e.g. HIST)

Implements MuonValR4::IRootVisualizationService::ICanvasObject.

Definition at line 60 of file DrawCanvasObject.cxx.

60  {
61  m_primitives.emplace_back(std::move(drawMe), drawOpt);
62  }

◆ add() [2/3]

virtual void MuonValR4::IRootVisualizationService::ICanvasObject::add ( PrimitiveVec_t &&  drawMe)
pure virtualinherited

Add a vector of TObjects to the ICanvasObject for later drawing onto a TCanvas.

Parameters
drawMeList of unique TObject pointers

◆ add() [3/3]

void MuonValR4::detail::DrawCanvasObject::add ( std::vector< PrimitivePtr_t > &&  drawMe)
finaloverridevirtual

Definition at line 63 of file DrawCanvasObject.cxx.

63  {
64  for (PrimitivePtr_t& obj : drawMe) {
65  add(std::move(obj));
66  }
67  }

◆ corner()

double MuonValR4::detail::DrawCanvasObject::corner ( const AxisRanges  r) const
finaloverridevirtual

Retrieves a corner coordinate of the drawn canvas.

Parameters
rCoordinate to return

Implements MuonValR4::IRootVisualizationService::ICanvasObject.

Definition at line 26 of file DrawCanvasObject.cxx.

26  {
27  const double deltaX = 0.5*(m_axisRanges[0][1] - m_axisRanges[0][0]) * m_axisScale;
28  const double deltaY = 0.5*(m_axisRanges[1][1] - m_axisRanges[1][0]) * m_axisScale;
29  switch (r) {
30  using enum AxisRanges;
31  case xLow:
32  case xHigh: {
33  const double mid = 0.5*(m_axisRanges[0][1] + m_axisRanges[0][0]);
34  return mid + (r == xLow ? -1. : 1.) * std::max(deltaX, deltaY * (1. -2.*m_quadCan));
35  } case yLow:
36  case yHigh: {
37  const double mid = 0.5*(m_axisRanges[1][1] + m_axisRanges[1][0]);
38  return mid + (r == yLow ? -1. : 1.) * std::max(deltaY, deltaX * (1. -2.*m_quadCan));
39  }
40  }
41  return s_dblMax;
42  }

◆ event()

std::size_t MuonValR4::detail::DrawCanvasObject::event ( ) const

Event number in which the canvas has been created.

Definition at line 50 of file DrawCanvasObject.cxx.

50 { return m_evt; }

◆ expandPad()

void MuonValR4::detail::DrawCanvasObject::expandPad ( const double  x,
const double  y 
)
finaloverridevirtual

Expands the axes of the pad such that the coordinates are guaranteed to appear at least at the Canvas edges.

Parameters
xExpansion in the width of the canvas
yExpansion in the height of the canvas

Implements MuonValR4::IRootVisualizationService::ICanvasObject.

Definition at line 56 of file DrawCanvasObject.cxx.

56  {
57  expand(x, m_axisRanges[0]);
58  expand(y, m_axisRanges[1]);
59  }

◆ name()

const std::string & MuonValR4::detail::DrawCanvasObject::name ( ) const

Name of the canvas.

Definition at line 49 of file DrawCanvasObject.cxx.

49 { return m_name; }

◆ primitives() [1/2]

PrimitiveVec_t & MuonValR4::detail::DrawCanvasObject::primitives ( )

Definition at line 55 of file DrawCanvasObject.cxx.

55 { return m_primitives; }

◆ primitives() [2/2]

const PrimitiveVec_t & MuonValR4::detail::DrawCanvasObject::primitives ( ) const

Definition at line 54 of file DrawCanvasObject.cxx.

54 { return m_primitives; }

◆ setAxisTitles()

void MuonValR4::detail::DrawCanvasObject::setAxisTitles ( const std::string &  xTitle,
const std::string &  yTitle,
const std::string &  zTitle 
)
finaloverridevirtual

Define the titles of the Canvas axes.

Parameters
xTitleTitle pf the x-axis
yTitleTitle pf the y-axis
zTitleTitle pf the z-axis

Implements MuonValR4::IRootVisualizationService::ICanvasObject.

Definition at line 68 of file DrawCanvasObject.cxx.

◆ setRangeScale()

void MuonValR4::detail::DrawCanvasObject::setRangeScale ( const double  s,
bool  quadCan 
)
finaloverridevirtual

To ensure that the drawn objects are not cut by the axis limits, a flat scale-factor on the drawn axis intervals can be applied.

Parameters
sscale-factor >1.
quadCanSwitch toggling whether the drawn intervals have an equal size

Implements MuonValR4::IRootVisualizationService::ICanvasObject.

Definition at line 43 of file DrawCanvasObject.cxx.

43  {
44  m_axisScale = std::max(1., s);
45  m_quadCan = quadCan;
46  }

◆ trash()

void MuonValR4::detail::DrawCanvasObject::trash ( )
finaloverridevirtual

If no object has been drawn mark the plot as junk.

Implements MuonValR4::IRootVisualizationService::ICanvasObject.

Definition at line 47 of file DrawCanvasObject.cxx.

47 { m_isTrashed = true; }

◆ trashed()

bool MuonValR4::detail::DrawCanvasObject::trashed ( ) const

Returns whether the canvas has been trashed.

Definition at line 48 of file DrawCanvasObject.cxx.

48 { return m_isTrashed; }

◆ xTitle()

const std::string & MuonValR4::detail::DrawCanvasObject::xTitle ( ) const

Returns the title of the x-axis.

Definition at line 51 of file DrawCanvasObject.cxx.

51 { return m_xTitle; }

◆ yTitle()

const std::string & MuonValR4::detail::DrawCanvasObject::yTitle ( ) const

Returns the title of the y-axis.

Definition at line 52 of file DrawCanvasObject.cxx.

52 { return m_yTitle; }

◆ zTitle()

const std::string & MuonValR4::detail::DrawCanvasObject::zTitle ( ) const

Returns the title of the z-axis.

Definition at line 53 of file DrawCanvasObject.cxx.

53 { return m_zTitle; }

Member Data Documentation

◆ m_axisRanges

Range2D_t MuonValR4::detail::DrawCanvasObject::m_axisRanges {Acts::filledArray<Range_t, 2>(Range_t{s_dblMax, -s_dblMax})}
private

Definition at line 57 of file DrawCanvasObject.h.

◆ m_axisScale

double MuonValR4::detail::DrawCanvasObject::m_axisScale {1.}
private

Definition at line 58 of file DrawCanvasObject.h.

◆ m_evt

std::size_t MuonValR4::detail::DrawCanvasObject::m_evt {}
private

Definition at line 62 of file DrawCanvasObject.h.

◆ m_isTrashed

std::atomic<bool> MuonValR4::detail::DrawCanvasObject::m_isTrashed {false}
private

Definition at line 69 of file DrawCanvasObject.h.

◆ m_name

std::string MuonValR4::detail::DrawCanvasObject::m_name {}
private

Definition at line 61 of file DrawCanvasObject.h.

◆ m_primitives

PrimitiveVec_t MuonValR4::detail::DrawCanvasObject::m_primitives {}
private

Definition at line 59 of file DrawCanvasObject.h.

◆ m_quadCan

bool MuonValR4::detail::DrawCanvasObject::m_quadCan {false}
private

Definition at line 68 of file DrawCanvasObject.h.

◆ m_xTitle

std::string MuonValR4::detail::DrawCanvasObject::m_xTitle {}
private

Definition at line 64 of file DrawCanvasObject.h.

◆ m_yTitle

std::string MuonValR4::detail::DrawCanvasObject::m_yTitle {}
private

Definition at line 65 of file DrawCanvasObject.h.

◆ m_zTitle

std::string MuonValR4::detail::DrawCanvasObject::m_zTitle {}
private

Definition at line 66 of file DrawCanvasObject.h.

◆ s_dblMax

constexpr double MuonValR4::detail::DrawCanvasObject::s_dblMax = std::numeric_limits<double>::max()
staticconstexprprivate

Definition at line 56 of file DrawCanvasObject.h.


The documentation for this class was generated from the following files:
beamspotman.r
def r
Definition: beamspotman.py:672
MuonValR4::detail::DrawCanvasObject::s_dblMax
static constexpr double s_dblMax
Definition: DrawCanvasObject.h:56
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:553
makeComparison.deltaY
int deltaY
Definition: makeComparison.py:44
MuonValR4::detail::DrawCanvasObject::m_evt
std::size_t m_evt
Definition: DrawCanvasObject.h:62
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
MuonValR4::detail::DrawCanvasObject::m_axisScale
double m_axisScale
Definition: DrawCanvasObject.h:58
x
#define x
MuonValR4::detail::DrawCanvasObject::zTitle
const std::string & zTitle() const
Returns the title of the z-axis.
Definition: DrawCanvasObject.cxx:53
MuonValR4::detail::DrawCanvasObject::m_primitives
PrimitiveVec_t m_primitives
Definition: DrawCanvasObject.h:59
MuonValR4::detail::DrawCanvasObject::m_quadCan
bool m_quadCan
Definition: DrawCanvasObject.h:68
MuonValR4::detail::expand
constexpr void expand(const double v, Range_t &r)
Definition: DrawCanvasObject.cxx:11
compareGeometries.deltaX
float deltaX
Definition: compareGeometries.py:32
MuonValR4::detail::DrawCanvasObject::xTitle
const std::string & xTitle() const
Returns the title of the x-axis.
Definition: DrawCanvasObject.cxx:51
MuonValR4::detail::DrawCanvasObject::yTitle
const std::string & yTitle() const
Returns the title of the y-axis.
Definition: DrawCanvasObject.cxx:52
MuonValR4::IRootVisualizationService::ICanvasObject::AxisRanges
AxisRanges
Enum to select the corner coordinates shown by the plot.
Definition: IRootVisualizationService.h:66
MuonValR4::detail::DrawCanvasObject::m_xTitle
std::string m_xTitle
Definition: DrawCanvasObject.h:64
MuonValR4::detail::DrawCanvasObject::PrimitivePtr_t
IRootVisualizationService::PrimitivePtr_t PrimitivePtr_t
Definition: DrawCanvasObject.h:16
MuonValR4::detail::DrawCanvasObject::m_axisRanges
Range2D_t m_axisRanges
Definition: DrawCanvasObject.h:57
y
#define y
MuonValR4::detail::DrawCanvasObject::m_yTitle
std::string m_yTitle
Definition: DrawCanvasObject.h:65
MuonValR4::detail::assignIfNotEmpty
void assignIfNotEmpty(const std::string &inStr, std::string &outStr)
Definition: DrawCanvasObject.cxx:15
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
MuonValR4::detail::DrawCanvasObject::m_isTrashed
std::atomic< bool > m_isTrashed
Definition: DrawCanvasObject.h:69
MuonValR4::detail::DrawCanvasObject::add
virtual void add(PrimitivePtr_t &&drawMe, const std::string &drawOpt="") override final
Add a TObject to the ICanvasObject for later drawing onto a TCanvas.
Definition: DrawCanvasObject.cxx:60
python.PyAthena.obj
obj
Definition: PyAthena.py:132
MuonValR4::detail::DrawCanvasObject::m_zTitle
std::string m_zTitle
Definition: DrawCanvasObject.h:66
MuonValR4::detail::DrawCanvasObject::m_name
std::string m_name
Definition: DrawCanvasObject.h:61