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 72 of file TrackVisualizationTool.h.

Member Typedef Documentation

◆ LegendEntry_t

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

Definition at line 92 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 78 of file TrackVisualizationTool.h.

79 :
80 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 82 of file TrackVisualizationTool.cxx.

82 {
83 if (colors.find(color) != colors.end()) {
84 return;
85 }
86 auto box = MuonValR4::drawBox(-1.5,-1.5,-1.,-1., color, MuonValR4::fullFilling);
87 legend->AddEntry(box.get(), label.c_str(), "F");
88 colors.insert(std::make_pair(color, std::move(box)));
89 }
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 90 of file TrackVisualizationTool.cxx.

90 {
91 if (markers.find(marker)!= markers.end()) {
92 return;
93 }
94 auto tMarker = drawMarker(Amg::Vector2D{2.*Gaudi::Units::km, 0.}, marker, color);
95 legend->AddEntry(tMarker.get(), label.c_str(), "P");
96 markers.insert(std::make_pair(marker, std::move(tMarker)));
97 }
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 98 of file TrackVisualizationTool.cxx.

98 {
99 legend->SetBorderSize(0);
100 legend->SetNColumns(4);
101 canvas.add(std::move(legend));
102 for (auto&[i, obj] : colors){
103 canvas.add(std::move(obj));
104 }
105 for (auto&[i, obj]: markers) {
106 canvas.add(std::move(obj));
107 }
108 }

Member Data Documentation

◆ colors

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

Definition at line 94 of file TrackVisualizationTool.h.

94{};

◆ legend

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

Definition at line 91 of file TrackVisualizationTool.h.

91{};

◆ markers

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

Definition at line 93 of file TrackVisualizationTool.h.

93{};

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