ATLAS Offline Software
Loading...
Searching...
No Matches
FastRecoVisualizationTool.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
11
15
21
22
23namespace MuonR4 {
24 class SpacePoint;
25}
26
27namespace MuonValR4 {
28 class FastRecoVisualizationTool : public extends<AthAlgTool, IFastRecoVisualizationTool> {
29 public:
30 using base_class::base_class;
31
32 virtual StatusCode initialize() override final;
33
34 virtual void plotPatternBuckets(const EventContext& ctx,
35 const std::string& extraLabel,
36 PatternHitVisualInfoVec&& patternVisualVec) const override final;
37 virtual void plotPatternBuckets(const EventContext& ctx,
38 const std::string& extraLabel,
39 PatternHitVisualInfoVec&& patternVisualVec,
40 PrimitiveVec&& extraPaints) const override final;
41 virtual void plotPatternBuckets(const EventContext& ctx,
42 const std::string& extraLabel,
43 PatternHitVisualInfo&& patternVisual) const override final;
44 virtual void plotPatternBuckets(const EventContext& ctx,
45 const std::string& extraLabel,
46 PatternHitVisualInfo&& patternVisual,
47 PrimitiveVec&& extraPaints) const override final;
48
51 virtual LabeledSegmentSet getLabeledSegments(const std::vector<const MuonR4::SpacePoint*>& hits) const override final;
52 virtual LabeledSegmentSet getLabeledSegments(const std::vector<const xAOD::UncalibratedMeasurement*>& hits) const override final;
53
56 virtual bool isLabeled(const MuonR4::SpacePoint& hit) const override final;
57 virtual bool isLabeled(const xAOD::UncalibratedMeasurement& hit) const override final;
58 private:
60 enum class View {
61 objViewEta = static_cast<int>(MuonValR4::objViewEta),
62 objViewPhi = static_cast<int>(MuonValR4::objViewPhi),
65 };
74 void plotPatternBucket(const EventContext& ctx,
75 const std::string& extraLabel,
76 const MuonR4::SpacePointBucket& bucket,
77 PatternHitVisualInfo&& patternVisual,
78 PrimitiveVec&& extraPaints) const;
88 void drawSearchWindow(const Amg::Transform3D& localToGlobalBucket,
89 PrimitiveVec& outputContainer,
90 const double thetaMin,
91 const double thetaMax,
92 const Canvas_t& canvas,
93 const View view) const;
108 const Amg::Transform3D& localToGlobalBucket,
109 PrimitiveVec& outputContainer,
110 const MuonR4::SpacePoint* seed,
111 const MuonR4::SpacePoint* testHit,
112 const double lineSlope,
113 const double Rwindow,
114 const PatternHitVisualInfo::HitStatus status,
115 const Canvas_t& canvas,
116 const View view) const;
125 void drawSegment(const xAOD::MuonSegment& segment,
126 const Amg::Transform3D& localToGlobalBucket,
127 PrimitiveVec& outputContainer,
128 bool& drawnTrueLabel,
129 const Canvas_t& canvas,
130 const View view) const;
142 template<class SpacePointType>
143 bool drawHits(const MuonR4::SpacePointBucket& bucket,
144 const Amg::Transform3D& localToGlobalBucket,
145 const std::vector<SpacePointType>& hitsToDraw,
146 Canvas_t& canvasDim,
147 const View view) const;
148
159 template<class SpacePointType>
160 const MuonR4::SpacePoint* drawHit(const SpacePointType& hit,
161 const Amg::Transform3D& localToGlobalBucket,
162 Canvas_t& canvas,
163 const View view,
164 unsigned int fillStyle) const;
165
172 void paintSimHits(const ActsTrk::GeometryContext& gctx,
173 const Amg::Transform3D& localToGlobalBucket,
174 const xAOD::MuonSegment& truthSeg,
175 PrimitiveVec& outputContainer,
176 const View view) const;
187 std::unique_ptr<TLine> drawLine(const Amg::Vector3D& lineDirection,
188 const Amg::Vector3D& linePoint,
189 const double lowEnd,
190 const double highEnd,
191 const int color = kRed +1,
192 const int lineStyle = kDashed,
193 const View view = View::objViewEta) const;
194
196 ServiceHandle<IRootVisualizationService> m_visualSvc{this, "VisualSvc", "MuonValR4::RootVisualizationService"};
200 UnsignedIntegerProperty m_canvasLimit{this, "CanvasLimits", 5000};
202 BooleanProperty m_saveSinglePDFs{this, "saveSinglePDFs", false};
204 BooleanProperty m_saveSummaryPDF{this, "saveSummaryPDF", false};
206 StringProperty m_canvasPrefix{this, "CanvasPreFix", ""};
208 StringProperty m_subDir{this, "outSubDir", ""};
210 BooleanProperty m_doEtaBucketViews{this,"doEtaBucketViews", true};
212 BooleanProperty m_doPhiBucketViews{this,"doPhiBucketViews", false};
213 BooleanProperty m_doRZBucketViews{this,"doRZBucketViews", false};
215 BooleanProperty m_paintTruthHits{this, "paintTruthHits", false};
217 BooleanProperty m_paintTruthSegment{this, "paintTruthSegment", false};
219 BooleanProperty m_paintSuccessfullPatterns {this, "PaintSuccessfullPatterns", true, "Toggle the display of successfully built patterns in the visualization"};
221 BooleanProperty m_paintFailedPatterns {this, "PaintFailedPatterns", false, "Toggle the display of failed patterns in the visualization"};
223 BooleanProperty m_paintOverlapPatterns {this, "PaintOverlapPatterns", false, "Toggle the display of overlap patterns in the visualization"};
227 Gaudi::Property<std::set<std::string>> m_truthSegLinks{this, "TruthSegDecors", {}};
231 using SegLinkVec_t = std::vector<SegLink_t>;
233 std::vector<SegLinkDecor_t> m_truthLinkDecors{};
234
236 BooleanProperty m_displayOnlyTruth{this, "displayTruthOnly", false};
238 BooleanProperty m_displayOnlyWithPattern{this, "displayOnlyWithPattern", true};
239
243 SG::ReadHandleKey<ActsTrk::GeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
245 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
247 mutable std::atomic<bool> m_plotsDone ATLAS_THREAD_SAFE {false};
248 };
249
250}
251
252#endif
: 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::set< std::string > > m_truthSegLinks
List of truth segment links to fetch.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Service Handle to the IMuonIdHelperSvc.
virtual StatusCode initialize() override final
std::unique_ptr< TLine > drawLine(const Amg::Vector3D &lineDirection, const Amg::Vector3D &linePoint, const double lowEnd, const double highEnd, const int color=kRed+1, const int lineStyle=kDashed, const View view=View::objViewEta) const
Draws a line given the parameters of the line in the local frame for Eta and Phi views and in the R-Z...
IRootVisualizationService::ClientToken m_clientToken
Token to present to the visualization service such that the display froms this tool are grouped toget...
BooleanProperty m_paintSuccessfullPatterns
Switch to visualize successfull patterns.
BooleanProperty m_paintOverlapPatterns
Switch to visualize overlap patterns.
const MuonR4::SpacePoint * drawHit(const SpacePointType &hit, const Amg::Transform3D &localToGlobalBucket, Canvas_t &canvas, const View view, unsigned int fillStyle) const
Converts a Hit into a particular TBox/ TEllipse for drawing.
SG::ReadDecorHandleKeyArray< xAOD::UncalibratedMeasurementContainer > m_truthLinkDecorKeys
Declaration of the dependency on the decorations.
virtual bool isLabeled(const MuonR4::SpacePoint &hit) const override final
Fetches all labeled (e.g.
void paintSimHits(const ActsTrk::GeometryContext &gctx, const Amg::Transform3D &localToGlobalBucket, const xAOD::MuonSegment &truthSeg, PrimitiveVec &outputContainer, const View view) const
Paints the truth sim hits associated with the segment.
void drawSearchWindow(const Amg::Transform3D &localToGlobalBucket, PrimitiveVec &outputContainer, const double thetaMin, const double thetaMax, const Canvas_t &canvas, const View view) const
Draw the search window lines in the local frame expressed by the Transform3D for eta views and in the...
BooleanProperty m_displayOnlyWithPattern
Toggle to print pattern buckets only if they contain pattern hits.
BooleanProperty m_saveSinglePDFs
If set to true each canvas is saved into a dedicated pdf file.
BooleanProperty m_paintFailedPatterns
Switch to visualize failed patterns.
std::atomic< bool > m_plotsDone ATLAS_THREAD_SAFE
Flag toggling whether all Canvases have been exhausted.
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
Geometry context key to retrieve the alignment.
void plotPatternBucket(const EventContext &ctx, const std::string &extraLabel, const MuonR4::SpacePointBucket &bucket, PatternHitVisualInfo &&patternVisual, PrimitiveVec &&extraPaints) const
Plot a single pattern bucket.
StringProperty m_canvasPrefix
Prefix of the individual canvas file names <MANDATORY>
BooleanProperty m_paintTruthSegment
Switch to visualize the truth segment.
BooleanProperty m_saveSummaryPDF
If set to true a summary Canvas is created.
void drawLineResidual(const ActsTrk::GeometryContext &gctx, const Amg::Transform3D &localToGlobalBucket, PrimitiveVec &outputContainer, const MuonR4::SpacePoint *seed, const MuonR4::SpacePoint *testHit, const double lineSlope, const double Rwindow, const PatternHitVisualInfo::HitStatus status, const Canvas_t &canvas, const View view) const
Draw the pattern line and acceptance window for the testHit used during pattern building in the local...
ElementLink< xAOD::MuonSegmentContainer > SegLink_t
ServiceHandle< IRootVisualizationService > m_visualSvc
Service handle of the visualization service.
BooleanProperty m_doPhiBucketViews
Switch to visualize the phi view of the bucket event.
BooleanProperty m_displayOnlyTruth
Toggle to print pattern buckets only if they contain truth hits.
SG::ReadHandleKeyArray< xAOD::UncalibratedMeasurementContainer > m_prepContainerKeys
Declare dependency on the prep data containers.
SG::AuxElement::ConstAccessor< SegLinkVec_t > SegLinkDecor_t
BooleanProperty m_doEtaBucketViews
Switch to visualize the eta view of the bucket event.
const MuonGMR4::MuonDetectorManager * m_detMgr
pointer to the Detector manager
void drawSegment(const xAOD::MuonSegment &segment, const Amg::Transform3D &localToGlobalBucket, PrimitiveVec &outputContainer, bool &drawnTrueLabel, const Canvas_t &canvas, const View view) const
Draw a segment on the canvas.
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.
BooleanProperty m_paintTruthHits
Switch to visualize the truth hits.
virtual void plotPatternBuckets(const EventContext &ctx, const std::string &extraLabel, PatternHitVisualInfoVec &&patternVisualVec) const override final
StringProperty m_subDir
Define the subdirectory in which the plots shall be saved.
IRootVisualizationService::ICanvasObject Canvas_t
std::vector< SegLinkDecor_t > m_truthLinkDecors
bool drawHits(const MuonR4::SpacePointBucket &bucket, const Amg::Transform3D &localToGlobalBucket, const std::vector< SpacePointType > &hitsToDraw, Canvas_t &canvasDim, const View view) const
Translates the Spacepoint information into TObjects that are dawn on the canvas & evaluates the size ...
UnsignedIntegerProperty m_canvasLimit
Maximum canvases to draw.
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570
Property holding a SG store/key/clid from which a ReadHandle is made.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.
MuonValR4::IPatternVisualizationTool::PrimitiveVec PrimitiveVec
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
constexpr int objViewEta
ObjectView.
PatternVisualizationTool::LabeledSegmentSet LabeledSegmentSet
constexpr int objViewPhi
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.