ATLAS Offline Software
Loading...
Searching...
No Matches
TrackVisualizationTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5
12
13
14#include <filesystem>
15#include <format>
16
17#include "TMarker.h"
18#include "TROOT.h"
19#include "TStyle.h"
20#include "TLegend.h"
21#include "TH1F.h"
22
23namespace {
24 using namespace MuonR4;
25 using PrimitivesVec_t = MuonValR4::TrackVisualizationTool::PrimitivesVec_t;
26 constexpr int truthColor = kOrange +2;
27
28 constexpr int ColorBarrel = kRed;
29 constexpr int ColorEndcapA = kBlue;
30 constexpr int ColorEndcapC = kGreen +2;
31 constexpr double inM = 1./ Gaudi::Units::m;
32
33 constexpr double extraMargin = 50.*Gaudi::Units::cm * inM;
34
35 static const Muon::MuonSectorMapping sectorMap{};
36
37
38 std::unique_ptr<TMarker> drawMarker(const Amg::Vector2D& pos, const int mStyle, const int mColor, const int mSize = 2) {
39 auto marker = std::make_unique<TMarker>(pos.x(), pos.y(), mStyle);
40 marker->SetMarkerColor(mColor);
41 marker->SetMarkerSize(mSize);
42 return marker;
43 }
44
45 std::unique_ptr<TArrow> drawArrow2D(const Amg::Vector2D& start, const Amg::Vector2D& dir, const int color, const int lineStyle=1) {
46 constexpr double arrowLength = 2.*Gaudi::Units::m;
47 const Amg::Vector2D end = start + (arrowLength / std::hypot(dir.x(), dir.y()) ) * dir;
48 auto arrow = std::make_unique<TArrow>(start.x(), start.y(), end.x(), end.y(),0.01);
49 arrow->SetLineColor(color);
50 arrow->SetLineWidth(2);
51 arrow->SetLineStyle(lineStyle);
52 return arrow;
53 }
54
55
56 inline int stationMarkerSyle(const Muon::MuonStationIndex::ChIndex ch,
57 const bool openMarker, const bool onSeed) {
60 case Inner:
61 case BarrelExtended:
62 case Extended:
63 return onSeed ? (openMarker ? kOpenTriangleUp : kFullTriangleUp)
64 : (openMarker ? kOpenTriangleDown : kFullTriangleDown);
65 case Middle:
66 return onSeed ? (openMarker ? kOpenCrossX : kFullCrossX)
67 : (openMarker ? kOpenCross : kFullCross);
68 case Outer:
69 return onSeed ? (openMarker ? kOpenFourTrianglesX: kFullFourTrianglesX)
70 : (openMarker ? kOpenThreeTriangles : kFullThreeTriangles);
71 default:
72 return 0;
73 }
74 }
75}
76
77namespace MuonValR4{
78
79 //** @brief Visualizing seeds and corresponding segments with different colors */
80 int seedColorIdx(std::size_t iSeed){
81 // Golden ratio hue stepping -> good spread even for many seeds
82 constexpr double phi = 0.6180339887498949;
83 const double h = 360 * std::fmod(0.13 + phi * double(iSeed), 1.0); // [0,1)
84 constexpr double s = 0.75;
85 constexpr double v = 0.95;
86
87 float r=0.f, g=0.f, b=0.f;
88 TColor::HLS2RGB(h, s, v, r, g, b);
89 return TColor::GetColor(r, g, b);
90 }
91
92 void TrackVisualizationTool::PlotLegend::addColor(const int color, const std::string& label){
93 if (colors.find(color) != colors.end()) {
94 return;
95 }
96 auto box = MuonValR4::drawBox(-1.5,-1.5,-1.,-1., color, MuonValR4::fullFilling);
97 legend->AddEntry(box.get(), label.c_str(), "F");
98 colors.insert(std::make_pair(color, std::move(box)));
99 }
100 void TrackVisualizationTool::PlotLegend::addMarker(const int marker, const std::string& label, const int color){
101 if (markers.find(marker)!= markers.end()) {
102 return;
103 }
104 auto tMarker = drawMarker(Amg::Vector2D{2.*Gaudi::Units::km, 0.}, marker, color);
105 legend->AddEntry(tMarker.get(), label.c_str(), "P");
106 markers.insert(std::make_pair(marker, std::move(tMarker)));
107 }
109 legend->SetBorderSize(0);
110 legend->SetNColumns(4);
111 canvas.add(std::move(legend));
112 for (auto&[i, obj] : colors){
113 canvas.add(std::move(obj));
114 }
115 for (auto&[i, obj]: markers) {
116 canvas.add(std::move(obj));
117 }
118 }
120 const Amg::Vector2D& posOnCylinder,
121 const DisplayView view) {
122 using enum DisplayView;
123 if (view == RZ) {
124 return Amg::Vector2D{ posOnCylinder[1]*inM, posOnCylinder[0]*inM};
125 }
126 const CxxUtils::sincos phi{phiV};
127 return posOnCylinder[0] * inM * Amg::Vector2D{phi.cs, phi.sn};
128 }
130 if (m_canvasLimit > 0) {
131 m_clientToken.canvasLimit = m_canvasLimit;
132 m_clientToken.preFixName = m_canvasPrefix;
133 m_clientToken.saveSinglePlots = m_saveSinglePDFs;
134 m_clientToken.saveSummaryPlot = m_saveSummaryPDF;
135 m_clientToken.subDirectory = m_subDir;
136 ATH_CHECK(m_visualSvc.retrieve());
137 ATH_CHECK(m_visualSvc->registerClient(m_clientToken));
138 } else {
139 m_plotsDone = true;
140 }
142 ATH_CHECK(m_geoCtxKey.initialize());
143 ATH_CHECK(m_extrapolationTool.retrieve(EnableTool{!m_extrapolationTool.empty()}));
144 return StatusCode::SUCCESS;
145 }
146 void TrackVisualizationTool::displaySeeds(const EventContext& ctx,
147 const MsTrackSeeder& seederObj,
148 const xAOD::MuonSegmentContainer& segments,
149 const MsTrackSeedContainer& seeds) const {
150 displaySeeds(ctx, seederObj, segments, seeds, PrimitivesVec_t{});
151 }
152 void TrackVisualizationTool::displaySeeds(const EventContext& ctx,
153 const MsTrackSeeder& seederObj,
154 const xAOD::MuonSegmentContainer& segments,
155 const MsTrackSeedContainer& seeds,
156 PrimitivesVec_t && extPrimitives) const {
157 if (m_plotsDone || segments.empty()) {
158 return;
159 }
160
161
162
163 displaySeeds(ctx, seederObj, DisplayView::RZ, segments, seeds, clone(extPrimitives));
164 displaySeeds(ctx, seederObj, DisplayView::XY, segments, seeds, std::move(extPrimitives));
165
166 //For each seed plot respective segment parameters
167
170
171 }
172
174 const EventContext& ctx,
175 const DisplayView view,
176 const MsTrackSeedContainer& seeds) const {
177
178 auto canvas = m_visualSvc->prepareCanvas(
179 ctx, m_clientToken,
180 std::format("SeedSegsGlobalTruth{:}", view == DisplayView::XY ? "XY" : "RZ"));
181
182 if (!canvas) { m_plotsDone = true; return; }
183
184 canvas->setAxisTitles(view == DisplayView::XY ? "x [m]" : "z [m]",
185 view == DisplayView::XY ? "y [m]" : "R [m]");
186
187 PlotLegend legend{0.005, 0.005, 0.6, 0.1};
188
189 PrimitivesVec_t primitives{};
190 bool drewAny{false};
191
192 // -----------------------
193 // (A) Draw TRUTH segments
194 // -----------------------
195 const xAOD::MuonSegmentContainer* truthSegs{nullptr};
196 if (!SG::get(truthSegs, m_truthSegKey, ctx).isSuccess()) {
197 THROW_EXCEPTION("Failed to fetch the truth segment container");
198 }
199 if (truthSegs) {
200 for (const xAOD::MuonSegment* seg : *truthSegs) {
201 if (!seg) continue;
202
203 // Same station-based marker, but OPEN marker to visually separate truth vs reco
204 const auto chIdx = seg->chamberIndex();
205 const int mStyleTruth = stationMarkerSyle(chIdx, /*openMarker=*/true, /*onSeed=*/true);
206
207 const Amg::Vector3D p = seg->position();
208 const double x = p.x() * inM;
209 const double y = p.y() * inM;
210 const double z = p.z() * inM;
211 const double r = std::hypot(x, y);
212 const Amg::Vector2D plotPos =
213 (view == DisplayView::XY) ? Amg::Vector2D{x, y}
214 : Amg::Vector2D{z, r};
215 primitives.emplace_back(drawMarker(plotPos, mStyleTruth, truthColor, /*mSize=*/3));
216
217 //Plot direction of the segment as well
218 const double dir_x = seg->direction().x() * inM;
219 const double dir_y = seg->direction().y() * inM;
220 const double dir_z = seg->direction().z() * inM;
221 const Amg::Vector2D plotDir =
222 (view == DisplayView::XY) ? Amg::Vector2D{dir_x, dir_y}
223 : Amg::Vector2D{dir_z, std::hypot(dir_x, dir_y)};
224 primitives.emplace_back(drawArrow2D(plotPos, plotDir, truthColor));
225
226
227 legend.addMarker(
228 mStyleTruth,
229 std::string(Muon::MuonStationIndex::layerName(Muon::MuonStationIndex::toLayerIndex(chIdx))) + " (truth)", truthColor);
230
231 canvas->expandPad(plotPos.x() - extraMargin, plotPos.y() - extraMargin);
232 canvas->expandPad(plotPos.x() + extraMargin, plotPos.y() + extraMargin);
233 drewAny = true;
234 }
235 }
236
237 // ---------------------------------
238 // (B) Draw RECO seed-associated segs
239 // ---------------------------------
240 for (std::size_t iSeed = 0; iSeed < seeds.size(); ++iSeed) {
241 const MsTrackSeed& seed = seeds[iSeed];
242 const int color = seedColorIdx(iSeed);
243
244 std::string seedLabel = std::format("s{:d}: ", static_cast<int>(iSeed));
245
246 for (const xAOD::MuonSegment* seg : seed.segments()) {
247 if (!seg) continue;
248
249 const auto chIdx = seg->chamberIndex();
250 const int mStyle = stationMarkerSyle(chIdx, /*openMarker=*/false, /*onSeed=*/true);
251
252 const Amg::Vector3D p = seg->position();
253 const double x = p.x() * inM;
254 const double y = p.y() * inM;
255 const double z = p.z() * inM;
256 const double r = std::hypot(x, y);
257 const Amg::Vector2D plotPos =
258 (view == DisplayView::XY) ? Amg::Vector2D{x, y}
259 : Amg::Vector2D{z, r};
260
261 primitives.emplace_back(drawMarker(plotPos, mStyle, color));
262
263 //Plot direction of the segment as well
264 const double dir_x = seg->direction().x() * inM;
265 const double dir_y = seg->direction().y() * inM;
266 const double dir_z = seg->direction().z() * inM;
267 const Amg::Vector2D plotDir =
268 (view == DisplayView::XY) ? Amg::Vector2D{dir_x, dir_y}
269 : Amg::Vector2D{dir_z, std::hypot(dir_x, dir_y)};
270 primitives.emplace_back(drawArrow2D(plotPos, plotDir, color));
271
272 std::string label = printID(*seg);
273 seedLabel += label + "_";
274
275 primitives.emplace_back(MuonValR4::drawLabel(label, plotPos.x() + 0.01, plotPos.y() + 0.01, 10, false, color));
276
277 // Marker legend: only one entry per station style (PlotLegend dedups)
278 legend.addMarker(
279 mStyle,
281
282 canvas->expandPad(plotPos.x() - extraMargin, plotPos.y() - extraMargin);
283 canvas->expandPad(plotPos.x() + extraMargin, plotPos.y() + extraMargin);
284 drewAny = true;
285 }
286 //Add text which shows segment names associated to the respective seeed
287 primitives.emplace_back(MuonValR4::drawLabel(seedLabel, 0.15, 0.9 - (0.03*iSeed), 10, true, color));
288 }
289
290 if (!drewAny) { canvas->trash(); return; }
291
292 for (auto& p : primitives) canvas->add(std::move(p));
293 legend.fillPrimitives(*canvas);
294}
295
296
297
298
299 void TrackVisualizationTool::displaySeeds(const EventContext& ctx,
300 const MsTrackSeeder& seeder,
301 const DisplayView view,
302 const xAOD::MuonSegmentContainer& segments,
303 const MsTrackSeedContainer& seeds,
304 PrimitivesVec_t&& extPrimitives) const{
305
306 auto canvas = m_visualSvc->prepareCanvas(ctx, m_clientToken, std::format("SeedDisplay{:}",
307 view == DisplayView::XY ? "XY" : "RZ" ));
308
309 if (!canvas) {
310 m_plotsDone = true;
311 return;
312 }
313 canvas->setAxisTitles(view == DisplayView::XY ? "x [m]" : "z [m]",
314 view == DisplayView::XY ? "y [m]" : "R [m]");
315
316 PlotLegend legend{0.005,0.005, 0.6,0.1};
318 fillTruthSeedPoints(ctx, seeder, view, legend, *canvas);
319
320 auto onSeed = [&seeds](const xAOD::MuonSegment* segment,
321 const Location loc) {
322 return std::ranges::any_of(seeds,[segment, loc](const MsTrackSeed& seed){
323 return seed.location() == loc && std::ranges::find(seed.segments(), segment) != seed.segments().end();
324 });
325 };
326
327 const ActsTrk::GeometryContext* gctx{nullptr};
328 if (!SG::get(gctx, m_geoCtxKey, ctx).isSuccess()) {
329 THROW_EXCEPTION("Failed to fetch the geometry context "<<m_geoCtxKey.fullKey());
330 }
331 bool drawnPoint{false};
332
333 for (const xAOD::MuonSegment* segment: segments) {
334 using enum Location;
336 using namespace Muon;
337 const MuonGMR4::SpectrometerSector* msSector = detailedSegment(*segment)->msSector();
338 const auto chIdx = segment->chamberIndex();
339 const int mColor = msSector->barrel() ? ColorBarrel : (msSector->side() > 0 ? ColorEndcapA : ColorEndcapC);
340
341 for (const auto secProj : {leftOverlap, center, rightOverlap}) {
342 if (!sectorMap.insideSector(segment->sector() + Acts::toUnderlying(secProj),
343 segment->position().phi())){
344 continue;
345 }
346
347 for (const Location loc : {Barrel, Endcap}) {
348 const Amg::Vector2D projPos{seeder.expressOnCylinder(*gctx, *segment, loc, secProj)};
349 if (!seeder.withinBounds(projPos, loc)) {
350 continue;
351 }
352 drawnPoint = true;
353 const bool isGood = onSeed(segment, loc);
354 const int mStyle = stationMarkerSyle(chIdx, true, isGood);
355 const double phi = seeder.projectedPhi(segment->sector(), secProj);
356 const Amg::Vector2D markerPos{viewVector(phi, projPos, view)};
357 extPrimitives.emplace_back( drawMarker(markerPos, mStyle, mColor)); //Is this necessary?
358 canvas->add( drawMarker(markerPos, mStyle, mColor));
359
360 if (view == DisplayView::XY) {
361 const double r = markerPos.mag() + extraMargin;
362 canvas->expandPad(r, r);
363 canvas->expandPad(-r, -r);
364 } else {
365 canvas->expandPad(markerPos[0] - extraMargin, markerPos[1] - extraMargin);
366 canvas->expandPad(markerPos[0] + extraMargin, markerPos[1] + extraMargin);
367 }
368 legend.addMarker(mStyle, std::format("{:}{:}", MuonStationIndex::layerName(MuonStationIndex::toLayerIndex(chIdx)),
369 isGood ? "" : " (discarded)"), mColor);
370 legend.addColor(mColor, msSector->barrel() ? "Barrel" : msSector->side() > 0 ? "Endcap A" : "Endcap C");
371 }
372 }
373 }
374 if (!drawnPoint) {
375 canvas->trash();
376 return;
377 }
378 for (const MsTrackSeed& seed : seeds) {
379 const Amg::Vector3D& pos{seed.position()};
380 canvas->add(drawMarker(viewVector(pos.phi(), Amg::Vector2D{pos.perp(), pos.z()}, view),
381 kFullDiamond, kBlack));
382 legend.addMarker(kFullDiamond, "track seed");
383 }
385 for (unsigned int s = 1; s<=16 ; ++s) {
386 if (view != DisplayView::XY) {
387 break;
388 }
389 const double phi = sectorMap.sectorPhi(s);
390 const double dPhi = sectorMap.sectorWidth(s);
391
392 const int lStyle = s%2 ? kDashed : kDotted;
393 const double r = canvas->corner(Edges::xHigh);
394 const CxxUtils::sincos phiM{phi-dPhi}, phiP{phi+dPhi};
395 const Amg::Vector2D e1{r * phiM.cs, r * phiM.sn};
396 const Amg::Vector2D e2{r * phiP.cs, r * phiP.sn};
397
398 auto theLine = std::make_unique<TLine>(0.,0., e1.x(), e1.y());
399 theLine->SetLineStyle(lStyle);
400 extPrimitives.insert(extPrimitives.begin(), std::move(theLine));
401 theLine = std::make_unique<TLine>(0.,0., e2.x(), e2.y());
402 theLine->SetLineStyle(lStyle);
403 extPrimitives.insert(extPrimitives.begin(), std::move(theLine));
404 theLine = std::make_unique<TLine>(e1.x(), e1.y(), e2.x(), e2.y());
405 theLine->SetLineStyle(lStyle);
406 extPrimitives.insert(extPrimitives.begin(), std::move(theLine));
407 }
408 legend.fillPrimitives(*canvas);
409 }
411 const MsTrackSeeder& seeder,
412 const DisplayView view,
413 PlotLegend& legend,
414 Canvas_t& canvas) const {
415 const xAOD::MuonSegmentContainer* truthSegs{nullptr};
416 if (!SG::get(truthSegs,m_truthSegKey, ctx).isSuccess()) {
417 THROW_EXCEPTION("Failed to fetch the truth segment container");
418 }
419 if (!truthSegs) {
420 return;
421 }
422 const ActsTrk::GeometryContext* gctx{nullptr};
423 if (!SG::get(gctx, m_geoCtxKey, ctx).isSuccess()) {
424 THROW_EXCEPTION("Failed to fetch the geometry context "<<m_geoCtxKey.fullKey());
425 }
426
427 bool addedEntry{false};
428 for (const xAOD::MuonSegment* segment: *truthSegs) {
429 const auto chIdx = segment->chamberIndex();
430 const int mStyle = stationMarkerSyle(chIdx, true, true);
431
432 using enum Location;
434 for (const auto secProj : {leftOverlap, center, rightOverlap}) {
435 if (!sectorMap.insideSector(segment->sector() + Acts::toUnderlying(secProj),
436 segment->position().phi())){
437 continue;
438 }
439 for (const Location loc : {Barrel, Endcap}) {
440 const Amg::Vector2D projected{seeder.expressOnCylinder(*gctx, *segment, loc, secProj)};
441 if (!seeder.withinBounds(projected, loc)) {
442 continue;
443 }
444 const double phi = MsTrackSeeder::projectedPhi(segment->sector(), secProj);
445 canvas.add(drawMarker(viewVector(phi, projected, view), mStyle, truthColor, 3));
446 legend.addMarker(mStyle, Muon::MuonStationIndex::layerName(Muon::MuonStationIndex::toLayerIndex(chIdx)), truthColor);
447 addedEntry = true;
448 }
449 }
450 }
451 if (addedEntry) {
452 legend.addColor(truthColor, "truth");
453 }
454 }
456 const MuonR4::MsTrackSeed& seed,
457 const OptBoundPars_t& parsToExt,
458 const std::string& objName) const {
460 return;
461 }
462 const ActsTrk::GeometryContext* gctx{nullptr};
463 SG::get(gctx, m_geoCtxKey, ctx).ignore();
464
465 Acts::ObjVisualization3D visualHelper{};
466 const std::string subDir = std::format("./ObjDisplays/{:}/", m_subDir.value());
467 ensureDirectory(subDir);
468 if (parsToExt.ok() && m_extrapolationTool.isEnabled()) {
469 auto stepsResult = m_extrapolationTool->propagationSteps(ctx, *parsToExt);
470 if (stepsResult.ok()) {
471 MuonValR4::drawPropagation(stepsResult->first, visualHelper);
472 } else {
473 ATH_MSG_WARNING("Failed to extrapolate the seed for visualization: " << stepsResult.error().message());
474 }
475 }
476 std::string segStr{removeNonAlphaNum(objName)};
477 for (const xAOD::MuonSegment* seg : seed.segments()) {
478 MuonValR4::drawSegmentMeasurements(*gctx,* seg, visualHelper);
479 MuonValR4::drawSegmentLine(*gctx,*seg, visualHelper);
480 segStr += std::format("_{:}", MuonR4::printID(*seg));
481 }
482
483 unsigned fileVersion{0};
484 std::string finalStr{};
485 while (finalStr.empty() || std::filesystem::exists(finalStr)) {
486 finalStr = std::format("{:}/{:}_{:}_{:}_{:}.obj", subDir,
487 m_clientToken.preFixName, ctx.eventID().event_number(), ++fileVersion, segStr);
488 }
489 visualHelper.write(finalStr);
490 ++m_objCounter;
491 }
492}
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define y
#define x
#define z
bool empty() const noexcept
Returns true if the collection is empty.
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
int8_t side() const
Returns the side of the MS-sector 1 -> A side ; -1 -> C side.
bool barrel() const
Returns whether the sector is placed in the barrel.
Helper class to group muon sgements that may belong to a muon trajectory.
bool withinBounds(const Amg::Vector2D &projPos, const Location loc) const
Returns whether the expression on the cylinder is within the surface bounds.
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.
SectorProjector
Enumeration to select the sector projection.
const MuonGMR4::SpectrometerSector * msSector() const
Returns the associated MS sector.
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 ...
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.
void displaySeedSegmentsGlobalWithTruth(const EventContext &ctx, const DisplayView view, const MuonR4::MsTrackSeedContainer &seeds) const
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.
double sectorPhi(int sector) const
returns the centeral phi position of a sector in radians
double sectorWidth(int sector) const
sector width (with overlap) in radians
bool insideSector(int sector, double phi) const
checks whether the phi position is consistent with sector
::Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Amg::Vector3D position() const
Returns the position as Amg::Vector.
int r
Definition globals.cxx:22
std::string label(const std::string &format, int i)
Definition label.h:19
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.
std::vector< MsTrackSeed > MsTrackSeedContainer
Definition MsTrackSeed.h:63
std::string printID(const xAOD::MuonSegment &seg)
Print the chamber ID of a segment, e.g.
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
void ensureDirectory(const std::string &path)
Ensures that the subdirectory in the path is created.
std::unique_ptr< TLatex > drawLabel(const std::string &text, const double xPos, const double yPos, const double textSize=18, const bool useNDC=true, const int color=kBlack)
Create a TLatex label,.
std::vector< std::unique_ptr< TObject > > clone(const std::vector< std::unique_ptr< TObject > > &cloneMe)
int seedColorIdx(std::size_t iSeed)
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.
constexpr int fullFilling
std::string removeNonAlphaNum(std::string str)
Removes all non-alpha numerical characters from 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.
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.
std::unique_ptr< TBox > drawBox(const Amg::Vector3D &boxCenter, const double boxWidth, const double boxHeight, const int color=kGreen+2, const int fillStyle=hollowFilling, const int view=objViewEta)
Creates a box for drawing, e.g strip measurements.
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
LayerIndex
enum to classify the different layers in the muon spectrometer
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
ChIndex
enum to classify the different chamber layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
MuonSegment_v1 MuonSegment
Reference the current persistent version:
Helper to simultaneously calculate sin and cos of the same angle.
Definition sincos.h:39
Helper struct to administer the markers & colors that are added to the legend.
void fillPrimitives(Canvas_t &canvas)
Add the primitives of the legend to the Canvas.
void addColor(const int color, const std::string &label)
Add new color legend entry.
void addMarker(const int marker, const std::string &label, const int color=kBlack)
Add new Marker style to the legend entry.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10