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  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  MdtDriftCircleVariables
class  MdtTwinDriftCircleVariables
class  MmClusterVariables
class  MsTrackTester
class  MuonHitTesterAlg
class  MuonHoughTransformTester
class  MuonRecoChainTester
class  MuonSPCalibrationTest
class  PatternVisualizationTool
class  RootVisualizationService
 Implementation of the IRootVisualization service. More...
class  RpcMeasurementVariables
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  SimHitTester
class  SpacePointTesterModule
class  TesterModuleBase
class  TgcStripVariables
class  TrackContainerModule
class  TrackSummaryModule
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  TrackVisualizationTool
class  xMuonHitAnalysis

Typedefs

using ObjectMatching = MuonHoughTransformTester::ObjectMatching
using simHitSet = std::unordered_set<const xAOD::MuonSimHit*>
using LabeledSegmentSet = PatternVisualizationTool::LabeledSegmentSet
using Category = MuonR4::HitSummary::HitCategory
using Status = MuonR4::HitSummary::Status
using ICanvasObject = RootVisualizationService::ICanvasObject

Functions

unsigned int countMatched (const simHitSet &truthHits, const simHitSet &recoHits)
unsigned int countMatched (const xAOD::MuonSegment *truthSeg, const MuonR4::SegmentSeed *seed)
unsigned int countMatched (const xAOD::MuonSegment *truthSeg, const MuonR4::Segment *segment)
template<class SpType>
bool isPrecHit (const SpType &sp)
 Define a spacepoint as precision hit if it's a Mdt or NSW eta hit.
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 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 MuonHoughTransformTester.cxx.

◆ Status

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 }

◆ countMatched() [1/3]

unsigned int MuonValR4::countMatched ( const simHitSet & truthHits,
const simHitSet & recoHits )

Definition at line 30 of file MuonHoughTransformTester.cxx.

31 {
32 unsigned int matched{0};
33 for (const xAOD::MuonSimHit* reco : recoHits) {
34 matched += truthHits.count(reco);
35 }
36 return matched;
37 }
MuonSimHit_v1 MuonSimHit
Defined the version of the MuonSimHit.
Definition MuonSimHit.h:12

◆ countMatched() [2/3]

unsigned int MuonValR4::countMatched ( const xAOD::MuonSegment * truthSeg,
const MuonR4::Segment * segment )

Definition at line 42 of file MuonHoughTransformTester.cxx.

43 {
44 return truthSeg ? countMatched(getMatchingSimHits(*truthSeg), getMatchingSimHits(*segment)) : 0;
45 }
std::unordered_set< const xAOD::MuonSimHit * > getMatchingSimHits(const xAOD::MuonSegment &segment)
: Returns all sim hits matched to a xAOD::MuonSegment
unsigned int countMatched(const simHitSet &truthHits, const simHitSet &recoHits)

◆ countMatched() [3/3]

unsigned int MuonValR4::countMatched ( const xAOD::MuonSegment * truthSeg,
const MuonR4::SegmentSeed * seed )

Definition at line 38 of file MuonHoughTransformTester.cxx.

39 {
40 return truthSeg ? countMatched(getMatchingSimHits(*truthSeg), getMatchingSimHits(*seed)) : 0;
41 }

◆ 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 231 of file ObjVisualizationHelpers.cxx.

