19#include "Acts/Utilities/Helpers.hpp"
24 using ChVec_t = std::vector<std::uint16_t>;
25 using ChVec_t = std::vector<std::uint16_t>;
40 return StatusCode::SUCCESS;
42 template <
typename PrdType_t>
47 const auto* prd =
dynamic_cast<const PrdType_t*
>(measurement);
52 if (hitId == prd->identify()) {
55 if constexpr(!std::is_same_v<PrdType_t, xAOD::MdtDriftCircle>) {
56 if (prd->readoutElement()->layerHash(hitId) != prd->layerHash()) {
60 if constexpr(std::is_same_v<PrdType_t, xAOD::TgcStrip> ||
61 std::is_same_v<PrdType_t, xAOD::RpcMeasurement>) {
62 if (( prd->measuresPhi() && Acts::rangeContainsValue(acc_phiChannel(*hit), prd->channelNumber())) ||
63 (!prd->measuresPhi() && Acts::rangeContainsValue(acc_etaChannel(*hit), prd->channelNumber()))) {
66 }
else if constexpr (std::is_same_v<PrdType_t, xAOD::MMCluster> ||
67 std::is_same_v<PrdType_t, xAOD::sTgcStripCluster>) {
68 for (
auto ch : prd->stripNumbers()) {
69 if (Acts::rangeContainsValue(acc_etaChannel(*hit), ch)) {
73 }
else if constexpr(std::is_same_v<PrdType_t, xAOD::sTgcWireHit>) {
74 if (Acts::rangeContainsValue(acc_phiChannel(*hit), prd->channelNumber())){
77 }
else if constexpr(std::is_same_v<PrdType_t, xAOD::sTgcPadHit>) {
78 if (Acts::rangeContainsValue(acc_padChannel(*hit), prd->channelNumber())){
92 if (measurements->
empty()){
93 return StatusCode::SUCCESS;
107 if ((simHitViewer.
size() == 0 ||
m_idHelperSvc->detElementHash(simHitViewer.
at(0)->identify()) > viewHash) &&
111 }
else if (
m_idHelperSvc->detElementHash(simHitViewer.
at(0)->identify()) < viewHash \
113 return m_idHelperSvc->detElementHash(hit->identify()) == viewHash;
118 <<
" view hash: "<<viewHash);
122 switch (measurement->type()) {
137 switch (prd->channelType()) {
155 return StatusCode::FAILURE;
162 decorHandle(*measurement) =
LinkType{*simHits, bestSimHit->
index()};
164 }
while (prdViewer.
next());
166 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
Handle class for adding a decoration to an object.
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.
xAOD::ChamberViewer< Cont_t > Viewer_t
Abrivate the chamber viewer type.
const xAOD::MuonSimHit * truthMatchPrd(Viewer_t< xAOD::MuonSimHitContainer > &simHits, const xAOD::UncalibratedMeasurement *measurement) const
Searches for the best matching sim hit to a measurement.
SG::ReadHandleKey< xAOD::MuonSimHitContainer > m_simHitsKey
Key to the associated simHit container.
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::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.
Helper class to provide constant type-safe access to aux data.
Handle class for adding a decoration to an object.
bool next() noexcept
Loads the hits from the next chamber.
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.
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.
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.
sTgcMeasurement_v1 sTgcMeasurement
UncalibratedMeasurementContainer_v1 UncalibratedMeasurementContainer
Define the version of the uncalibrated measurement container.
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.