ATLAS Offline Software
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MuonValR4::PatternVisualizationTool Class Reference

#include <PatternVisualizationTool.h>

Inheritance diagram for MuonValR4::PatternVisualizationTool:
Collaboration diagram for MuonValR4::PatternVisualizationTool:

Public Types

using TruthSegmentSet = std::unordered_set< const xAOD::MuonSegment * >
 

Public Member Functions

 PatternVisualizationTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize () override final
 
virtual StatusCode finalize () override final
 
virtual void visualizeBucket (const EventContext &ctx, const MuonR4::SpacePointBucket &bucket, const std::string &extraLabel) const override final
 
virtual void visualizeBucket (const EventContext &ctx, const MuonR4::SpacePointBucket &bucket, const std::string &extraLabel, PrimitiveVec &&extraPaints) const override final
 
virtual void visualizeSeed (const EventContext &ctx, const MuonR4::SegmentSeed &seed, const std::string &extraLabel) const override final
 
virtual void visualizeSeed (const EventContext &ctx, const MuonR4::SegmentSeed &seed, const std::string &extraLabel, PrimitiveVec &&extraPaints) const override final
 
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 visualizeAccumulator (const EventContext &ctx, const MuonR4::HoughPlane &accumulator, const Acts::HoughTransformUtils::HoughAxisRanges &axisRanges, const MaximumVec &maxima, const std::string &extraLabel, PrimitiveVec &&extraPaints) const override final
 
virtual void visualizeSegment (const EventContext &ctx, const MuonR4::Segment &segment, const std::string &extraLabel) const override final
 
virtual void visualizeSegment (const EventContext &ctx, const MuonR4::Segment &segment, const std::string &extraLabel, PrimitiveVec &&extraPaints) const override final
 
virtual TruthSegmentSet fetchTruthSegs (const std::vector< const MuonR4::SpacePoint * > &hits) const override final
 Fetches all truth segments where at least one measurement in the list was used to build them. More...
 
virtual TruthSegmentSet fetchTruthSegs (const std::vector< const xAOD::UncalibratedMeasurement * > &hits) const override final
 
virtual bool isTruthMatched (const MuonR4::SpacePoint &hit) const override final
 Returns whether the hit has been used in the truth-segment building. More...
 
virtual bool isTruthMatched (const xAOD::UncalibratedMeasurement &hit) const override final
 
template<class SpacePointType >
const SpacePointdrawHit (const SpacePointType &hit, PrimitiveVec &primitives, std::array< double, 4 > &canvasDim, const unsigned int view, unsigned int fillStyle) const
 

Private Types

using SegLink_t = ElementLink< xAOD::MuonSegmentContainer >
 
using SegLinkVec_t = std::vector< SegLink_t >
 
using SegLinkDecor_t = SG::AuxElement::ConstAccessor< SegLinkVec_t >
 

Private Member Functions

void closeSummaryCanvas () const
 Closes the summary canvas & closes the associated ROOT file. More...
 
std::unique_ptr< TCanvas > makeCanvas (const EventContext &ctx, const std::array< double, 4 > &canvasDim, const int view) const
 Create a new Canvas & draw the underlying frame. More...
 
void saveCanvas (const EventContext &ctx, const Identifier &chambId, TCanvas &canvas, const std::string &extraLabel) const
 Saves the Canvas as pdf & also into the ROOT file. More...
 
template<class SpacePointType >
bool drawHits (const MuonR4::SpacePointBucket &bucket, const std::vector< SpacePointType > &hitsToDraw, PrimitiveVec &primitivesToPush, std::array< double, 4 > &canvasDim, unsigned int view) const
 Translates the Spacepoint information into TObjects that are dawn on the canvas & evaluates the size of the box surrounding the event. More...
 
template<class SpacePointType >
const MuonR4::SpacePointdrawHit (const SpacePointType &hit, PrimitiveVec &primitives, std::array< double, 4 > &canvasDim, const unsigned int view, unsigned int fillStyle) const
 Converts a Hit into a particular TBox/ TEllipse for drawing. More...
 
template<class SpacePointType >
void writeChi2 (const MuonR4::SegmentFit::Parameters &pars, const std::vector< SpacePointType > &hits, PrimitiveVec &primitivesToPush, const double legX=0.15, double startLegY=0.8, const double endLegY=0.3) const
 Writes the chi2 of the hits onto the Canvas. More...
 

Private Attributes

Gaudi::Property< unsigned int > m_canvasLimit {this, "CanvasLimits", 5000}
 Maximum canvases to draw. More...
 
Gaudi::Property< bool > m_saveSinglePDFs {this, "saveSinglePDFs", false}
 If set to true each canvas is saved into a dedicated pdf file. More...
 
Gaudi::Property< bool > m_saveSummaryPDF {this, "saveSummaryPDF", false}
 If set to true a summary Canvas is created. More...
 
Gaudi::Property< std::string > m_allCanName {this, "AllCanvasName", "AllPatternPlots"}
 Name of the summary canvas & the ROOT file to save the monitoring plots. More...
 
Gaudi::Property< std::string > m_canvasPrefix {this, "CanvasPreFix", ""}
 Prefix of the individual canvas file names <MANDATORY>
More...
 
Gaudi::Property< bool > m_displayBucket {this, "displayBucket", true}
 Display the surrounding hits from the bucket not part of the seed. More...
 
Gaudi::Property< double > m_canvasExtraScale {this, "CanvasExtraScale" , 1.3}
 Extra safety margin to zoom out from the Canvas. More...
 
Gaudi::Property< bool > m_accumlIsEta {this, "AccumulatorsInEtaPlane", true}
 Swtich toggling whether the accumulator view are in the eta or phi plane. More...
 
Gaudi::Property< bool > m_doEtaBucketViews {this,"doEtaBucketViews", true}
 Switch to visualize the eta view of the bucket event. More...
 
Gaudi::Property< bool > m_doPhiBucketViews {this,"doPhiBucketViews", true}
 Switch to visualize the phi view of the bucket event. More...
 
SG::ReadHandleKeyArray< xAOD::UncalibratedMeasurementContainerm_prepContainerKeys {this, "PrdContainer", {}}
 Declare dependency on the prep data containers. More...
 
Gaudi::Property< std::set< std::string > > m_truthSegLinks {this, "TruthSegDecors", {}}
 List of truth segment links to fetch. More...
 
SG::ReadDecorHandleKeyArray< xAOD::UncalibratedMeasurementContainerm_truthLinkDecorKeys {this, "LinkDecorKeys", {}}
 Declaration of the dependency on the decorations. More...
 
std::vector< SegLinkDecor_tm_truthLinkDecors {}
 
Gaudi::Property< unsigned > m_canvasWidth {this, "CanvasWidth", 800}
 
Gaudi::Property< unsigned > m_canvasHeight {this, "CanvasHeight", 600}
 
Gaudi::Property< bool > m_displayOnlyTruth {this, "displayTruthOnly", false}
 
const MuonGMR4::MuonDetectorManagerm_detMgr {nullptr}
 pointer to the Detector manager More...
 
SG::ReadHandleKey< ActsGeometryContextm_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"}
 Geometry context key to retrieve the alignment. More...
 
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
 Service Handle to the IMuonIdHelperSvc. More...
 
std::unique_ptr< TCanvas > m_allCan ATLAS_THREAD_SAFE {}
 
std::unique_ptr< TFile > m_outFile ATLAS_THREAD_SAFE {}
 
std::atomic< unsigned int > m_canvCounter ATLAS_THREAD_SAFE {0}
 how many canvases have been visualized More...
 

Static Private Attributes

static std::mutex s_mutex {}
 

Detailed Description

Definition at line 29 of file PatternVisualizationTool.h.

Member Typedef Documentation

◆ SegLink_t

Definition at line 189 of file PatternVisualizationTool.h.

◆ SegLinkDecor_t

Definition at line 191 of file PatternVisualizationTool.h.

◆ SegLinkVec_t

Definition at line 190 of file PatternVisualizationTool.h.

◆ TruthSegmentSet

Definition at line 79 of file PatternVisualizationTool.h.

Constructor & Destructor Documentation

◆ PatternVisualizationTool()

MuonValR4::PatternVisualizationTool::PatternVisualizationTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 58 of file PatternVisualizationTool.cxx.

