 |
ATLAS Offline Software
|
#include <TrackVisualizationTool.h>
|
| struct | PlotLegend |
| | Helper struct to administer the markers & colors that are added to the legend. More...
|
| |
|
| virtual | ~TrackVisualizationTool ()=default |
| | Destructor. More...
|
| |
| virtual StatusCode | initialize () override final |
| |
| 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 the successfully built seeds & truth segments. More...
|
| |
| virtual void | displaySeeds (const EventContext &ctx, const MuonR4::MsTrackSeeder &seederObj, const xAOD::MuonSegmentContainer &segments, const MuonR4::MsTrackSeedContainer &seeds, PrimitivesVec_t &&extPrimitives) const override final |
| | Displays all segments on the representative cylinder in the R-Z & X-Y plane and draws the markers of the successfully built seeds & truth segments. More...
|
| |
| 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 line parameters as an obj file. More...
|
| |
|
| ToolHandle< ActsTrk::IExtrapolationTool > | m_extrapolationTool {this, "ExtrapolationTool" ,"" } |
| | Track extrapolation tool. More...
|
| |
| ServiceHandle< IRootVisualizationService > | m_visualSvc {this, "VisualSvc", "MuonValR4::RootVisualizationService"} |
| | Service handle of the visualization service. More...
|
| |
| IRootVisualizationService::ClientToken | m_clientToken {} |
| | Token to present to the visualization service such that the display froms this tool are grouped together. More...
|
| |
| SG::ReadHandleKey< xAOD::MuonSegmentContainer > | m_truthSegKey {this, "TruthSegkey", "MuonTruthSegments"} |
| | Key to the truth segment selection to draw the segment parameters. More...
|
| |
| SG::ReadHandleKey< ActsTrk::GeometryContext > | m_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"} |
| | Dependency on the geometry alignment. More...
|
| |
| Gaudi::Property< unsigned > | m_canvasLimit {this, "CanvasLimit", 5000} |
| | Maximum canvases to draw. More...
|
| |
| Gaudi::Property< bool > | m_saveSinglePDFs {this, "saveSinglePDFs", true} |
| | If set to true each canvas is saved into a dedicated pdf file. More...
|
| |
| Gaudi::Property< bool > | m_saveSummaryPDF {this, "saveSummaryPDF", true} |
| | If set to true a summary Canvas is created. More...
|
| |
| Gaudi::Property< std::string > | m_subDir {this, "outSubDir", ""} |
| | Define the subdirectory in which the plots shall be saved. More...
|
| |
| Gaudi::Property< std::string > | m_canvasPrefix {this, "CanvasPreFix", "MsTrackValid"} |
| | Prefix of the individual canvas file names <MANDATORY>
More...
|
| |
| std::atomic< bool > | m_plotsDone {false} |
| | Flag toggling whether all Canvases have been exhausted. More...
|
| |
| std::atomic< unsigned > | m_objCounter {0} |
| | How many obj have been produced. More...
|
| |
Definition at line 19 of file TrackVisualizationTool.h.
◆ Canvas_t
◆ Edges
◆ Location
Enumeration to toggle whether the segment shall displayed on the barrel/endcap.
Definition at line 93 of file TrackVisualizationTool.h.
◆ DisplayView
Enumeration to toggle whether the seeds shall be painted in x-y or R-z view.
Definition at line 95 of file TrackVisualizationTool.h.
◆ ~TrackVisualizationTool()
| virtual MuonValR4::TrackVisualizationTool::~TrackVisualizationTool |
( |
| ) |
|
|
virtualdefault |
◆ displaySeeds() [1/3]
Actual implementation of the display seeds method with the augmentation to define the view.
- Parameters
-
| ctx | EventContext to access store gate & conditions |
| seederObj | Configured instance of the track seeder which actually constructed the seeds. |
| view | Actual view to display |
| segments | Container of all MS segments in the event |
| seeds | The constructed track seeds from the event |
| extPrimitives | Extra TObjects that should be additionally painted onto the Canvases |
First add the truth points
Draw the sector map
Definition at line 141 of file TrackVisualizationTool.cxx.
158 PlotLegend
legend{0.005,0.005, 0.6,0.1};
164 return std::ranges::any_of(seeds,[segment, loc](
const MsTrackSeed& seed){
173 bool drawnPoint{
false};
178 using namespace Muon;
181 const int mColor = msSector->
barrel() ? ColorBarrel : (msSector->
side() > 0 ? ColorEndcapA : ColorEndcapC);
183 for (
const auto secProj : {leftOverlap, center, rightOverlap}) {
184 if (!sectorMap.insideSector(segment->
sector() + Acts::toUnderlying(secProj),
190 const Amg::Vector2D projPos{seeder.expressOnCylinder(*gctx, *segment, loc, secProj)};
191 if (!seeder.withinBounds(projPos, loc)) {
195 const bool isGood = onSeed(segment, loc);
196 const int mStyle = stationMarkerSyle(chIdx,
false, isGood);
197 const double phi = seeder.projectedPhi(segment->
sector(), secProj);
199 extPrimitives.emplace_back(drawMarker(markerPos, mStyle, mColor));
202 const double r = markerPos.mag() + extraMargin;
206 canvas->expandPad(markerPos[0] - extraMargin, markerPos[1] - extraMargin);
207 canvas->expandPad(markerPos[0] + extraMargin, markerPos[1] + extraMargin);
210 isGood ?
"" :
" (discarded)"));
211 legend.addColor(mColor, msSector->
barrel() ?
"Barrel" : msSector->
side() > 0 ?
"Endcap A" :
"Endcap C");
222 kFullDiamond, kBlack));
223 legend.addMarker(kFullDiamond,
"track seed");
226 for (
unsigned int s = 1;
s<=16 ; ++
s) {
230 const double phi = sectorMap.sectorPhi(
s);
231 const double dPhi = sectorMap.sectorWidth(
s);
233 const int lStyle =
s%2 ? kDashed : kDotted;
239 auto theLine = std::make_unique<TLine>(0.,0.,
e1.x(),
e1.y());
240 theLine->SetLineStyle(lStyle);
241 extPrimitives.insert(extPrimitives.begin(), std::move(theLine));
242 theLine = std::make_unique<TLine>(0.,0.,
e2.x(),
e2.y());
243 theLine->SetLineStyle(lStyle);
244 extPrimitives.insert(extPrimitives.begin(), std::move(theLine));
245 theLine = std::make_unique<TLine>(
e1.x(),
e1.y(),
e2.x(),
e2.y());
246 theLine->SetLineStyle(lStyle);
247 extPrimitives.insert(extPrimitives.begin(), std::move(theLine));
◆ displaySeeds() [2/3]
Displays all segments on the representative cylinder in the R-Z & X-Y plane and draws the markers of the successfully built seeds & truth segments.
- Parameters
-
| ctx | EventContext to access store gate & conditions |
| seederObj | Configured instance of the track seeder which actually constructed the seeds. |
| segments | Container of all MS segments in the event |
| seeds | The constructed track seeds from the event |
Definition at line 123 of file TrackVisualizationTool.cxx.
127 displaySeeds(ctx, seederObj, segments, seeds, PrimitivesVec_t{});
◆ displaySeeds() [3/3]
Displays all segments on the representative cylinder in the R-Z & X-Y plane and draws the markers of the successfully built seeds & truth segments.
- Parameters
-
| ctx | EventContext to access store gate & conditions |
| seederObj | Configured instance of the track seeder which actually constructed the seeds. |
| segments | Container of all MS segments in the event |
| extPrimitives | Extra TObjects that should be additionally painted onto the Canvases |
Definition at line 129 of file TrackVisualizationTool.cxx.
◆ displayTrackSeedObj()
| void MuonValR4::TrackVisualizationTool::displayTrackSeedObj |
( |
const EventContext & |
ctx, |
|
|
const MuonR4::MsTrackSeed & |
seed, |
|
|
const OptBoundPars_t & |
parsToExt, |
|
|
const std::string & |
objName = "" |
|
) |
| const |
|
finaloverridevirtual |
Visualizes the measurements of the segments on the track seed together with their predicted local line parameters as an obj file.
If parameters to extrapolate are parsed, then they're extrapolated to the end of the world and the trajectory is added to the obj
- Parameters
-
| ctx | EventContext to fetch the conditions data & the event information |
| seed | MsTrack to visualize |
| parsToExt | Parameters to extrapolate on top |
| objName | Extra token to be added to the file name |
Definition at line 296 of file TrackVisualizationTool.cxx.
306 Acts::ObjVisualization3D visualHelper{};
321 std::string finalStr{};
323 finalStr =
std::format(
"{:}/{:}_{:}_{:}_{:}.obj", subDir,
326 visualHelper.write(finalStr);
◆ fillTruthSeedPoints()
Add the truth segments to the canvas.
- Parameters
-
| ctx | EventContext to access store gate |
| seederObj | Configured instance of the track seeder which actually constructed the seeds. |
| view | Actual view to display |
| legend | Reference to the legend object to add the marker / truth legends |
| canvas | Reference to the canvas to which the drawn markers are appended to |
Definition at line 251 of file TrackVisualizationTool.cxx.
268 bool addedEntry{
false};
270 const auto chIdx = segment->chamberIndex();
271 const int mStyle = stationMarkerSyle(chIdx,
false,
true);
275 for (
const auto secProj : {leftOverlap, center, rightOverlap}) {
276 if (!sectorMap.insideSector(segment->sector() + Acts::toUnderlying(secProj),
277 segment->position().phi())){
293 legend.addColor(truthColor,
"truth");
◆ initialize()
| StatusCode MuonValR4::TrackVisualizationTool::initialize |
( |
| ) |
|
|
finaloverridevirtual |
◆ viewVector()
Transforms the projected vector into the actual view, if it's xy then an external phi is needed to place the marker.
- Parameters
-
| phi | Angle for the xy view - taken from the segment direction |
| posOnCylinder | Projection of the segment's position onto the seed cylinder |
| view | Actual view to display |
Definition at line 96 of file TrackVisualizationTool.cxx.
101 return Amg::Vector2D{ posOnCylinder[1]*inM, posOnCylinder[0]*inM};
◆ m_canvasLimit
| Gaudi::Property<unsigned> MuonValR4::TrackVisualizationTool::m_canvasLimit {this, "CanvasLimit", 5000} |
|
private |
◆ m_canvasPrefix
| Gaudi::Property<std::string> MuonValR4::TrackVisualizationTool::m_canvasPrefix {this, "CanvasPreFix", "MsTrackValid"} |
|
private |
◆ m_clientToken
Token to present to the visualization service such that the display froms this tool are grouped together.
Definition at line 134 of file TrackVisualizationTool.h.
◆ m_extrapolationTool
◆ m_geoCtxKey
◆ m_objCounter
| std::atomic<unsigned> MuonValR4::TrackVisualizationTool::m_objCounter {0} |
|
mutableprivate |
◆ m_plotsDone
| std::atomic<bool> MuonValR4::TrackVisualizationTool::m_plotsDone {false} |
|
mutableprivate |
◆ m_saveSinglePDFs
| Gaudi::Property<bool> MuonValR4::TrackVisualizationTool::m_saveSinglePDFs {this, "saveSinglePDFs", true} |
|
private |
◆ m_saveSummaryPDF
| Gaudi::Property<bool> MuonValR4::TrackVisualizationTool::m_saveSummaryPDF {this, "saveSummaryPDF", true} |
|
private |
◆ m_subDir
| Gaudi::Property<std::string> MuonValR4::TrackVisualizationTool::m_subDir {this, "outSubDir", ""} |
|
private |
◆ m_truthSegKey
◆ m_visualSvc
The documentation for this class was generated from the following files:
std::string preFixName
Prefix name of the saved Canvas.
std::string printID(const xAOD::MuonSegment &seg)
Print the chamber ID of a segment, e.g.
std::string subDirectory
Subdirectory in which the plots are written.
int8_t side() const
Returns the side of the MS-sector 1 -> A side ; -1 -> C side.
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
Scalar phi() const
phi method
std::string find(const std::string &s)
return a remapped string
bool withinBounds(const Amg::Vector2D &projPos, const Location loc) const
Returns whether the expression on the cylinder is within the surface bounds.
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling
bool saveSinglePlots
Save single plots.
Eigen::Matrix< double, 2, 1 > Vector2D
Class describing a MuonSegment.
std::string removeNonAlphaNum(std::string str)
Removes all non-alpha numerical characters from a string.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
std::vector< std::unique_ptr< TObject > > clone(const std::vector< std::unique_ptr< TObject >> &cloneMe)
std::size_t canvasLimit
How many canvases are drawn at maximum in a job.
void drawSegmentLine(const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewLine, const double standardLength=1.*Gaudi::Units::m)
Draw a segment line inside the obj file.
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
Amg::Vector2D expressOnCylinder(const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, const Location loc, const SectorProjector proj) const
Expresses the segment on the cylinder surface.
static double projectedPhi(const int sector, const SectorProjector proj)
Returns the projected phi for a given sector and projector.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
bool barrel() const
Returns whether the sector is placed in the barrel.
void drawPropagation(const std::vector< Acts::detail::Step > &steps, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewLine)
Draws the recorded propagation steps as a polygon line.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const MuonGMR4::SpectrometerSector * msSector() const
Returns the associated MS sector.
Amg::Vector3D position() const
Returns the position as Amg::Vector.
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
void drawSegmentMeasurements(const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
Draw all uncalibrated measurements associated to the segment.
Eigen::Matrix< double, 3, 1 > Vector3D
bool saveSummaryPlot
Save a summary pdf.
#define THROW_EXCEPTION(MESSAGE)
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
SectorProjector
Enumeration to select the sector projection.
Helper to simultaneously calculate sin and cos of the same angle.
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
void ensureDirectory(const std::string &path)
Ensures that the subdirectory in the path is created.
::Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
bool empty() const noexcept
Returns true if the collection is empty.