ATLAS Offline Software
Public Types | Public Member Functions | Public Attributes | List of all members
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. More...
 
void addColor (const int color, const std::string &label)
 Add new color legend entry. More...
 
void addMarker (const int marker, const std::string &label)
 Add new Marker style to the legend entry. More...
 
void fillPrimitives (Canvas_t &canvas)
 Add the primitives of the legend to the Canvas. More...
 

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 69 of file TrackVisualizationTool.cxx.

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

◆ 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 77 of file TrackVisualizationTool.cxx.

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

◆ fillPrimitives()

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

Add the primitives of the legend to the Canvas.

Definition at line 85 of file TrackVisualizationTool.cxx.

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

Member Data Documentation

◆ colors

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

Definition at line 89 of file TrackVisualizationTool.h.

◆ legend

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

Definition at line 86 of file TrackVisualizationTool.h.

◆ markers

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

Definition at line 88 of file TrackVisualizationTool.h.


The documentation for this struct was generated from the following files:
MuonValR4::fullFilling
constexpr int fullFilling
Definition: VisualizationHelpers.h:24
color
Definition: jFexInputByteStreamTool.cxx:25
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
MuonValR4::drawBox
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.
Definition: VisualizationHelpers.cxx:49
MuonValR4::TrackVisualizationTool::PlotLegend::markers
LegendEntry_t markers
Definition: TrackVisualizationTool.h:88
python.Include.marker
string marker
Definition: Include.py:21
lumiFormat.i
int i
Definition: lumiFormat.py:85
DeMoAtlasDataLoss.canvas
dictionary canvas
Definition: DeMoAtlasDataLoss.py:187
MuonValR4::TrackVisualizationTool::PlotLegend::colors
LegendEntry_t colors
Definition: TrackVisualizationTool.h:89
add-xsec-uncert-quadrature-N.label
label
Definition: add-xsec-uncert-quadrature-N.py:104
python.SystemOfUnits.km
float km
Definition: SystemOfUnits.py:110
MuonValR4::TrackVisualizationTool::PlotLegend::legend
std::unique_ptr< TLegend > legend
Definition: TrackVisualizationTool.h:86
python.PyAthena.obj
obj
Definition: PyAthena.py:132