 |
ATLAS Offline Software
|
Go to the documentation of this file.
25 return StatusCode::SUCCESS;
36 if (!vertexInHandle.
isValid()) {
37 ATH_MSG_ERROR (
"Could not retrieve HiveDataObj with key " << vertexInHandle.
key());
38 return StatusCode::FAILURE;
40 vxContainer = vertexInHandle.
cptr();
43 if (vertexContainer !=
nullptr) {
44 vxContainer = vertexContainer;
48 return StatusCode::FAILURE;
53 if (vxContainer->
empty())
return StatusCode::SUCCESS;
58 primaryVertex = (*vxContainer)[0];
61 for (
const auto vertex : *vxContainer) {
70 if (primaryVertex) pTau.
setVertex(vxContainer, primaryVertex);
73 if (!
m_useTJVA)
return StatusCode::SUCCESS;
78 return StatusCode::FAILURE;
82 ATH_MSG_DEBUG(
"TJVA enabled -> try to find new PV for the tau candidate");
86 if (newPrimaryVertexLink.
isValid()) {
98 return StatusCode::SUCCESS;
108 std::vector<const xAOD::TrackParticle*> tracksForTJVA;
112 std::vector<const xAOD::TrackParticle*> assocTracks;
121 float sumTrackAll = 0.0;
122 for (
auto xTrack : assocTracks ) {
125 tracksForTJVA.push_back(xTrack);
130 ATH_MSG_WARNING(
"Original ERM track link is not available, skipping track");
133 auto original_id_track_link = acc_originalTrack(*xTrack);
134 if (!original_id_track_link.isValid()) {
135 ATH_MSG_WARNING(
"Original ERM track link is not valid, skipping track");
138 tracksForTJVA.push_back(*original_id_track_link);
140 sumTrackAll += xTrack->pt();
145 ATH_MSG_DEBUG(
"tracksForTJVA # = " << tracksForTJVA.size() <<
", sum pT = " << sumTrackAll);
147 for (
uint i = 0;
i < tracksForTJVA.size();
i++){
155 std::vector<const xAOD::Vertex*> vertVec;
157 vertVec.push_back(vert);
162 for (
uint i = 0;
i < vertVec.size();
i++){
171 for (
const auto& [vtx, trks] : trktovxmap){
172 std::stringstream
ss;
173 for (
auto ass_trk : trks){
174 for (
uint i=0;
i < tracksForTJVA.size();
i++){
175 if (ass_trk->p4() == tracksForTJVA[
i]->p4()) {
181 ATH_MSG_DEBUG(
"Vtx[" << vtx->index() <<
"] associated with trks [" <<
ss.str() <<
"]");
189 std::vector<float> sumDz;
190 std::vector<float> v_jvf;
194 std::vector<const xAOD::TrackParticle*> tracks = trktovxmap[vert];
197 jvf = (sumTrackAll!=0. ? spair.first/sumTrackAll : 0.);
198 v_jvf.push_back(jvf);
199 sumDz.push_back(spair.second);
203 maxIndex = vert->index();
208 ATH_MSG_DEBUG(
"TJVA vtx found at z: " << vertices.at(maxIndex)->z() <<
" i_vtx = " << maxIndex <<
"jvf = " << maxJVF);
209 ATH_MSG_DEBUG(
"highest pt vtx found at z (i=0): " << vertices.at(0)->z());
211 float min_sumDz = 99999999.;
213 ATH_MSG_DEBUG(
"i_vtx=" << vert->index() <<
", z=" << vert->z() <<
", JVF=" << v_jvf[vert->index()] <<
", sumDz=" << sumDz[vert->index()]);
214 if ( v_jvf[vert->index()] == maxJVF ){
216 if (sumDz[vert->index()] < min_sumDz){
217 min_sumDz = sumDz[vert->index()];
218 maxIndex = vert->index();
225 ATH_MSG_DEBUG(
"TJVA vtx found at z: " << vertices.at(maxIndex)->z() <<
" i_vtx = " << maxIndex);
234 float sumTrackPV = 0.;
235 float sumDeltaZ = 0.;
236 for (
auto trk : tracks){
237 sumTrackPV += trk->pt();
238 sumDeltaZ += std::abs(trk->z0() - vx_z + trk->vz());
241 return std::make_pair(sumTrackPV, sumDeltaZ);
Gaudi::Property< bool > m_useTJVA
Gaudi::Property< double > m_dDeltaRMax
const_pointer_type cptr()
Dereference the pointer.
Helper class to provide constant type-safe access to aux data.
std::map< const xAOD::Vertex *, xAOD::TrackVertexAssociationList > TrackVertexAssociationMap
#define ATH_MSG_VERBOSE(x)
void setVertex(const xAOD::VertexContainer *cont, const xAOD::Vertex *vertex)
Gaudi::Property< std::string > m_assocTracksName
bool isValid() const
Test to see if the link can be dereferenced.
std::vector< const T * > getAssociatedObjects(const std::string &name) const
get associated objects as a vector<object> this compact form throws an exception if the object is not...
ToolHandle< InDet::IInDetTrackSelectionTool > m_TrackSelectionToolForTJVA
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a tau jet.
ToolHandle< CP::ITrackVertexAssociationTool > m_trkVertexAssocTool
std::pair< float, float > getVertexScores(const std::vector< const xAOD::TrackParticle * > &tracks, float vx_z) const
StatusCode executeVertexFinder(xAOD::TauJet &pTau, const xAOD::VertexContainer *vertexContainer=nullptr) const override
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackPartInputContainer
ElementLink implementation for ROOT usage.
@ TauJetVtxFraction
@Tau Jet Vertex Fraction
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Class describing a Vertex.
void setVertexLink(const VertexLink_t &vertexLink)
#define ATH_MSG_WARNING(x)
void setDetail(TauJetParameters::Detail detail, int value)
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
ElementLink< xAOD::VertexContainer > getPV_TJVA(const xAOD::TauJet &tauJet, const xAOD::VertexContainer &vertices, float &maxJVF) const
TauVertexFinder(const std::string &name)
Constructor and Destructor.
size_type size() const noexcept
Returns the number of elements in the collection.
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexInputContainer
bool empty() const noexcept
Returns true if the collection is empty.
StatusCode initialize() override
Algorithm functions.