58  :
59  base_class{type,name,parent} {}

Member Function Documentation

◆ closeSummaryCanvas()

void MuonValR4::PatternVisualizationTool::closeSummaryCanvas ( ) const
private

Closes the summary canvas & closes the associated ROOT file.

Definition at line 639 of file PatternVisualizationTool.cxx.

639  {
640  if (!m_outFile) return;
641  ATH_MSG_INFO("Close summary pdf & root file "<<m_allCanName);
642  if (m_allCan) {
643  m_allCan->cd();
644  m_allCan->SaveAs((m_allCanName +".pdf]").c_str());
645  m_allCan.reset();
646  }
647  m_outFile.reset();
648  }

◆ drawHit() [1/2]

template<class SpacePointType >
const MuonR4::SpacePoint* MuonValR4::PatternVisualizationTool::drawHit ( const SpacePointType &  hit,
PrimitiveVec primitives,
std::array< double, 4 > &  canvasDim,
const unsigned int  view,
unsigned int  fillStyle 
) const
private

Converts a Hit into a particular TBox/ TEllipse for drawing.

If the hit provides information that's requested for that view. The underlying space pointer is returned and the dimensions of the canvas are updated, if the drawing was succesful

Parameters
hitReference to the hit to draw
primitivesVector into which the generated object is pushed
canvasDimArray encoding the canvas dimensions [0] -> low x; [1] -> high x, [2] -> low y, [3] -> high y
viewDraw the hit either in the eta or phi view,
fillStyleStandard fill style for the box e.g. full.

◆ drawHit() [2/2]

template<class SpacePointType >
const SpacePoint* MuonValR4::PatternVisualizationTool::drawHit ( const SpacePointType &  hit,
PrimitiveVec primitives,
std::array< double, 4 > &  canvasDim,
const unsigned int  view,
unsigned int  fillStyle 
) const

Don't draw any hit which is not participating in the view

Update the fill style accrodingly

Definition at line 450 of file PatternVisualizationTool.cxx.

452  {
453 
454  static_assert(std::is_same_v<SpacePointType, SpacePoint> ||
455  std::is_same_v<SpacePointType, CalibratedSpacePoint>, "Only usual & calibrated space points are supported");
457  if ((view == objViewEta && !hit.measuresEta()) || (view == objViewPhi && !hit.measuresPhi())) {
458  return nullptr;
459  }
460 
461  if (hit.type() != xAOD::UncalibMeasType::Other) {
462  canvasDim[Edges::yLow] = std::min(canvasDim[Edges::yLow], hit.positionInChamber()[view] - hit.driftRadius());
463  canvasDim[Edges::yHigh] = std::max(canvasDim[Edges::yHigh], hit.positionInChamber()[view] + hit.driftRadius());
464  canvasDim[Edges::zLow] = std::min(canvasDim[Edges::zLow], hit.positionInChamber().z() - hit.driftRadius());
465  canvasDim[Edges::zHigh] = std::max(canvasDim[Edges::zHigh], hit.positionInChamber().z() + hit.driftRadius());
466  }
467 
468  const SpacePoint* underlyingSp{nullptr};
470  constexpr int invalidCalibFill = 3305;
471  if constexpr (std::is_same_v<SpacePointType, SpacePoint>) {
472  underlyingSp = &hit;
473  if (hit.type() == xAOD::UncalibMeasType::MdtDriftCircleType) {
474  const auto* dc = static_cast<const xAOD::MdtDriftCircle*>(hit.primaryMeasurement());
476  fillStyle = invalidCalibFill;
477  }
478  }
479  } else if constexpr(std::is_same_v<SpacePointType, CalibratedSpacePoint>) {
480  underlyingSp = hit.spacePoint();
481  if (hit.fitState() == CalibratedSpacePoint::State::Valid) {
482  fillStyle = fullFilling;
483  } else if (hit.fitState() == CalibratedSpacePoint::State::FailedCalib) {
484  fillStyle = invalidCalibFill;
485  } else {
486  fillStyle = hatchedFilling;
487  }
488  }
489  switch(hit.type()) {
491  const auto* dc = static_cast<const xAOD::MdtDriftCircle*>(underlyingSp->primaryMeasurement());
492  primitives.push_back(drawDriftCircle(hit.positionInChamber(), dc->readoutElement()->innerTubeRadius(),
493  kBlack, hollowFilling));
494 
495  const int circColor = isTruthMatched(*dc) ? truthColor : kBlue;
496  primitives.push_back(drawDriftCircle(hit.positionInChamber(), hit.driftRadius(), circColor, fillStyle));
497  break;
499  const auto* meas{static_cast<const xAOD::RpcMeasurement*>(underlyingSp->primaryMeasurement())};
500  const int boxColor = isTruthMatched(*meas) ? truthColor : kGreen +2;
501  const double boxWidth = 0.5*std::sqrt(12)*underlyingSp->uncertainty()[view];
502  primitives.push_back(drawBox(hit.positionInChamber(), boxWidth, 0.5*meas->readoutElement()->gasGapPitch(),
503  boxColor, fillStyle));
504  break;
506  const auto* meas{static_cast<const xAOD::TgcStrip*>(underlyingSp->primaryMeasurement())};
507  const int boxColor = isTruthMatched(*meas) ? truthColor : kCyan + 2;
508  const double boxWidth = 0.5*std::sqrt(12)*underlyingSp->uncertainty()[view];
509  primitives.push_back(drawBox(hit.positionInChamber(), boxWidth, 0.5*meas->readoutElement()->gasGapPitch(),
510  boxColor, fillStyle));
511  break;
513  break;
514  } default:
515  ATH_MSG_WARNING("Please implement proper drawings of the new small wheel.. "<<__FILE__<<":"<<__LINE__);
516  break;
517  }
518  return underlyingSp;
519  }

◆ drawHits()

template<class SpacePointType >
bool MuonValR4::PatternVisualizationTool::drawHits ( const MuonR4::SpacePointBucket bucket,
const std::vector< SpacePointType > &  hitsToDraw,
PrimitiveVec primitivesToPush,
std::array< double, 4 > &  canvasDim,
unsigned int  view 
) const
private

Translates the Spacepoint information into TObjects that are dawn on the canvas & evaluates the size of the box surrounding the event.

Returns true if at least 2 objects were created.

Parameters
bucketSpacePoint bucket from which the hits are taken. If the <DisplayBucket> is set true, the hits that were not in the subset are also painted with hollow filling
hitsToDrawPrimary hit collection to draw which are drawn with fullFillStyle
primitivesToPushOutput vector into which the painting objects are pushed_back
canvasDimArray encoding the canvas dimensions [0] -> low x; [1] -> high x, [2] -> low y, [3] -> high y
viewEither the eta or the phi view?

Definition at line 522 of file PatternVisualizationTool.cxx.

526  {
527 
528  canvasDim[Edges::yLow] = canvasDim[Edges::zLow] = 100. *Gaudi::Units::m;
529  canvasDim[Edges::yHigh] = canvasDim[Edges::zHigh] = -100. *Gaudi::Units::m;
530 
531  SpacePointSet drawnPoints{};
532  for (const SpacePointType& hit : hitsToDraw) {
533  drawnPoints.insert(drawHit(*hit, primitives, canvasDim, view, fullFilling));
534  }
535  if (m_displayBucket) {
536  for (const SpacePointBucket::value_type& hit : bucket) {
537  // Don't redraw the other points
538  if (drawnPoints.count(hit.get())) {
539  continue;
540  }
541  drawHit(*hit, primitives, canvasDim, view, hollowFilling);
542  }
543  }
544  double width = (canvasDim[Edges::yHigh] - canvasDim[Edges::yLow])*m_canvasExtraScale;
545  double height = (canvasDim[Edges::zHigh] - canvasDim[Edges::zLow])*m_canvasExtraScale;
546  if (height > width) width = height;
547  else height = width;
548 
549  const double midPointX = 0.5 * (canvasDim[Edges::yHigh] + canvasDim[Edges::yLow]);
550  const double midPointY = 0.5 * (canvasDim[Edges::zHigh] + canvasDim[Edges::zLow]);
551  canvasDim[Edges::yLow] = midPointX - 0.5 * width;
552  canvasDim[Edges::zLow] = midPointY - 0.5 * height;
553  canvasDim[Edges::yHigh] = midPointX + 0.5 * width;
554  canvasDim[Edges::zHigh] = midPointY + 0.5 * height;
555  return drawnPoints.size() - drawnPoints.count(nullptr) > 1;
556  }

