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
11
12#include <TLegend.h>
13
14namespace MuonR4{
15 class MsTrackSeeder;
16}
17
18namespace MuonValR4{
19 class TrackVisualizationTool : public extends<AthAlgTool, ITrackVisualizationTool> {
20 public:
22 using base_class::base_class;
24 virtual ~TrackVisualizationTool() = default;
25
26 virtual StatusCode initialize() override final;
34 virtual void displaySeeds(const EventContext& ctx,
35 const MuonR4::MsTrackSeeder& seederObj,
36 const xAOD::MuonSegmentContainer& segments,
37 const MuonR4::MsTrackSeedContainer& seeds) const override final;
45 virtual void displaySeeds(const EventContext& ctx,
46 const MuonR4::MsTrackSeeder& seederObj,
47 const xAOD::MuonSegmentContainer& segments,
49 PrimitivesVec_t && extPrimitives) const override final;
50
59 virtual void displayTrackSeedObj(const EventContext& ctx,
61 const OptBoundPars_t& parsToExt,
62 const std::string& objName = "") const override final;
63 private:
65 using Edges = Canvas_t::AxisRanges;
67 struct PlotLegend {
73 PlotLegend(const double xLow, const double yLow,
74 const double xHigh, const double yHigh):
75 legend{std::make_unique<TLegend>(xLow, yLow, xHigh, yHigh)}{}
76
79 void addColor(const int color, const std::string& label);
83 void addMarker(const int marker, const std::string& label);
85 void fillPrimitives(Canvas_t& canvas);
86 std::unique_ptr<TLegend> legend{};
87 using LegendEntry_t = std::unordered_map<int, PrimitivePtr_t>;
90 };
91
95 enum class DisplayView{RZ, XY};
103 void displaySeeds(const EventContext& ctx,
104 const MuonR4::MsTrackSeeder& seederObj,
105 const DisplayView view,
106 const xAOD::MuonSegmentContainer& segments,
107 const MuonR4::MsTrackSeedContainer& seeds,
108 PrimitivesVec_t&& extPrimitives) const;
115 void fillTruthSeedPoints(const EventContext& ctx,
116 const MuonR4::MsTrackSeeder& seeder,
117 const DisplayView view,
118 PlotLegend& legend,
119 Canvas_t& canvas) const;
125 static Amg::Vector2D viewVector(const double phi,
126 const Amg::Vector2D& posOnCylinder,
127 const DisplayView view);
129 ToolHandle<ActsTrk::IExtrapolationTool> m_extrapolationTool{this, "ExtrapolationTool" ,"" };
131 ServiceHandle<IRootVisualizationService> m_visualSvc{this, "VisualSvc", "MuonValR4::RootVisualizationService"};
136 SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_truthSegKey{this, "TruthSegkey", "MuonTruthSegments"};
138 SG::ReadHandleKey<ActsTrk::GeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
140 Gaudi::Property<unsigned> m_canvasLimit{this, "CanvasLimit", 5000};
142 Gaudi::Property<bool> m_saveSinglePDFs{this, "saveSinglePDFs", true};
144 Gaudi::Property<bool> m_saveSummaryPDF{this, "saveSummaryPDF", true};
146 Gaudi::Property<std::string> m_subDir{this, "outSubDir", ""};
148 Gaudi::Property<std::string> m_canvasPrefix{this, "CanvasPreFix", "MsTrackValid"};
150 mutable std::atomic<bool> m_plotsDone{false};
152 mutable std::atomic<unsigned> m_objCounter{0};
153 };
154}
155
156#endif
Scalar phi() const
phi method
Location
Enum defining whether the seed is made in the endcap / barrel.
Definition MsTrackSeed.h:21
Helper class to group muon sgements that may belong to a muon trajectory.
Definition of the IRootVisualizationService interface.
Gaudi::Property< unsigned > m_canvasLimit
Maximum canvases to draw.
virtual void displaySeeds(const EventContext &ctx, const MuonR4::MsTrackSeeder &seederObj, const xAOD::MuonSegmentContainer &segments, 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 ...
virtual ~TrackVisualizationTool()=default
Destructor.
Gaudi::Property< std::string > m_canvasPrefix
Prefix of the individual canvas file names <MANDATORY>
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
Track extrapolation tool.
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
Dependency on the geometry alignment.
virtual StatusCode initialize() override final
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.
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.
DisplayView
Enumeration to toggle whether the seeds shall be painted in x-y or R-z view.
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.
void fillTruthSeedPoints(const EventContext &ctx, const MuonR4::MsTrackSeeder &seeder, const DisplayView view, PlotLegend &legend, Canvas_t &canvas) const
Add the truth segments to the canvas.
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:63
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
RootVisualizationService::ICanvasObject ICanvasObject
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
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