|
ATLAS Offline Software
|
Go to the documentation of this file.
39 return StatusCode::SUCCESS;
50 if (!vertexInHandle.
isValid()) {
51 ATH_MSG_ERROR (
"Could not retrieve HiveDataObj with key " << vertexInHandle.
key());
52 return StatusCode::FAILURE;
54 vxContainer = vertexInHandle.
cptr();
57 if (vertexContainer !=
nullptr) {
58 vxContainer = vertexContainer;
62 return StatusCode::FAILURE;
67 if (vxContainer->
empty())
return StatusCode::SUCCESS;
75 primaryVertex = (*vxContainer)[0];
78 for (
const auto vertex : *vxContainer) {
87 if(primaryVertex==
nullptr && pTau.
jet()!=
nullptr) {
93 if (primaryVertex) pTau.
setVertex(vxContainer, primaryVertex);
96 if (!
m_useTJVA)
return StatusCode::SUCCESS;
101 return StatusCode::FAILURE;
105 ATH_MSG_DEBUG(
"TJVA enabled -> try to find new PV for the tau candidate");
107 float maxJVF = -100.;
109 if (newPrimaryVertexLink.
isValid()) {
121 return StatusCode::SUCCESS;
131 std::vector<const xAOD::TrackParticle*> tracksForTJVA;
132 const double dDeltaRMax(0.2);
134 std::vector<const xAOD::Vertex*> matchedVertexOnline;
137 std::vector<const xAOD::TrackParticle*> assocTracks;
146 float sumTrackAll = 0.0;
147 for (
auto xTrack : assocTracks ) {
150 tracksForTJVA.push_back(xTrack);
155 ATH_MSG_WARNING(
"Original ERM track link is not available, skipping track");
158 auto original_id_track_link = acc_originalTrack(*xTrack);
159 if (!original_id_track_link.isValid()) {
160 ATH_MSG_WARNING(
"Original ERM track link is not valid, skipping track");
163 tracksForTJVA.push_back(*original_id_track_link);
165 sumTrackAll += xTrack->pt();
170 ATH_MSG_DEBUG(
"tracksForTJVA # = " << tracksForTJVA.size() <<
", sum pT = " << sumTrackAll);
172 for (
uint i = 0;
i < tracksForTJVA.size();
i++){
180 std::vector<const xAOD::Vertex*> vertVec;
182 vertVec.push_back(vert);
187 for (
uint i = 0;
i < vertVec.size();
i++){
196 for (
const auto& [vtx, trks] : trktovxmap){
197 std::stringstream
ss;
198 for (
auto ass_trk : trks){
199 for (
uint i=0;
i < tracksForTJVA.size();
i++){
200 if (ass_trk->p4() == tracksForTJVA[
i]->p4()) {
206 ATH_MSG_DEBUG(
"Vtx[" << vtx->index() <<
"] associated with trks [" <<
ss.str() <<
"]");
214 std::vector<float> sumDz;
215 std::vector<float> v_jvf;
219 std::vector<const xAOD::TrackParticle*> tracks = trktovxmap[vert];
222 jvf = (sumTrackAll!=0. ? spair.first/sumTrackAll : 0.);
223 v_jvf.push_back(jvf);
224 sumDz.push_back(spair.second);
228 maxIndex = vert->index();
233 ATH_MSG_DEBUG(
"TJVA vtx found at z: " << vertices.at(maxIndex)->z() <<
" i_vtx = " << maxIndex <<
"jvf = " << maxJVF);
234 ATH_MSG_DEBUG(
"highest pt vtx found at z (i=0): " << vertices.at(0)->z());
236 float min_sumDz = 99999999.;
238 ATH_MSG_DEBUG(
"i_vtx=" << vert->index() <<
", z=" << vert->z() <<
", JVF=" << v_jvf[vert->index()] <<
", sumDz=" << sumDz[vert->index()]);
239 if ( v_jvf[vert->index()] == maxJVF ){
241 if (sumDz[vert->index()] < min_sumDz){
242 min_sumDz = sumDz[vert->index()];
243 maxIndex = vert->index();
250 ATH_MSG_DEBUG(
"TJVA vtx found at z: " << vertices.at(maxIndex)->z() <<
" i_vtx = " << maxIndex);
259 float sumTrackPV = 0.;
260 float sumDeltaZ = 0.;
261 for (
auto trk : tracks){
262 sumTrackPV += trk->pt();
263 sumDeltaZ += std::abs(trk->z0() - vx_z + trk->vz());
266 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.
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.