◆ fetchTruthSegs() [1/2]

TruthSegmentSet MuonValR4::PatternVisualizationTool::fetchTruthSegs ( const std::vector< const MuonR4::SpacePoint * > &  hits) const
finaloverridevirtual

Fetches all truth segments where at least one measurement in the list was used to build them.

Parameters
hitsVector of hits to search

Definition at line 113 of file PatternVisualizationTool.cxx.

113  {
114  std::vector<const xAOD::UncalibratedMeasurement*> measurements{};
115  measurements.reserve(2* hits.size());
116  for (const SpacePoint* hit: hits) {
117  measurements.push_back(hit->primaryMeasurement());
118  if(hit->secondaryMeasurement()) {
119  measurements.push_back(hit->secondaryMeasurement());
120  }
121  }
122  return fetchTruthSegs(measurements);
123  }

◆ fetchTruthSegs() [2/2]

TruthSegmentSet MuonValR4::PatternVisualizationTool::fetchTruthSegs ( const std::vector< const xAOD::UncalibratedMeasurement * > &  hits) const
finaloverridevirtual

Definition at line 124 of file PatternVisualizationTool.cxx.

124  {
125  TruthSegmentSet truthSegs{};
126  for (const xAOD::UncalibratedMeasurement* hit : hits) {
127  for (const SegLinkDecor_t& decor: m_truthLinkDecors) {
128  for (const SegLink_t& link : decor(*hit)) {
129  truthSegs.insert(*link);
130  }
131  }
132  }
133  return truthSegs;
134  }

◆ finalize()

StatusCode MuonValR4::PatternVisualizationTool::finalize ( )
finaloverridevirtual

Definition at line 98 of file PatternVisualizationTool.cxx.

98  {
100  return StatusCode::SUCCESS;
101  }

◆ initialize()

StatusCode MuonValR4::PatternVisualizationTool::initialize ( )
finaloverridevirtual

Definition at line 61 of file PatternVisualizationTool.cxx.

61  {
62  if (m_canvasLimit > 0) {
63  if (m_canvasPrefix.value().empty() || m_allCanName.value().empty()) {
64  ATH_MSG_FATAL("Please define "<<m_canvasPrefix<<" && "<<m_allCanName);
65  return StatusCode::FAILURE;
66  }
67  if (m_saveSummaryPDF) {
68  m_allCan = std::make_unique<TCanvas>("all", "all", m_canvasWidth, m_canvasHeight);
69  m_allCan->SaveAs((m_allCanName +".pdf[").c_str());
70  }
71  m_outFile = std::make_unique<TFile>( (m_allCanName +".root").c_str(), "RECREATE");
72  if (m_saveSinglePDFs) {
73  std::filesystem::create_directories("Plots/" + m_canvasPrefix);
74  }
75  }
76  ATH_CHECK(m_prepContainerKeys.initialize(!m_truthSegLinks.empty()));
77  m_truthLinkDecorKeys.clear();
78  ATH_MSG_INFO("Hits linked to the following segment decorations are considered as truth");
79  for (const std::string& decorName : m_truthSegLinks) {
80  ATH_MSG_INFO(" **** "<<decorName);
81  if (decorName.empty()) {
82  ATH_MSG_FATAL("Decoration must not be empty");
83  return StatusCode::FAILURE;
84  }
86  m_truthLinkDecorKeys.emplace_back(key, decorName);
87  m_truthLinkDecors.push_back(SegLinkDecor_t{decorName});
88  }
89  }
90  ATH_CHECK(m_truthLinkDecorKeys.initialize());
91  m_displayOnlyTruth.value() &= !m_truthLinkDecorKeys.empty();
92 
93  ATH_CHECK(m_idHelperSvc.retrieve());
96  return StatusCode::SUCCESS;
97  }

◆ isTruthMatched() [1/2]

bool MuonValR4::PatternVisualizationTool::isTruthMatched ( const MuonR4::SpacePoint hit) const
finaloverridevirtual

Returns whether the hit has been used in the truth-segment building.

Parameters
hitReference to the hit to check

Definition at line 102 of file PatternVisualizationTool.cxx.

102  {
103  return isTruthMatched(*hit.primaryMeasurement()) ||
105  }

◆ isTruthMatched() [2/2]

bool MuonValR4::PatternVisualizationTool::isTruthMatched ( const xAOD::UncalibratedMeasurement hit) const
finaloverridevirtual

Definition at line 106 of file PatternVisualizationTool.cxx.

106  {
107  return std::find_if(m_truthLinkDecors.begin(), m_truthLinkDecors.end(),
108  [&hit](const SegLinkDecor_t& decor){
109  return !decor(hit).empty();
110  }) != m_truthLinkDecors.end();
111  }

◆ makeCanvas()

std::unique_ptr< TCanvas > MuonValR4::PatternVisualizationTool::makeCanvas ( const EventContext &  ctx,
const std::array< double, 4 > &  canvasDim,
const int  view 
) const
private

Create a new Canvas & draw the underlying frame.

Parameters
ctxEventContext to generate a unique canvas name
canvasDimArray encoding the canvas dimensions [0] -> low x; [1] -> high x, [2] -> low y, [3] -> high y
viewIs the canvas created in the context of an eta or phi visualization view The x-axis of the frame is adapted accordingly

Definition at line 649 of file PatternVisualizationTool.cxx.

651  {
652  std::stringstream canvasName{};
653  canvasName<<name()<<"_"<<ctx.eventID().event_number()<<"_"<<m_canvCounter;
654  ATH_MSG_VERBOSE("Create new canvas "<<canvasName.str()<<" "<<canvasDim);
655  auto canvas = std::make_unique<TCanvas>(canvasName.str().c_str(), "all", m_canvasWidth, m_canvasHeight);
656  canvas->cd();
657  TH1F* frame = canvas->DrawFrame(canvasDim[Edges::yLow],canvasDim[Edges::zLow], canvasDim[Edges::yHigh], canvasDim[Edges::zHigh]);
658  frame->GetXaxis()->SetTitle(std::format("{:} [mm]", view == objViewEta ? 'y' : 'x').c_str());
659  frame->GetYaxis()->SetTitle("z [mm]");
660  return canvas;
661  }

◆ saveCanvas()

void MuonValR4::PatternVisualizationTool::saveCanvas ( const EventContext &  ctx,
const Identifier chambId,
TCanvas &  canvas,
const std::string &  extraLabel 
) const
private

Saves the Canvas as pdf & also into the ROOT file.

If the canvase limit is reached, then the summary files are closed as well.

Parameters
ctxEventContext to fetch the event number
chambIdIdentifier of the chamber from which the hits are stemming from
primtivesList of objects to draw onto the canvas
extraLabelExternally passed extra label

Definition at line 662 of file PatternVisualizationTool.cxx.

665  {
666  // If an eta view closes the summary canvas & a phi view is processed
667  std::stringstream canvasName{};
668  canvasName<<m_canvasPrefix.value()<<"_"<<ctx.eventID().event_number()<<"_"<<(m_canvCounter++)<<"_"
669  <<m_idHelperSvc->stationNameString(chambId)
670  <<std::abs(m_idHelperSvc->stationEta(chambId))
671  <<(m_idHelperSvc->stationEta(chambId) >0 ? "A" : "C")
672  <<m_idHelperSvc->stationPhi(chambId);
673  if (!extraLabel.empty()) canvasName<<"_"<<removeNonAlphaNum(extraLabel);
674  ATH_MSG_VERBOSE("Save new plot "<<canvasName.str());
675  if (m_saveSinglePDFs) {
676  canvas.SaveAs(("Plots/" + m_canvasPrefix+"/" + canvasName.str()+".pdf").c_str());
677  }
678  if (m_saveSummaryPDF) {
679  canvas.SaveAs((m_allCanName+".pdf").c_str());
680  }
681  m_outFile->WriteObject(&canvas, canvasName.str().c_str());
682  }

◆ visualizeAccumulator() [1/2]

