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
20
22
23
24namespace MuonR4 {
25 class SpacePoint;
26}
27
28namespace MuonValR4 {
29 class PatternVisualizationTool : public extends<AthAlgTool, IPatternVisualizationTool> {
30 public:
31
32 using base_class::base_class;
33
34 virtual StatusCode initialize() override final;
35
36 virtual void visualizeBucket(const EventContext& ctx,
37 const MuonR4::SpacePointBucket& bucket,
38 const std::string& extraLabel) const override final;
39 virtual void visualizeBucket(const EventContext& ctx,
40 const MuonR4::SpacePointBucket& bucket,
41 const std::string& extraLabel,
42 PrimitiveVec&& extraPaints) const override final;
43
44 virtual void visualizeSeed(const EventContext& ctx,
45 const MuonR4::SegmentSeed& seed,
46 const std::string& extraLabel) const override final;
47
48
49 virtual void visualizeSeed(const EventContext& ctx,
50 const MuonR4::SegmentSeed& seed,
51 const std::string& extraLabel,
52 PrimitiveVec&& extraPaints) const override final;
53
54
55 virtual void visualizeAccumulator(const EventContext& ctx,
56 const MuonR4::HoughPlane& accumulator,
57 const Acts::HoughTransformUtils::HoughAxisRanges& axisRanges,
58 const MaximumVec& maxima,
59 const std::string& extraLabel) const override final;
60
61 virtual void visualizeAccumulator(const EventContext& ctx,
62 const MuonR4::HoughPlane& accumulator,
63 const Acts::HoughTransformUtils::HoughAxisRanges& axisRanges,
64 const MaximumVec& maxima,
65 const std::string& extraLabel,
66 PrimitiveVec&& extraPaints) const override final;
67
68 virtual void visualizeSegment(const EventContext& ctx,
69 const MuonR4::Segment& segment,
70 const std::string& extraLabel) const override final;
71
72 virtual void visualizeSegment(const EventContext& ctx,
73 const MuonR4::Segment& segment,
74 const std::string& extraLabel,
75 PrimitiveVec&& extraPaints) const override final;
76
77 virtual void visualizeSegmentsMeasurementsObj(const EventContext& ctx,
78 const MuonR4::Segment& segment,
79 const std::string& extraLabel) const override final;
80
81 virtual void visualizeSegmentsMeasurementsObj(const EventContext& ctx,
82 const MuonR4::Segment::MeasVec& measVec,
83 const std::string& extraLabel) const override final;
84
85
86 using LabeledSegmentSet = std::unordered_set<const xAOD::MuonSegment*>;
87
90 virtual LabeledSegmentSet getLabeledSegments(const std::vector<const MuonR4::SpacePoint*>& hits) const override final;
91 virtual LabeledSegmentSet getLabeledSegments(const std::vector<const xAOD::UncalibratedMeasurement*>& hits) const override final;
92
95 virtual bool isLabeled(const MuonR4::SpacePoint& hit) const override final;
96 virtual bool isLabeled(const xAOD::UncalibratedMeasurement& hit) const override final;
97 private:
109 template<class SpacePointType>
110 bool drawHits(const MuonR4::SpacePointBucket& bucket,
111 const std::vector<SpacePointType>& hitsToDraw,
112 Canvas_t& canvasDim,
113 unsigned int view) const;
114
123 template<class SpacePointType>
124 const MuonR4::SpacePoint* drawHit(const SpacePointType& hit,
125 Canvas_t& canvas,
126 const unsigned int view,
127 unsigned int fillStyle) const;
137 template<class SpacePointType>
139 const std::vector<SpacePointType>& hits,
140 Canvas_t& canvas,
141 const double legX = 0.2, double startLegY = 0.8,
142 const double endLegY = 0.3) const;
143
151 void paintSimHits(const EventContext& ctx,
152 const xAOD::MuonSegment& truthSeg,
153 Canvas_t& canvas,
154 const int view) const;
155
161 void drawObjHits(const ActsTrk::GeometryContext& geoCtx,
162 const MuonR4::Segment::MeasVec& measVec,
163 Acts::ObjVisualization3D& visualHelper) const;
164
166 ServiceHandle<IRootVisualizationService> m_visualSvc{this, "VisualSvc", "MuonValR4::RootVisualizationService"};
171 Gaudi::Property<unsigned int> m_canvasLimit{this, "CanvasLimits", 5000};
173 Gaudi::Property<bool> m_saveSinglePDFs{this, "saveSinglePDFs", false};
175 Gaudi::Property<bool> m_saveSummaryPDF{this, "saveSummaryPDF", false};
177 Gaudi::Property<std::string> m_canvasPrefix{this, "CanvasPreFix", ""};
179 Gaudi::Property<std::string> m_subDir{this, "outSubDir", ""};
181 Gaudi::Property<bool> m_displayBucket{this, "displayBucket", true};
184 Gaudi::Property<bool> m_accumlIsEta{this, "AccumulatorsInEtaPlane", true};
186 Gaudi::Property<bool> m_doEtaBucketViews{this,"doEtaBucketViews", true};
188 Gaudi::Property<bool> m_doPhiBucketViews{this,"doPhiBucketViews", false};
190 Gaudi::Property<bool> m_paintTruthHits{this, "paintTruthHits", false};
194 Gaudi::Property<std::set<std::string>> m_truthSegLinks{this, "TruthSegDecors", {}};
198 using SegLinkVec_t = std::vector<SegLink_t>;
200 std::vector<SegLinkDecor_t> m_truthLinkDecors{};
201
202 Gaudi::Property<bool> m_displayOnlyTruth{this, "displayTruthOnly", false};
203
207 SG::ReadHandleKey<ActsTrk::GeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
209 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
211 mutable std::atomic<bool> m_plotsDone{false};
212
213 };
214
215}
216
217#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 void visualizeSegmentsMeasurementsObj(const EventContext &ctx, const MuonR4::Segment &segment, const std::string &extraLabel) const override final
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
void drawObjHits(const ActsTrk::GeometryContext &geoCtx, const MuonR4::Segment::MeasVec &measVec, Acts::ObjVisualization3D &visualHelper) const
Append hits from a segment in an obj file.
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:570
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.