ATLAS Offline Software
Loading...
Searching...
No Matches
PatternVisualizationTool.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 MUONR4_MUONPATTERNRECOGNITIONTEST_PATTERNVISUALIZATIONTOOL_H
5#define MUONR4_MUONPATTERNRECOGNITIONTEST_PATTERNVISUALIZATIONTOOL_H
6
9
11
14
19
21
22
23namespace MuonR4 {
24 class SpacePoint;
25}
26
27namespace MuonValR4 {
28 class PatternVisualizationTool : public extends<AthAlgTool, IPatternVisualizationTool> {
29 public:
30
31 using base_class::base_class;
32
33 virtual StatusCode initialize() override final;
34
35 virtual void visualizeBucket(const EventContext& ctx,
36 const MuonR4::SpacePointBucket& bucket,
37 const std::string& extraLabel) const override final;
38 virtual void visualizeBucket(const EventContext& ctx,
39 const MuonR4::SpacePointBucket& bucket,
40 const std::string& extraLabel,
41 PrimitiveVec&& extraPaints) const override final;
42
43 virtual void visualizeSeed(const EventContext& ctx,
44 const MuonR4::SegmentSeed& seed,
45 const std::string& extraLabel) const override final;
46
47
48 virtual void visualizeSeed(const EventContext& ctx,
49 const MuonR4::SegmentSeed& seed,
50 const std::string& extraLabel,
51 PrimitiveVec&& extraPaints) const override final;
52
53
54 virtual void visualizeAccumulator(const EventContext& ctx,
55 const MuonR4::HoughPlane& accumulator,
56 const Acts::HoughTransformUtils::HoughAxisRanges& axisRanges,
57 const MaximumVec& maxima,
58 const std::string& extraLabel) const override final;
59
60 virtual void visualizeAccumulator(const EventContext& ctx,
61 const MuonR4::HoughPlane& accumulator,
62 const Acts::HoughTransformUtils::HoughAxisRanges& axisRanges,
63 const MaximumVec& maxima,
64 const std::string& extraLabel,
65 PrimitiveVec&& extraPaints) const override final;
66
67 virtual void visualizeSegment(const EventContext& ctx,
68 const MuonR4::Segment& segment,
69 const std::string& extraLabel) const override final;
70
71 virtual void visualizeSegment(const EventContext& ctx,
72 const MuonR4::Segment& segment,
73 const std::string& extraLabel,
74 PrimitiveVec&& extraPaints) const override final;
75
76
77 using LabeledSegmentSet = std::unordered_set<const xAOD::MuonSegment*>;
78
81 virtual LabeledSegmentSet getLabeledSegments(const std::vector<const MuonR4::SpacePoint*>& hits) const override final;
82 virtual LabeledSegmentSet getLabeledSegments(const std::vector<const xAOD::UncalibratedMeasurement*>& hits) const override final;
83
86 virtual bool isLabeled(const MuonR4::SpacePoint& hit) const override final;
87 virtual bool isLabeled(const xAOD::UncalibratedMeasurement& hit) const override final;
88 private:
100 template<class SpacePointType>
101 bool drawHits(const MuonR4::SpacePointBucket& bucket,
102 const std::vector<SpacePointType>& hitsToDraw,
103 Canvas_t& canvasDim,
104 unsigned int view) const;
105
114 template<class SpacePointType>
115 const MuonR4::SpacePoint* drawHit(const SpacePointType& hit,
116 Canvas_t& canvas,
117 const unsigned int view,
118 unsigned int fillStyle) const;
128 template<class SpacePointType>
130 const std::vector<SpacePointType>& hits,
131 Canvas_t& canvas,
132 const double legX = 0.2, double startLegY = 0.8,
133 const double endLegY = 0.3) const;
134
142 void paintSimHits(const EventContext& ctx,
143 const xAOD::MuonSegment& truthSeg,
144 Canvas_t& canvas,
145 const int view) const;
147 ServiceHandle<IRootVisualizationService> m_visualSvc{this, "VisualSvc", "MuonValR4::RootVisualizationService"};
152 Gaudi::Property<unsigned int> m_canvasLimit{this, "CanvasLimits", 5000};
154 Gaudi::Property<bool> m_saveSinglePDFs{this, "saveSinglePDFs", false};
156 Gaudi::Property<bool> m_saveSummaryPDF{this, "saveSummaryPDF", false};
158 Gaudi::Property<std::string> m_canvasPrefix{this, "CanvasPreFix", ""};
160 Gaudi::Property<std::string> m_subDir{this, "outSubDir", ""};
162 Gaudi::Property<bool> m_displayBucket{this, "displayBucket", true};
165 Gaudi::Property<bool> m_accumlIsEta{this, "AccumulatorsInEtaPlane", true};
167 Gaudi::Property<bool> m_doEtaBucketViews{this,"doEtaBucketViews", true};
169 Gaudi::Property<bool> m_doPhiBucketViews{this,"doPhiBucketViews", false};
171 Gaudi::Property<bool> m_paintTruthHits{this, "paintTruthHits", false};
175 Gaudi::Property<std::set<std::string>> m_truthSegLinks{this, "TruthSegDecors", {}};
179 using SegLinkVec_t = std::vector<SegLink_t>;
181 std::vector<SegLinkDecor_t> m_truthLinkDecors{};
182
183 Gaudi::Property<bool> m_displayOnlyTruth{this, "displayTruthOnly", false};
184
188 SG::ReadHandleKey<ActsTrk::GeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
190 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
192 mutable std::atomic<bool> m_plotsDone{false};
193
194 };
195
196}
197
198#endif
Representation of a segment seed (a fully processed hough maximum) produced by the hough transform.
Definition SegmentSeed.h:14
Placeholder for what will later be the muon segment EDM representation.
: The muon space point bucket represents a collection of points that will bre processed together in t...
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Gaudi::Property< std::string > m_subDir
Define the subdirectory in which the plots shall be saved.
Gaudi::Property< bool > m_doEtaBucketViews
Switch to visualize the eta view of the bucket event.
virtual StatusCode initialize() override final
Gaudi::Property< bool > m_accumlIsEta
Swtich toggling whether the accumulator view are in the eta or phi plane.
virtual void visualizeAccumulator(const EventContext &ctx, const MuonR4::HoughPlane &accumulator, const Acts::HoughTransformUtils::HoughAxisRanges &axisRanges, const MaximumVec &maxima, const std::string &extraLabel) const override final
virtual void visualizeSegment(const EventContext &ctx, const MuonR4::Segment &segment, const std::string &extraLabel) const override final
Gaudi::Property< unsigned int > m_canvasLimit
Maximum canvases to draw.
Gaudi::Property< bool > m_displayBucket
Display the surrounding hits from the bucket not part of the seed.
Gaudi::Property< std::string > m_canvasPrefix
Prefix of the individual canvas file names <MANDATORY>
virtual void visualizeBucket(const EventContext &ctx, const MuonR4::SpacePointBucket &bucket, const std::string &extraLabel) const override final
Gaudi::Property< bool > m_saveSinglePDFs
If set to true each canvas is saved into a dedicated pdf file.
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
Geometry context key to retrieve the alignment.
std::unordered_set< const xAOD::MuonSegment * > LabeledSegmentSet
virtual void visualizeSeed(const EventContext &ctx, const MuonR4::SegmentSeed &seed, const std::string &extraLabel) const override final
IRootVisualizationService::ClientToken m_clientToken
Token to present to the visualization service such that the display froms this tool are grouped toget...
std::vector< SegLinkDecor_t > m_truthLinkDecors
Gaudi::Property< bool > m_doPhiBucketViews
Switch to visualize the phi view of the bucket event.
SG::ReadDecorHandleKeyArray< xAOD::UncalibratedMeasurementContainer > m_truthLinkDecorKeys
Declaration of the dependency on the decorations.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Service Handle to the IMuonIdHelperSvc.
SG::ReadHandleKeyArray< xAOD::UncalibratedMeasurementContainer > m_prepContainerKeys
Declare dependency on the prep data containers.
bool drawHits(const MuonR4::SpacePointBucket &bucket, const std::vector< SpacePointType > &hitsToDraw, Canvas_t &canvasDim, unsigned int view) const
Translates the Spacepoint information into TObjects that are dawn on the canvas & evaluates the size ...
virtual LabeledSegmentSet getLabeledSegments(const std::vector< const MuonR4::SpacePoint * > &hits) const override final
Returns whether the hit has been used on the labeled segments we refer to (e.g.
IRootVisualizationService::ICanvasObject Canvas_t
Gaudi::Property< std::set< std::string > > m_truthSegLinks
List of truth segment links to fetch.
void paintSimHits(const EventContext &ctx, const xAOD::MuonSegment &truthSeg, Canvas_t &canvas, const int view) const
Paints the truth sim hits associated with the segment.
ElementLink< xAOD::MuonSegmentContainer > SegLink_t
ServiceHandle< IRootVisualizationService > m_visualSvc
Service handle of the visualization service.
virtual bool isLabeled(const MuonR4::SpacePoint &hit) const override final
Fetches all labeled (e.g.
Gaudi::Property< bool > m_saveSummaryPDF
If set to true a summary Canvas is created.
const MuonR4::SpacePoint * drawHit(const SpacePointType &hit, Canvas_t &canvas, const unsigned int view, unsigned int fillStyle) const
Converts a Hit into a particular TBox/ TEllipse for drawing.
void writeChi2(const MuonR4::SegmentFit::Parameters &pars, const std::vector< SpacePointType > &hits, Canvas_t &canvas, const double legX=0.2, double startLegY=0.8, const double endLegY=0.3) const
Writes the chi2 of the hits onto the Canvas.
const MuonGMR4::MuonDetectorManager * m_detMgr
pointer to the Detector manager
Gaudi::Property< bool > m_paintTruthHits
Switch to visualize the truth hits.
std::atomic< bool > m_plotsDone
Flag toggling whether all Canvases have been exhausted.
SG::AuxElement::ConstAccessor< SegLinkVec_t > SegLinkDecor_t
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
Property holding a SG store/key/clid from which a ReadHandle is made.
Acts::Experimental::CompositeSpacePointLineFitter::ParamVec_t Parameters
This header ties the generic definitions in this package.
MuonValR4::IPatternVisualizationTool::PrimitiveVec PrimitiveVec
Acts::HoughTransformUtils::HoughPlane< HoughHitType > HoughPlane
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
DecorHandleKeyArray< ReadDecorHandle< T, S >, ReadDecorHandleKey< T >, Gaudi::DataHandle::Reader > ReadDecorHandleKeyArray
HandleKeyArray< ReadHandle< T >, ReadHandleKey< T >, Gaudi::DataHandle::Reader > ReadHandleKeyArray
MuonSegment_v1 MuonSegment
Reference the current persistent version:
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
Token class to identify a particular visualization client.
Interface to the container class to temporarily cache the ROOT objects to be drawn on a TCanvas and t...
AxisRanges
Enum to select the corner coordinates shown by the plot.