ATLAS Offline Software
Loading...
Searching...
No Matches
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 class  AxisRanges : std::uint8_t { xLow , xHigh , yLow , 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.
virtual void add (PrimitivePtr_t &&drawMe, const std::string &drawOpt="") override final
 Add a TObject to the ICanvasObject for later drawing onto a TCanvas.
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.
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.
virtual void trash () override final
 If no object has been drawn mark the plot as junk.
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.
const std::string & xTitle () const
 Returns the title of the x-axis.
const std::string & yTitle () const
 Returns the title of the y-axis.
const std::string & zTitle () const
 Returns the title of the z-axis.
std::size_t event () const
 Event number in which the canvas has been created.
const std::string & name () const
 Name of the canvas.
bool trashed () const
 Returns whether the canvas has been trashed.
virtual void add (PrimitiveVec_t &&drawMe)=0
 Add a vector of TObjects to the ICanvasObject for later drawing onto a TCanvas.

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

◆ 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 class 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 78 of file IRootVisualizationService.h.

78 : std::uint8_t{
79 xLow, xHigh, yLow, yHigh
80 };

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]

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 }
IRootVisualizationService::PrimitivePtr_t PrimitivePtr_t
virtual void add(PrimitivePtr_t &&drawMe, const std::string &drawOpt="") override final
Add a TObject to the ICanvasObject for later drawing onto a TCanvas.

◆ add() [3/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

◆ 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 }
int r
Definition globals.cxx:22
AxisRanges
Enum to select the corner coordinates shown by the plot.

◆ 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 {
59 }
#define y
#define x
constexpr void expand(const double v, Range_t &r)

◆ 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.

70 {
74 }
const std::string & zTitle() const
Returns the title of the z-axis.
const std::string & yTitle() const
Returns the title of the y-axis.
const std::string & xTitle() const
Returns the title of the x-axis.
void assignIfNotEmpty(const std::string &inStr, std::string &outStr)

◆ 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.

57{Acts::filledArray<Range_t, 2>(Range_t{s_dblMax, -s_dblMax})};

◆ m_axisScale

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

Definition at line 58 of file DrawCanvasObject.h.

58{1.};

◆ m_evt

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

Definition at line 62 of file DrawCanvasObject.h.

62{};

◆ m_isTrashed

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

Definition at line 69 of file DrawCanvasObject.h.

69{false};

◆ m_name

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

Definition at line 61 of file DrawCanvasObject.h.

61{};

◆ m_primitives

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

Definition at line 59 of file DrawCanvasObject.h.

59{};

◆ m_quadCan

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

Definition at line 68 of file DrawCanvasObject.h.

68{false};

◆ m_xTitle

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

Definition at line 64 of file DrawCanvasObject.h.

64{};

◆ m_yTitle

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

Definition at line 65 of file DrawCanvasObject.h.

65{};

◆ m_zTitle

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

Definition at line 66 of file DrawCanvasObject.h.

66{};

◆ s_dblMax

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: