![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
40 return StatusCode::SUCCESS;
51 if (!vertexInHandle.
isValid()) {
52 ATH_MSG_ERROR (
"Could not retrieve HiveDataObj with key " << vertexInHandle.
key());
53 return StatusCode::FAILURE;
55 vxContainer = vertexInHandle.
cptr();
58 if (vertexContainer !=
nullptr) {
59 vxContainer = vertexContainer;
63 return StatusCode::FAILURE;
68 if (vxContainer->
empty())
return StatusCode::SUCCESS;
76 primaryVertex = (*vxContainer)[0];
79 for (
const auto vertex : *vxContainer) {
88 if(primaryVertex==
nullptr && pTau.
jet()!=
nullptr) {
94 if (primaryVertex) pTau.
setVertex(vxContainer, primaryVertex);
97 if (!
m_useTJVA)
return StatusCode::SUCCESS;
102 return StatusCode::FAILURE;
106 ATH_MSG_DEBUG(
"TJVA enabled -> try to find new PV for the tau candidate");
108 float maxJVF = -100.;
110 if (newPrimaryVertexLink.
isValid()) {
122 return StatusCode::SUCCESS;
132 std::vector<const xAOD::TrackParticle*> tracksForTJVA;
133 const double dDeltaRMax(0.2);
135 std::vector<const xAOD::Vertex*> matchedVertexOnline;
138 std::vector<const xAOD::TrackParticle*> assocTracks;
147 float sumTrackAll = 0.0;
148 for (
auto xTrack : assocTracks ) {
151 tracksForTJVA.push_back(xTrack);
156 ATH_MSG_WARNING(
"Original ERM track link is not available, skipping track");
159 auto original_id_track_link = acc_originalTrack(*xTrack);
160 if (!original_id_track_link.isValid()) {
161 ATH_MSG_WARNING(
"Original ERM track link is not valid, skipping track");
164 tracksForTJVA.push_back(*original_id_track_link);
166 sumTrackAll += xTrack->pt();
171 ATH_MSG_DEBUG(
"tracksForTJVA # = " << tracksForTJVA.size() <<
", sum pT = " << sumTrackAll);
173 for (
uint i = 0;
i < tracksForTJVA.size();
i++){
181 std::vector<const xAOD::Vertex*> vertVec;
183 vertVec.push_back(vert);
188 for (
uint i = 0;
i < vertVec.size();
i++){
197 for (
const auto& [vtx, trks] : trktovxmap){
198 std::stringstream
ss;
199 for (
auto ass_trk : trks){
200 for (
uint i=0;
i < tracksForTJVA.size();
i++){
201 if (ass_trk->p4() == tracksForTJVA[
i]->p4()) {
207 ATH_MSG_DEBUG(
"Vtx[" << vtx->index() <<
"] associated with trks [" <<
ss.str() <<
"]");
215 std::vector<float> sumDz;
216 std::vector<float> v_jvf;
221 std::vector<const xAOD::TrackParticle*> tracks = trktovxmap[vert];
224 jvf = (sumTrackAll!=0. ? spair.first/sumTrackAll : 0.);
225 v_jvf.push_back(jvf);
226 sumDz.push_back(spair.second);
237 ATH_MSG_DEBUG(
"TJVA vtx found at z: " << vertices.at(maxIndex)->z() <<
" i_vtx = " << maxIndex <<
"jvf = " << maxJVF);
238 ATH_MSG_DEBUG(
"highest pt vtx found at z (i=0): " << vertices.at(0)->z());
240 float min_sumDz = 99999999.;
243 ATH_MSG_DEBUG(
"i_vtx=" << iVertex <<
", z=" << vert->z() <<
", JVF=" << v_jvf[iVertex] <<
", sumDz=" << sumDz[iVertex]);
244 if ( v_jvf[iVertex] == maxJVF ){
246 if (sumDz[iVertex] < min_sumDz){
247 min_sumDz = sumDz[iVertex];
257 ATH_MSG_DEBUG(
"TJVA vtx found at z: " << vertices.at(maxIndex)->z() <<
" i_vtx = " << maxIndex);
266 float sumTrackPV = 0.;
267 float sumDeltaZ = 0.;
268 for (
auto trk : tracks){
269 sumTrackPV += trk->pt();
270 sumDeltaZ += std::abs(trk->z0() - vx_z + trk->vz());
273 return std::make_pair(sumTrackPV, sumDeltaZ);
Gaudi::Property< bool > m_useTJVA
const_pointer_type cptr()
Dereference the pointer.
Helper class to provide constant type-safe access to aux data.
Gaudi::Property< bool > m_useTJVA_Tiebreak
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.