33 std::ostringstream oss;
36 <<
", Dir theta/phi: "<<(seg.
direction().
theta() /Gaudi::Units::degree)
38 <<
", Pos theta/phi: "<<(seg.
position().
theta() / Gaudi::Units::degree)
39 <<
" / "<<(seg.
position().
phi() / Gaudi::Units::degree)
40 <<
", R: "<<Acts::fastHypot(seg.
x(), seg.
y()) <<
", Z: "<<seg.
z()
44 <<
", nPhi: "<<
static_cast<int>(seg.
nPhiLayers())
51 if (acc.isAvailable(seg)){
61 return acc_prdLinks.isAvailable(segment) ? acc_prdLinks(segment).size() : 0;
64 const std::size_t n) {
65 if (!acc_prdLinks.isAvailable(segment)) {
69 const PrdLink_t& link{acc_prdLinks(segment)[n]};
70 return link.isValid() ? *link :
nullptr;
73 const std::size_t n) {
74 if(!acc_prdState.isAvailable(segment)) {
77 assert (n < acc_prdState(segment).
size());
78 return acc_prdState(segment)[n] != Acts::toUnderlying(CalibratedSpacePoint::State::Valid);
82 std::vector<const xAOD::UncalibratedMeasurement*> out{};
84 out.reserve(links.size());
85 for (std::size_t l = 0 ; l < links.size(); ++l) {
93 Acts::GeometryIdentifier
volumeId(
const Acts::Surface& surface) {
94 return surface.geometryId().withSensitive(0).withBoundary(0);
98 const bool skipOutlier) {
100 for (std::size_t i = 0; i < n ; ++i) {
108 const bool skipOutlier) {
110 for (std::size_t i = 0; i <= n ; ++i) {
120 const bool skipOutlier) {
122 assert(meas !=
nullptr);
125 const Acts::MultiIntersection isect = surface.intersect(tgContext,
128 Acts::BoundaryTolerance::Infinite());
129 return isect.closest().position();
133 const bool skipOutlier) {
135 assert(meas !=
nullptr);
137 const Acts::MultiIntersection isect = surface.intersect(tgContext,
140 Acts::BoundaryTolerance::Infinite());
141 return isect.closest().position();
146 if (
const float dPt =
a->pt() - b->pt();
147 std::abs(dPt) > std::numeric_limits<float>::epsilon()) {
150 if (
const float dEta =
a->eta() - b->eta();
151 std::abs(dEta) > std::numeric_limits<float>::epsilon()) {
159 if (
a->nPrecisionHits() != b->nPrecisionHits()) {
160 return a->nPrecisionHits() > b->nPrecisionHits();
162 if (
a->nPhiLayers() != b->nPhiLayers()) {
163 return a->nPhiLayers() > b->nPhiLayers();
165 if (
a->nTrigEtaLayers() != b->nTrigEtaLayers()) {
166 return a->nTrigEtaLayers() > b->nTrigEtaLayers();
168 const float chi2A =
a->chiSquared() / std::max(1.f,
a->numberDoF());
169 const float chi2B = b->chiSquared() / std::max(1.f, b->numberDoF());
170 if (std::isnan(chi2A) != std::isnan(chi2B)) {
171 return std::isnan(chi2B);
173 if (chi2A != chi2B && !std::isnan(chi2A)) {
174 return chi2A < chi2B;
176 return a->index() < b->index();
Scalar phi() const
phi method
Scalar theta() const
theta method
size_t size() const
Number of registered mappings.
ElementLink implementation for ROOT usage.
Placeholder for what will later be the muon segment EDM representation.
Helper class to provide constant type-safe access to aux data.
Class providing the definition of the 4-vector interface.
float y() const
Returns the x position.
std::uint8_t nTrigEtaLayers() const
Returns the number of trigger eta hits.
float numberDoF() const
Returns the numberDoF.
Amg::Vector3D direction() const
Returns the direction as Amg::Vector.
std::uint8_t nPrecisionHits() const
Returns the number of precision hits.
::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 ).
std::uint8_t nPhiLayers() const
Returns the number of trigger phi hits.
float z() const
Returns the y position.
Eigen::Matrix< double, 3, 1 > Vector3D
Parameters localSegmentPars(const xAOD::MuonSegment &seg)
Returns the localSegPars decoration from a xAODMuon::Segment.
std::string toString(const Parameters &pars)
Dumps the parameters into a string with labels in front of each number.
This header ties the generic definitions in this package.
std::string printID(const xAOD::MuonSegment &seg)
Print the chamber ID of a segment, e.g.
ElementLink< PrdCont_t > PrdLink_t
const xAOD::UncalibratedMeasurement * getMeasurement(const xAOD::MuonSegment &segment, const std::size_t n)
Returns the n-th uncalibrated measurement.
std::string printSegment(const xAOD::MuonSegment &seg)
Print the details of a segment.
std::size_t nMeasurements(const xAOD::MuonSegment &segment)
Returns the number of associated Uncalibrated measurements.
std::vector< const xAOD::UncalibratedMeasurement * > collectMeasurements(const xAOD::MuonSegment &segment, bool skipOutlier=true)
Helper function to extract the measurements from the segment.
Acts::GeometryIdentifier volumeId(const Acts::Surface &surface)
Returns the identifier of the volume in which the surface is embedded.
bool isOutlierMeasurement(const xAOD::MuonSegment &segment, const std::size_t n)
Returns whether the n-the uncalibrated measurement is an outlier.
Amg::Vector3D atLastSurface(const Acts::GeometryContext &tgContext, const xAOD::MuonSegment &segment, const bool skipOutlier=true)
Expresses the segment position on the surface of the last measurement.
const xAOD::UncalibratedMeasurement * firstMeasurement(const xAOD::MuonSegment &segment, const bool skipOutlier=true)
Retrieves the first measurement associated with the segment.
Amg::Vector3D atFirstSurface(const Acts::GeometryContext &tgContext, const xAOD::MuonSegment &segment, const bool skipOutlier=true)
Expresses the segment position on the surface of the first measurement.
std::vector< PrdLink_t > PrdLinkVec_t
ElementLink< xAOD::MuonSegmentContainer > SegLink_t
const xAOD::UncalibratedMeasurement * lastMeasurement(const xAOD::MuonSegment &segment, const bool skipOutlier=true)
Retrieves the last measurement associated with the segment.
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
const std::string & chName(ChIndex index)
convert ChIndex into a string
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
MuonSegment_v1 MuonSegment
Reference the current persistent version:
const Acts::Surface & muonSurface(const UncalibratedMeasurement *meas)
Returns the associated Acts surface to the measurement.
bool operator()(const xAOD::IParticle *a, const xAOD::IParticle *b) const
bool operator()(const xAOD::MuonSegment *a, const xAOD::MuonSegment *b) const