void MuonValR4::PatternVisualizationTool::visualizeAccumulator ( const EventContext &  ctx,
const MuonR4::HoughPlane accumulator,
const Acts::HoughTransformUtils::HoughAxisRanges &  axisRanges,
const MaximumVec &  maxima,
const std::string &  extraLabel 
) const
finaloverridevirtual

Definition at line 135 of file PatternVisualizationTool.cxx.

139  {
140  PrimitiveVec primitives{};
141  visualizeAccumulator(ctx, accumulator, axisRanges, maxima, extraLabel, std::move(primitives));
142  }

◆ visualizeAccumulator() [2/2]

void MuonValR4::PatternVisualizationTool::visualizeAccumulator ( const EventContext &  ctx,
const MuonR4::HoughPlane accumulator,
const Acts::HoughTransformUtils::HoughAxisRanges &  axisRanges,
const MaximumVec &  maxima,
const std::string &  extraLabel,
PrimitiveVec &&  extraPaints 
) const
finaloverridevirtual

Check whether the canvas limit has been reached

Enter the lock phase

Check again in case multiple threads are simultaneously in the lock phase

Definition at line 143 of file PatternVisualizationTool.cxx.

148  {
149 
151  if (m_canvCounter >= m_canvasLimit) {
152  return;
153  }
155  std::lock_guard guard{s_mutex};
157  if (m_canvCounter >= m_canvasLimit) {
158  return;
159  }
160  if (accumulator.getNonEmptyBins().empty()) {
161  ATH_MSG_WARNING("Hough accumulator is empty");
162  return;
163  }
164 
165  auto accHisto = std::make_unique<TH2F>("AccumulatorHisto", "histo",
166  accumulator.nBinsX(), axisRanges.xMin, axisRanges.xMax,
167  accumulator.nBinsY(), axisRanges.yMin, axisRanges.yMax);
168 
169  accHisto->SetDirectory(nullptr);
170  accHisto->GetXaxis()->SetTitle(std::format("tan #{}", m_accumlIsEta ? "theta" : "phi" ).c_str());
171  accHisto->GetYaxis()->SetTitle( std::string{m_accumlIsEta ? "y_{0}" : "x_{0}"}.c_str());
172 
173  std::vector<const SpacePoint*> spacePointsInAcc{};
174  for (const std::size_t bin : accumulator.getNonEmptyBins()) {
175  const auto [xBin, yBin] = accumulator.axisBins(bin);
176  const SpacePointSet& hitsInBin{accumulator.hitIds(xBin, yBin)};
177  spacePointsInAcc.insert(spacePointsInAcc.end(),hitsInBin.begin(), hitsInBin.end());
178  accHisto->SetBinContent(xBin+1, yBin+1, accumulator.nHits(bin));
179  }
180 
181  const TruthSegmentSet truthSegs{fetchTruthSegs(spacePointsInAcc)};
182  if (truthSegs.empty() && m_displayOnlyTruth) {
183  return;
184  }
185  for (const xAOD::MuonSegment* segment : truthSegs) {
186  const auto [pos, dir] = makeLine(localSegmentPars(*segment));
187  const double tan = m_accumlIsEta ? houghTanTheta(dir) : houghTanPhi(dir);
188  const double icept = pos[m_accumlIsEta ? objViewEta : objViewPhi];
189  auto truthMarker = std::make_unique<TMarker>(tan, icept, kFullCrossX);
190  truthMarker->SetMarkerColor(truthColor);
191  truthMarker->SetMarkerSize(8);
192  primitives.push_back(std::move(truthMarker));
193  }
194  for (const auto& maximum : maxima) {
195  auto maxMarker = std::make_unique<TMarker>(maximum.x, maximum.y, kFullTriangleUp);
196  maxMarker->SetMarkerColor(parLineColor);
197  maxMarker->SetMarkerSize(8);
198  primitives.push_back(std::move(maxMarker));
199  }
200 
201  std::stringstream canvasName{};
202  canvasName<<name()<<"_"<<ctx.eventID().event_number()<<"_"<<m_canvCounter;
203  auto canvas = std::make_unique<TCanvas>(canvasName.str().c_str(),
204  "can", m_canvasWidth, m_canvasHeight);
205  canvas->cd();
206  accHisto->Draw("COLZ");
207  for (auto& prim : primitives) {
208  prim->Draw();
209  }
210  primitives.push_back(std::move(accHisto));
211  saveCanvas(ctx, spacePointsInAcc.front()->identify(), *canvas, extraLabel);
212  primitives.push_back(std::move(canvas));
213 
214  primitives.clear();
215  if (m_canvasLimit <= m_canvCounter) {
217  }
218  }

◆ visualizeBucket() [1/2]

void MuonValR4::PatternVisualizationTool::visualizeBucket ( const EventContext &  ctx,
const MuonR4::SpacePointBucket bucket,
const std::string &  extraLabel 
) const
finaloverridevirtual

Definition at line 295 of file PatternVisualizationTool.cxx.

297  {
298  PrimitiveVec primitives{};
299  visualizeBucket(ctx, bucket, extraLabel, std::move(primitives));
300  }

◆ visualizeBucket() [2/2]

void MuonValR4::PatternVisualizationTool::visualizeBucket ( const EventContext &  ctx,
const MuonR4::SpacePointBucket bucket,
const std::string &  extraLabel,
PrimitiveVec &&  extraPaints 
) const
finaloverridevirtual

Check whether the canvas limit has been reached

Enter the lock phase

Check again in case multiple threads are simultaneously in the lock phase

reset the primitives

Definition at line 301 of file PatternVisualizationTool.cxx.

304  {
306  if (m_canvCounter >= m_canvasLimit) {
307  return;
308  }
310  std::lock_guard guard{s_mutex};
312  if (m_canvCounter >= m_canvasLimit) {
313  return;
314  }
315  std::array<double, 4> canvasDim{};
316  TruthSegmentSet truthSegs{fetchTruthSegs(stripSmartPtr(bucket))};
317  if (truthSegs.empty() && m_displayOnlyTruth) {
318  return;
319  }
320  const std::size_t parsedPrimSize{primitives.size()};
321  for (const int view : {objViewEta, objViewPhi}) {
322  if ((view == objViewEta && !m_doEtaBucketViews) ||
324  continue;
325  }
327  primitives.resize(parsedPrimSize);
328  if (!drawHits(bucket, bucket, primitives, canvasDim, view)) {
329  continue;
330  }
331  bool drawnTrueLabel{false};
332  for (const xAOD::MuonSegment* segment : truthSegs) {
333  primitives.push_back(drawLine(localSegmentPars(*segment), canvasDim[Edges::zLow], canvasDim[Edges::zHigh],
334  truthColor, kDotted, view));
335  if (!drawnTrueLabel) {
336  primitives.push_back(drawLabel(std::format("true parameters: {:}",makeLabel(localSegmentPars(*segment))),0.2, 0.91,14));
337  drawnTrueLabel = true;
338  }
339  }
340 
341  std::stringstream legendLabel{};
342  legendLabel<<"Event: "<<ctx.eventID().event_number()
343  <<", chamber : "<<m_idHelperSvc->toStringChamber(bucket.front()->identify())
344  <<",#"<<(view ==objViewEta ? "eta" : "phi")<<"-view";
345  if (!extraLabel.empty()) {
346  legendLabel<<" ("<<extraLabel<<")";
347  }
348  primitives.push_back(drawLabel(legendLabel.str(), 0.2, 0.96));
349  auto can = makeCanvas(ctx , canvasDim, view);
350  for (PrimitivePtr& prim : primitives) {
351  prim->Draw();
352  }
353  saveCanvas(ctx, bucket.front()->identify(), *can, extraLabel);
354  }
355  if (m_canvasLimit <= m_canvCounter) {
356  primitives.clear();
358  }
359 
360  }

◆ visualizeSeed() [1/2]

void MuonValR4::PatternVisualizationTool::visualizeSeed ( const EventContext &  ctx,
const MuonR4::SegmentSeed seed,
const std::string &  extraLabel 
) const
finaloverridevirtual

Definition at line 220 of file PatternVisualizationTool.cxx.

222  {
223  PrimitiveVec primitives{};
224  visualizeSeed(ctx, seed, extraLabel, std::move(primitives));
225  }

◆ visualizeSeed() [2/2]

