33 if ( m_VertexFinderTool.retrieve().isFailure() )
35 ATH_MSG_FATAL(
"Failed to retrieve tool " << m_VertexFinderTool);
36 return StatusCode::FAILURE;
41 if (m_doVertexMerging) {
42 if ( m_VertexMergingTool.retrieve().isFailure() )
44 ATH_MSG_FATAL(
"Failed to retrieve tool " << m_VertexMergingTool);
45 return StatusCode::FAILURE;
49 m_VertexMergingTool.disable();
53 if (m_doVertexSorting) {
54 if ( m_VertexCollectionSortingTool.retrieve().isFailure() )
56 ATH_MSG_FATAL(
"Failed to retrieve tool " << m_VertexCollectionSortingTool);
57 return StatusCode::FAILURE;
64 m_VertexCollectionSortingTool.disable();
66 if (!m_monTool.empty())
CHECK(m_monTool.retrieve());
68 ATH_CHECK(m_trkTracksName.initialize(!m_useTrackParticles));
69 ATH_CHECK(m_tracksName.initialize(m_useTrackParticles));
70 ATH_CHECK(m_vxCandidatesOutputName.initialize());
71 return StatusCode::SUCCESS;
82 std::pair< xAOD::VertexContainer*, xAOD::VertexAuxContainer* > vertexContainerPair
83 = std::make_pair( vertexContainer, vertexAuxContainer );
85 if(m_useTrackParticles){
87 if(trackParticleCollection.isValid()){
89 vertexContainerPair = m_VertexFinderTool->findVertex ( trackParticleCollection.cptr() );
92 ATH_MSG_ERROR(
"No TrackParticle Collection with key "<<m_tracksName.key()<<
" exists in StoreGate. No Vertexing Possible");
93 return StatusCode::FAILURE;
97 if(trackCollection.isValid()){
98 vertexContainerPair = m_VertexFinderTool->findVertex ( trackCollection.cptr() );
100 ATH_MSG_ERROR(
"No Trk::Track Collection with key "<<m_trkTracksName.key()<<
" exists in StoreGate. No Vertexing Possible");
101 return StatusCode::FAILURE;
106 std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer* >
107 myVertexContainerPair{
nullptr,
nullptr};
108 auto deletePair = [](std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer* > &
p){
109 delete p.first;
p.first =
nullptr;
110 delete p.second;
p.second =
nullptr;
113 if (vertexContainerPair.first) {
115 if(m_doVertexMerging && vertexContainerPair.first->size() > 1) {
116 myVertexContainerPair = m_VertexMergingTool->mergeVertexContainer( *vertexContainerPair.first );
117 deletePair(vertexContainerPair);
118 vertexContainerPair = myVertexContainerPair;
121 if (m_doVertexSorting) {
122 myVertexContainerPair = m_VertexCollectionSortingTool->sortVertexContainer(*vertexContainerPair.first);
123 deletePair(vertexContainerPair);
126 if (myVertexContainerPair.first ==
nullptr) {
128 return StatusCode::FAILURE;
131 if (not myVertexContainerPair.first->hasStore()) {
133 return StatusCode::FAILURE;
136 ATH_MSG_DEBUG(
"Successfully reconstructed " << myVertexContainerPair.first->size()-1 <<
" vertices (excluding dummy)");
139 ATH_CHECK(outputVertices.record(std::unique_ptr<xAOD::VertexContainer>(myVertexContainerPair.first),std::unique_ptr<xAOD::VertexAuxContainer>(myVertexContainerPair.second)));
143 vertexIter != myVertexContainerPair.first->end(); ++vertexIter ) {
144 if((*vertexIter)->nTrackParticles() > 0 and (*vertexIter)->vertexType() != 0 ){
146 monitor_vertex(
"allVertex", **vertexIter);
148 if( vertexIter == myVertexContainerPair.first->begin() ) monitor_vertex(
"primVertex", **vertexIter);
153 return StatusCode::SUCCESS;
158 return StatusCode::SUCCESS;
162 if (
prefix ==
"allVertex"){
171 else if (
prefix ==
"primVertex"){