43 return StatusCode::FAILURE;
46 return StatusCode::SUCCESS;
57 return StatusCode::FAILURE;
60 if(jetReadHandle->empty())
return StatusCode::SUCCESS;
69 ATH_MSG_ERROR(
"Failed to retrieve hits container with key " << hitsHandle.
key());
70 return StatusCode::FAILURE;
82 std::vector<std::pair<TLorentzVector, const xAOD::TrackMeasurementValidation*>> hits;
84 const int hit_bec = bec(*hit);
89 hits.emplace_back(TLorentzVector(
x(*hit),
y(*hit),
z(*hit), 0), hit);
95 std::vector<ElementLink<xAOD::TrackMeasurementValidationContainer>> links;
104 hitAssociation(*
jet) = std::move(links);
107 return StatusCode::SUCCESS;
111 const std::vector<std::pair<float, const xAOD::TrackMeasurementValidation*>>
113 const std::vector<std::pair<TLorentzVector, const xAOD::TrackMeasurementValidation*>>& hits)
const {
114 const TLorentzVector p4 =
jet->p4();
116 std::unique_ptr<RoiDescriptor> roi;
118 roi = std::make_unique<RoiDescriptor>(
126 std::vector<std::pair<float, const xAOD::TrackMeasurementValidation*>> ret;
127 for(
const auto& [hitP4, hit] : hits) {
134 ret.emplace_back(dPhi, hit);
139 std::sort(ret.begin(), ret.end(), [](
const auto& h1,
const auto& h2) ->
bool { return h1.first < h2.first; });
140 ret.resize(std::min(
static_cast<unsigned int>(
m_maxHits),
static_cast<unsigned int>(ret.size())));
148 if(!hit)
return false;
151 if(isFake(*hit))
return false;
154 if(hasBSError(*hit))
return false;
157 if(DCSState(*hit))
return false;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Handle class for reading a decoration on an object.
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
Gaudi::Property< bool > m_includeBarrel
Gaudi::Property< int > m_maxHits
Gaudi::Property< float > m_dEtaHitToVertex
Gaudi::Property< bool > m_includeEndcap
bool isGoodIDPixelHit(const xAOD::TrackMeasurementValidation *hit) const
SG::ReadDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_hitsYRelToVertexKey
Gaudi::Property< float > m_dZHitToVertex
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_inputHitCollectionKey
Gaudi::Property< bool > m_removeBadIDPixelHits
SG::ReadHandleKey< xAOD::IParticleContainer > m_jetCollectionKey
Gaudi::Property< bool > m_useWedgeSelection
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< std::pair< TLorentzVector, const xAOD::TrackMeasurementValidation * > > &hits) const
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_hitAssociationKey
virtual StatusCode initialize() override
SG::ReadDecorHandleKey< xAOD::TrackMeasurementValidationContainer > m_hitsZRelToVertexKey
SG::ConstAccessor< T, ALLOC > ConstAccessor
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.
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.