ATLAS Offline Software
Loading...
Searching...
No Matches
InDetPriVxResorter.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5/***************************************************************************
6 InDetPriVxResorter.cxx - Description
7 -------------------
8 begin : 15-08-2024
9 authors : Teng Jian Khoo
10 email : khoo@cern.ch
11 changes :
12 ***************************************************************************/
14
15#include <memory>
17
18namespace InDet
19{
20
22 (const std::string& name,ISvcLocator* pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator)
23 { }
24
25
27 {
28
29 if ( m_VertexCollectionSortingTool.retrieve().isFailure() )
30 {
31 ATH_MSG_FATAL("Failed to retrieve tool " << m_VertexCollectionSortingTool);
32 return StatusCode::FAILURE;
33 }
34
35 ATH_CHECK(m_verticesInKey.initialize());
36 ATH_CHECK(m_verticesOutKey.initialize());
37 return StatusCode::SUCCESS;
38 }
39
40
41 StatusCode InDetPriVxResorter::execute(const EventContext& ctx) const
42 {
43
46
47 auto vertexContainerPair = m_VertexCollectionSortingTool->sortVertexContainer(*inputVertices);
48 ATH_CHECK(outputVertices.record(std::unique_ptr<xAOD::VertexContainer>(vertexContainerPair.first),std::unique_ptr<xAOD::VertexAuxContainer>(vertexContainerPair.second)));
49
50 if(msgLevel()==MSG::VERBOSE) {
51 for(size_t ivx=0; ivx<inputVertices->size(); ++ivx) {
53 "Ntracks for original (resorted) vertex " << ivx << ": "
54 << inputVertices->at(ivx)->nTrackParticles()
55 << "(" << outputVertices->at(ivx)->nTrackParticles() << ")"
56 );
57 }
58 }
59
60 return StatusCode::SUCCESS;
61 }
62
63} // end namespace InDet
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
An algorithm that can be simultaneously executed in multiple threads.
virtual StatusCode execute(const EventContext &ctx) const override
SG::ReadHandleKey< xAOD::VertexContainer > m_verticesInKey
ToolHandle< Trk::IVertexCollectionSortingTool > m_VertexCollectionSortingTool
virtual StatusCode initialize() override
InDetPriVxResorter(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteHandleKey< xAOD::VertexContainer > m_verticesOutKey
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Primary Vertex Finder.