47 return StatusCode::FAILURE;
52 return StatusCode::FAILURE;
55 return StatusCode::SUCCESS;
66 return StatusCode::FAILURE;
69 if(jetReadHandle->empty())
return StatusCode::SUCCESS;
74 std::optional<SG::ReadDecorHandle<xAOD::IParticleContainer, float>> wedgeZ;
81 ATH_MSG_ERROR(
"Failed to retrieve hits container with key " << hitsHandle.
key());
82 return StatusCode::FAILURE;
91 static const SG::AuxElement::ConstAccessor<int> bec(
"bec");
94 std::vector<Hit> hits;
95 hits.reserve(hitsHandle->size());
97 const int hit_bec = bec(*
hit);
101 const float hx =
x(*
hit);
102 const float hy =
y(*
hit);
103 hits.push_back({
hit, std::atan2(hy, hx),
z(*
hit), std::sqrt(hx*hx + hy*hy)});
111 zed = (*wedgeZ)(*jet);
112 if(!std::isfinite(zed)) {
113 ATH_MSG_WARNING(
"Wedge z-centre is not finite, dropping hits for this jet.");
114 hitAssociation(*
jet) = {};
120 std::vector<ElementLink<xAOD::TrackMeasurementValidationContainer>> links;
129 hitAssociation(*
jet) = std::move(links);
132 return StatusCode::SUCCESS;
136 const std::vector<std::pair<float, const xAOD::TrackMeasurementValidation*>>
138 const std::vector<Hit>& hits,
140 const double eta =
jet->eta();
141 const double phi =
jet->phi();
143 std::vector<std::pair<float, const xAOD::TrackMeasurementValidation*>> ret;
146 for(
const Hit&
hit : hits) {
147 const float dEta =
eta - std::asinh((
hit.z - zed) /
hit.r);
150 const float dR = std::sqrt(dEta * dEta + dPhi * dPhi);
153 ret.emplace_back(dR,
hit.original_hit);
163 for(
const Hit&
hit : hits) {
172 std::sort(ret.begin(), ret.end(), [](
const auto& h1,
const auto& h2) ->
bool { return h1.first < h2.first; });
173 ret.resize(std::min(
static_cast<unsigned int>(
m_maxHits),
static_cast<unsigned int>(ret.size())));
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define 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.
ElementLink implementation for ROOT usage.
virtual StatusCode execute(const EventContext &) const override
SG::ReadDecorHandleKey< xAOD::IParticleContainer > m_wedgeZKey
Gaudi::Property< bool > m_includeBarrel
Gaudi::Property< int > m_maxHits
Gaudi::Property< float > m_dEtaHitToVertex
Gaudi::Property< bool > m_includeEndcap
SG::ReadDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_hitsYRelToVertexKey
Gaudi::Property< bool > m_useDRCone
Gaudi::Property< float > m_dZHitToVertex
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_inputHitCollectionKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_jetCollectionKey
Gaudi::Property< float > m_dRHitToJet
JetHitAssociationAlg(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< float > m_dPhiHitToJet
SG::ReadDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_hitsXRelToVertexKey
const std::vector< std::pair< float, const xAOD::TrackMeasurementValidation * > > getJetHits(const xAOD::IParticle *jet, const std::vector< Hit > &hits, double zed) const
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_hitAssociationKey
virtual StatusCode initialize() override
SG::ReadDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_hitsZRelToVertexKey
Describes the Region of Ineterest geometry It has basically 9 parameters.
Handle class for reading a decoration on an object.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Handle class for adding a decoration to an object.
Class providing the definition of the 4-vector interface.
constexpr T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
bool contains(const IRoiDescriptor &roi, double z0, double dzdr)
see whether a segment is contained within the roi in r-z
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
TrackMeasurementValidation_v1 TrackMeasurementValidation
Reference the current persistent version:
Helper for azimuthal angle calculations.