33 ATH_MSG_ERROR(
"No hits to select: set PixelAssociation, SCTAssociation, or both");
34 return StatusCode::FAILURE;
37 << (
m_useSCT ?
" SCT" :
"") <<
", keeping at most "
56 return StatusCode::SUCCESS;
62 const EventContext& ctx,
68 std::vector<std::vector<SortedHit>>& hitsPerJet)
const {
75 for (std::size_t iJet = 0; iJet < jets.size(); ++iJet) {
78 const float jetPhi =
jet.phi();
79 std::vector<SortedHit>& out = hitsPerJet[iJet];
83 ATH_MSG_ERROR(
"Invalid hit link in " << assocKey.
key() <<
" on jet " << iJet);
84 return StatusCode::FAILURE;
87 if (!isClean(
hit))
continue;
89 const float hitPhi = std::atan2(hitY(
hit), hitX(
hit));
94 return StatusCode::SUCCESS;
100 if (!jets.isValid()) {
102 return StatusCode::FAILURE;
105 std::vector<std::vector<SortedHit>> hitsPerJet(jets->size());
119 for (std::size_t iJet = 0; iJet < jets->size(); ++iJet) {
121 std::vector<SortedHit>& sorted = hitsPerJet[iJet];
125 return a.dphi < b.dphi;
128 if (sorted.size() >
static_cast<std::size_t
>(
m_maxHits)) {
132 std::vector<HitLink> outEL;
133 outEL.reserve(sorted.size());
135 outEL.push_back(
sh.link);
138 cleanMergedAssoc(*(*jets)[iJet]) = std::move(outEL);
141 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Handle class for reading a decoration on an object.
Handle class for reading from StoreGate.
Handle class for adding a decoration to an object.
An algorithm that can be simultaneously executed in multiple threads.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_pixelAssocKey
SG::ReadDecorHandleKey< HitContainer > m_pixelHitXKey
virtual StatusCode initialize() override
SG::ReadHandleKey< HitContainer > m_sctHitsKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_sctAssocKey
HitsSelectorAlg(const std::string &name, ISvcLocator *svcLoc)
StatusCode collectHits(const EventContext &ctx, const SG::ReadDecorHandleKey< xAOD::JetContainer > &assocKey, const SG::ReadDecorHandleKey< HitContainer > &xKey, const SG::ReadDecorHandleKey< HitContainer > &yKey, const SG::ReadDecorHandleKey< HitContainer > &cleanKey, const xAOD::JetContainer &jets, std::vector< std::vector< SortedHit > > &hitsPerJet) const
virtual StatusCode execute(const EventContext &ctx) const override
SG::ReadDecorHandleKey< HitContainer > m_sctCleanKey
SG::ReadDecorHandleKey< HitContainer > m_pixelHitYKey
ElementLink< HitContainer > HitLink
Gaudi::Property< int > m_maxHits
SG::ReadHandleKey< HitContainer > m_pixelHitsKey
SG::ReadDecorHandleKey< HitContainer > m_pixelCleanKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetsKey
SG::ReadDecorHandleKey< HitContainer > m_sctHitXKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_hitAssocKey
SG::ReadDecorHandleKey< HitContainer > m_sctHitYKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Handle class for reading a decoration on an object.
const std::string & key() const
Return the StoreGate ID for the referenced object.
Handle class for adding a decoration to an object.
constexpr T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Jet_v1 Jet
Definition of the current "jet version".
TrackMeasurementValidation_v1 TrackMeasurementValidation
Reference the current persistent version:
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Helper for azimuthal angle calculations.