ATLAS Offline Software
Loading...
Searching...
No Matches
DrawCanvasObject.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONVISUALIZATIONHELPERSR4_DRAWCANVASOBJECT_H
5#define MUONVISUALIZATIONHELPERSR4_DRAWCANVASOBJECT_H
7
8#include <TObject.h>
9#include <Acts/Utilities/ArrayHelpers.hpp>
10#include <limits>
11#include <atomic>
12
13namespace MuonValR4::detail {
15 public:
17 using PrimitiveVec_t = std::vector<std::pair<PrimitivePtr_t, std::string>>;
18 using Range_t = std::array<double, 2>;
19 using Range2D_t = std::array<Range_t, 2>;
20
21 DrawCanvasObject(const std::string& canvasName,
22 const std::size_t evtNumber);
23 virtual ~DrawCanvasObject() = default;
24
25 virtual void expandPad(const double x, const double y) override final;
26
27 virtual void add(PrimitivePtr_t&& drawMe,
28 const std::string& drawOpt ="") override final;
29 virtual void add(std::vector<PrimitivePtr_t>&& drawMe) override final;
30
31 virtual double corner(const AxisRanges r) const override final;
32 virtual void setRangeScale(const double s, bool quadCan) override final;
33 virtual void trash() override final;
34
37
38 virtual void setAxisTitles(const std::string& xTitle,
39 const std::string& yTitle,
40 const std::string& zTitle) override final;
42 const std::string& xTitle() const;
44 const std::string& yTitle() const;
46 const std::string& zTitle() const;
48 std::size_t event() const;
50 const std::string& name() const;
52 bool trashed() const;
53
54
55 private:
56 static constexpr double s_dblMax = std::numeric_limits<double>::max();
57 Range2D_t m_axisRanges{Acts::filledArray<Range_t, 2>(Range_t{s_dblMax, -s_dblMax})};
58 double m_axisScale{1.};
60
61 std::string m_name{};
62 std::size_t m_evt{};
63
64 std::string m_xTitle{};
65 std::string m_yTitle{};
66 std::string m_zTitle{};
67
68 bool m_quadCan{false};
69 std::atomic<bool> m_isTrashed{false};
70
71
72
73 };
74}
75
76#endif
#define y
#define x
#define max(a, b)
Definition cfImp.cxx:41
std::unique_ptr< TObject > PrimitivePtr_t
Abrivation for a TObject to be drawn on a canvas.
virtual double corner(const AxisRanges r) const override final
Retrieves a corner coordinate of the drawn canvas.
std::size_t event() const
Event number in which the canvas has been created.
IRootVisualizationService::PrimitivePtr_t PrimitivePtr_t
const std::string & zTitle() const
Returns the title of the z-axis.
DrawCanvasObject(const std::string &canvasName, const std::size_t evtNumber)
virtual void add(PrimitivePtr_t &&drawMe, const std::string &drawOpt="") override final
Add a TObject to the ICanvasObject for later drawing onto a TCanvas.
const std::string & name() const
Name of the canvas.
std::array< Range_t, 2 > Range2D_t
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 axi...
bool trashed() const
Returns whether the canvas has been trashed.
const std::string & yTitle() const
Returns the title of the y-axis.
std::vector< std::pair< PrimitivePtr_t, std::string > > PrimitiveVec_t
const PrimitiveVec_t & primitives() const
const std::string & xTitle() const
Returns the title of the x-axis.
virtual void setAxisTitles(const std::string &xTitle, const std::string &yTitle, const std::string &zTitle) override final
Define the titles of the Canvas axes.
virtual void trash() override final
If no object has been drawn mark the plot as junk.
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...
int r
Definition globals.cxx:22
STL namespace.
Interface to the container class to temporarily cache the ROOT objects to be drawn on a TCanvas and t...
AxisRanges
Enum to select the corner coordinates shown by the plot.
#define private