28 ATH_MSG_INFO(
"Initializing JetTrackSumMomentsTool " << name());
39 ATH_MSG_ERROR(
"JetTrackSumMomentsTool needs to have its input jet container configured!");
40 return StatusCode::FAILURE;
48 return StatusCode::SUCCESS;
57 if (!handle_v.isValid()){
60 return StatusCode::FAILURE;
63 const auto *vertexContainer = handle_v.cptr();
67 if (!handle_tva.isValid()){
68 ATH_MSG_ERROR(
"Could not retrieve the TrackVertexAssociation: "
70 return StatusCode::FAILURE;
73 const auto *tva = handle_tva.cptr();
80 std::vector<const xAOD::TrackParticle*> tracks;
86 if (vertexContainer->empty() ) {
88 return StatusCode::FAILURE;
99 ATH_MSG_ERROR(
"OriginVertex was requested, but the jet does not contain an OriginVertex");
100 return StatusCode::FAILURE;
103 ATH_MSG_VERBOSE(
"JetTrackSumMomentsTool " << name() <<
" is using OriginVertex at index: " << HSvertex->
index());
105 const std::pair<float,float> tracksums =
getJetTrackSums(HSvertex, tracks, tva);
107 trackSumPtHandle(*
jet) = tracksums.first;
108 trackSumMassHandle(*
jet) = tracksums.second;
111 <<
": TrackSumPt=" << tracksums.first
112 <<
", TrackSumMass=" << tracksums.second );
114 return StatusCode::SUCCESS;
121 for (
size_t iVertex = 0; iVertex < vertices->
size(); ++iVertex ) {
124 ATH_MSG_VERBOSE(
"JetVertexTaggerTool " << name() <<
" Found HS vertex at index: "<< iVertex);
125 return vertices->
at(iVertex);
128 ATH_MSG_VERBOSE(
"There is no vertex of type PriVx. Taking default vertex.");
129 return vertices->
at(0);
135 const std::vector<const xAOD::TrackParticle*>& tracks,
139 unsigned int nkeep = 0;
140 unsigned int nskip = 0;
142 for (
size_t iTrack = 0; iTrack < tracks.size(); ++iTrack) {
144 if ( notsel ||
m_htsel->accept(*track) ) {
156 <<
": nsel=" << nkeep
157 <<
", nrej=" << nskip );
159 return std::make_pair(tracksum.Pt(),tracksum.M());
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
size_t index() const
Return the index of this element within its container.
Handle class for adding a decoration to an object.
Class to hold N-to-one aassociations between tracks and vertices.
const xAOD::Vertex * associatedVertex(const xAOD::TrackParticle *trk) const
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
VxType::VertexType vertexType() const
The type of the vertex.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Jet_v1 Jet
Definition of the current "jet version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.