ATLAS Offline Software
Loading...
Searching...
No Matches
TrackVisualizationTool.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 MUONTRACKFINDINGTEST_TRACKVISUALIZATIONTOOL_H
5#define MUONTRACKFINDINGTEST_TRACKVISUALIZATIONTOOL_H
6
13
14#include "TColor.h"
15
16#include <TLegend.h>
17
18
19namespace MuonValR4{
20 class TrackVisualizationTool : public extends<AthAlgTool, ITrackVisualizationTool> {
21 public:
23 using base_class::base_class;
25 virtual ~TrackVisualizationTool() = default;
26
27 virtual StatusCode initialize() override final;
29 virtual void displaySeeds(const EventContext& ctx,
30 const MuonR4::MsTrackSeedContainer& seeds) const override final;
32 virtual void displaySeeds(const EventContext& ctx,
34 PrimitivesVec_t && extPrimitives) const override final;
35
37 virtual void displayTrackSeedObj(const EventContext& ctx,
39 const OptBoundPars_t& parsToExt,
40 const std::string& objName = "") const override final;
41 private:
43 using Edges = Canvas_t::AxisRanges;
45 struct PlotLegend {
51 PlotLegend(const double xLow, const double yLow,
52 const double xHigh, const double yHigh):
53 legend{std::make_unique<TLegend>(xLow, yLow, xHigh, yHigh)}{}
54
57 void addColor(const int color, const std::string& label);
61 void addMarker(const int marker, const std::string& label, const int color = kBlack);
63 void fillPrimitives(Canvas_t& canvas);
64 std::unique_ptr<TLegend> legend{};
65 using LegendEntry_t = std::unordered_map<int, PrimitivePtr_t>;
68 };
69
73 enum class DisplayView{RZ, XY};
80 void displaySeeds(const EventContext& ctx,
81 const DisplayView view,
82 const xAOD::MuonSegmentContainer& segments,
84 PrimitivesVec_t&& extPrimitives) const;
90 void fillTruthSeedPoints(const EventContext& ctx,
91 const DisplayView view,
92 PlotLegend& legend,
93 Canvas_t& canvas) const;
94
95 void displaySeedSegmentsGlobalWithTruth(const EventContext& ctx,
96 const DisplayView view,
97 const MuonR4::MsTrackSeedContainer& seeds) const;
98
104 static Amg::Vector2D viewVector(const double phi,
105 const Amg::Vector2D& posOnCylinder,
106 const DisplayView view);
108 ToolHandle<ActsTrk::IExtrapolationTool> m_extrapolationTool{this, "ExtrapolationTool" ,"" };
110 ServiceHandle<IRootVisualizationService> m_visualSvc{this, "VisualSvc", "MuonValR4::RootVisualizationService"};
115 SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_truthSegKey{this, "TruthSegkey", "MuonTruthSegments"};
117 ToolHandle<MuonR4::ITrackSeedingDiagnosticsTool> m_seedingTool{this, "SeedingTool", ""};
120 SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_segmentKey{this, "SegmentContainer", "MuonSegmentsFromR4" };
121
123 ActsTrk::GeoContextReadKey_t m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
125 Gaudi::Property<unsigned> m_canvasLimit{this, "CanvasLimit", 5000};
127 Gaudi::Property<bool> m_saveSinglePDFs{this, "saveSinglePDFs", true};
129 Gaudi::Property<bool> m_saveSummaryPDF{this, "saveSummaryPDF", true};
131 Gaudi::Property<std::string> m_subDir{this, "outSubDir", ""};
133 Gaudi::Property<std::string> m_canvasPrefix{this, "CanvasPreFix", "MsTrackValid"};
135 mutable std::atomic<bool> m_plotsDone{false};
137 mutable std::atomic<unsigned> m_objCounter{0};
138 };
139
140 //** @brief Visualizing seeds and corresponding segments with different colors */
141 int seedColorIdx(std::size_t iSeed);
142}
143
144#endif
Scalar phi() const
phi method
Location
Enum defining whether the seed is made in the endcap / barrel.
Definition MsTrackSeed.h:25
Definition of the IRootVisualizationService interface.
Gaudi::Property< unsigned > m_canvasLimit
Maximum canvases to draw.
virtual ~TrackVisualizationTool()=default
Destructor.
void fillTruthSeedPoints(const EventContext &ctx, const DisplayView view, PlotLegend &legend, Canvas_t &canvas) const
Add the truth segments to the canvas.
Gaudi::Property< std::string > m_canvasPrefix
Prefix of the individual canvas file names <MANDATORY>.
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
Track extrapolation tool.
virtual StatusCode initialize() override final
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segmentKey
Declare the data dependency on the standard Mdt+Rpc+Tgc segment container & on the NSW segment contai...
std::atomic< unsigned > m_objCounter
How many obj have been produced.
ServiceHandle< IRootVisualizationService > m_visualSvc
Service handle of the visualization service.
std::atomic< bool > m_plotsDone
Flag toggling whether all Canvases have been exhausted.
virtual void displayTrackSeedObj(const EventContext &ctx, const MuonR4::MsTrackSeed &seed, const OptBoundPars_t &parsToExt, const std::string &objName="") const override final
Visualizes the measurements of the segments on the track seed together with their predicted local lin...
IRootVisualizationService::ClientToken m_clientToken
Token to present to the visualization service such that the display froms this tool are grouped toget...
IRootVisualizationService::ICanvasObject Canvas_t
static Amg::Vector2D viewVector(const double phi, const Amg::Vector2D &posOnCylinder, const DisplayView view)
Transforms the projected vector into the actual view, if it's xy then an external phi is needed to pl...
Gaudi::Property< bool > m_saveSinglePDFs
If set to true each canvas is saved into a dedicated pdf file.
ActsTrk::GeoContextReadKey_t m_geoCtxKey
Dependency on the geometry alignment.
Gaudi::Property< std::string > m_subDir
Define the subdirectory in which the plots shall be saved.
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_truthSegKey
Key to the truth segment selection to draw the segment parameters.
ToolHandle< MuonR4::ITrackSeedingDiagnosticsTool > m_seedingTool
The track seeding tool to construct the seed candidates and to estimate the initial parameters.
DisplayView
Enumeration to toggle whether the seeds shall be painted in x-y or R-z view.
void displaySeedSegmentsGlobalWithTruth(const EventContext &ctx, const DisplayView view, const MuonR4::MsTrackSeedContainer &seeds) const
Gaudi::Property< bool > m_saveSummaryPDF
If set to true a summary Canvas is created.
MuonR4::MsTrackSeed::Location Location
Enumeration to toggle whether the segment shall displayed on the barrel/endcap.
virtual void displaySeeds(const EventContext &ctx, const MuonR4::MsTrackSeedContainer &seeds) const override final
Displays all segments on the representative cylinder in the R-Z & X-Y plane and draws the markers of ...
Property holding a SG store/key/clid from which a ReadHandle is made.
std::string label(const std::string &format, int i)
Definition label.h:19
SG::ReadHandleKey< GeometryContext > GeoContextReadKey_t
Abrivate the ReadHandleKey to declare the data dependency on the Geometry context.
Eigen::Matrix< double, 2, 1 > Vector2D
This header ties the generic definitions in this package.
std::vector< MsTrackSeed > MsTrackSeedContainer
Definition MsTrackSeed.h:69
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
int seedColorIdx(std::size_t iSeed)
RootVisualizationService::ICanvasObject ICanvasObject
STL namespace.
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
Token class to identify a particular visualization client.
PlotLegend(const double xLow, const double yLow, const double xHigh, const double yHigh)
Constructor defining the Legned placement.
std::unordered_map< int, PrimitivePtr_t > LegendEntry_t
#define private
Definition testRead.cxx:27