21 return StatusCode::SUCCESS;
34 if (measurements->
empty()){
35 return StatusCode::SUCCESS;
45 if ((simHitViewer.
size() == 0 ||
m_idHelperSvc->detElementHash(simHitViewer.
at(0)->identify()) > viewHash) &&
49 }
else if (
m_idHelperSvc->detElementHash(simHitViewer.
at(0)->identify()) < viewHash \
51 return m_idHelperSvc->detElementHash(hit->identify()) == viewHash;
55 ATH_MSG_VERBOSE(
"Container size "<<simHits->
size()<<
" viewer size: "<<simHitViewer.
size()<<
" view hash: "<<viewHash);
56 std::unordered_set<Identifier> prds{};
60 switch (measurement->type()) {
68 if (matching_itr != simHitViewer.
end()) {
69 bestSimHit =(*matching_itr);
76 const int ml = mmIdHelper.
multilayer(mmHit->identify());
77 for (
const uint16_t
strip : mmHit->stripNumbers()) {
78 prds.insert(mmIdHelper.
channelID(mmHit->identify(), ml, mmHit->gasGap(),
strip));
84 if (matching_itr != simHitViewer.
end()) {
85 bestSimHit =(*matching_itr);
98 if (measurement->numDimensions() == 1) {
99 locPos = measurement->localPosition<1>().
x() * Amg::Vector3D::UnitX();
101 locPos.block<2,1>(0,0) = xAOD::toEigen(measurement->localPosition<2>());
105 if (gasGapId !=
m_idHelperSvc->gasGapId(simHit->identify())) {
114 if (measurement->numDimensions() == 1) {
115 dist = std::abs(prdPos.x() - simHit->localPosition().x())
116 / std::sqrt(measurement->localCovariance<1>()(0,0));
118 const Amg::Vector2D diff = (prdPos - xAOD::toEigen(simHit->localPosition())).block<2,1>(0,0);
119 dist = std::sqrt(
diff.dot(xAOD::toEigen(measurement->localCovariance<2>()).inverse() *
diff));
121 if (dist < closestDistance) {
122 closestDistance = dist;
129 return StatusCode::FAILURE;
135 decorHandle(*measurement) =
LinkType{*simHits, bestSimHit->
index()};
138 }
while (prdViewer.
next());
140 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
Handle class for adding a decoration to an object.
DataModel_detail::const_iterator< DataVector > const_iterator
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
This is a "hash" representation of an Identifier.
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
int multilayer(const Identifier &id) const
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
const Amg::Transform3D & localToGlobalTrans(const ActsTrk::GeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
virtual IdentifierHash layerHash(const Identifier &measId) const =0
Amg::Transform3D globalToLocalTrans(const ActsTrk::GeometryContext &ctx) const
Transformations to translate between local <-> global coordinates.
SG::ReadHandleKey< xAOD::MuonSimHitContainer > m_simHitsKey
Key to the associated simHit container.
Gaudi::Property< double > m_PullCutOff
The number of standard deviations a measurement may be pulled apart in order to be associated.
ElementLink< xAOD::MuonSimHitContainer > LinkType
Attached sim-hit link decoration to the measurement container.
SG::ReadHandleKey< xAOD::UncalibratedMeasurementContainer > m_prdHitKey
Key to the uncalibrated measurements to decorate.
StatusCode execute(const EventContext &ctx) const override final
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
Key to the geometry context.
SG::WriteDecorHandleKey< xAOD::UncalibratedMeasurementContainer > m_decorKey
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc to decode the Identifiers.
StatusCode initialize() override final
size_t index() const
Return the index of this element within its container.
Handle class for adding a decoration to an object.
bool next() noexcept
Loads the hits from the next chamber.
const_iterator end() const noexcept
End iterator of the current chamber view.
const_ref at(const std::size_t idx) const
Returns the i-the measurement from the current chamber.
std::size_t size() const noexcept
Returns how many hits are in the current chamber.
bool loadView(const Identifier &chamberId)
Loads the view matching the parsed identifier.
Identifier identify() const
Returns the global ATLAS identifier of the SimHit.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
@ DetElement
View ends if the detElementHash changes.
const MuonGMR4::MuonReadoutElement * muonReadoutElement(const UncalibratedMeasurement *meas)
Returns the associated readout element to the measurement.
MuonSimHit_v1 MuonSimHit
Defined the version of the MuonSimHit.
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
MuonSimHitContainer_v1 MuonSimHitContainer
Define the version of the pixel cluster container.
UncalibratedMeasurementContainer_v1 UncalibratedMeasurementContainer
Define the version of the uncalibrated measurement container.
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.