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

Member Typedef Documentation

◆ LegendEntry_t

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

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

74 :
75 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 68 of file TrackVisualizationTool.cxx.

68 {
69 if (colors.find(color) != colors.end()) {
70 return;
71 }
72 auto box = MuonValR4::drawBox(-1.5,-1.5,-1.,-1., color, MuonValR4::fullFilling);
73 legend->AddEntry(box.get(), label.c_str(), "F");
74 colors.insert(std::make_pair(color, std::move(box)));
75 }
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 )

Add new Marker style to the legend entry.

Parameters
markerTMarkerStyle code to add
labelText to be dispayed

Definition at line 76 of file TrackVisualizationTool.cxx.

76 {
77 if (markers.find(marker)!= markers.end()) {
78 return;
79 }
80 auto tMarker = drawMarker(Amg::Vector2D{2.*Gaudi::Units::km, 0.}, marker, kBlack);
81 legend->AddEntry(tMarker.get(), label.c_str(), "P");
82 markers.insert(std::make_pair(marker, std::move(tMarker)));
83 }
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 84 of file TrackVisualizationTool.cxx.

84 {
85 legend->SetBorderSize(0);
86 legend->SetNColumns(4);
87 canvas.add(std::move(legend));
88 for (auto&[i, obj] : colors){
89 canvas.add(std::move(obj));
90 }
91 for (auto&[i, obj]: markers) {
92 canvas.add(std::move(obj));
93 }
94 }

Member Data Documentation

◆ colors

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

Definition at line 89 of file TrackVisualizationTool.h.

89{};

◆ legend

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

Definition at line 86 of file TrackVisualizationTool.h.

86{};

◆ markers

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

Definition at line 88 of file TrackVisualizationTool.h.

88{};

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