24 declareInterface<IMuonTrackToSegmentTool>(
this);
34 return StatusCode::SUCCESS;
56 std::set<Identifier> chIds;
60 rots.
reserve(track.measurementsOnTrack()->size());
73 std::unique_ptr<Amg::Transform3D> surfaceTransformToBeDeleted;
74 double weightedDistanceSquared{0}, weightSquared{0};
87 if (!
id.is_valid() ||
m_idHelperSvc->measuresPhi(
id))
continue;
89 double distance = (pars->position() - perigee->
position()).dot(dir);
93 weightedDistanceSquared += distance * weight;
94 weightSquared += weight;
97 if (!surfaceTransform) {
103 surfaceTransform = surfaceTransformToBeDeleted.get();
107 surfaceTransform = &(meas)->associatedSurface().transform();
108 }
else if (!surfaceTransform && !backupTransform) {
109 backupTransform = &(meas)->associatedSurface().transform();
112 if (!surfaceTransform) surfaceTransform = backupTransform;
114 double refDistance = (weightSquared > 0 ? weightedDistanceSquared / weightSquared : 1) - 100;
120 double minDist = -1e6;
125 if (!pars || !pars->covariance())
continue;
128 double distance = (pars->position() - refPos).dot(dir);
129 if (distance < 0 && std::abs(distance) < std::abs(minDist)) {
135 if (!surfaceTransform) {
136 ATH_MSG_DEBUG(
" failed to create a PlaneSurface for the track, cannot make segment!!! " << std::endl
144 closestPars = perigee;
145 minDist = (perigee->
position() - refPos).dot(dir);
149 transform.pretranslate(refPos);
150 constexpr double surfDim = 500.;
151 std::unique_ptr<Trk::PlaneSurface> surf = std::make_unique<Trk::PlaneSurface>(transform, surfDim, surfDim);
154 if (!exPars || !exPars->covariance()) {
155 ATH_MSG_VERBOSE(
"First trial reaching the surface failed. This is presumably due to a too large momentum. Let's try with a dummy 1 GeV momentum");
156 std::unique_ptr<Trk::TrackParameters> cloned_pars {closestPars->
clone()};
157 constexpr double OneOverGeV = 1./ Gaudi::Units::GeV;
158 cloned_pars->parameters()[
Trk::qOverP] = cloned_pars->charge() *OneOverGeV;
163 ATH_MSG_DEBUG(
" propagation failed!!! "<<*cloned_pars<<std::endl<<std::endl<<*surf);
169 if (!surf->globalToLocal(exPars->position(), exPars->momentum(), locPos)) {
174 surf->globalToLocalDirection(exPars->momentum(), locDir);
178 exPars->associatedSurface().transform().rotation().inverse());
185 globalToLocalMeasJacobian(
Trk::phi,
Trk::phi) = globalToLocalMeasAnglesJacobian(0, 0);
187 globalToLocalMeasJacobian(
Trk::theta,
Trk::phi) = globalToLocalMeasAnglesJacobian(0, 1);
191 AmgSymMatrix(5) cov = exPars->covariance()->similarity(globalToLocalMeasJacobian);
194 if (!chIds.empty()) {
196 std::vector<Identifier> holes;
199 holes.insert(holes.end(), holesChamber.begin(), holesChamber.end());
207 locPos, locDir, cov, surf.release(), std::move(rots), quality);
216 ATH_MSG_ERROR(
"Failed to retrieve chamber intersection service");
222 const MuonStationIntersect intersect = InterSectSvc->tubesCrossedByTrack(MuonDetMgr, chid, pars.position(), pars.momentum().unit());
225 std::set<Identifier> hitsOnSegment;
228 if (mdt) hitsOnSegment.insert(mdt->
identify());
232 std::vector<Identifier> holes;
233 for (
unsigned int ii = 0; ii < intersect.tubeIntersects().size(); ++ii) {
237 if (hitsOnSegment.count(tint.
tubeId))
continue;
241 holes.push_back(tint.
tubeId);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define AmgSymMatrix(dim)
MuonSegment_v1 MuonSegment
Reference the current persistent version:
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const PtrVector & stdcont() const
Return the underlying std::vector of the container.
double innerTubeRadius() const
Returns the inner tube radius excluding the aluminium walls.
virtual const Amg::Vector3D & center(const Identifier &) const override final
Return the center of the surface associated with this identifier In the case of silicon it returns th...
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
virtual Amg::Transform3D AmdbLRSToGlobalTransform() const
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
virtual const MuonGM::MdtReadoutElement * detectorElement() const override final
Returns the detector element, assoicated with the PRD of this class.
This is the common muon segment quality object.
This is the common class for 3D segments used in the muon spectrometer.
const_pointer_type cptr()
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
double chiSquared() const
returns the of the overall track fit
This jacobian transforms the polar and azimutal angle of a global momentum representation to a local...
represents the three-dimensional global direction with respect to a planar surface frame.
magnetic field properties to steer the behavior of the extrapolation
This class is the pure abstract base class for all fittable tracking measurements.
virtual MeasurementBase * clone() const =0
Pseudo-Constructor.
virtual bool type(MeasurementBaseType::Type type) const =0
Interface method checking the type.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
const Amg::Vector3D & momentum() const
Access method for the momentum.
virtual ParametersBase< DIM, T > * clone() const override=0
clone method for polymorphic deep copy
const Amg::Vector3D & position() const
Access method for the position.
Identifier identify() const
return the identifier -extends MeasurementBase
represents the track state (measurement, material, fit parameters and quality) at a surface.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
DataVector< const Trk::TrackStateOnSurface > TrackStates
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ NoField
Field is set to 0., 0., 0.,.
ParametersBase< TrackParametersDim, Charged > TrackParameters
Tell the compiler to optimize assuming that FP may trap.
#define CXXUTILS_TRAPPING_FP