ATLAS Offline Software
Loading...
Searching...
No Matches
MuonValR4::TrackVisualizationTool::PlotLegend Struct Reference

Helper struct to administer the markers & colors that are added to the legend. More...

Collaboration diagram for MuonValR4::TrackVisualizationTool::PlotLegend:

Public Types

using LegendEntry_t = std::unordered_map<int, PrimitivePtr_t>

Public Member Functions

 PlotLegend (const double xLow, const double yLow, const double xHigh, const double yHigh)
 Constructor defining the Legned placement.
void addColor (const int color, const std::string &label)
 Add new color legend entry.
void addMarker (const int marker, const std::string &label, const int color=kBlack)
 Add new Marker style to the legend entry.
void fillPrimitives (Canvas_t &canvas)
 Add the primitives of the legend to the Canvas.

Public Attributes

std::unique_ptr< TLegend > legend {}
LegendEntry_t markers {}
LegendEntry_t colors {}

Detailed Description

Helper struct to administer the markers & colors that are added to the legend.

Definition at line 45 of file TrackVisualizationTool.h.

Member Typedef Documentation

◆ LegendEntry_t

using MuonValR4::TrackVisualizationTool::PlotLegend::LegendEntry_t = std::unordered_map<int, PrimitivePtr_t>

Definition at line 65 of file TrackVisualizationTool.h.

Constructor & Destructor Documentation

◆ PlotLegend()

MuonValR4::TrackVisualizationTool::PlotLegend::PlotLegend ( const double xLow,
const double yLow,
const double xHigh,
const double yHigh )
inline

Constructor defining the Legned placement.

Parameters
xLowLow x-end of the Legend (relative coords.)
yLowLow y-end of the Legend (relative coords.)
xHighHigh x-end of the Legend (relative coords.)
yHighHigh y-end of the Legend (relative coords.)

Definition at line 51 of file TrackVisualizationTool.h.

52 :
53 legend{std::make_unique<TLegend>(xLow, yLow, xHigh, yHigh)}{}

Member Function Documentation

◆ addColor()

void MuonValR4::TrackVisualizationTool::PlotLegend::addColor ( const int color,
const std::string & label )

Add new color legend entry.

Parameters
colorTColor code of the color to add
labelText to be dispayed

Definition at line 91 of file TrackVisualizationTool.cxx.

91 {
92 if (colors.find(color) != colors.end()) {
93 return;
94 }
95 auto box = MuonValR4::drawBox(-1.5,-1.5,-1.,-1., color, MuonValR4::fullFilling);
96 legend->AddEntry(box.get(), label.c_str(), "F");
97 colors.insert(std::make_pair(color, std::move(box)));
98 }
std::string label(const std::string &format, int i)
Definition label.h:19
constexpr int fullFilling
std::unique_ptr< TBox > drawBox(const Amg::Vector3D &boxCenter, const double boxWidth, const double boxHeight, const int color=kGreen+2, const int fillStyle=hollowFilling, const int view=objViewEta)
Creates a box for drawing, e.g strip measurements.

◆ addMarker()

void MuonValR4::TrackVisualizationTool::PlotLegend::addMarker ( const int marker,
const std::string & label,
const int color = kBlack )

Add new Marker style to the legend entry.

Parameters
markerTMarkerStyle code to add
labelText to be dispayed

Definition at line 99 of file TrackVisualizationTool.cxx.

99 {
100 if (markers.find(marker)!= markers.end()) {
101 return;
102 }
103 auto tMarker = drawMarker(Amg::Vector2D{2.*Gaudi::Units::km, 0.}, marker, color);
104 legend->AddEntry(tMarker.get(), label.c_str(), "P");
105 markers.insert(std::make_pair(marker, std::move(tMarker)));
106 }
Eigen::Matrix< double, 2, 1 > Vector2D

◆ fillPrimitives()

void MuonValR4::TrackVisualizationTool::PlotLegend::fillPrimitives ( Canvas_t & canvas)

Add the primitives of the legend to the Canvas.

Definition at line 107 of file TrackVisualizationTool.cxx.

107 {
108 legend->SetBorderSize(0);
109 legend->SetNColumns(4);
110 canvas.add(std::move(legend));
111 for (auto&[i, obj] : colors){
112 canvas.add(std::move(obj));
113 }
114 for (auto&[i, obj]: markers) {
115 canvas.add(std::move(obj));
116 }
117 }

Member Data Documentation

◆ colors

LegendEntry_t MuonValR4::TrackVisualizationTool::PlotLegend::colors {}

Definition at line 67 of file TrackVisualizationTool.h.

67{};

◆ legend

std::unique_ptr<TLegend> MuonValR4::TrackVisualizationTool::PlotLegend::legend {}

Definition at line 64 of file TrackVisualizationTool.h.

64{};

◆ markers

LegendEntry_t MuonValR4::TrackVisualizationTool::PlotLegend::markers {}

Definition at line 66 of file TrackVisualizationTool.h.

66{};

The documentation for this struct was generated from the following files: