ATLAS Offline Software
Loading...
Searching...
No Matches
MuonValR4 Namespace Reference

Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a validation NTuple with identifier and drift circle info. More...

Namespaces

namespace  detail

Classes

class  IFastRecoVisualizationTool
 Helper tool to visualize a pattern recogntion incident or a certain stage of the segment fit. More...
class  IPatternVisualizationTool
 Helper tool to visualize a pattern recogntion incident or a certain stage of the segment fit. More...
class  IRootVisualizationService
 Definition of the IRootVisualizationService interface. More...
class  ITrackVisualizationTool
 Helper tool to visualize a pattern recogntion incident or a certain stage of the segment fit. More...
class  MdtCalibDbAlgTest
class  FastRecoVisualizationTool
class  MuonFastRecoTester
class  MuonHoughTransformTester
class  MuonRecoChainTester
class  PatternVisualizationTool
class  MdtDriftCircleVariables
class  MdtTwinDriftCircleVariables
class  MmClusterVariables
class  RpcMeasurementVariables
class  SimHitTester
class  SpacePointTesterModule
class  TesterModuleBase
class  TgcStripVariables
class  TrackContainerModule
class  TrackSummaryValueBranch
 Helper branch class to dump a pick a single hit summary value from the overall summary & to dump it in the tree. More...
class  TrackSummaryModule
class  MuonHitTesterAlg
class  MuonSPCalibrationTest
class  MsTrackTester
class  SegmentExtpTest
class  SegmentRefitTest
 Simple tester class to refit the Mdt segments with the Acts global chi2 fitter In the ideal case, the Acts fit should return the same parameters as the Muon segment fitter with the same measurements to be included on the fit. More...
class  TrackVisualizationTool
class  RootVisualizationService
 Implementation of the IRootVisualization service. More...
class  xMuonHitAnalysis

Typedefs

using StIndex = Muon::MuonStationIndex::StIndex
using simHitSet = std::unordered_set<const xAOD::MuonSimHit*>
using TruthParticleMap = std::map<const xAOD::TruthParticle*, std::vector<simHitSet>>
using ObjectMatching = MuonHoughTransformTester::ObjectMatching
using LabeledSegmentSet = PatternVisualizationTool::LabeledSegmentSet
using Category = MuonR4::HitSummary::HitCategory
using Status = MuonR4::HitSummary::Status
using ICanvasObject = RootVisualizationService::ICanvasObject

Functions

std::optional< std::size_t > isTruthMatched (const xAOD::MuonMeasurement &meas, const TruthParticleMap &truthHits)
bool isInPattern (const SpacePoint *sp, const StIndex station, const GlobalPattern &pattern)
std::string nameBr (Category cat, Status status, LayerIndex layer, bool isSmall)
int seedColorIdx (std::size_t iSeed)
std::string removeNonAlphaNum (std::string str)
 Removes all non-alpha numerical characters from a string.
void ensureDirectory (const std::string &path)
 Ensures that the subdirectory in the path is created.
void drawPropagation (const std::vector< Acts::detail::Step > &steps, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewLine)
 Draws the recorded propagation steps as a polygon line.
void drawBoundParameters (const ActsTrk::GeometryContext &gctx, const Acts::BoundTrackParameters &pars, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewLine, const double standardLength=3.*Gaudi::Units::cm)
 Draw a line representing the bound track parameters.
void drawSegmentLine (const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewLine, const double standardLength=1.*Gaudi::Units::m)
 Draw a segment line inside the obj file.
void drawSegmentLine (const ActsTrk::GeometryContext &gctx, const MuonR4::Segment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewLine)
 Draw a segment line inside the obj file.