void MuonValR4::PatternVisualizationTool::visualizeSeed ( const EventContext &  ctx,
const MuonR4::SegmentSeed seed,
const std::string &  extraLabel,
PrimitiveVec &&  extraPaints 
) const
finaloverridevirtual

Check whether the canvas limit has been reached

Enter the lock phase

Check again in case multiple threads are simultaneously in the lock phase

reset the primitives

Definition at line 226 of file PatternVisualizationTool.cxx.

229  {
230 
232  if (m_canvCounter >= m_canvasLimit) {
233  return;
234  }
236  std::lock_guard guard{s_mutex};
238  if (m_canvCounter >= m_canvasLimit) {
239  return;
240  }
241 
242  const TruthSegmentSet truthSegs{fetchTruthSegs(seed.getHitsInMax())};
243  if (truthSegs.empty() && m_displayOnlyTruth) {
244  return;
245  }
246 
247  std::array<double, 4> canvasDim{};
248  const std::size_t parsedPrimSize{primitives.size()};
249  for (const int view : {objViewEta, objViewPhi}) {
250  if ((view == objViewEta && !m_doEtaBucketViews) ||
252  continue;
253  }
255  primitives.resize(parsedPrimSize);
256 
257  if (!drawHits(*seed.parentBucket(), seed.getHitsInMax(), primitives, canvasDim, view)) {
258  continue;
259  }
260 
261  for (const xAOD::MuonSegment* segment : truthSegs) {
262  primitives.push_back(drawLine(localSegmentPars(*segment), canvasDim[Edges::zLow], canvasDim[Edges::zHigh],
263  truthColor, kDotted, view));
264  }
265  primitives.push_back(drawLine(seed.parameters(), canvasDim[Edges::zLow], canvasDim[Edges::zHigh],
266  parLineColor, kDashed, view));
267 
268  writeChi2(seed.parameters(), seed.getHitsInMax(), primitives);
269 
270  std::stringstream legendLabel{};
271  double chi2{0.};
272  unsigned nDoF{0};
273  legendLabel<<"Event: "<<ctx.eventID().event_number()<<", chamber : "<<m_idHelperSvc->toStringChamber(seed.getHitsInMax().front()->identify())
274  <<" #chi^{2} /nDoF: "<<std::format("{:.2f}", chi2/std::max(1u, nDoF))
275  <<", nDoF: "<<nDoF<<", #"<<(view ==objViewEta ? "eta" : "phi")<<"-view";;
276 
277  if (!extraLabel.empty()) {
278  legendLabel<<" ("<<extraLabel<<")";
279  }
280  primitives.push_back(drawLabel(legendLabel.str(), 0.1, 0.96));
281  primitives.push_back(drawLabel(makeLabel(seed.parameters()),0.25, 0.91));
282 
283  auto canvas = makeCanvas(ctx, canvasDim, view);
284  for (PrimitivePtr& prim : primitives) {
285  prim->Draw();
286  }
287  saveCanvas(ctx, seed.getHitsInMax().front()->identify(), *canvas, extraLabel);
288  }
289  if (m_canvasLimit <= m_canvCounter) {
290  primitives.clear();
292  }
293  }

◆ visualizeSegment() [1/2]

void MuonValR4::PatternVisualizationTool::visualizeSegment ( const EventContext &  ctx,
const MuonR4::Segment segment,
const std::string &  extraLabel 
) const
finaloverridevirtual

Definition at line 362 of file PatternVisualizationTool.cxx.

364  {
365  PrimitiveVec primitives{};
366  visualizeSegment(ctx, segment,extraLabel, std::move(primitives));
367  }

◆ visualizeSegment() [2/2]

void MuonValR4::PatternVisualizationTool::visualizeSegment ( const EventContext &  ctx,
const MuonR4::Segment segment,
const std::string &  extraLabel,
PrimitiveVec &&  extraPaints 
) const
finaloverridevirtual

Check whether the canvas limit has been reached

Enter the lock phase

Check again in case multiple threads are simultaneously in the lock phase

reset the primitives

Definition at line 369 of file PatternVisualizationTool.cxx.

372  {
374  if (m_canvCounter >= m_canvasLimit) {
375  return;
376  }
378  std::lock_guard guard{s_mutex};
380  if (m_canvCounter >= m_canvasLimit) {
381  return;
382  }
383  const TruthSegmentSet truthSegs{fetchTruthSegs(segment.parent()->getHitsInMax())};
384  if (truthSegs.empty() && m_displayOnlyTruth) {
385  return;
386  }
387  Parameters segPars{};
388  {
389  SG::ReadHandle geoCtx{m_geoCtxKey, ctx};
390  const Amg::Transform3D trf{segment.msSector()->globalToLocalTrans(*geoCtx)};
391  const Amg::Vector3D locPos = trf * segment.position();
392  const Amg::Vector3D locDir = trf.linear() * segment.direction();
393  segPars[toInt(ParamDefs::x0)] = locPos.x();
394  segPars[toInt(ParamDefs::y0)] = locPos.y();
395  segPars[toInt(ParamDefs::theta)] = locDir.theta();
396  segPars[toInt(ParamDefs::phi)] = locDir.phi();
397  segPars[toInt(ParamDefs::time)] = segment.segementT0();
398  }
399 
400  std::array<double, 4> canvasDim{};
401  const std::size_t parsedPrimSize{primitives.size()};
402  for (const int view : {objViewEta, objViewPhi}) {
403  if ((view == objViewEta && !m_doEtaBucketViews) ||
405  continue;
406  }
408  primitives.resize(parsedPrimSize);
409 
410  if (!drawHits(*segment.parent()->parentBucket(), segment.measurements(),
411  primitives, canvasDim, view)) {
412  continue;
413  }
414  for (const xAOD::MuonSegment* segment : truthSegs) {
415  primitives.push_back(drawLine(localSegmentPars(*segment), canvasDim[Edges::zLow], canvasDim[Edges::zHigh],
416  truthColor, kDotted, view));
417  }
418  writeChi2(segPars, segment.measurements(), primitives);
419 
420  primitives.push_back(drawLine(segPars, canvasDim[Edges::zLow], canvasDim[Edges::zHigh],
421  parLineColor, kDashed, view));
422 
423 
424  std::stringstream legendLabel{};
425  const Identifier canvasId{segment.parent()->getHitsInMax().front()->identify()};
426  legendLabel<<"Event: "<<ctx.eventID().event_number() <<", chamber : "<<m_idHelperSvc->toStringChamber(canvasId)
427  <<", #chi^{2} /nDoF: "<<std::format("{:.2f} ({:d})", segment.chi2() /std::max(1u, segment.nDoF()), segment.nDoF())
428  <<", #"<<(view ==objViewEta ? "eta" : "phi")<<"-view";
429 
430  if (!extraLabel.empty()) {
431  legendLabel<<" ("<<extraLabel<<")";
432  }
433  primitives.push_back(drawLabel(legendLabel.str(), 0.1, 0.96));
434  primitives.push_back(drawLabel(makeLabel(segPars),0.25, 0.91));
435 
436  auto canvas = makeCanvas(ctx, canvasDim, view);
437  for (PrimitivePtr& prim : primitives) {
438  prim->Draw();
439  }
440  saveCanvas(ctx, canvasId, *canvas, extraLabel);
441  }
442  if (m_canvasLimit <= m_canvCounter) {
443  primitives.clear();
445  }
446  }

◆ writeChi2()

template<class SpacePointType >
void MuonValR4::PatternVisualizationTool::writeChi2 ( const MuonR4::SegmentFit::Parameters pars,
const std::vector< SpacePointType > &  hits,
PrimitiveVec primitivesToPush,
const double  legX = 0.15,
double  startLegY = 0.8,
const double  endLegY = 0.3 
) const
private

Writes the chi2 of the hits onto the Canvas.

Parameters
parsParameter for which the chi2 is evaluated,
hitsVector of hits to consider
primitivesToPushOutput vector into which the TLabels are pushed for later drawing
legXx-position of the list
statLegYy-position of the first entry. The next one is 0.05 apart
endLegy-position of the last shown entry. The routine aborts if there're more hits in the event.

Definition at line 558 of file PatternVisualizationTool.cxx.

