Estimate the start track parameters for a given track seed.
78 {
79
80 const Acts::GeometryContext tgContext{
m_ctxProvider.getGeometryContext(ctx)};
84
88 if (!truthSeg) {
89 ATH_MSG_WARNING(__func__<<
"() "<<__LINE__<<
" - No truth segment found");
90 return Acts::Result<Acts::BoundTrackParameters>::failure(std::make_error_code(std::errc::invalid_argument));
91 }
94 const double distA = firstSurf.intersect(tgContext, truthSeg->
position(), truthSeg->
direction()).closest().pathLength();
95 const double distB = secondSurf.intersect(tgContext, truthSeg->
position(), truthSeg->
direction()).closest().pathLength();
96 ATH_MSG_VERBOSE(__func__<<
" "<<__LINE__<<
" - Detected segments in sector overlap "
98 <<". Check whether they need to be swapped "<<distA<<" vs. "<<distB);
99 if (distA> distB) {
101 }
102 }
104 if (!truthSeg) {
105 ATH_MSG_WARNING(__func__<<
"() "<<__LINE__<<
" - No truth segment found");
106 return Acts::Result<Acts::BoundTrackParameters>::failure(std::make_error_code(std::errc::invalid_argument));
107 }
109 if (!truthPart) {
110 ATH_MSG_WARNING(__func__<<
"() "<<__LINE__<<
" - No truth particle found");
111 return Acts::Result<Acts::BoundTrackParameters>::failure(std::make_error_code(std::errc::invalid_argument));
112 }
113 const MuonGMR4::SpectrometerSector* msSector{
m_detMgr->getSectorEnvelope(truthSeg->
chamberIndex(),
116 const Acts::Surface& sectorSurf{msSector->
surface()};
121
122 const Amg::Transform3D& oldTrf{sectorSurf.localToGlobalTransform(tgContext)};
125 const double pathLength = std::abs((truthSeg->
position() - firstPos).dot(segDir)) + 10._cm;
126
130 auto shiftedSurf = Acts::Surface::makeShared<Acts::PlaneSurface>(newTrf);
131
133 static const SG::ConstAccessor<float> acc_pt{"pt"};
135 Acts::BoundTrackParameters
result{shiftedSurf, locPars,
136 Acts::BoundMatrix::Identity(),
137 Acts::ParticleHypothesis::muon()};
138 using namespace Acts::detail::LineHelper;
139 if (msgLvl(MSG::VERBOSE)) {
140 std::stringstream outStream{};
141 outStream<<
"Start parameters:\n"<<
result<<
",\n"
142 <<
result.referenceSurface().toString(tgContext)
143 <<"absolute momentum: "
145 <<
", start point closure: "<<(
result.position(tgContext) + pathLength * segDir - truthSeg->
position()).mag()
147 <<"\n\ndump measurements:\n";
148
155 continue;
156 }
159 const double dist{surf.intersect(tgContext,
result.position(tgContext), segDir,
160 Acts::BoundaryTolerance::Infinite()).closest().pathLength()};
161 outStream<<
" *** "<<
m_detMgr->idHelperSvc()->toString(mMeas->identify())
162 <<
" @ "<<
Amg::toString(surf.localToGlobalTransform(tgContext) * mMeas->localMeasurementPos())
164 <<", travelled distance: "<<dist<<std::endl;
165 }
166 }
167 ATH_MSG_VERBOSE(__func__<<
"() "<<__LINE__<<
" - Created start parameters:\n"<<outStream.str());
168 }
170 }
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns the IdHelpeSvc.
std::string identString() const
Returns a string encoding the chamber index & the sector of the MS sector.
const Acts::PlaneSurface & surface() const
Returns the associated surface.
virtual std::string toString(const Identifier &id) const =0
print all fields to string
Amg::Vector3D direction() const
Returns the direction as Amg::Vector.
::Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
Amg::Vector3D position() const
Returns the position as Amg::Vector.
int etaIndex() const
Returns the eta index, which corresponds to stationEta in the offline identifiers (and the ).
virtual double pt() const override final
The transverse momentum ( ) of the particle.
double charge() const
Physical charge.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
constexpr double energyToActs(const double athenaE)
Converts an energy scalar from Athena to Acts units.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
double angle(const Amg::Vector3D &v1, const Amg::Vector3D &v2)
calculates the opening angle between two vectors
Amg::Isometry3D 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
Acts::BoundTrackParameters boundSegmentPars(const ActsTrk::GeometryContext &gctx, const MuonGMR4::MuonDetectorManager &detMgr, const xAOD::MuonSegment &segment, const Acts::ParticleHypothesis hypot=Acts::ParticleHypothesis::muon())
Returns the segment parameters as boundTrackParameters.
const xAOD::TruthParticle * getTruthMatchedParticle(const xAOD::MuonSegment &segment)
Returns the particle truth-matched to the segment.
std::string printID(const xAOD::MuonSegment &seg)
Print the chamber ID of a segment, e.g.
const xAOD::UncalibratedMeasurement * getMeasurement(const xAOD::MuonSegment &segment, const std::size_t n)
Returns the n-th uncalibrated measurement.
std::size_t nMeasurements(const xAOD::MuonSegment &segment)
Returns the number of associated Uncalibrated measurements.
const xAOD::UncalibratedMeasurement * firstMeasurement(const xAOD::MuonSegment &segment, const bool skipOutlier=true)
Retrieves the first measurement associated with the segment.
const xAOD::MuonSegment * getMatchedTruthSegment(const xAOD::MuonSegment &segment)
Returns the truth-matched segment.
Amg::Vector3D atFirstSurface(const Acts::GeometryContext &gctx, const xAOD::MuonSegment &segment, const bool skipOutlier=true)
Expresses the segment position on the surface of the first measurement.
StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
MuonMeasurement_v1 MuonMeasurement
TruthParticle_v1 TruthParticle
Typedef to implementation.
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
MuonSegment_v1 MuonSegment
Reference the current persistent version:
const Acts::Surface & muonSurface(const UncalibratedMeasurement *meas)
Returns the associated Acts surface to the measurement.