235 {
236 const Amg::Vector3D globPos = pars.position(gctx.context());
237 const Amg::Vector3D start = globPos - 0.5 * standardLength * pars.direction();
238 const Amg::Vector3D end = globPos + 0.5 * standardLength * pars.direction();
239 Acts::GeometryView3D::drawSegment(visualHelper, start, end, viewConfig);
240 }
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]
lumiLuminosity [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 126 of file ObjVisualizationHelpers.cxx.

129 {
130
131 const Acts::Surface& surf = xAOD::muonSurface(meas);
132 const Acts::GeometryContext tgContext = gctx.context();
133 const auto& bounds = surf.bounds();
135 const auto& lBounds = static_cast<const Acts::LineBounds&>(bounds);
136 const auto* driftCirc = static_cast<const xAOD::MdtDriftCircle*>(meas);
137 const double dR = driftCirc->driftRadius();
138 const double hZ = driftCirc->numDimensions() == 1 ?
139 lBounds.get(Acts::LineBounds::eHalfLengthZ) :
140 std::sqrt(meas->localCovariance<2>()(1,1));
141 auto newBounds = std::make_unique<Acts::LineBounds>(dR, hZ);
142 auto dummySurface = Acts::Surface::makeShared<Acts::StrawSurface>(surf.localToGlobalTransform(tgContext)*
143 Amg::getTranslate3D(driftCirc->localMeasurementPos()),
144 std::move(newBounds));
145 Acts::GeometryView3D::drawSurface(visualHelper, *dummySurface, tgContext,
146 Amg::Transform3D::Identity(), viewConfig);
147 return;
148 }
149 double dX{0.}, dY{0.};
150 Amg::Vector3D locPos{Amg::Vector3D::Zero()};
151 switch (meas->numDimensions()) {
153 case 0:{
154 const auto* cmbMeas = static_cast<const xAOD::CombinedMuonStrip*>(meas);
155 if(cmbMeas->primaryStrip()->type() == xAOD::UncalibMeasType::sTgcStripType){
156 // combined stgc space points can be strip/wire, strip/pad or pad/wire combinations.
157 const auto* primMeas = static_cast<const xAOD::sTgcMeasurement*>(cmbMeas->primaryStrip());
158 const auto* secMeas = static_cast<const xAOD::sTgcMeasurement*>(cmbMeas->secondaryStrip());
159 if(primMeas->channelType() == sTgcIdHelper::sTgcChannelTypes::Strip){
160 locPos[Amg::x] = primMeas->localPosition<1>()[0];
161 dX = std::sqrt(primMeas->localCovariance<1>()(0,0));
162 } else if (primMeas->channelType() == sTgcIdHelper::sTgcChannelTypes::Pad) {
163 locPos[Amg::x] = primMeas->localPosition<2>()[0];
164 dX = std::sqrt(primMeas->localCovariance<2>()(0,0));
165 }
166 if(secMeas->channelType() == sTgcIdHelper::sTgcChannelTypes::Wire){
167 locPos[Amg::y] = secMeas->localPosition<1>()[0];
168 dY = std::sqrt(secMeas->localCovariance<1>()(0,0));
169 } else if (secMeas->channelType() == sTgcIdHelper::sTgcChannelTypes::Pad) {
170 locPos[Amg::y] = secMeas->localPosition<2>()[1];
171 dY = std::sqrt(secMeas->localCovariance<2>()(1,1));
172 }
173 break;
174 }
175 locPos[Amg::x] = cmbMeas->primaryStrip()->localPosition<1>()[0];
176 locPos[Amg::y] = cmbMeas->secondaryStrip()->localPosition<1>()[0];
177 dX = std::sqrt(cmbMeas->primaryStrip()->localCovariance<1>()(0,0));
178 dY = std::sqrt(cmbMeas->secondaryStrip()->localCovariance<1>()(0,0));
179 break;
180 } case 1:{
183 const auto* rpcClus = static_cast<const xAOD::RpcMeasurement*>(meas);
184 locPos = rpcClus->localMeasurementPos();
185 dX = rpcClus->measuresPhi() ? 0.5* rpcClus->readoutElement()->stripPhiLength()
186 : std::sqrt(rpcClus->localCovariance<1>()(0,0));
187 dY = rpcClus->measuresPhi() ? std::sqrt(rpcClus->localCovariance<1>()(0,0))
188 : 0.5* rpcClus->readoutElement()->stripEtaLength();
189 } else if (meas->type() == xAOD::UncalibMeasType::TgcStripType) {
190 const auto* tgcClus = static_cast<const xAOD::TgcStrip*>(meas);
191 const MuonGMR4::TgcReadoutElement* re = tgcClus->readoutElement();
192 const auto& stripLay = re->sensorLayout(tgcClus->measurementHash());
193 locPos = tgcClus->localMeasurementPos();
194 dX = tgcClus->measuresPhi() ? 0.5* stripLay->design(true).stripLength(tgcClus->channelNumber())
195 : std::sqrt(tgcClus->localCovariance<1>()(0,0));
196 dY = tgcClus->measuresPhi() ? std::sqrt(tgcClus->localCovariance<1>()(0,0))
197 : 0.5* stripLay->design(false).stripLength(tgcClus->channelNumber());
198 } else if (meas->type() == xAOD::UncalibMeasType::MMClusterType) {
199 const auto* mmClust = static_cast<const xAOD::MMCluster*>(meas);
200 locPos = mmClust->localMeasurementPos();
201 dX = std::sqrt(mmClust->localCovariance<1>()(0,0));
202 dY = 0.5* mmClust->readoutElement()->stripLength(mmClust->measurementHash());
203 } else if(meas->type() == xAOD::UncalibMeasType::sTgcStripType) {
204 const auto* sTgcClus = static_cast<const xAOD::sTgcMeasurement*>(meas);
205 locPos = sTgcClus->localMeasurementPos();
206 if (sTgcClus->channelType() == sTgcIdHelper::sTgcChannelTypes::Strip){
207 dX = std::sqrt(sTgcClus->localCovariance<1>()(0,0));
208 dY = 0.5* sTgcClus->readoutElement()->stripDesign(sTgcClus->measurementHash()).stripLength(sTgcClus->channelNumber());
209 } else if (sTgcClus->channelType() == sTgcIdHelper::sTgcChannelTypes::Wire) {
210 dY = std::sqrt(sTgcClus->localCovariance<1>()(0,0));
211 dX = 0.5*sTgcClus->readoutElement()->wireDesign(sTgcClus->measurementHash()).stripLength(sTgcClus->channelNumber());
212 }
213 }
214 break;
215 }
217 case 2:{
218 locPos.block<2,1>(0, 0) = xAOD::toEigen(meas->localPosition<2>());
219 dX = std::sqrt(meas->localCovariance<2>()(0,0));
220 dY = std::sqrt(meas->localCovariance<2>()(1,1));
221 break;
222 }
223 }
224 auto newBounds = std::make_unique<Acts::RectangleBounds>(dX, dY);
225 auto dummySurf = Acts::Surface::makeShared<Acts::PlaneSurface>(surf.localToGlobalTransform(tgContext)*
226 Amg::getTranslate3D(locPos),
227 std::move(newBounds));
228 Acts::GeometryView3D::drawSurface(visualHelper, *dummySurf, tgContext,
229 Amg::Transform3D::Identity(), viewConfig);
230 }
const boost::regex re(r_e)
const StripLayerPtr & sensorLayout(const IdentifierHash &hash) const
Returns the pointer to the strip layer associated with the gas gap.
const xAOD::UncalibratedMeasurement * primaryStrip() const
Returns the primary associated measurement.
Amg::Vector3D localMeasurementPos() const
Returns the local measurement position as 3-vector.
Amg::Vector3D localMeasurementPos() const
Returns the local position of the measurement.
const MuonGMR4::TgcReadoutElement * readoutElement() const
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
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
MdtDriftCircle_v1 MdtDriftCircle
TgcStrip_v1 TgcStrip
Definition TgcStripFwd.h:9
const Acts::Surface & muonSurface(const UncalibratedMeasurement *meas)
Returns the associated Acts surface to the measurement.
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 37 of file ObjVisualizationHelpers.cxx.

