 |
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;
72 primaryVertex = (*vxContainer)[0];
75 for (
const auto vertex : *vxContainer) {
84 if (primaryVertex) pTau.
setVertex(vxContainer, primaryVertex);
87 if (!
m_useTJVA)
return StatusCode::SUCCESS;
92 return StatusCode::FAILURE;
96 ATH_MSG_DEBUG(
"TJVA enabled -> try to find new PV for the tau candidate");
100 if (newPrimaryVertexLink.
isValid()) {
112 return StatusCode::SUCCESS;
122 std::vector<const xAOD::TrackParticle*> tracksForTJVA;
126 std::vector<const xAOD::TrackParticle*> assocTracks;
135 float sumTrackAll = 0.0;
136 for (
auto xTrack : assocTracks ) {
139 tracksForTJVA.push_back(xTrack);
144 ATH_MSG_WARNING(
"Original ERM track link is not available, skipping track");
147 auto original_id_track_link = acc_originalTrack(*xTrack);
148 if (!original_id_track_link.isValid()) {
149 ATH_MSG_WARNING(
"Original ERM track link is not valid, skipping track");
152 tracksForTJVA.push_back(*original_id_track_link);
154 sumTrackAll += xTrack->pt();
159 ATH_MSG_DEBUG(
"tracksForTJVA # = " << tracksForTJVA.size() <<
", sum pT = " << sumTrackAll);
161 for (
uint i = 0;
i < tracksForTJVA.size();
i++){
169 std::vector<const xAOD::Vertex*> vertVec;
171 vertVec.push_back(vert);
176 for (
uint i = 0;
i < vertVec.size();
i++){
185 for (
const auto& [vtx, trks] : trktovxmap){
186 std::stringstream
ss;
187 for (
auto ass_trk : trks){
188 for (
uint i=0;
i < tracksForTJVA.size();
i++){
189 if (ass_trk->p4() == tracksForTJVA[
i]->p4()) {
195 ATH_MSG_DEBUG(
"Vtx[" << vtx->index() <<
"] associated with trks [" <<
ss.str() <<
"]");
203 std::vector<float> sumDz;
204 std::vector<float> v_jvf;
208 std::vector<const xAOD::TrackParticle*> tracks = trktovxmap[vert];
211 jvf = (sumTrackAll!=0. ? spair.first/sumTrackAll : 0.);
212 v_jvf.push_back(jvf);
213 sumDz.push_back(spair.second);
217 maxIndex = vert->index();
222 ATH_MSG_DEBUG(
"TJVA vtx found at z: " << vertices.at(maxIndex)->z() <<
" i_vtx = " << maxIndex <<
"jvf = " << maxJVF);
223 ATH_MSG_DEBUG(
"highest pt vtx found at z (i=0): " << vertices.at(0)->z());
225 float min_sumDz = 99999999.;
227 ATH_MSG_DEBUG(
"i_vtx=" << vert->index() <<
", z=" << vert->z() <<
", JVF=" << v_jvf[vert->index()] <<
", sumDz=" << sumDz[vert->index()]);
228 if ( v_jvf[vert->index()] == maxJVF ){
230 if (sumDz[vert->index()] < min_sumDz){
231 min_sumDz = sumDz[vert->index()];
232 maxIndex = vert->index();
239 ATH_MSG_DEBUG(
"TJVA vtx found at z: " << vertices.at(maxIndex)->z() <<
" i_vtx = " << maxIndex);
248 float sumTrackPV = 0.;
249 float sumDeltaZ = 0.;
250 for (
auto trk : tracks){
251 sumTrackPV += trk->pt();
252 sumDeltaZ += std::abs(trk->z0() - vx_z + trk->vz());
255 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.