562  {
563 
564  const auto [locPos, locDir] = makeLine(pars);
565  for (const SpacePointType& hit : hits) {
566  const SpacePoint* underlyingSp{nullptr};
567  double chi2{0.};
568  if constexpr( std::is_same_v<SpacePointType, Segment::MeasType>) {
569  underlyingSp = hit->spacePoint();
571  std::nullopt, *hit, msgStream());
572  } else {
573  underlyingSp = hit;
574  chi2 = SegmentFitHelpers::chiSqTerm(locPos, locDir, *hit, msgStream());
575  }
576 
577  const Identifier hitId = underlyingSp ? underlyingSp->identify(): Identifier{};
578  std::stringstream legendstream{};
579  switch(hit->type()) {
581  const int driftSign{SegmentFitHelpers::driftSign(locPos, locDir, *hit, msgStream())};
582  const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
583  legendstream<<"ML: "<<idHelper.multilayer(hitId);
584  legendstream<<", TL: "<<idHelper.tubeLayer(hitId);
585  legendstream<<", T: "<<idHelper.tube(hitId);
586  legendstream<<", "<<(driftSign == -1 ? "L" : "R");
587  break;
589  const RpcIdHelper& idHelper{m_idHelperSvc->rpcIdHelper()};
590  legendstream<<"DR: "<<idHelper.doubletR(hitId);
591  legendstream<<" DZ: "<<idHelper.doubletZ(hitId);
592  legendstream<<", GAP: "<<idHelper.gasGap(hitId);
593  legendstream<<", #eta/#phi: "<<(hit->measuresEta() ? "si" : "nay")
594  << "/"<<(hit->measuresPhi() ? "si" : "nay");
595  break;
597  const TgcIdHelper& idHelper{m_idHelperSvc->tgcIdHelper()};
598  legendstream<<"ST: "<<m_idHelperSvc->stationNameString(hitId);
599  legendstream<<", GAP: "<<idHelper.gasGap(hitId);
600  legendstream<<", #eta/#phi: "<<(hit->measuresEta() ? "si" : "nay")
601  << "/"<<(hit->measuresPhi() ? "si" : "nay");
602  break;
604  const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
605  legendstream<<"ML: "<<idHelper.multilayer(hitId);
606  legendstream<<", GAP: "<<idHelper.gasGap(hitId);
607  legendstream<<", stereo: "<<(idHelper.isStereo(hitId)? "si" : "nay");
608  break;
610  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
611  legendstream<<"ML: "<<idHelper.multilayer(hitId);
612  legendstream<<", GAP: "<<idHelper.gasGap(hitId);
613  switch (idHelper.channelType(hitId)) {
614  case sTgcIdHelper::sTgcChannelTypes::Strip:
615  legendstream<<", strip";
616  break;
617  case sTgcIdHelper::sTgcChannelTypes::Wire:
618  legendstream<<", wire";
619  break;
620  case sTgcIdHelper::sTgcChannelTypes::Pad:
621  legendstream<<", pad";
622  break;
623  default:
624  break;
625  }
626  break;
627  }
628  default:
629  break;
630  }
631  legendstream<<", #chi^{2}: "<<std::format("{:.2f}", chi2);
632  primitives.push_back(drawLabel(legendstream.str(), legX, startLegY, 14));
633  startLegY -= 0.05;
634  if (startLegY<= endLegY) {
635  break;
636  }
637  }
638  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/3]

std::unique_ptr<TCanvas> m_allCan MuonValR4::PatternVisualizationTool::ATLAS_THREAD_SAFE {}
mutableprivate

Definition at line 208 of file PatternVisualizationTool.h.

◆ ATLAS_THREAD_SAFE [2/3]

std::unique_ptr<TFile> m_outFile MuonValR4::PatternVisualizationTool::ATLAS_THREAD_SAFE {}
mutableprivate

Definition at line 209 of file PatternVisualizationTool.h.

◆ ATLAS_THREAD_SAFE [3/3]

std::atomic<unsigned int> m_canvCounter MuonValR4::PatternVisualizationTool::ATLAS_THREAD_SAFE {0}
mutableprivate

how many canvases have been visualized

Definition at line 211 of file PatternVisualizationTool.h.

◆ m_accumlIsEta

Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_accumlIsEta {this, "AccumulatorsInEtaPlane", true}
private

Swtich toggling whether the accumulator view are in the eta or phi plane.

Just affects the axis labels

Definition at line 178 of file PatternVisualizationTool.h.

◆ m_allCanName

Gaudi::Property<std::string> MuonValR4::PatternVisualizationTool::m_allCanName {this, "AllCanvasName", "AllPatternPlots"}
private

Name of the summary canvas & the ROOT file to save the monitoring plots.

Definition at line 169 of file PatternVisualizationTool.h.

◆ m_canvasExtraScale

Gaudi::Property<double> MuonValR4::PatternVisualizationTool::m_canvasExtraScale {this, "CanvasExtraScale" , 1.3}
private

Extra safety margin to zoom out from the Canvas.

Definition at line 175 of file PatternVisualizationTool.h.

◆ m_canvasHeight

Gaudi::Property<unsigned> MuonValR4::PatternVisualizationTool::m_canvasHeight {this, "CanvasHeight", 600}
private

Definition at line 195 of file PatternVisualizationTool.h.

◆ m_canvasLimit

Gaudi::Property<unsigned int> MuonValR4::PatternVisualizationTool::m_canvasLimit {this, "CanvasLimits", 5000}
private

Maximum canvases to draw.

Definition at line 162 of file PatternVisualizationTool.h.

◆ m_canvasPrefix

Gaudi::Property<std::string> MuonValR4::PatternVisualizationTool::m_canvasPrefix {this, "CanvasPreFix", ""}
private

Prefix of the individual canvas file names <MANDATORY>

Definition at line 171 of file PatternVisualizationTool.h.

◆ m_canvasWidth

Gaudi::Property<unsigned> MuonValR4::PatternVisualizationTool::m_canvasWidth {this, "CanvasWidth", 800}
private

Definition at line 194 of file PatternVisualizationTool.h.

◆ m_detMgr

const MuonGMR4::MuonDetectorManager* MuonValR4::PatternVisualizationTool::m_detMgr {nullptr}
private

pointer to the Detector manager

Definition at line 201 of file PatternVisualizationTool.h.

◆ m_displayBucket

Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_displayBucket {this, "displayBucket", true}
private

Display the surrounding hits from the bucket not part of the seed.

Definition at line 173 of file PatternVisualizationTool.h.

◆ m_displayOnlyTruth

Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_displayOnlyTruth {this, "displayTruthOnly", false}
private

Definition at line 197 of file PatternVisualizationTool.h.

◆ m_doEtaBucketViews

Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_doEtaBucketViews {this,"doEtaBucketViews", true}
private

Switch to visualize the eta view of the bucket event.

Definition at line 180 of file PatternVisualizationTool.h.

◆ m_doPhiBucketViews

Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_doPhiBucketViews {this,"doPhiBucketViews", true}
private

Switch to visualize the phi view of the bucket event.

Definition at line 182 of file PatternVisualizationTool.h.

◆ m_geoCtxKey

SG::ReadHandleKey<ActsGeometryContext> MuonValR4::PatternVisualizationTool::m_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"}
private

Geometry context key to retrieve the alignment.

Definition at line 203 of file PatternVisualizationTool.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonValR4::PatternVisualizationTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Service Handle to the IMuonIdHelperSvc.

Definition at line 205 of file PatternVisualizationTool.h.

◆ m_prepContainerKeys

SG::ReadHandleKeyArray<xAOD::UncalibratedMeasurementContainer> MuonValR4::PatternVisualizationTool::m_prepContainerKeys {this, "PrdContainer", {}}
private

Declare dependency on the prep data containers.

Definition at line 184 of file PatternVisualizationTool.h.

◆ m_saveSinglePDFs

Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_saveSinglePDFs {this, "saveSinglePDFs", false}
private

If set to true each canvas is saved into a dedicated pdf file.

Definition at line 164 of file PatternVisualizationTool.h.

◆ m_saveSummaryPDF

Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_saveSummaryPDF {this, "saveSummaryPDF", false}
private

If set to true a summary Canvas is created.

ATTENTION: There can be only one summary PDF in an athena job

Definition at line 167 of file PatternVisualizationTool.h.