39 {
40
41 if (steps.empty()) {
42 return;
43 }
44 Amg::Vector3D start = steps.front().position;
45 for (std::size_t s = 1; s < steps.size(); ++s) {
46 Amg::Vector3D end = steps[s].position;
47 if ( (end - start).mag() > Acts::s_epsilon){
48 Acts::GeometryView3D::drawSegment(visualHelper, start, end, viewConfig);
49 start = std::move(end);
50 }
51
52 }
53 }
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 54 of file ObjVisualizationHelpers.cxx.

57 {
59 const Amg::Transform3D& locToGlob = segment.msSector()->localToGlobalTransform(gctx);
60 const Amg::Vector3D firstSurfPos = locToGlob*segment.measurements().front()->localPosition();
61 const Amg::Vector3D lastSurfPos = locToGlob*segment.measurements().back()->localPosition();
62 const Amg::Vector3D planeNorm = locToGlob.linear().col(2);
64 const auto firstPlaneIsect = intersectPlane(segment.position(), segment.direction(),
65 planeNorm, firstSurfPos);
66 const auto lastPlaneIsect = intersectPlane(segment.position(), segment.direction(),
67 planeNorm, lastSurfPos);
68
69 Acts::GeometryView3D::drawSegment(visualHelper,
70 segment.position() + firstPlaneIsect.pathLength() * segment.direction(),
71 segment.position() + lastPlaneIsect.pathLength() * segment.direction(),
72 viewConfig);
73 }
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 74 of file ObjVisualizationHelpers.cxx.

