ATLAS Offline Software
Loading...
Searching...
No Matches
TrackVisualizationTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONTRACKFINDINGTEST_TRACKVISUALIZATIONTOOL_H
5#define MUONTRACKFINDINGTEST_TRACKVISUALIZATIONTOOL_H
6
14
16
17#include "TColor.h"
18#include "TLegend.h"
19
20
21namespace MuonValR4{
22 class TrackVisualizationTool : public extends<AthAlgTool, ITrackVisualizationTool> {
23 public:
25 using base_class::base_class;
27 virtual ~TrackVisualizationTool() = default;
28
29 virtual StatusCode initialize() override final;
31 virtual void displaySeeds(const EventContext& ctx,
32 const MuonR4::MsTrackSeedContainer& seeds) const override final;
34 virtual void displaySeeds(const EventContext& ctx,
36 PrimitivesVec_t && extPrimitives) const override final;
37
39 virtual void displayTrackSeedObj(const EventContext& ctx,
41 const OptBoundPars_t& parsToExt,
42 const std::string& objName = "") const override final;
43 private:
45 using Edges = Canvas_t::AxisRanges;
47 struct PlotLegend {
53 PlotLegend(const double xLow, const double yLow,
54 const double xHigh, const double yHigh):
55 legend{std::make_unique<TLegend>(xLow, yLow, xHigh, yHigh)}{}
56
59 void addColor(const int color, const std::string& label);
63 void addMarker(const int marker, const std::string& label, const int color = kBlack);
65 void fillPrimitives(Canvas_t& canvas);
66 std::unique_ptr<TLegend> legend{};
67 using LegendEntry_t = std::unordered_map<int, PrimitivePtr_t>;
70 };
71
75 enum class DisplayView{RZ, XY};
82 void displaySeeds(const EventContext& ctx,
83 const DisplayView view,
84 const xAOD::MuonSegmentContainer& segments,
86 PrimitivesVec_t&& extPrimitives) const;
92 void fillTruthSeedPoints(const EventContext& ctx,
93 const DisplayView view,
94 PlotLegend& legend,
95 Canvas_t& canvas) const;
96
97 void displaySeedSegmentsGlobalWithTruth(const EventContext& ctx,
98 const DisplayView view,
99 const MuonR4::MsTrackSeedContainer& seeds) const;
100
106 static Amg::Vector2D viewVector(const double phi,
107 const Amg::Vector2D& posOnCylinder,
108 const DisplayView view);
110 ToolHandle<ActsTrk::IExtrapolationTool> m_extrapolationTool{this, "ExtrapolationTool" ,"" };
112 ServiceHandle<IRootVisualizationService> m_visualSvc{this, "VisualSvc", "MuonValR4::RootVisualizationService"};
114 ServiceHandle<ActsTrk::ITrackingGeometrySvc> m_trackingGeometrySvc{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"};
119 SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_truthSegKey{this, "TruthSegkey", "MuonTruthSegments"};
121 ToolHandle<MuonR4::ITrackSeedingDiagnosticsTool> m_seedingTool{this, "SeedingTool", ""};
124 SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_segmentKey{this, "SegmentContainer", "MuonSegmentsFromR4" };
125
129 Gaudi::Property<unsigned> m_canvasLimit{this, "CanvasLimit", 5000};
131 Gaudi::Property<bool> m_saveSinglePDFs{this, "saveSinglePDFs", true};
133 Gaudi::Property<bool> m_saveSummaryPDF{this, "saveSummaryPDF", true};
135 Gaudi::Property<std::string> m_subDir{this, "outSubDir", ""};
137 Gaudi::Property<std::string> m_canvasPrefix{this, "CanvasPreFix", "MsTrackValid"};
139 mutable std::atomic<bool> m_plotsDone{false};
141 mutable std::atomic<unsigned> m_objCounter{0};
142 };
143
144 //** @brief Visualizing seeds and corresponding segments with different colors */
145 int seedColorIdx(std::size_t iSeed);
146}
147
148#endif
Scalar phi() const
phi method
Utility class to handle the three contexts neeeded in an ACTS reconstruction job 1) GeometryContext -...
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::ContextUtility m_contextProvider
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.
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
Service handle to the tracking geometry service.
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
Eigen::Matrix< double, 2, 1 > Vector2D
This header ties the generic definitions in this package.
std::vector< MsTrackSeed > MsTrackSeedContainer
Definition MsTrackSeed.h:96
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