ATLAS Offline Software
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 
18 namespace 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
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::InDetPriVxResorter::InDetPriVxResorter
InDetPriVxResorter(const std::string &name, ISvcLocator *pSvcLocator)
Definition: InDetPriVxResorter.cxx:29
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDet::InDetPriVxResorter::m_VertexCollectionSortingTool
ToolHandle< Trk::IVertexCollectionSortingTool > m_VertexCollectionSortingTool
Definition: InDetPriVxResorter.h:64
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
InDet::InDetPriVxResorter::initialize
virtual StatusCode initialize() override
Definition: InDetPriVxResorter.cxx:33
InDetPriVxResorter.h
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
InDet::InDetPriVxResorter::m_verticesInKey
SG::ReadHandleKey< xAOD::VertexContainer > m_verticesInKey
Definition: InDetPriVxResorter.h:62
VertexContainer.h
InDet::InDetPriVxResorter::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: InDetPriVxResorter.cxx:48
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
InDet::InDetPriVxResorter::m_verticesOutKey
SG::WriteHandleKey< xAOD::VertexContainer > m_verticesOutKey
Definition: InDetPriVxResorter.h:63