24 ATH_MSG_ERROR(
"No jet collection provided for selecting tracks!");
25 return StatusCode::FAILURE;
35 return StatusCode::SUCCESS;
41 return StatusCode::SUCCESS;
51 declareInterface<IVertexWeightCalculator>(
this);
61 ATH_MSG_ERROR (
"HardScatterSelectionTool configured to use jet collection "<<
m_jetContKey.key()<<
", but collection is not found!");
67 std::set<const xAOD::TrackParticle*> tracks_in_jets;
69 std::vector<const xAOD::TrackParticle*> tracks_in_this_jet;
71 tracks_in_jets.insert(tracks_in_this_jet.begin(),tracks_in_this_jet.end());
73 ATH_MSG_VERBOSE(
"Collected " << tracks_in_jets.size() <<
" tracks in " << jetCont->
size() <<
" jets");
75 size_t n_selected_tracks{0};
76 double total_pt{0.}, jet_only_pt{0.};
78 <<
vertex.nTrackParticles() <<
" tracks at vertex.");
79 for (
const auto& elTrackParticle :
vertex.trackParticleLinks()) {
81 if (not elTrackParticle.isValid()) {
83 "No valid link to tracks in xAOD::Vertex object. Skipping track for "
84 "signal compatibility (may be serious).");
89 (*elTrackParticle.cptr())->perigeeParameters();
92 increment = std::pow(1. / perigee.parameters()[
Trk::qOverP] *
96 increment = std::fabs(1. / perigee.parameters()[
Trk::qOverP]) *
99 total_pt += increment;
101 if(tracks_in_jets.contains(*elTrackParticle)) {
102 ATH_MSG_VERBOSE(
"Accepted track with index " << (*elTrackParticle)->index() <<
" in jet vicinity.");
104 jet_only_pt += increment;
109 <<
" towards vertex sumpt " << std::setprecision(3) << jet_only_pt <<
" (unrestricted sum: " << total_pt <<
")");
112 (*m_decPlainSumPt)(
vertex) = total_pt;
115 if(jetCont->
empty()){
116 ATH_MSG_DEBUG(
"No jets found in this event, fall back to unrestricted sum");
117 jet_only_pt = total_pt;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
virtual StatusCode finalize() override
virtual double estimateSignalCompatibility(const xAOD::Vertex &vertex) const override final
WeightCalculator.
virtual StatusCode initialize() override
Gaudi::Property< bool > m_doSumPt2Selection
Flag to Set SumPt^2 not SumPt as selection criteria.
Gaudi::Property< std::string > m_plainSumPtKey
JetRestrictedSumPtVertexWeightCalculator(const std::string &t, const std::string &n, const IInterface *p)
constructor
SG::ReadHandleKey< xAOD::JetContainer > m_jetContKey
Gaudi::Property< float > m_cone_dR
std::unique_ptr< SG::AuxElement::Decorator< float > > m_decPlainSumPt
ToolHandle< xAOD::ITrackParticlesInConeTool > m_tracksInCone
::StatusCode StatusCode
StatusCode definition for legacy code.
Ensure that the ATLAS eigen extensions are properly loaded.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
Jet_v1 Jet
Definition of the current "jet version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
JetContainer_v1 JetContainer
Definition of the current "jet container version".