78 {
79
80 std::vector<const xAOD::UncalibratedMeasurement*> assocMeas = collectMeasurements(segment, false);
81 if (assocMeas.empty()){
82 Acts::GeometryView3D::drawSegment(visualHelper,
83 segment.position() - 0.5 * standardLength * segment.direction(),
84 segment.position() + 0.5 * standardLength * segment.direction(),
85 viewConfig);
86 return;
87 }
88 const xAOD::UncalibratedMeasurement* firstMeas = assocMeas.front()->type() != xAOD::UncalibMeasType::Other ?
89 assocMeas.front() : assocMeas[1];
90 const xAOD::UncalibratedMeasurement* lastMeas = assocMeas.back();
91
92 const Amg::Vector3D firstSurfPos = xAOD::muonSurface(firstMeas).center(gctx.context());
93 const Amg::Vector3D lastSurfPos = xAOD::muonSurface(lastMeas).center(gctx.context());
94
95 const Segment* detSeg = detailedSegment(segment);
97 const Amg::Vector3D planeNorm = detSeg->msSector()->localToGlobalTransform(gctx).linear().col(2);
99 const auto firstPlaneIsect = intersectPlane(segment.position(), segment.direction(),
100 planeNorm, firstSurfPos);
101 const auto lastPlaneIsect = intersectPlane(segment.position(), segment.direction(),
102 planeNorm, lastSurfPos);
103
104 Acts::GeometryView3D::drawSegment(visualHelper,
105 segment.position() + firstPlaneIsect.pathLength() * segment.direction(),
106 segment.position() + lastPlaneIsect.pathLength() * segment.direction(),
107 viewConfig);
108 }
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.
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 118 of file ObjVisualizationHelpers.cxx.

121 {
122 for (const auto& meas : segment.measurements()) {
123 drawSpacePoint(gctx, *meas, segment.msSector(), visualHelper, viewConfig);
124 }
125 }
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 109 of file ObjVisualizationHelpers.cxx.

112 {
113 std::vector<const xAOD::UncalibratedMeasurement*> assocMeas = collectMeasurements(segment, false);
114 for (const xAOD::UncalibratedMeasurement* meas : assocMeas){
115 drawMeasurement(gctx, meas, visualHelper, viewConfig);
116 }
117 }
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 259 of file ObjVisualizationHelpers.cxx.

263 {
264 if (spacePoint.type() != xAOD::UncalibMeasType::Other) {
265 drawSpacePoint(gctx, *spacePoint.spacePoint(), visualHelper, viewConfig);
266 return;
267 }
268 const Amg::Transform3D& locToGlob = msSector->localToGlobalTransform(gctx);
269 if (spacePoint.isStraw()) {
270 const double dR = std::sqrt(spacePoint.covariance()[Acts::toUnderlying(CovIdx::etaCov)]);
271 const double hZ = std::sqrt(spacePoint.covariance()[Acts::toUnderlying(CovIdx::phiCov)]);
272 auto bounds = std::make_unique<Acts::LineBounds>(dR, hZ);
273 const Amg::Transform3D trf = locToGlob * Amg::getTranslate3D(spacePoint.localPosition());
274 auto surface = Acts::Surface::makeShared<Acts::StrawSurface>(trf, std::move(bounds));
275 Acts::GeometryView3D::drawSurface(visualHelper, *surface, gctx.context());
276 } else {
277 const double dX = std::sqrt(spacePoint.covariance()[Acts::toUnderlying(CovIdx::phiCov)]);
278 const double dY = std::sqrt(spacePoint.covariance()[Acts::toUnderlying(CovIdx::etaCov)]);
279 auto bounds = std::make_unique<Acts::RectangleBounds>(dX, dY);
280 const Acts::Transform3 trf = locToGlob * Amg::getTranslate3D(spacePoint.localPosition());
281 auto surf = Acts::Surface::makeShared<Acts::PlaneSurface>(trf, std::move(bounds));
282 Acts::GeometryView3D::drawSurface(visualHelper, *surf, gctx.context());
283 }
284 }
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 241 of file ObjVisualizationHelpers.cxx.

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

◆ 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

◆ isPrecHit()

template<class SpType>
bool MuonValR4::isPrecHit ( const SpType & sp)

Define a spacepoint as precision hit if it's a Mdt or NSW eta hit.

Definition at line 48 of file MuonHoughTransformTester.cxx.

48 {
51 (sp.type() == xAOD::UncalibMeasType::sTgcStripType && sp.measuresEta());
52 }
static Double_t sp

◆ 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"),
23 (status == Status::OnTrack ? std::string{"Hits"}
24 : HitSummary::toString(status) +"s"));
25 }
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 70 of file TrackVisualizationTool.cxx.

70 {
71 // Golden ratio hue stepping -> good spread even for many seeds
72 constexpr double phi = 0.6180339887498949;
73 const double h = 360 * std::fmod(0.13 + phi * double(iSeed), 1.0); // [0,1)
74 constexpr double s = 0.75;
75 constexpr double v = 0.95;
76
77 float r=0.f, g=0.f, b=0.f;
78 TColor::HLS2RGB(h, s, v, r, g, b);
79 return TColor::GetColor(r, g, b);
80 }
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.