◆ m_truthLinkDecorKeys

SG::ReadDecorHandleKeyArray<xAOD::UncalibratedMeasurementContainer> MuonValR4::PatternVisualizationTool::m_truthLinkDecorKeys {this, "LinkDecorKeys", {}}
private

Declaration of the dependency on the decorations.

(Overwritten in initialize)

Definition at line 188 of file PatternVisualizationTool.h.

◆ m_truthLinkDecors

std::vector<SegLinkDecor_t> MuonValR4::PatternVisualizationTool::m_truthLinkDecors {}
private

Definition at line 192 of file PatternVisualizationTool.h.

◆ m_truthSegLinks

Gaudi::Property<std::set<std::string> > MuonValR4::PatternVisualizationTool::m_truthSegLinks {this, "TruthSegDecors", {}}
private

List of truth segment links to fetch.

Definition at line 186 of file PatternVisualizationTool.h.

◆ s_mutex

std::mutex MuonValR4::PatternVisualizationTool::s_mutex {}
staticprivate

Definition at line 207 of file PatternVisualizationTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
MuonValR4::PatternVisualizationTool::m_detMgr
const MuonGMR4::MuonDetectorManager * m_detMgr
pointer to the Detector manager
Definition: PatternVisualizationTool.h:201
MuonValR4::fullFilling
constexpr int fullFilling
Definition: VisualizationHelpers.h:20
MuonR4::PrimitiveVec
MuonValR4::IPatternVisualizationTool::PrimitiveVec PrimitiveVec
Definition: SegmentFittingAlg.cxx:60
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
xAOD::RpcMeasurement_v1
RpcMeasurement_v1: Class storing the geneic.
Definition: RpcMeasurement_v1.h:21
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonValR4::PatternVisualizationTool::m_canvasWidth
Gaudi::Property< unsigned > m_canvasWidth
Definition: PatternVisualizationTool.h:194
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
max
#define max(a, b)
Definition: cfImp.cxx:41
MuonR4::SegmentFit::Parameters
AmgVector(toInt(ParamDefs::nPars)) Parameters
Definition: MuonHoughDefs.h:48
vtune_athena.format
format
Definition: vtune_athena.py:14
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
MuonValR4::PatternVisualizationTool::SegLinkDecor_t
SG::AuxElement::ConstAccessor< SegLinkVec_t > SegLinkDecor_t
Definition: PatternVisualizationTool.h:191
MuonValR4::PatternVisualizationTool::s_mutex
static std::mutex s_mutex
Definition: PatternVisualizationTool.h:207
MuonValR4::PatternVisualizationTool::isTruthMatched
virtual bool isTruthMatched(const MuonR4::SpacePoint &hit) const override final
Returns whether the hit has been used in the truth-segment building.
Definition: PatternVisualizationTool.cxx:102
MuonValR4::PatternVisualizationTool::m_geoCtxKey
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
Geometry context key to retrieve the alignment.
Definition: PatternVisualizationTool.h:203
TgcIdHelper
Definition: TgcIdHelper.h:50
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MuonValR4::PatternVisualizationTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Service Handle to the IMuonIdHelperSvc.
Definition: PatternVisualizationTool.h:205
MuonValR4::PatternVisualizationTool::m_canvasPrefix
Gaudi::Property< std::string > m_canvasPrefix
Prefix of the individual canvas file names <MANDATORY>
Definition: PatternVisualizationTool.h:171
xAOD::TgcStrip_v1
Definition: TgcStrip_v1.h:19
MuonValR4::PatternVisualizationTool::TruthSegmentSet
std::unordered_set< const xAOD::MuonSegment * > TruthSegmentSet
Definition: PatternVisualizationTool.h:79
xAOD::UncalibMeasType::MMClusterType
@ MMClusterType
bin
Definition: BinsDiffFromStripMedian.h:43
MuonValR4::drawBox
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.
Definition: VisualizationHelpers.cxx:31
MuonValR4::PatternVisualizationTool::visualizeSegment
virtual void visualizeSegment(const EventContext &ctx, const MuonR4::Segment &segment, const std::string &extraLabel) const override final
Definition: PatternVisualizationTool.cxx:362
MuonValR4::PatternVisualizationTool::writeChi2
void writeChi2(const MuonR4::SegmentFit::Parameters &pars, const std::vector< SpacePointType > &hits, PrimitiveVec &primitivesToPush, const double legX=0.15, double startLegY=0.8, const double endLegY=0.3) const
Writes the chi2 of the hits onto the Canvas.
Definition: PatternVisualizationTool.cxx:558
xAOD::MuonSegment_v1
Class describing a MuonSegment.
Definition: MuonSegment_v1.h:33
MuonValR4::PatternVisualizationTool::saveCanvas
void saveCanvas(const EventContext &ctx, const Identifier &chambId, TCanvas &canvas, const std::string &extraLabel) const
Saves the Canvas as pdf & also into the ROOT file.
Definition: PatternVisualizationTool.cxx:662
MuonValR4::drawLine
std::unique_ptr< TLine > drawLine(const MuonR4::SegmentFit::Parameters &pars, const double lowEnd, const double highEnd, const int color=kRed+1, const int lineStyle=kDashed, const int view=objViewEta)
Definition: VisualizationHelpers.cxx:43
MuonR4::SpacePoint::secondaryMeasurement
const xAOD::UncalibratedMeasurement * secondaryMeasurement() const
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/SpacePoint.cxx:110
MuonR4::stripSmartPtr
HitVec stripSmartPtr(const SpacePointBucket &bucket)
Definition: SpacePointPerLayerSorter.cxx:10
MuonValR4::PatternVisualizationTool::fetchTruthSegs
virtual TruthSegmentSet fetchTruthSegs(const std::vector< const MuonR4::SpacePoint * > &hits) const override final
Fetches all truth segments where at least one measurement in the list was used to build them.
Definition: PatternVisualizationTool.cxx:113
MuonValR4::PatternVisualizationTool::makeCanvas
std::unique_ptr< TCanvas > makeCanvas(const EventContext &ctx, const std::array< double, 4 > &canvasDim, const int view) const
Create a new Canvas & draw the underlying frame.
Definition: PatternVisualizationTool.cxx:649
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::ReadHandleKey< xAOD::UncalibratedMeasurementContainer >
MuonValR4::PatternVisualizationTool::m_truthLinkDecorKeys
SG::ReadDecorHandleKeyArray< xAOD::UncalibratedMeasurementContainer > m_truthLinkDecorKeys
Declaration of the dependency on the decorations.
Definition: PatternVisualizationTool.h:188
xAOD::UncalibMeasType::sTgcStripType
@ sTgcStripType
MuonR4::SegmentFitHelpers::chiSqTerm
double chiSqTerm(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const SpacePoint &measurement, MsgStream &msg)
Calculates the chi2 contribuation to a linear segment line from an uncalibrated measurement.
Definition: SegmentFitHelperFunctions.cxx:27
MuonR4::SegmentFit::makeLine
std::pair< Amg::Vector3D, Amg::Vector3D > makeLine(const Parameters &pars)
Returns the parsed parameters into an Eigen line parametrization.
Definition: SegmentFitterEventData.cxx:30
MuonValR4::drawLabel
std::unique_ptr< TLatex > drawLabel(const std::string &text, const double xPos, const double yPos, const unsigned int fontSize=18)
Create a TLatex label,.
Definition: VisualizationHelpers.cxx:22
MuonValR4::PatternVisualizationTool::m_prepContainerKeys
SG::ReadHandleKeyArray< xAOD::UncalibratedMeasurementContainer > m_prepContainerKeys
Declare dependency on the prep data containers.
Definition: PatternVisualizationTool.h:184
RpcIdHelper
Definition: RpcIdHelper.h:51
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
MuonValR4::PatternVisualizationTool::m_displayOnlyTruth
Gaudi::Property< bool > m_displayOnlyTruth
Definition: PatternVisualizationTool.h:197
Muon::MdtStatusDriftTime
@ MdtStatusDriftTime
The tube produced a vaild measurement.
Definition: MdtDriftCircleStatus.h:34
MuonValR4::PatternVisualizationTool::m_canvasExtraScale
Gaudi::Property< double > m_canvasExtraScale
Extra safety margin to zoom out from the Canvas.
Definition: PatternVisualizationTool.h:175
MuonR4::SegmentFit::ParamDefs::phi
@ phi
xAOD::UncalibMeasType::TgcStripType
@ TgcStripType
MuonR4::SpacePoint::primaryMeasurement
const xAOD::UncalibratedMeasurement * primaryMeasurement() const
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/SpacePoint.cxx:107
MuonR4::houghTanPhi
double houghTanPhi(const Amg::Vector3D &v)
: Returns the hough tanPhi [x] / [z]
Definition: SegmentFitterEventData.cxx:18
MuonR4::SegmentFitHelpers::driftSign
int driftSign(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const SpacePoint &uncalibHit, MsgStream &msg)
Calculates whether a segement line travereses the tube measurement on the left (-1) or right (1) side...
Definition: SegmentFitHelperFunctions.cxx:221
MuonR4::SegmentFit::AxisDefs::t0
@ t0
MuonValR4::PatternVisualizationTool::visualizeSeed
virtual void visualizeSeed(const EventContext &ctx, const MuonR4::SegmentSeed &seed, const std::string &extraLabel) const override final
Definition: PatternVisualizationTool.cxx:220
PlotPulseshapeFromCool.can
can
Definition: PlotPulseshapeFromCool.py:91
xAOD::UncalibratedMeasurement_v1
Definition: UncalibratedMeasurement_v1.h:13
MuonValR4::PatternVisualizationTool::visualizeAccumulator
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
Definition: PatternVisualizationTool.cxx:135
Generate_dsid_ranseed.seed
seed
Definition: Generate_dsid_ranseed.py:10
DeMoAtlasDataLoss.canvas
dictionary canvas
Definition: DeMoAtlasDataLoss.py:187
MuonValR4::PatternVisualizationTool::drawHit
const MuonR4::SpacePoint * drawHit(const SpacePointType &hit, PrimitiveVec &primitives, std::array< double, 4 > &canvasDim, const unsigned int view, unsigned int fillStyle) const
Converts a Hit into a particular TBox/ TEllipse for drawing.
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
MdtIdHelper
Definition: MdtIdHelper.h:61
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::Other
@ Other
MuonValR4::objViewPhi
constexpr int objViewPhi
Definition: VisualizationHelpers.h:25
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonValR4::PatternVisualizationTool::m_doEtaBucketViews
Gaudi::Property< bool > m_doEtaBucketViews
Switch to visualize the eta view of the bucket event.
Definition: PatternVisualizationTool.h:180
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
MuonR4::SegmentFit::ParamDefs::x0
@ x0
MuonValR4::PatternVisualizationTool::m_saveSinglePDFs
Gaudi::Property< bool > m_saveSinglePDFs
If set to true each canvas is saved into a dedicated pdf file.
Definition: PatternVisualizationTool.h:164
MuonValR4::PatternVisualizationTool::drawHits
bool drawHits(const MuonR4::SpacePointBucket &bucket, const std::vector< SpacePointType > &hitsToDraw, PrimitiveVec &primitivesToPush, std::array< double, 4 > &canvasDim, unsigned int view) const
Translates the Spacepoint information into TObjects that are dawn on the canvas & evaluates the size ...
Definition: PatternVisualizationTool.cxx:522
MuonValR4::PatternVisualizationTool::m_canvasLimit
Gaudi::Property< unsigned int > m_canvasLimit
Maximum canvases to draw.
Definition: PatternVisualizationTool.h:162
MuonR4::SegmentFit::ParamDefs::time
@ time
beamspotman.dir
string dir
Definition: beamspotman.py:623
min
#define min(a, b)
Definition: cfImp.cxx:40
MuonR4::SpacePoint
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePoint.h:18
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
MuonR4::SegmentFit::ParamDefs::y0
@ y0
MuonValR4::objViewEta
constexpr int objViewEta
ObjectView.
Definition: VisualizationHelpers.h:24
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MuonR4::SegmentFit::toInt
constexpr int toInt(const ParamDefs p)
Definition: MuonHoughDefs.h:42
sTgcIdHelper
Definition: sTgcIdHelper.h:55
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonValR4::PatternVisualizationTool::m_saveSummaryPDF
Gaudi::Property< bool > m_saveSummaryPDF
If set to true a summary Canvas is created.
Definition: PatternVisualizationTool.h:167
python.copyTCTOutput.locDir
locDir
Definition: copyTCTOutput.py:113
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MuonValR4::PatternVisualizationTool::m_doPhiBucketViews
Gaudi::Property< bool > m_doPhiBucketViews
Switch to visualize the phi view of the bucket event.
Definition: PatternVisualizationTool.h:182
MmIdHelper
Definition: MmIdHelper.h:54
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::SpacePointSet
std::vector< const SpacePoint * > SpacePointSet
vector of space points
Definition: FitterTypes.h:38
MuonValR4::PatternVisualizationTool::closeSummaryCanvas
void closeSummaryCanvas() const
Closes the summary canvas & closes the associated ROOT file.
Definition: PatternVisualizationTool.cxx:639
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MuonValR4::PatternVisualizationTool::m_displayBucket
Gaudi::Property< bool > m_displayBucket
Display the surrounding hits from the bucket not part of the seed.
Definition: PatternVisualizationTool.h:173
MuonValR4::PatternVisualizationTool::m_canvasHeight
Gaudi::Property< unsigned > m_canvasHeight
Definition: PatternVisualizationTool.h:195
MuonValR4::hollowFilling
constexpr int hollowFilling
Filling codes for hollow / fullFilling / hatched filling.
Definition: VisualizationHelpers.h:19
MuonValR4::PatternVisualizationTool::m_truthLinkDecors
std::vector< SegLinkDecor_t > m_truthLinkDecors
Definition: PatternVisualizationTool.h:192
MuonR4::SegmentFit::makeLabel
std::string makeLabel(const Parameters &pars)
Definition: SegmentFitterEventData.cxx:54
MuonR4::SegmentFit::localSegmentPars
Parameters localSegmentPars(const xAOD::MuonSegment &seg)
Returns the localSegPars decoration from a xAODMuon::Segment.
Definition: SegmentFitterEventData.cxx:36
MuonValR4::drawDriftCircle
std::unique_ptr< TEllipse > drawDriftCircle(const Amg::Vector3D &center, const double radius, const int color=kViolet, const int fillStyle=hollowFilling)
Create a TEllipse for drawing a drift circle.
Definition: VisualizationHelpers.cxx:11
MuonValR4::PatternVisualizationTool::m_accumlIsEta
Gaudi::Property< bool > m_accumlIsEta
Swtich toggling whether the accumulator view are in the eta or phi plane.
Definition: PatternVisualizationTool.h:178
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
CaloLCW_tf.trf
trf
Definition: CaloLCW_tf.py:20
xAOD::MdtDriftCircle_v1
https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecEvent/Mu...
Definition: MdtDriftCircle_v1.h:21
MuonValR4::PatternVisualizationTool::visualizeBucket
virtual void visualizeBucket(const EventContext &ctx, const MuonR4::SpacePointBucket &bucket, const std::string &extraLabel) const override final
Definition: PatternVisualizationTool.cxx:295
xAOD::UncalibMeasType::RpcStripType
@ RpcStripType
xAOD::UncalibMeasType::MdtDriftCircleType
@ MdtDriftCircleType
MuonR4::houghTanTheta
double houghTanTheta(const Amg::Vector3D &v)
Returns the hough tanTheta [y] / [z].
Definition: SegmentFitterEventData.cxx:14
MuonValR4::PatternVisualizationTool::m_truthSegLinks
Gaudi::Property< std::set< std::string > > m_truthSegLinks
List of truth segment links to fetch.
Definition: PatternVisualizationTool.h:186
MuonR4::SegmentFit::ParamDefs::theta
@ theta
MuonValR4::hatchedFilling
constexpr int hatchedFilling
Definition: VisualizationHelpers.h:21
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
MuonValR4::PatternVisualizationTool::m_allCanName
Gaudi::Property< std::string > m_allCanName
Name of the summary canvas & the ROOT file to save the monitoring plots.
Definition: PatternVisualizationTool.h:169
drawFromPickle.view
view
Definition: drawFromPickle.py:294
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
Identifier
Definition: IdentifierFieldParser.cxx:14