 |
ATLAS Offline Software
|
#include <PatternVisualizationTool.h>
|
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 LabeledSegmentSet | getLabeledSegments (const std::vector< const MuonR4::SpacePoint * > &hits) const override final |
| Returns whether the hit has been used on the labeled segments we refer to (e.g. More...
|
|
virtual LabeledSegmentSet | getLabeledSegments (const std::vector< const xAOD::UncalibratedMeasurement * > &hits) const override final |
|
virtual bool | isLabeled (const MuonR4::SpacePoint &hit) const override final |
| Fetches all labeled (e.g. More...
|
|
virtual bool | isLabeled (const xAOD::UncalibratedMeasurement &hit) const override final |
|
template<class SpacePointType > |
const SpacePoint * | drawHit (const SpacePointType &hit, PrimitiveVec &primitives, std::array< double, 4 > &canvasDim, const unsigned int view, unsigned int fillStyle) const |
|
|
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::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. More...
|
|
template<class SpacePointType > |
void | writeChi2 (const MuonR4::SegmentFit::Parameters &pars, const std::vector< SpacePointType > &hits, PrimitiveVec &primitivesToPush, const double legX=0.2, double startLegY=0.8, const double endLegY=0.3) const |
| Writes the chi2 of the hits onto the Canvas. More...
|
|
void | drawPrimitives (const TCanvas &can, PrimitiveVec &primitives) const |
| Draw the various primitives onto the Canvas. More...
|
|
void | paintSimHits (const EventContext &ctx, const xAOD::MuonSegment &truthSeg, PrimitiveVec &primitives, const int view) const |
| Paints the truth sim hits associated with the segment. More...
|
|
|
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.5} |
| 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...
|
|
Gaudi::Property< bool > | m_paintTruthHits {this, "paintTruthHits", false} |
| Switch to visualize the truth hits
More...
|
|
Gaudi::Property< std::string > | m_AtlasLabel {this, "AtlasLabel", "Internal"} |
| ATLAS label (Internal / Prelimnary / Simulation) More...
|
|
Gaudi::Property< std::string > | m_sqrtSLabel {this, "SqrtSLabel", "14"} |
| Centre of mass energy label. More...
|
|
Gaudi::Property< std::string > | m_lumiLabel {this, "LumiLabel", ""} |
| Luminosity label. More...
|
|
SG::ReadHandleKeyArray< xAOD::UncalibratedMeasurementContainer > | m_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::UncalibratedMeasurementContainer > | m_truthLinkDecorKeys {this, "LinkDecorKeys", {}} |
| Declaration of the dependency on the decorations. More...
|
|
std::vector< SegLinkDecor_t > | m_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::MuonDetectorManager * | m_detMgr {nullptr} |
| pointer to the Detector manager More...
|
|
SG::ReadHandleKey< ActsGeometryContext > | m_geoCtxKey {this, "AlignmentKey", "ActsAlignment", "cond handle key"} |
| Geometry context key to retrieve the alignment. More...
|
|
ServiceHandle< Muon::IMuonIdHelperSvc > | m_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...
|
|
Definition at line 29 of file PatternVisualizationTool.h.
◆ LabeledSegmentSet
◆ SegLink_t
◆ SegLinkDecor_t
◆ SegLinkVec_t
◆ closeSummaryCanvas()
void MuonValR4::PatternVisualizationTool::closeSummaryCanvas |
( |
| ) |
const |
|
private |
◆ drawHit() [1/2]
template<class SpacePointType >
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
-
hit | Reference to the hit to draw |
primitives | Vector into which the generated object is pushed |
canvasDim | Array encoding the canvas dimensions [0] -> low x; [1] -> high x, [2] -> low y, [3] -> high y |
view | Draw the hit either in the eta or phi view, |
fillStyle | Standard 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 518 of file PatternVisualizationTool.cxx.
522 static_assert(std::is_same_v<SpacePointType, SpacePoint> ||
523 std::is_same_v<SpacePointType, CalibratedSpacePoint>,
"Only usual & calibrated space points are supported");
530 canvasDim[Edges::yLow] =
std::min(canvasDim[Edges::yLow], hit.positionInChamber()[
view] - hit.driftRadius());
531 canvasDim[Edges::yHigh] =
std::max(canvasDim[Edges::yHigh], hit.positionInChamber()[
view] + hit.driftRadius());
532 canvasDim[Edges::zLow] =
std::min(canvasDim[Edges::zLow], hit.positionInChamber().z() - hit.driftRadius());
533 canvasDim[Edges::zHigh] =
std::max(canvasDim[Edges::zHigh], hit.positionInChamber().z() + hit.driftRadius());
538 constexpr
int invalidCalibFill = 3305;
539 if constexpr (std::is_same_v<SpacePointType, SpacePoint>) {
544 fillStyle = invalidCalibFill;
547 }
else if constexpr(std::is_same_v<SpacePointType, CalibratedSpacePoint>) {
548 underlyingSp = hit.spacePoint();
549 if (hit.fitState() == CalibratedSpacePoint::State::Valid) {
551 }
else if (hit.fitState() == CalibratedSpacePoint::State::FailedCalib) {
552 fillStyle = invalidCalibFill;
560 primitives.push_back(
drawDriftCircle(hit.positionInChamber(), dc->readoutElement()->innerTubeRadius(),
563 const int circColor =
isLabeled(*dc) ? truthColor : kBlue;
564 primitives.push_back(
drawDriftCircle(hit.positionInChamber(), hit.driftRadius(), circColor, fillStyle));
568 const int boxColor =
isLabeled(*meas) ? truthColor : kGreen +2;
569 const double boxWidth = 0.5*std::sqrt(12)*underlyingSp->uncertainty()[
view];
570 primitives.push_back(
drawBox(hit.positionInChamber(), boxWidth, 0.5*meas->readoutElement()->gasGapPitch(),
571 boxColor, fillStyle));
574 const auto* meas{
static_cast<const xAOD::TgcStrip*
>(underlyingSp->primaryMeasurement())};
575 const int boxColor =
isLabeled(*meas) ? truthColor : kCyan + 2;
576 const double boxWidth = 0.5*std::sqrt(12)*underlyingSp->uncertainty()[
view];
577 primitives.push_back(
drawBox(hit.positionInChamber(), boxWidth, 0.5*meas->readoutElement()->gasGapPitch(),
578 boxColor, fillStyle));
581 const auto* meas{
static_cast<const xAOD::MMCluster*
>(underlyingSp->primaryMeasurement())};
582 const int boxColor =
isLabeled(*meas) ? truthColor : kAquamarine;
585 boxColor, fillStyle));
590 ATH_MSG_WARNING(
"Please implement proper drawings of the new small wheel.. "<<__FILE__<<
":"<<__LINE__);
◆ 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
-
bucket | SpacePoint 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 |
hitsToDraw | Primary hit collection to draw which are drawn with fullFillStyle |
primitivesToPush | Output vector into which the painting objects are pushed_back |
canvasDim | Array encoding the canvas dimensions [0] -> low x; [1] -> high x, [2] -> low y, [3] -> high y |
view | Either the eta or the phi view? |
Definition at line 597 of file PatternVisualizationTool.cxx.
603 canvasDim[Edges::yLow] = canvasDim[Edges::zLow] = 100. *
Gaudi::Units::m;
604 canvasDim[Edges::yHigh] = canvasDim[Edges::zHigh] = -100. *
Gaudi::Units::m;
607 for (
const SpacePointType& hit : hitsToDraw) {
611 for (
const SpacePointBucket::value_type& hit : bucket) {
613 if (drawnPoints.count(hit.get())) {
622 for (
auto & prim : primitives){
623 TBox* theBox =
dynamic_cast<TBox*
>(prim.get());
625 canvasDim[Edges::zLow] =
std::min(canvasDim[Edges::zLow], theBox->GetY1());
626 canvasDim[Edges::zHigh] =
std::max(canvasDim[Edges::zHigh], theBox->GetY2());
631 double height = (canvasDim[Edges::zHigh] - canvasDim[Edges::zLow])*
m_canvasExtraScale;
635 const double midPointX = 0.5 * (canvasDim[Edges::yHigh] + canvasDim[Edges::yLow]);
636 const double midPointY = 0.5 * (canvasDim[Edges::zHigh] + canvasDim[Edges::zLow]);
637 canvasDim[Edges::yLow] = midPointX - 0.5 *
width;
638 canvasDim[Edges::zLow] = midPointY - 0.5 * height;
639 canvasDim[Edges::yHigh] = midPointX + 0.5 *
width;
640 canvasDim[Edges::zHigh] = midPointY + 0.5 * height;
641 return drawnPoints.size() - drawnPoints.count(
nullptr) > 1;
◆ drawPrimitives()
void MuonValR4::PatternVisualizationTool::drawPrimitives |
( |
const TCanvas & |
can, |
|
|
PrimitiveVec & |
primitives |
|
) |
| const |
|
private |
Draw the various primitives onto the Canvas.
If a TLine is amongst them it's automatically adjusted to fit the canvas ranges
- Parameters
-
canvas | Reference to the canvas to draw the primitives on |
prmitives | Primitives to draw onto the Canvas |
Definition at line 135 of file PatternVisualizationTool.cxx.
136 const double yLow =
can.GetPad(0)->GetUymin();
137 const double yHigh =
can.GetPad(0)->GetUymax();
138 for (
auto& prim : primitives) {
139 const TObject &primRef = *prim;
140 if (
typeid(primRef) ==
typeid(TLine)){
141 TLine*
line =
static_cast<TLine*
>(prim.get());
145 const Amg::Vector3D newHigh = linePoint + Amg::intersect<3>(linePoint, lineDir, Amg::Vector3D::UnitY(), yHigh).value_or(0.) * lineDir;
146 const Amg::Vector3D newLow = linePoint + Amg::intersect<3>(linePoint, lineDir, Amg::Vector3D::UnitY(), yLow).value_or(0.) * lineDir;
147 line->SetX1(newLow.x());
148 line->SetY1(newLow.y());
149 line->SetX2(newHigh.x());
150 line->SetY2(newHigh.y());
◆ finalize()
StatusCode MuonValR4::PatternVisualizationTool::finalize |
( |
| ) |
|
|
finaloverridevirtual |
◆ getLabeledSegments() [1/2]
Returns whether the hit has been used on the labeled segments we refer to (e.g.
truth or data Zµµ)
- Parameters
-
hits | Vector of hits to search |
Definition at line 113 of file PatternVisualizationTool.cxx.
114 std::vector<const xAOD::UncalibratedMeasurement*> measurements{};
115 measurements.reserve(2*
hits.size());
117 measurements.push_back(hit->primaryMeasurement());
118 if(hit->secondaryMeasurement()) {
119 measurements.push_back(hit->secondaryMeasurement());
◆ getLabeledSegments() [2/2]
◆ initialize()
StatusCode MuonValR4::PatternVisualizationTool::initialize |
( |
| ) |
|
|
finaloverridevirtual |
Definition at line 56 of file PatternVisualizationTool.cxx.
60 return StatusCode::FAILURE;
66 m_outFile = std::make_unique<TFile>( (
m_allCanName +
".root").c_str(),
"RECREATE");
70 gROOT->SetStyle(
"ATLAS");
71 TStyle* plotStyle = gROOT->GetStyle(
"ATLAS");
72 plotStyle->SetOptTitle(0);
73 plotStyle->SetHistLineWidth(1.);
74 plotStyle->SetPalette(kViridis);
78 ATH_MSG_INFO(
"Hits linked to the following segment decorations are considered as truth");
81 if (decorName.empty()) {
83 return StatusCode::FAILURE;
96 return StatusCode::SUCCESS;
◆ isLabeled() [1/2]
Fetches all labeled (e.g.
by truth or Zµµ reco) segments containing at least one measurement in the list passed as arg
- Parameters
-
hit | Reference to the hit to check |
Definition at line 102 of file PatternVisualizationTool.cxx.
◆ isLabeled() [2/2]
◆ 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
-
ctx | EventContext to generate a unique canvas name |
canvasDim | Array encoding the canvas dimensions [0] -> low x; [1] -> high x, [2] -> low y, [3] -> high y |
view | Is 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 728 of file PatternVisualizationTool.cxx.
731 std::stringstream canvasName{};
732 canvasName<<
name()<<
"_"<<ctx.eventID().event_number()<<
"_"<<m_canvCounter;
733 ATH_MSG_VERBOSE(
"Create new canvas "<<canvasName.str()<<
" "<<canvasDim);
736 TH1F* frame =
canvas->DrawFrame(canvasDim[Edges::yLow],canvasDim[Edges::zLow], canvasDim[Edges::yHigh], canvasDim[Edges::zHigh]);
738 frame->GetYaxis()->SetTitle(
"z [mm]");
◆ paintSimHits()
Paints the truth sim hits associated with the segment.
Hits are drawn as orange arrows
- Parameters
-
ctx | EventContext to fetch the alignment constants |
truthSeg | Segment made from truth sim hits |
primitives | Drawing primitives to append the painted hits |
view | Draw the hit either in the eta or phi view |
Definition at line 249 of file PatternVisualizationTool.cxx.
264 re->measurementHash(simHit->identify()) :
265 re->layerHash(simHit->identify());
267 re->localToGlobalTrans(*geoCtx,
hash);
◆ 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
-
ctx | EventContext to fetch the event number |
chambId | Identifier of the chamber from which the hits are stemming from |
primtives | List of objects to draw onto the canvas |
extraLabel | Externally passed extra label |
Definition at line 741 of file PatternVisualizationTool.cxx.
746 std::stringstream canvasName{};
747 canvasName<<
m_canvasPrefix.value()<<
"_"<<ctx.eventID().event_number()<<
"_"<<(m_canvCounter++)<<
"_"
752 if (!extraLabel.empty()) canvasName<<
"_"<<removeNonAlphaNum(extraLabel);
760 m_outFile->WriteObject(&
canvas, canvasName.str().c_str());
◆ 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 |
◆ 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
TODO: After next ACTS update, the following three lines can become const SpacePointSet& hitsInBin{accumulator.uniqueHitIds(xBin, yBin)};
Definition at line 164 of file PatternVisualizationTool.cxx.
176 std::lock_guard guard{
s_mutex};
182 if (accumulator.getNonEmptyBins().empty()) {
187 auto accHisto = std::make_unique<TH2F>(
"AccumulatorHisto",
"histo",
188 accumulator.nBinsX(), axisRanges.xMin, axisRanges.xMax,
189 accumulator.nBinsY(), axisRanges.yMin, axisRanges.yMax);
191 accHisto->SetDirectory(
nullptr);
193 accHisto->GetYaxis()->SetTitle( std::string{
m_accumlIsEta ?
"y_{0}" :
"x_{0}"}.c_str());
195 std::vector<const SpacePoint*> spacePointsInAcc{};
196 for (
const std::size_t
bin : accumulator.getNonEmptyBins()) {
197 const auto [xBin, yBin] = accumulator.axisBins(
bin);
201 auto hitIds = accumulator.hitIds(xBin, yBin);
202 hitsInBin.insert(std::make_move_iterator(hitIds.begin()),std::make_move_iterator(hitIds.end()));
204 spacePointsInAcc.insert(spacePointsInAcc.end(),hitsInBin.begin(), hitsInBin.end());
205 accHisto->SetBinContent(xBin+1, yBin+1, accumulator.nHits(
bin));
216 auto truthMarker = std::make_unique<TMarker>(
tan, icept, kFullCrossX);
217 truthMarker->SetMarkerColor(truthColor);
218 truthMarker->SetMarkerSize(8);
219 primitives.push_back(std::move(truthMarker));
222 for (
const auto& maximum : maxima) {
223 auto maxMarker = std::make_unique<TMarker>(maximum.x, maximum.y, kFullTriangleUp);
224 maxMarker->SetMarkerColor(parLineColor);
225 maxMarker->SetMarkerSize(8);
226 primitives.push_back(std::move(maxMarker));
231 std::stringstream canvasName{};
232 canvasName<<
name()<<
"_"<<ctx.eventID().event_number()<<
"_"<<m_canvCounter;
233 auto canvas = std::make_unique<TCanvas>(canvasName.str().c_str(),
235 canvas->GetPad(0)->SetRightMargin(0.12);
236 canvas->GetPad(0)->SetTopMargin(0.12);
238 accHisto->Draw(
"COLZ");
240 primitives.push_back(std::move(accHisto));
242 primitives.push_back(std::move(
canvas));
◆ visualizeBucket() [1/2]
◆ visualizeBucket() [2/2]
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 357 of file PatternVisualizationTool.cxx.
366 std::lock_guard guard{
s_mutex};
372 std::array<double, 4> canvasDim{};
377 const std::size_t parsedPrimSize{primitives.size()};
384 primitives.resize(parsedPrimSize);
385 if (!
drawHits(bucket, bucket, primitives, canvasDim,
view)) {
388 bool drawnTrueLabel{
false};
391 truthColor, kDotted,
view));
392 if (!drawnTrueLabel) {
394 drawnTrueLabel =
true;
399 std::stringstream legendLabel{};
400 legendLabel<<
"Event: "<<ctx.eventID().event_number()
401 <<
", chamber : "<<
m_idHelperSvc->toStringChamber(bucket.front()->identify())
403 if (!extraLabel.empty()) {
404 legendLabel<<
" ("<<extraLabel<<
")";
406 primitives.push_back(
drawLabel(legendLabel.str(), 0.2, 0.96));
414 saveCanvas(ctx, bucket.front()->identify(), *
can, extraLabel);
◆ visualizeSeed() [1/2]
◆ visualizeSeed() [2/2]
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 279 of file PatternVisualizationTool.cxx.
289 std::lock_guard guard{
s_mutex};
301 std::array<double, 4> canvasDim{};
302 const std::size_t parsedPrimSize{primitives.size()};
309 primitives.resize(parsedPrimSize);
316 truthColor, kDotted,
view));
319 primitives.push_back(
drawLine(
seed.parameters(), canvasDim[Edges::zLow], canvasDim[Edges::zHigh],
320 parLineColor, kDashed,
view));
324 std::stringstream legendLabel{};
327 legendLabel<<
"Event: "<<ctx.eventID().event_number()<<
", chamber : "<<
m_idHelperSvc->toStringChamber(
seed.getHitsInMax().front()->identify())
331 if (!extraLabel.empty()) {
332 legendLabel<<
" ("<<extraLabel<<
")";
334 primitives.push_back(
drawLabel(legendLabel.str(), 0.1, 0.96));
◆ visualizeSegment() [1/2]
void MuonValR4::PatternVisualizationTool::visualizeSegment |
( |
const EventContext & |
ctx, |
|
|
const MuonR4::Segment & |
segment, |
|
|
const std::string & |
extraLabel |
|
) |
| const |
|
finaloverridevirtual |
◆ visualizeSegment() [2/2]
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 430 of file PatternVisualizationTool.cxx.
439 std::lock_guard guard{
s_mutex};
465 std::array<double, 4> canvasDim{};
466 const std::size_t parsedPrimSize{primitives.size()};
473 primitives.resize(parsedPrimSize);
476 primitives, canvasDim,
view)) {
481 truthColor, kDotted,
view));
489 primitives.push_back(
drawLine(segPars, canvasDim[Edges::zLow], canvasDim[Edges::zHigh],
490 parLineColor, kDashed,
view));
493 std::stringstream legendLabel{};
495 legendLabel<<
"Event: "<<ctx.eventID().event_number() <<
", chamber : "<<
m_idHelperSvc->toStringChamber(canvasId)
499 if (!extraLabel.empty()) {
500 legendLabel<<
" ("<<extraLabel<<
")";
502 primitives.push_back(
drawLabel(legendLabel.str(), 0.2, 0.96));
◆ writeChi2()
template<class SpacePointType >
Writes the chi2 of the hits onto the Canvas.
- Parameters
-
pars | Parameter for which the chi2 is evaluated, |
hits | Vector of hits to consider |
primitivesToPush | Output vector into which the TLabels are pushed for later drawing |
legX | x-position of the list |
statLegY | y-position of the first entry. The next one is 0.05 apart |
endLeg | y-position of the last shown entry. The routine aborts if there're more hits in the event. |
Definition at line 644 of file PatternVisualizationTool.cxx.
651 for (
const SpacePointType& hit :
hits) {
654 bool displayChi2{
true};
655 if constexpr(std::is_same_v<SpacePointType, Segment::MeasType>) {
656 underlyingSp = hit->spacePoint();
657 displayChi2 = (hit->fitState() == CalibratedSpacePoint::State::Valid );
659 std::nullopt, *hit, msgStream());
666 std::string legendstream{};
667 switch(hit->type()) {
671 legendstream =
std::format(
"ML: {:1d}, TL: {:1d}, T: {:3d}, {:}",
672 idHelper.multilayer(hitId), idHelper.tubeLayer(hitId),
673 idHelper.tube(hitId),
driftSign == -1 ?
"L" :
"R");
677 legendstream=
std::format(
"DR: {:1d}, DZ: {:1d}, GAP: {:1d}, #eta/#phi: {:}/{:}",
678 idHelper.doubletR(hitId), idHelper.doubletZ(hitId), idHelper.gasGap(hitId),
679 hit->measuresEta() ?
"si" :
"nay", hit->measuresPhi() ?
"si" :
"nay");
683 legendstream =
std::format(
"ST: {:}, GAP: {:1d}, #eta/#phi: {:}/{:}",
684 m_idHelperSvc->stationNameString(hitId), idHelper.gasGap(hitId),
685 hit->measuresEta() ?
"si" :
"nay", hit->measuresPhi() ?
"si" :
"nay");
689 const auto* clus =
static_cast<const xAOD::MMCluster*
>(underlyingSp->primaryMeasurement());
690 const MuonGMR4::StripDesign& design = clus->readoutElement()->stripLayer(clus->layerHash()).design();
691 legendstream =
std::format(
"ML: {:1d}, GAP: {:1d}, {:}", idHelper.multilayer(hitId), idHelper.gasGap(hitId),
696 legendstream =
std::format(
"ML: {:1d}, GAP: {:1d}, #eta/#phi: {:}/{:}",
697 idHelper.multilayer(hitId), idHelper.gasGap(hitId),
698 hit->measuresEta() ?
"si" :
"nay", hit->measuresPhi() ?
"si" :
"nay");
701 legendstream =
"Ext. constaint";
709 legendstream+=
", #chi^{2}: ---";
711 primitives.push_back(
drawLabel(legendstream, legX, startLegY, 14));
713 if (startLegY<= endLegY) {
◆ ATLAS_THREAD_SAFE [1/3]
std::unique_ptr<TCanvas> m_allCan MuonValR4::PatternVisualizationTool::ATLAS_THREAD_SAFE {} |
|
mutableprivate |
◆ ATLAS_THREAD_SAFE [2/3]
std::unique_ptr<TFile> m_outFile MuonValR4::PatternVisualizationTool::ATLAS_THREAD_SAFE {} |
|
mutableprivate |
◆ ATLAS_THREAD_SAFE [3/3]
std::atomic<unsigned int> m_canvCounter MuonValR4::PatternVisualizationTool::ATLAS_THREAD_SAFE {0} |
|
mutableprivate |
◆ 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 194 of file PatternVisualizationTool.h.
◆ m_allCanName
Gaudi::Property<std::string> MuonValR4::PatternVisualizationTool::m_allCanName {this, "AllCanvasName", "AllPatternPlots"} |
|
private |
◆ m_AtlasLabel
Gaudi::Property<std::string> MuonValR4::PatternVisualizationTool::m_AtlasLabel {this, "AtlasLabel", "Internal"} |
|
private |
◆ m_canvasExtraScale
Gaudi::Property<double> MuonValR4::PatternVisualizationTool::m_canvasExtraScale {this, "CanvasExtraScale" , 1.5} |
|
private |
◆ m_canvasHeight
Gaudi::Property<unsigned> MuonValR4::PatternVisualizationTool::m_canvasHeight {this, "CanvasHeight", 600} |
|
private |
◆ m_canvasLimit
Gaudi::Property<unsigned int> MuonValR4::PatternVisualizationTool::m_canvasLimit {this, "CanvasLimits", 5000} |
|
private |
◆ m_canvasPrefix
Gaudi::Property<std::string> MuonValR4::PatternVisualizationTool::m_canvasPrefix {this, "CanvasPreFix", ""} |
|
private |
◆ m_canvasWidth
Gaudi::Property<unsigned> MuonValR4::PatternVisualizationTool::m_canvasWidth {this, "CanvasWidth", 800} |
|
private |
◆ m_detMgr
◆ m_displayBucket
Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_displayBucket {this, "displayBucket", true} |
|
private |
◆ m_displayOnlyTruth
Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_displayOnlyTruth {this, "displayTruthOnly", false} |
|
private |
◆ m_doEtaBucketViews
Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_doEtaBucketViews {this,"doEtaBucketViews", true} |
|
private |
◆ m_doPhiBucketViews
Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_doPhiBucketViews {this,"doPhiBucketViews", true} |
|
private |
◆ m_geoCtxKey
◆ m_idHelperSvc
◆ m_lumiLabel
Gaudi::Property<std::string> MuonValR4::PatternVisualizationTool::m_lumiLabel {this, "LumiLabel", ""} |
|
private |
◆ m_paintTruthHits
Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_paintTruthHits {this, "paintTruthHits", false} |
|
private |
◆ m_prepContainerKeys
◆ m_saveSinglePDFs
Gaudi::Property<bool> MuonValR4::PatternVisualizationTool::m_saveSinglePDFs {this, "saveSinglePDFs", false} |
|
private |
◆ 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 183 of file PatternVisualizationTool.h.
◆ m_sqrtSLabel
Gaudi::Property<std::string> MuonValR4::PatternVisualizationTool::m_sqrtSLabel {this, "SqrtSLabel", "14"} |
|
private |
◆ m_truthLinkDecorKeys
◆ m_truthLinkDecors
std::vector<SegLinkDecor_t> MuonValR4::PatternVisualizationTool::m_truthLinkDecors {} |
|
private |
◆ m_truthSegLinks
Gaudi::Property<std::set<std::string> > MuonValR4::PatternVisualizationTool::m_truthSegLinks {this, "TruthSegDecors", {}} |
|
private |
◆ s_mutex
std::mutex MuonValR4::PatternVisualizationTool::s_mutex {} |
|
staticprivate |
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
constexpr int fullFilling
MuonValR4::IPatternVisualizationTool::PrimitiveVec PrimitiveVec
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)
Draws a line from the segment fit parameters.
double stereoAngle() const
Returns the value of the stereo angle.
RpcMeasurement_v1: Class storing the geneic.
AmgVector(toInt(ParamDefs::nPars)) Parameters
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
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.
Class describing a MuonSegment.
const xAOD::UncalibratedMeasurement * secondaryMeasurement() const
#define ATH_MSG_VERBOSE(x)
Property holding a SG store/key/clid from which a ReadHandle is made.
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.
std::pair< Amg::Vector3D, Amg::Vector3D > makeLine(const Parameters &pars)
Returns the parsed parameters into an Eigen line parametrization.
std::unique_ptr< TLatex > drawLabel(const std::string &text, const double xPos, const double yPos, const unsigned int fontSize=18)
Create a TLatex label,.
@ u
Enums for curvilinear frames.
@ MdtStatusDriftTime
The tube produced a vaild measurement.
const xAOD::UncalibratedMeasurement * primaryMeasurement() const
double houghTanPhi(const Amg::Vector3D &v)
: Returns the hough tanPhi [x] / [z]
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...
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Eigen::Affine3d Transform3D
double chi2(TH1 *h0, TH1 *h1)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Include the GeoPrimitives which need to be put first.
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
ElementLink implementation for ROOT usage.
constexpr int objViewEta
ObjectView.
constexpr int toInt(const ParamDefs p)
Eigen::Matrix< double, 3, 1 > Vector3D
std::unique_ptr< TArrow > drawArrow(const Amg::Vector3D &start, const Amg::Vector3D &dir, const int color=kRed+1, const int lineStyle=kDashed, const int view=objViewEta)
#define ATH_MSG_WARNING(x)
std::vector< const SpacePoint * > SpacePointSet
vector of space points
const boost::regex re(r_e)
constexpr int hollowFilling
Filling codes for hollow / fullFilling / hatched filling.
std::string makeLabel(const Parameters &pars)
Parameters localSegmentPars(const xAOD::MuonSegment &seg)
Returns the localSegPars decoration from a xAODMuon::Segment.
bool hasStereoAngle() const
Returns whether a stereo angle is defined.
std::unique_ptr< TEllipse > drawDriftCircle(const Amg::Vector3D ¢er, const double radius, const int color=kViolet, const int fillStyle=hollowFilling)
Create a TEllipse for drawing a drift circle.
std::unique_ptr< TLatex > drawAtlasLabel(const double xPos, const double yPos, const std::string &status="Internal")
Create a ATLAS label.
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecEvent/Mu...
double houghTanTheta(const Amg::Vector3D &v)
Returns the hough tanTheta [y] / [z].
std::unordered_set< const xAOD::MuonSimHit * > getMatchingSimHits(const xAOD::MuonSegment &segment)
: Returns all sim hits matched to a xAOD::MuonSegment
std::unique_ptr< TLatex > drawLumiSqrtS(const double xPos, const double yPos, const std::string_view sqrtS="14", const std::string_view lumi="")
Create a luminosity sqrtS label.
constexpr int hatchedFilling
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
const MuonReadoutElement * getReadoutElement(const Identifier &id) const
Returns a generic Muon readout element.