21#include "Acts/Surfaces/detail/PlanarHelper.hpp"
22#include "Acts/Visualization/GeometryView3D.hpp"
23#include "Acts/Surfaces/StrawSurface.hpp"
24#include "Acts/Surfaces/LineBounds.hpp"
25#include "Acts/Surfaces/RectangleBounds.hpp"
26#include "Acts/Surfaces/TrapezoidBounds.hpp"
27#include "Acts/Surfaces/PlaneSurface.hpp"
28#include "Acts/Definitions/Units.hpp"
31using namespace Acts::PlanarHelper;
33using namespace Acts::UnitLiterals;
41 Acts::ObjVisualization3D& visualHelper,
42 const Acts::ViewConfig& viewConfig){
48 for (std::size_t s = 1; s < steps.size(); ++s) {
50 if ( (end - start).
mag() > Acts::s_epsilon){
51 Acts::GeometryView3D::drawSegment(visualHelper, start, end, viewConfig);
52 start = std::move(end);
59 Acts::ObjVisualization3D& visualHelper,
60 const Acts::ViewConfig& viewConfig) {
67 const auto firstPlaneIsect = intersectPlane(segment.
position(), segment.
direction(),
68 planeNorm, firstSurfPos);
69 const auto lastPlaneIsect = intersectPlane(segment.
position(), segment.
direction(),
70 planeNorm, lastSurfPos);
72 Acts::GeometryView3D::drawSegment(visualHelper,
79 Acts::ObjVisualization3D& visualHelper,
80 const Acts::ViewConfig& viewConfig ,
81 const double standardLength){
83 std::vector<const xAOD::UncalibratedMeasurement*> assocMeas =
collectMeasurements(segment,
false);
84 if (assocMeas.empty()){
85 Acts::GeometryView3D::drawSegment(visualHelper,
92 assocMeas.front() : assocMeas[1];
102 const auto firstPlaneIsect = intersectPlane(segment.
position(), segment.
direction(),
103 planeNorm, firstSurfPos);
104 const auto lastPlaneIsect = intersectPlane(segment.
position(), segment.
direction(),
105 planeNorm, lastSurfPos);
107 Acts::GeometryView3D::drawSegment(visualHelper,
114 Acts::ObjVisualization3D& visualHelper,
115 const Acts::ViewConfig& viewConfig) {
116 std::vector<const xAOD::UncalibratedMeasurement*> assocMeas =
collectMeasurements(segment,
false);
123 Acts::ObjVisualization3D& visualHelper,
124 const Acts::ViewConfig& viewConfig) {
131 Acts::ObjVisualization3D& visualHelper,
132 const Acts::ViewConfig& viewConfig) {
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);
141 const double dR = driftCirc->driftRadius();
142 const double hZ = driftCirc->numDimensions() == 1 ?
143 lBounds.get(Acts::LineBounds::eHalfLengthZ) :
145 auto newBounds = std::make_unique<Acts::LineBounds>(dR, hZ);
146 auto dummySurface = Acts::Surface::makeShared<Acts::StrawSurface>(surf.localToGlobalTransform(tgContext)*
148 std::move(newBounds));
149 Acts::GeometryView3D::drawSurface(visualHelper, *dummySurface, tgContext,
150 Amg::Transform3D::Identity(), viewConfig);
153 double dX{0.}, dY{0.};
160 dX = std::sqrt(locCov2D(0,0));
161 dY = std::sqrt(locCov2D(1,1));
162 locPos.block<2,1>(0,0) = locPos2D;
168 locPos = rpcClus->localMeasurementPos();
169 dX = rpcClus->measuresPhi() ? 0.5* rpcClus->readoutElement()->stripPhiLength()
170 : std::sqrt(rpcClus->localCovariance<1>()(0,0));
171 dY = rpcClus->measuresPhi() ? std::sqrt(rpcClus->localCovariance<1>()(0,0))
172 : 0.5* rpcClus->readoutElement()->stripEtaLength();
176 const auto& stripLay =
re->sensorLayout(tgcClus->measurementHash());
177 locPos = tgcClus->localMeasurementPos();
178 dX = tgcClus->measuresPhi() ? 0.5* stripLay->design(
true).stripLength(tgcClus->channelNumber())
179 : std::sqrt(tgcClus->localCovariance<1>()(0,0));
180 dY = tgcClus->measuresPhi() ? std::sqrt(tgcClus->localCovariance<1>()(0,0))
181 : 0.5* stripLay->design(
false).stripLength(tgcClus->channelNumber());
184 locPos = mmClust->localMeasurementPos();
185 dX = std::sqrt(mmClust->localCovariance<1>()(0,0));
186 dY = 0.5* mmClust->readoutElement()->stripLength(mmClust->measurementHash());
189 locPos = sTgcClus->localMeasurementPos();
191 dX = std::sqrt(sTgcClus->localCovariance<1>()(0,0));
192 dY = 0.5* sTgcClus->readoutElement()->stripDesign(sTgcClus->measurementHash()).stripLength(sTgcClus->channelNumber());
194 dY = std::sqrt(sTgcClus->localCovariance<1>()(0,0));
195 dX = 0.5*sTgcClus->readoutElement()->wireDesign(sTgcClus->measurementHash()).stripLength(sTgcClus->channelNumber());
200 constexpr double measLength = 1._m;
201 if (pseudo->calibProjector() == ProjectorType::e1DimNoTime) {
204 }
else if (pseudo->calibProjector() == ProjectorType::e1DimRotNoTime) {
213 locPos.block<2,1>(0, 0) = xAOD::toEigen(meas->
localPosition<2>());
220 std::shared_ptr<Acts::Surface> dummySurf{};
222 if (surf.type() == Acts::Surface::SurfaceType::Straw) {
223 auto newBounds = std::make_unique<Acts::LineBounds>(dX, dY);
224 dummySurf = Acts::Surface::makeShared<Acts::StrawSurface>(surf.localToGlobalTransform(tgContext)*
226 std::move(newBounds));
229 auto newBounds = std::make_unique<Acts::RectangleBounds>(dX, dY);
230 dummySurf = Acts::Surface::makeShared<Acts::PlaneSurface>(surf.localToGlobalTransform(tgContext)*
232 std::move(newBounds));
235 Acts::GeometryView3D::drawSurface(visualHelper, *dummySurf, tgContext,
236 Amg::Transform3D::Identity(), viewConfig);
239 const Acts::BoundTrackParameters& pars,
240 Acts::ObjVisualization3D& visualHelper,
241 const Acts::ViewConfig& viewConfig,
242 const double standardLength){
244 const Amg::Vector3D start = globPos - 0.5 * standardLength * pars.direction();
245 const Amg::Vector3D end = globPos + 0.5 * standardLength * pars.direction();
246 Acts::GeometryView3D::drawSegment(visualHelper, start, end, viewConfig);
250 Acts::ObjVisualization3D& visualHelper,
251 const Acts::ViewConfig& viewConfig) {
255 const double dX = std::sqrt(spacePoint.
covariance()[Acts::toUnderlying(CovIdx::phiCov)]);
256 const double dY = std::sqrt(spacePoint.
covariance()[Acts::toUnderlying(CovIdx::etaCov)]);
257 auto bounds = std::make_unique<Acts::RectangleBounds>(dX, dY);
259 auto surf = Acts::Surface::makeShared<Acts::PlaneSurface>(trf, std::move(bounds));
260 Acts::GeometryView3D::drawSurface(visualHelper, *surf, gctx.
context());
263 visualHelper, viewConfig);
269 Acts::ObjVisualization3D& visualHelper,
270 const Acts::ViewConfig& viewConfig) {
277 const double dR = std::sqrt(spacePoint.
covariance()[Acts::toUnderlying(CovIdx::etaCov)]);
278 const double hZ = std::sqrt(spacePoint.
covariance()[Acts::toUnderlying(CovIdx::phiCov)]);
279 auto bounds = std::make_unique<Acts::LineBounds>(dR, hZ);
281 auto surface = Acts::Surface::makeShared<Acts::StrawSurface>(trf, std::move(bounds));
282 Acts::GeometryView3D::drawSurface(visualHelper, *surface, gctx.
context());
284 const double dX = std::sqrt(spacePoint.
covariance()[Acts::toUnderlying(CovIdx::phiCov)]);
285 const double dY = std::sqrt(spacePoint.
covariance()[Acts::toUnderlying(CovIdx::etaCov)]);
286 auto bounds = std::make_unique<Acts::RectangleBounds>(dX, dY);
288 auto surf = Acts::Surface::makeShared<Acts::PlaneSurface>(trf, std::move(bounds));
289 Acts::GeometryView3D::drawSurface(visualHelper, *surf, gctx.
context());
const boost::regex re(r_e)
Scalar mag() const
mag method
Acts::GeometryContext context() const
Helper class to access the Acts::surface associated with an Uncalibrated xAOD measurement.
const Acts::Surface * get(const xAOD::UncalibratedMeasurement *meas) const
Operator.
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
const Amg::Transform3D & localToGlobalTransform(const ActsTrk::GeometryContext &gctx) const
Returns the local -> global tarnsformation from the sector.
The calibrated Space point is created during the calibration process.
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.
Placeholder for what will later be the muon segment EDM representation.
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.
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
unsigned dimension() const
Is the space point a 1D or combined 2D measurement.
bool isStraw() const
Returns whether the measurement is a Mdt.
const xAOD::UncalibratedMeasurement * secondaryMeasurement() const
const Amg::Vector3D & localPosition() const
const Cov_t & covariance() const
Returns the covariance array.
const xAOD::UncalibratedMeasurement * primaryMeasurement() const
const MuonGMR4::SpectrometerSector * msSector() const
ActsTrk::detail::MeasurementCalibratorBase::ProjectorType ProjectorType
Use the calibration projector.
Amg::Vector3D direction() const
Returns the direction as Amg::Vector.
Amg::Vector3D position() const
Returns the position as Amg::Vector.
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::Transform3D getTranslate3D(const double X, const double Y, const double Z)
: Returns a shift transformation along an arbitrary axis
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.
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.
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
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 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 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 drawSegmentMeasurements(const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewSensitive)
Draw all uncalibrated measurements associated to the segment.
void drawSegmentLine(const ActsTrk::GeometryContext &gctx, const xAOD::MuonSegment &segment, Acts::ObjVisualization3D &visualHelper, const Acts::ViewConfig &viewConfig=Acts::s_viewLine, const double standardLength=1.*Gaudi::Units::m)
Draw a segment line inside the obj file.
AuxiliaryMeasurement_v1 AuxiliaryMeasurement
MdtDriftCircle_v1 MdtDriftCircle
std::pair< Amg::Vector2D, AmgSymMatrix(2)> positionAndCovariance(const CombinedMuonStrip *combinedPrd)
Returns the position and covariance from a combined strip measurement.
RpcMeasurement_v1 RpcMeasurement
sTgcMeasurement_v1 sTgcMeasurement
MuonSegment_v1 MuonSegment
Reference the current persistent version:
const Acts::Surface & muonSurface(const UncalibratedMeasurement *meas)
Returns the associated Acts surface to the measurement.
CombinedMuonStrip_v1 CombinedMuonStrip
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.