void drawSegmentMeasurements (const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
 Draw all uncalibrated measurements associated to the segment.
void drawSegmentMeasurements (const ActsTrk::GeometryContext &gctx, const MuonR4::Segment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
 Draw all uncalibrated measurements associated to the segment.
void drawMeasurement (const ActsTrk::GeometryContext &gctx, const xAOD::UncalibratedMeasurement *meas, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
 Draw an uncalibrated measurement inside the obj file.
void drawSpacePoint (const ActsTrk::GeometryContext &gctx, const MuonR4::SpacePoint &spacePoint, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
 Draw an uncalibrated space point inside the obj file.
void drawSpacePoint (const ActsTrk::GeometryContext &gctx, const MuonR4::CalibratedSpacePoint &spacePoint, const MuonGMR4::SpectrometerSector *msSector, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
 Draw a calibrated space point inside the obj file.
std::vector< std::unique_ptr< TObject > > clone (const std::vector< std::unique_ptr< TObject > > &cloneMe)
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.
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.
std::unique_ptr< TBox > drawBox (const double x1, const double y1, const double x2, const double y2, const int color=kGreen+2, const int fillStyle=hollowFilling)
 Creates a box for drawing, e.g strip measurements.
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.
std::unique_ptr< TLine > drawLine (const Amg::Vector3D &lowEnd, const Amg::Vector3D &highEnd, const int color=kRed+1, const int lineStyle=kSolid, const int view=objViewEta)
 Draw a line between two endpoints in the y-z or the x-z plane.
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)
 Draw an arror between two endpoints in the y-z or the x-z plane.
std::unique_ptr< TLatex > drawLabel (const std::string &text, const double xPos, const double yPos, const double textSize=18, const bool useNDC=true, const int color=kBlack)
 Create a TLatex label,.
std::unique_ptr< TLatex > drawAtlasLabel (const double xPos, const double yPos, const std::string &status="Internal")
 Create a ATLAS label.
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.

Variables

constexpr std::size_t s_nStations {Acts::toUnderlying(StIndex::StIndexMax)}
constexpr int hollowFilling = 0
 Filling codes for hollow / fullFilling / hatched filling.
constexpr int fullFilling = 1001
constexpr int hatchedFilling = 3344
constexpr int objViewEta = Acts::toUnderlying(MuonR4::SegmentFit::AxisDefs::etaCov)
 ObjectView.
constexpr int objViewPhi = Acts::toUnderlying(MuonR4::SegmentFit::AxisDefs::phiCov)

Detailed Description

Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a validation NTuple with identifier and drift circle info.

Module to dump the basic properties of the TgcStrip collection.

Module to dump the basic properties of the RpcMeasurement collection.

Module to dump the basic properties of the MmCluster collection.

Module to dump the basic properties of the MdtTwinDriftCircle collection.

Module to dump the basic properties of the MdtDriftCircle collection.

Typedef Documentation

◆ Category

◆ ICanvasObject

using MuonValR4::ICanvasObject = RootVisualizationService::ICanvasObject

Definition at line 33 of file RootVisualizationService.cxx.

◆ LabeledSegmentSet

◆ ObjectMatching

◆ simHitSet

using MuonValR4::simHitSet = std::unordered_set<const xAOD::MuonSimHit*>

Definition at line 29 of file MuonFastRecoTester.cxx.

◆ Status

◆ StIndex

◆ TruthParticleMap

Definition at line 30 of file MuonFastRecoTester.cxx.

Function Documentation

◆ clone()

std::vector< std::unique_ptr< TObject > > MuonValR4::clone ( const std::vector< std::unique_ptr< TObject > > & cloneMe)

Definition at line 13 of file VisualizationHelpers.cxx.

13 {
14 std::vector<std::unique_ptr<TObject>> cloned{};
15 for (auto& obj : cloneMe) {
16 cloned.emplace_back(obj->Clone());
17 }
18 return cloned;
19 }

◆ drawArrow()

std::unique_ptr< TArrow > MuonValR4::drawArrow ( const Amg::Vector3D & start,
const Amg::Vector3D & dir,
const int color = kRed +1,
const int lineStyle = kDashed,
const int view = objViewEta )

Draw an arror between two endpoints in the y-z or the x-z plane.

Parameters
startLower start point of the arrow
dirDirection of the arrow
colorColor of the line (Cf. TColor documentation)
lineStyleStyle of the drawn line (cf. TAttLine documentation)
viewIs the line placed in the y-z or in the x-z plane

Definition at line 30 of file VisualizationHelpers.cxx.

31 {
32 constexpr double arrowLength = 2.*Gaudi::Units::cm;
33 const Amg::Vector3D end = start + (arrowLength / std::hypot(dir[view], dir.z()) ) * dir;
34 auto arrow = std::make_unique<TArrow>(start[view], start.z(), end[view], end.z(),0.01);
35 arrow->SetLineColor(color);
36 arrow->SetLineWidth(2);
37 arrow->SetLineStyle(lineStyle);
38 return arrow;
39 }
Eigen::Matrix< double, 3, 1 > Vector3D

◆ drawAtlasLabel()

std::unique_ptr< TLatex > MuonValR4::drawAtlasLabel ( const double xPos,
const double yPos,
const std::string & status = "Internal" )

Create a ATLAS label.

Parameters
xPosx-position of the label on the Canvas
yPosy-position of the label on the Canvas
statusATLAS label status to be drawn

Definition at line 97 of file VisualizationHelpers.cxx.

98 {
99 return drawLabel( "#font[72]{ATLAS} "+status, xPos, yPos);
100 }
std::unique_ptr< TLatex > drawLabel(const std::string &text, const double xPos, const double yPos, const double textSize=18, const bool useNDC=true, const int color=kBlack)
Create a TLatex label,.

◆ drawBoundParameters()

void MuonValR4::drawBoundParameters ( const ActsTrk::GeometryContext & gctx,
const Acts::BoundTrackParameters & pars,
Acts::ObjVisualization3D & visualHelper,
const Acts::ViewConfig & viewConfig = Acts::s_viewLine,
const double standardLength = 3.*Gaudi::Units::cm )

Draw a line representing the bound track parameters.

Parameters
gctxGeometry context to align the parameters globally
parsBound track parameters to draw
vsualHelperObj helper to which the drawn line is appended
viewConfigConfiguration style of the drawn line
standardLengthLength of the segment as a fallback solution

Definition at line 237 of file ObjVisualizationHelpers.cxx.

241 {
242 const Amg::Vector3D globPos = pars.position(gctx.context());
243 const Amg::Vector3D start = globPos - 0.5 * standardLength * pars.direction();
244 const Amg::Vector3D end = globPos + 0.5 * standardLength * pars.direction();
245 Acts::GeometryView3D::drawSegment(visualHelper, start, end, viewConfig);
246 }
Acts::GeometryContext context() const

◆ drawBox() [1/2]

std::unique_ptr< TBox > MuonValR4::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.

Parameters
boxCenterCenter of the box to be placed expressed in chamber frame coordinates
boxWidthWidth of the drawn box
boxHeightHeight of the drawn box
colorColor of the surrounding line & filling
fillStyleBox fill style
viewIs the box placed in the y-z or in the x-z plane

Definition at line 54 of file VisualizationHelpers.cxx.

57 {
58 return drawBox(boxCenter[view] - 0.5*boxWidth, boxCenter.z() - 0.5*boxHeight,
59 boxCenter[view] + 0.5*boxWidth, boxCenter.z() + 0.5*boxHeight,
60 color, fillStyle);
61 }
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.

◆ drawBox() [2/2]

std::unique_ptr< TBox > MuonValR4::drawBox ( const double x1,
const double y1,
const double x2,
const double y2,
const int color = kGreen +2,
const int fillStyle = hollowFilling )

Creates a box for drawing, e.g strip measurements.

Parameters
x1Left edge location
y1Bottom edge location
x2Right edge location
y2TopEdgeLocation
colorColor of the surrounding line & filling
fillStyleBox fill style
viewIs the box placed in the y-z or in the x-z plane

Definition at line 62 of file VisualizationHelpers.cxx.

64 {
65 auto box = std::make_unique<TBox>(x1,y1,x2,y2);
66 box->SetFillColor(color);
67 box->SetLineColor(color);
68 box->SetFillStyle(fillStyle);
69 box->SetFillColorAlpha(color, 0.8);
70 return box;
71 }

◆ drawDriftCircle()

std::unique_ptr< TEllipse > MuonValR4::drawDriftCircle ( const Amg::Vector3D & center,
const double radius,
const int color = kViolet,
const int fillStyle = hollowFilling )

Create a TEllipse for drawing a drift circle.

Parameters
centerPosition of the drift cirle expressed in the chambers frame y-coordinate corresponds to the tube layer z-coordinate corresponds to the tube in the layer
radiusRadius of the drift circle to draw
colorColor of the circle to draw
fillStyleStyle to pick the filling of the circle

Definition at line 20 of file VisualizationHelpers.cxx.

22 {
23 auto ellipse = std::make_unique<TEllipse>(center.y(), center.z(), radius);
24 ellipse->SetLineColor(color);
25 ellipse->SetFillStyle(fillStyle);
26 ellipse->SetLineWidth(1);
27 ellipse->SetFillColorAlpha(color, 0.2);
28 return ellipse;
29 }

◆ drawLabel()

std::unique_ptr< TLatex > MuonValR4::drawLabel ( const std::string & text,
const double xPos,
const double yPos,
const double textSize = 18,
const bool useNDC = true,
const int color = kBlack )

Create a TLatex label,.

Parameters
textLabel text
xPosx-position of the label on the Canvas in relative coordinates
yPosy-position of the label on the Canvas in relative coordinates
fontSizeSize of the label font
useNDCWhether to use Normalized Device Coordinates

Definition at line 40 of file VisualizationHelpers.cxx.

44 {
45 auto tl = std::make_unique<TLatex>(xPos, yPos, text.c_str());
46 tl->SetTextFont(43);
47 if(useNDC){
48 tl->SetNDC();
49 }
50 tl->SetTextSize(textSize);
51 tl->SetTextColor(color);
52 return tl;
53 }

◆ drawLine() [1/2]

std::unique_ptr< TLine > MuonValR4::drawLine ( const Amg::Vector3D & lowEnd,
const Amg::Vector3D & highEnd,
const int color = kRed + 1,
const int lineStyle = kSolid,
const int view = objViewEta )

Draw a line between two endpoints in the y-z or the x-z plane.

Parameters
lowEndLower boundary in Canvas-y of the line
highEndUpper boundaty in Canbas-y of the line
colorColor of the line (Cf. TColor documentation)
lineStyleStyle of the drawn line (cf. TAttLine documentation)
viewIs the line placed in the y-z or in the x-z plane

Definition at line 81 of file VisualizationHelpers.cxx.

84 {
85 const double x1 = lowEnd[view];
86 const double y1 = lowEnd[Amg::z];
87 const double x2 = highEnd[view];
88 const double y2 = highEnd[Amg::z];
89
90 auto seedLine = std::make_unique<TLine>(x1, y1, x2, y2);
91 seedLine->SetLineColor(color);
92 seedLine->SetLineWidth(2);
93 seedLine->SetLineStyle(lineStyle);
94 return seedLine;
95
96 }

◆ drawLine() [2/2]

std::unique_ptr< TLine > MuonValR4::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.

Parameters
parsSegment fit parameters to extract position & direction from
lowEndLower boundary in Canvas-y of the line
highEndUpper boundaty in Canbas-y of the line
colorColor of the line (Cf. TColor documentation)
lineStyleStyle of the drawn line (cf. TAttLine documentation)
viewIs the line placed in the y-z or in the x-z plane

Definition at line 72 of file VisualizationHelpers.cxx.

75 {
76 const auto [pos, dir] = makeLine(pars);
77 return drawLine(pos + Amg::intersect<3>(pos,dir,Amg::Vector3D::UnitZ(), lowEnd).value_or(0.)* dir,
78 pos + Amg::intersect<3>(pos,dir,Amg::Vector3D::UnitZ(), highEnd).value_or(0.)* dir,
79 color, lineStyle, view);
80 }
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
std::pair< Amg::Vector3D, Amg::Vector3D > makeLine(const Parameters &pars)
Returns the parsed parameters into an Eigen line parametrization.
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.

◆ drawLumiSqrtS()

std::unique_ptr< TLatex > MuonValR4::drawLumiSqrtS ( const double xPos,
const double yPos,
const std::string_view sqrtS = "14",
const std::string_view lumi = "" )

Create a luminosity sqrtS label.

Parameters
xPosx-position of the label on the Canvas
yPosy-position of the label on the Canvas
sqrtSCentre of mass energy [TeV]
Luminosity FunctionsLuminosity [fb^{-1}]. If less <0 not drawn

Definition at line 101 of file VisualizationHelpers.cxx.

104 {
105 return drawLabel(std::format("#sqrt{{s}}={0} TeV {1}{2}", sqrtS, lumi, lumi.empty() ? "" : "fb^{-1}"), xPos, yPos);
106 }

◆ drawMeasurement()

void MuonValR4::drawMeasurement ( const ActsTrk::GeometryContext & gctx,
const xAOD::UncalibratedMeasurement * meas,
Acts::ObjVisualization3D & visualHelper,
const Acts::ViewConfig & viewConfig = Acts::s_viewSensitive )

Draw an uncalibrated measurement inside the obj file.

The measurement is translated to a temporary surface with adapted position & boundaries (e.g. drift radius or measurement uncertainty)

Parameters
gctxGeometry context needed to fetch the positions of the surface
measPointer to the muon measurement to visualize
vsualHelperObj helper to which the measurement is appended.
viewConfigConfiguration style of the drawn measurement

Combined pseudo measurement

Check whether the measurement is a phi measurement or not

2D RPC or sTGC pad

Definition at line 129 of file ObjVisualizationHelpers.cxx.

132 {
133
135 const Acts::Surface& surf{*surfAcc.get(meas)};
136 const Acts::GeometryContext tgContext = gctx.context();
137 const auto& bounds = surf.bounds();
139 const auto& lBounds = static_cast<const Acts::LineBounds&>(bounds);
140 const auto* driftCirc = static_cast<const xAOD::MdtDriftCircle*>(meas);
141 const double dR = driftCirc->driftRadius();
142 const double hZ = driftCirc->numDimensions() == 1 ?
143 lBounds.get(Acts::LineBounds::eHalfLengthZ) :
144 std::sqrt(meas->localCovariance<2>()(1,1));
145 auto newBounds = std::make_unique<Acts::LineBounds>(dR, hZ);
146 auto dummySurface = Acts::Surface::makeShared<Acts::StrawSurface>(surf.localToGlobalTransform(tgContext)*
147 Amg::getTranslate3D(driftCirc->localMeasurementPos()),
148 std::move(newBounds));
149 Acts::GeometryView3D::drawSurface(visualHelper, *dummySurface, tgContext,
150 Amg::Transform3D::Identity(), viewConfig);
151 return;
152 }
153 double dX{0.}, dY{0.};
154 Amg::Vector3D locPos{Amg::Vector3D::Zero()};
155 switch (meas->numDimensions()) {
157 case 0:{
158 const auto* cmbMeas = static_cast<const xAOD::CombinedMuonStrip*>(meas);
159 dX = std::sqrt(cmbMeas->localCovariance<2>()(0,0));
160 dY = std::sqrt(cmbMeas->localCovariance<2>()(1,1));
161 locPos.block<2,1>(0,0) = xAOD::toEigen(cmbMeas->localPosition<2>());
162 break;
163 } case 1:{
166 const auto* rpcClus = static_cast<const xAOD::RpcMeasurement*>(meas);
167 locPos = rpcClus->localMeasurementPos();
168 dX = rpcClus->measuresPhi() ? 0.5* rpcClus->readoutElement()->stripPhiLength()
169 : std::sqrt(rpcClus->localCovariance<1>()(0,0));
170 dY = rpcClus->measuresPhi() ? std::sqrt(rpcClus->localCovariance<1>()(0,0))
171 : 0.5* rpcClus->readoutElement()->stripEtaLength();
172 } else if (meas->type() == xAOD::UncalibMeasType::TgcStripType) {
173 const auto* tgcClus = static_cast<const xAOD::TgcStrip*>(meas);
174 const MuonGMR4::TgcReadoutElement* re = tgcClus->readoutElement();
175 const auto& stripLay = re->sensorLayout(tgcClus->measurementHash());
176 locPos = tgcClus->localMeasurementPos();
177 dX = tgcClus->measuresPhi() ? 0.5* stripLay->design(true).stripLength(tgcClus->channelNumber())
178 : std::sqrt(tgcClus->localCovariance<1>()(0,0));
179 dY = tgcClus->measuresPhi() ? std::sqrt(tgcClus->localCovariance<1>()(0,0))
180 : 0.5* stripLay->design(false).stripLength(tgcClus->channelNumber());
181 } else if (meas->type() == xAOD::UncalibMeasType::MMClusterType) {
182 const auto* mmClust = static_cast<const xAOD::MMCluster*>(meas);
183 locPos = mmClust->localMeasurementPos();
184 dX = std::sqrt(mmClust->localCovariance<1>()(0,0));
185 dY = 0.5* mmClust->readoutElement()->stripLength(mmClust->measurementHash());
186 } else if(meas->type() == xAOD::UncalibMeasType::sTgcStripType) {
187 const auto* sTgcClus = static_cast<const xAOD::sTgcMeasurement*>(meas);
188 locPos = sTgcClus->localMeasurementPos();
189 if (sTgcClus->channelType() == sTgcIdHelper::sTgcChannelTypes::Strip){
190 dX = std::sqrt(sTgcClus->localCovariance<1>()(0,0));
191 dY = 0.5* sTgcClus->readoutElement()->stripDesign(sTgcClus->measurementHash()).stripLength(sTgcClus->channelNumber());
192 } else if (sTgcClus->channelType() == sTgcIdHelper::sTgcChannelTypes::Wire) {
193 dY = std::sqrt(sTgcClus->localCovariance<1>()(0,0));
194 dX = 0.5*sTgcClus->readoutElement()->wireDesign(sTgcClus->measurementHash()).stripLength(sTgcClus->channelNumber());
195 }
196 } else if (meas->type() == xAOD::UncalibMeasType::Other) {
197 const auto* pseudo = static_cast<const xAOD::AuxiliaryMeasurement*>(meas);
198 using ProjectorType = xAOD::AuxiliaryMeasurement::ProjectorType;
199 constexpr double measLength = 1._m;
200 if (pseudo->calibProjector() == ProjectorType::e1DimNoTime) {
201 dX = std::sqrt(meas->localCovariance<1>()(0,0));
202 dY = measLength;
203 } else if (pseudo->calibProjector() == ProjectorType::e1DimRotNoTime) {
204 dY = std::sqrt(meas->localCovariance<1>()(0,0));
205 dX = measLength;
206 }
207 }
208 break;
209 }
211 case 2:{
212 locPos.block<2,1>(0, 0) = xAOD::toEigen(meas->localPosition<2>());
213 dX = std::sqrt(meas->localCovariance<2>()(0,0));
214 dY = std::sqrt(meas->localCovariance<2>()(1,1));
215 break;
216 }
217 }
218
219 std::shared_ptr<Acts::Surface> dummySurf{};
220
221 if (surf.type() == Acts::Surface::SurfaceType::Straw) {
222 auto newBounds = std::make_unique<Acts::LineBounds>(dX, dY);
223 dummySurf = Acts::Surface::makeShared<Acts::StrawSurface>(surf.localToGlobalTransform(tgContext)*
224 Amg::getTranslate3D(locPos),
225 std::move(newBounds));
226
227 } else {
228 auto newBounds = std::make_unique<Acts::RectangleBounds>(dX, dY);
229 dummySurf = Acts::Surface::makeShared<Acts::PlaneSurface>(surf.localToGlobalTransform(tgContext)*
230 Amg::getTranslate3D(locPos),
231 std::move(newBounds));
232
233 }
234 Acts::GeometryView3D::drawSurface(visualHelper, *dummySurf, tgContext,
235 Amg::Transform3D::Identity(), viewConfig);
236 }
const boost::regex re(r_e)
Helper class to access the Acts::surface associated with an Uncalibrated xAOD measurement.
const Acts::Surface * get(const xAOD::UncalibratedMeasurement *meas) const
Operator.
const StripLayerPtr & sensorLayout(const IdentifierHash &hash) const
Returns the pointer to the strip layer associated with the gas gap.
ActsTrk::detail::MeasurementCalibratorBase::ProjectorType ProjectorType
Use the calibration projector.
Amg::Vector3D localMeasurementPos() const override final
Returns the local measurement position as 3-vector.
float driftRadius() const
Returns the drift radius.
Amg::Vector3D localMeasurementPos() const override final
Returns the local position of the measurement.
const MuonGMR4::TgcReadoutElement * readoutElement() const override final
Retrieve the associated TgcReadoutElement.
ConstMatrixMap< N > localCovariance() const
Returns the local covariance of the measurement.
ConstVectorMap< N > localPosition() const
Returns the local position of the measurement.
virtual unsigned int numDimensions() const =0
Returns the number of dimensions of the measurement.
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
Amg::Vector3D localMeasurementPos() const override final
Returns the local measurement position as 3-vector.
Amg::Transform3D getTranslate3D(const double X, const double Y, const double Z)
: Returns a shift transformation along an arbitrary axis
AuxiliaryMeasurement_v1 AuxiliaryMeasurement
MdtDriftCircle_v1 MdtDriftCircle
TgcStrip_v1 TgcStrip
Definition TgcStripFwd.h:9
RpcMeasurement_v1 RpcMeasurement
MMCluster_v1 MMCluster
sTgcMeasurement_v1 sTgcMeasurement
CombinedMuonStrip_v1 CombinedMuonStrip

◆ drawPropagation()

void MuonValR4::drawPropagation ( const std::vector< Acts::detail::Step > & steps,
Acts::ObjVisualization3D & visualHelper,
const Acts::ViewConfig & viewConfig = Acts::s_viewLine )

Draws the recorded propagation steps as a polygon line.

Parameters
stepList of steps to draw
vsualHelperObj helper to which the drawn trajectory is appended
viewConfigConfiguration style of the drawn polygon.

Definition at line 40 of file ObjVisualizationHelpers.cxx.

42 {
43
44 if (steps.empty()) {
45 return;
46 }
47 Amg::Vector3D start = steps.front().position;
48 for (std::size_t s = 1; s < steps.size(); ++s) {
49 Amg::Vector3D end = steps[s].position;
50 if ( (end - start).mag() > Acts::s_epsilon){
51 Acts::GeometryView3D::drawSegment(visualHelper, start, end, viewConfig);
52 start = std::move(end);
53 }
54
55 }
56 }
Scalar mag() const
mag method

◆ drawSegmentLine() [1/2]

void MuonValR4::drawSegmentLine ( const ActsTrk::GeometryContext & gctx,
const MuonR4::Segment & segment,
Acts::ObjVisualization3D & visualHelper,
const Acts::ViewConfig & viewConfig = Acts::s_viewLine )

Draw a segment line inside the obj file.

IThe first and last surface positions are used to determine the length of the segment.

Parameters
gctxGeometry context needed to fetch the positions of the first & last measurement
segmentThe segment which is meant to draw
vsualHelperObj helper to which the segment is appended.
viewConfigConfiguration style of the drawn line

Take the local z component of the local to global transform as plane normal

Create the intersections

Definition at line 57 of file ObjVisualizationHelpers.cxx.

60 {
62 const Amg::Transform3D& locToGlob = segment.msSector()->localToGlobalTransform(gctx);
63 const Amg::Vector3D firstSurfPos = locToGlob*segment.measurements().front()->localPosition();
64 const Amg::Vector3D lastSurfPos = locToGlob*segment.measurements().back()->localPosition();
65 const Amg::Vector3D planeNorm = locToGlob.linear().col(2);
67 const auto firstPlaneIsect = intersectPlane(segment.position(), segment.direction(),
68 planeNorm, firstSurfPos);
69 const auto lastPlaneIsect = intersectPlane(segment.position(), segment.direction(),
70 planeNorm, lastSurfPos);
71
72 Acts::GeometryView3D::drawSegment(visualHelper,
73 segment.position() + firstPlaneIsect.pathLength() * segment.direction(),
74 segment.position() + lastPlaneIsect.pathLength() * segment.direction(),
75 viewConfig);
76 }
const Amg::Transform3D & localToGlobalTransform(const ActsTrk::GeometryContext &gctx) const
Returns the local -> global tarnsformation from the sector.
const MuonGMR4::SpectrometerSector * msSector() const
Returns the associated MS sector.
const MeasVec & measurements() const
Returns the associated measurements.
const Amg::Vector3D & position() const
Returns the global segment position.
const Amg::Vector3D & direction() const
Returns the global segment direction.
Eigen::Affine3d Transform3D

◆ drawSegmentLine() [2/2]

void MuonValR4::drawSegmentLine ( const ActsTrk::GeometryContext & gctx,
const xAOD::MuonSegment & segment,
Acts::ObjVisualization3D & visualHelper,
const Acts::ViewConfig & viewConfig = Acts::s_viewLine,
const double standardLength = 1.*Gaudi::Units::m )

Draw a segment line inside the obj file.

If the segment is a reconstructed segment and has associated measurements, then the first and last surface position are used to determine the length of the segment, otherwise the standard lenth is used.

Parameters
gctxGeometry context needed to fetch the positions of the first & last measurement
segmentThe segment which is meant to draw
vsualHelperObj helper to which the segment is appended.
viewConfigConfiguration style of the drawn line
standardLengthLength of the segment as a fallback solution

Take the local z component of the local to global transform as plane normal

Create the intersections

Definition at line 77 of file ObjVisualizationHelpers.cxx.

81 {
82
83 std::vector<const xAOD::UncalibratedMeasurement*> assocMeas = collectMeasurements(segment, false);
84 if (assocMeas.empty()){
85 Acts::GeometryView3D::drawSegment(visualHelper,
86 segment.position() - 0.5 * standardLength * segment.direction(),
87 segment.position() + 0.5 * standardLength * segment.direction(),
88 viewConfig);
89 return;
90 }
91 const xAOD::UncalibratedMeasurement* firstMeas = assocMeas.front()->type() != xAOD::UncalibMeasType::Other ?
92 assocMeas.front() : assocMeas[1];
93 const xAOD::UncalibratedMeasurement* lastMeas = assocMeas.back();
94
95 const Amg::Vector3D firstSurfPos = xAOD::muonSurface(firstMeas).center(gctx.context());
96 const Amg::Vector3D lastSurfPos = xAOD::muonSurface(lastMeas).center(gctx.context());
97
98 const Segment* detSeg = detailedSegment(segment);
100 const Amg::Vector3D planeNorm = detSeg->msSector()->localToGlobalTransform(gctx).linear().col(2);
102 const auto firstPlaneIsect = intersectPlane(segment.position(), segment.direction(),
103 planeNorm, firstSurfPos);
104 const auto lastPlaneIsect = intersectPlane(segment.position(), segment.direction(),
105 planeNorm, lastSurfPos);
106
107 Acts::GeometryView3D::drawSegment(visualHelper,
108 segment.position() + firstPlaneIsect.pathLength() * segment.direction(),
109 segment.position() + lastPlaneIsect.pathLength() * segment.direction(),
110 viewConfig);
111 }
Placeholder for what will later be the muon segment EDM representation.
Amg::Vector3D direction() const
Returns the direction as Amg::Vector.
Amg::Vector3D position() const
Returns the position as Amg::Vector.
std::vector< const xAOD::UncalibratedMeasurement * > collectMeasurements(const xAOD::MuonSegment &segment, bool skipOutlier=true)
Helper function to extract the measurements from the segment.
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
const Acts::Surface & muonSurface(const UncalibratedMeasurement *meas)
Returns the associated Acts surface to the measurement.
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.

◆ drawSegmentMeasurements() [1/2]

void MuonValR4::drawSegmentMeasurements ( const ActsTrk::GeometryContext & gctx,
const MuonR4::Segment & segment,
Acts::ObjVisualization3D & visualHelper,
const Acts::ViewConfig & viewConfig = Acts::s_viewSensitive )

Draw all uncalibrated measurements associated to the segment.


Parameters
gctxGeometry context needed to fetch the positions of the first & last measurement
segmentThe segment which from which the measurements are taken
vsualHelperObj helper to which the measurements are appended.
viewConfigConfiguration style of the drawn measurements

Definition at line 121 of file ObjVisualizationHelpers.cxx.

124 {
125 for (const auto& meas : segment.measurements()) {
126 drawSpacePoint(gctx, *meas, segment.msSector(), visualHelper, viewConfig);
127 }
128 }
void drawSpacePoint(const ActsTrk::GeometryContext &gctx, const MuonR4::SpacePoint &spacePoint, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
Draw an uncalibrated space point inside the obj file.

◆ drawSegmentMeasurements() [2/2]

void MuonValR4::drawSegmentMeasurements ( const ActsTrk::GeometryContext & gctx,
const xAOD::MuonSegment & segment,
Acts::ObjVisualization3D & visualHelper,
const Acts::ViewConfig & viewConfig = Acts::s_viewSensitive )

Draw all uncalibrated measurements associated to the segment.


Parameters
gctxGeometry context needed to fetch the positions of the first & last measurement
segmentThe segment which from which the measurements are taken
vsualHelperObj helper to which the measurements are appended.
viewConfigConfiguration style of the drawn measurements

Definition at line 112 of file ObjVisualizationHelpers.cxx.

115 {
116 std::vector<const xAOD::UncalibratedMeasurement*> assocMeas = collectMeasurements(segment, false);
117 for (const xAOD::UncalibratedMeasurement* meas : assocMeas){
118 drawMeasurement(gctx, meas, visualHelper, viewConfig);
119 }
120 }
void drawMeasurement(const ActsTrk::GeometryContext &gctx, const xAOD::UncalibratedMeasurement *meas, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
Draw an uncalibrated measurement inside the obj file.

◆ drawSpacePoint() [1/2]

void MuonValR4::drawSpacePoint ( const ActsTrk::GeometryContext & gctx,
const MuonR4::CalibratedSpacePoint & spacePoint,
const MuonGMR4::SpectrometerSector * msSector,
Acts::ObjVisualization3D & visualHelper,
const Acts::ViewConfig & viewConfig = Acts::s_viewSensitive )

Draw a calibrated space point inside the obj file.

Ordinary measurements are forwarded to the uncalibrated case and the auxiliary beamspot constraint is handled extra

Parameters
gctxGeometry context needed to fetch the positions of the surface
spacePointReference to the space point to visualize
msSectorPointer to the associated msSector (Fetch the transform for the auxiliaries)
vsualHelperObj helper to which the measurement is appended.
viewConfigConfiguration style of the drawn measurement

Definition at line 265 of file ObjVisualizationHelpers.cxx.

269 {
270 if (spacePoint.type() != xAOD::UncalibMeasType::Other) {
271 drawSpacePoint(gctx, *spacePoint.spacePoint(), visualHelper, viewConfig);
272 return;
273 }
274 const Amg::Transform3D& locToGlob = msSector->localToGlobalTransform(gctx);
275 if (spacePoint.isStraw()) {
276 const double dR = std::sqrt(spacePoint.covariance()[Acts::toUnderlying(CovIdx::etaCov)]);
277 const double hZ = std::sqrt(spacePoint.covariance()[Acts::toUnderlying(CovIdx::phiCov)]);
278 auto bounds = std::make_unique<Acts::LineBounds>(dR, hZ);
279 const Amg::Transform3D trf = locToGlob * Amg::getTranslate3D(spacePoint.localPosition());
280 auto surface = Acts::Surface::makeShared<Acts::StrawSurface>(trf, std::move(bounds));
281 Acts::GeometryView3D::drawSurface(visualHelper, *surface, gctx.context());
282 } else {
283 const double dX = std::sqrt(spacePoint.covariance()[Acts::toUnderlying(CovIdx::phiCov)]);
284 const double dY = std::sqrt(spacePoint.covariance()[Acts::toUnderlying(CovIdx::etaCov)]);
285 auto bounds = std::make_unique<Acts::RectangleBounds>(dX, dY);
286 const Acts::Transform3 trf = locToGlob * Amg::getTranslate3D(spacePoint.localPosition());
287 auto surf = Acts::Surface::makeShared<Acts::PlaneSurface>(trf, std::move(bounds));
288 Acts::GeometryView3D::drawSurface(visualHelper, *surf, gctx.context());
289 }
290 }
const Amg::Vector3D & localPosition() const
bool isStraw() const
Returns whether the measurement is a Mdt.
const SpacePoint * spacePoint() const
The pointer to the space point out of which this space point has been built.
xAOD::UncalibMeasType type() const
Returns the space point type.
const Cov_t & covariance() const
Returns the covariance array.

◆ drawSpacePoint() [2/2]

void MuonValR4::drawSpacePoint ( const ActsTrk::GeometryContext & gctx,
const MuonR4::SpacePoint & spacePoint,
Acts::ObjVisualization3D & visualHelper,
const Acts::ViewConfig & viewConfig = Acts::s_viewSensitive )

Draw an uncalibrated space point inside the obj file.

A Spacepoint consisting of two 1D measurements is translated ino a small rectangle. Otherwise the request is forwarded to draw an uncalibrated measurement.

Parameters
gctxGeometry context needed to fetch the positions of the surface
spacePointReference to the space point to visualize
vsualHelperObj helper to which the measurement is appended.
viewConfigConfiguration style of the drawn measurement

Definition at line 247 of file ObjVisualizationHelpers.cxx.

250 {
251 if (spacePoint.dimension() == 2 && !spacePoint.isStraw() &&
252 spacePoint.primaryMeasurement() != spacePoint.secondaryMeasurement()) {
253 const Amg::Transform3D& locToGlob = spacePoint.msSector()->localToGlobalTransform(gctx);
254 const double dX = std::sqrt(spacePoint.covariance()[Acts::toUnderlying(CovIdx::phiCov)]);
255 const double dY = std::sqrt(spacePoint.covariance()[Acts::toUnderlying(CovIdx::etaCov)]);
256 auto bounds = std::make_unique<Acts::RectangleBounds>(dX, dY);
257 const Acts::Transform3 trf = locToGlob * Amg::getTranslate3D(spacePoint.localPosition());
258 auto surf = Acts::Surface::makeShared<Acts::PlaneSurface>(trf, std::move(bounds));
259 Acts::GeometryView3D::drawSurface(visualHelper, *surf, gctx.context());
260 } else {
261 drawMeasurement(gctx, spacePoint.primaryMeasurement(),
262 visualHelper, viewConfig);
263 }
264 }
const Cov_t & covariance() const
Returns the covariance array.
unsigned dimension() const
Is the space point a 1D or combined 2D measurement.
bool isStraw() const
Returns whether the measurement is a Mdt.

◆ ensureDirectory()

void MuonValR4::ensureDirectory ( const std::string & path)

Ensures that the subdirectory in the path is created.

Parameters
pathReference to the path from which the directory is to be craeted

Definition at line 17 of file FileHelpers.cxx.

17 {
18 const std::string dir = path.substr(0, path.rfind("/"));
19 if (dir.rfind("/") != std::string::npos){
20 ensureDirectory(dir);
21 } else if (dir.empty()) {
22 return;
23 }
24 if (!std::filesystem::is_directory(dir) && !std::filesystem::create_directory(dir)) {
25 THROW_EXCEPTION("Failed to create "<<dir);
26 }
27 }
void ensureDirectory(const std::string &path)
Ensures that the subdirectory in the path is created.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

◆ isInPattern()

bool MuonValR4::isInPattern ( const SpacePoint * sp,
const StIndex station,
const GlobalPattern & pattern )

Definition at line 47 of file MuonFastRecoTester.cxx.

49 {
50 for (const SpacePoint* hit : pattern.hitsInStation(station)) {
51 if (hit == sp) return true;
52 }
53 return false;
54 };
static Double_t sp
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...

◆ isTruthMatched()

std::optional< std::size_t > MuonValR4::isTruthMatched ( const xAOD::MuonMeasurement & meas,
const TruthParticleMap & truthHits )

Definition at line 31 of file MuonFastRecoTester.cxx.

32 {
33 const xAOD::MuonSimHit* hit {getTruthMatchedHit(meas)};
34 if (!hit) return std::nullopt;
35 std::size_t idx{0};
36 for (const auto& [tp, truthHitSets] : truthHits) {
37 for (const simHitSet& truthHitSet : truthHitSets) {
38 if (truthHitSet.count(hit)) {
39 if (tp) return idx;
40 else return truthHits.size(); // Pileup muon
41 }
42 }
43 if (tp) ++idx;
44 }
45 return std::nullopt;
46 };
const xAOD::MuonSimHit * getTruthMatchedHit(const xAOD::MuonMeasurement &prdHit)
Returns the MuonSimHit, if there's any, matched to the uncalibrated muon measurement.
std::unordered_set< const xAOD::MuonSimHit * > simHitSet
MuonSimHit_v1 MuonSimHit
Defined the version of the MuonSimHit.
Definition MuonSimHit.h:12

◆ nameBr()

std::string MuonValR4::nameBr ( Category cat,
Status status,
LayerIndex layer,
bool isSmall )
inline

Definition at line 16 of file TrackSummaryModule.cxx.

17 {
18 std::string lName = layerName(layer);
19 lName[0] = std::tolower(lName[0]);
20 return std::format("{:}{:}{:}{:}",
21 lName, (isSmall ? "Small" :"Large"), cat,
22 (status == Status::OnTrack ? std::string{"Hits"}
23 : HitSummary::toString(status) +"s"));
24 }
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
static std::string toString(const HitCategory c)
Converts the hit category to a string.

◆ removeNonAlphaNum()

std::string MuonValR4::removeNonAlphaNum ( std::string str)

Removes all non-alpha numerical characters from a string.

Definition at line 10 of file FileHelpers.cxx.

10 {
11 str.erase(std::remove_if(str.begin(),str.end(),
12 [](const unsigned char c){
13 return !std::isalnum(c);
14 }), str.end());
15 return str;
16 }
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.

◆ seedColorIdx()

int MuonValR4::seedColorIdx ( std::size_t iSeed)

Definition at line 80 of file TrackVisualizationTool.cxx.

80 {
81 // Golden ratio hue stepping -> good spread even for many seeds
82 constexpr double phi = 0.6180339887498949;
83 const double h = 360 * std::fmod(0.13 + phi * double(iSeed), 1.0); // [0,1)
84 constexpr double s = 0.75;
85 constexpr double v = 0.95;
86
87 float r=0.f, g=0.f, b=0.f;
88 TColor::HLS2RGB(h, s, v, r, g, b);
89 return TColor::GetColor(r, g, b);
90 }
Scalar phi() const
phi method
int r
Definition globals.cxx:22

Variable Documentation

◆ fullFilling

int MuonValR4::fullFilling = 1001
constexpr

Definition at line 24 of file VisualizationHelpers.h.

◆ hatchedFilling

int MuonValR4::hatchedFilling = 3344
constexpr

Definition at line 25 of file VisualizationHelpers.h.

◆ hollowFilling

int MuonValR4::hollowFilling = 0
constexpr

Filling codes for hollow / fullFilling / hatched filling.

Definition at line 23 of file VisualizationHelpers.h.

◆ objViewEta

int MuonValR4::objViewEta = Acts::toUnderlying(MuonR4::SegmentFit::AxisDefs::etaCov)
constexpr

ObjectView.

Definition at line 28 of file VisualizationHelpers.h.

◆ objViewPhi

int MuonValR4::objViewPhi = Acts::toUnderlying(MuonR4::SegmentFit::AxisDefs::phiCov)
constexpr

Definition at line 29 of file VisualizationHelpers.h.

◆ s_nStations

std::size_t MuonValR4::s_nStations {Acts::toUnderlying(StIndex::StIndexMax)}
constexpr

Definition at line 28 of file MuonFastRecoTester.cxx.

28{Acts::toUnderlying(StIndex::StIndexMax)};