ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkAlgorithms
TrkAmbiguitySolver
src
TrkAmbiguitySolver.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrkAmbiguitySolver/TrkAmbiguitySolver.h
"
6
#include "
TrkToolInterfaces/ITrackAmbiguityProcessorTool.h
"
7
#include "
TrkToolInterfaces/ITrackAmbiguityScoreProcessorTool.h
"
8
9
Trk::TrkAmbiguitySolver::TrkAmbiguitySolver
(
const
std::string& name, ISvcLocator* pSvcLocator) :
10
AthReentrantAlgorithm
(name, pSvcLocator) {}
11
12
//--------------------------------------------------------------------------
13
Trk::TrkAmbiguitySolver::~TrkAmbiguitySolver
(
void
)
14
=
default
;
15
16
//-----------------------------------------------------------------------
17
StatusCode
18
Trk::TrkAmbiguitySolver::initialize
()
19
{
20
ATH_CHECK
(
m_ambiTool
.retrieve());
21
22
ATH_CHECK
(
m_scoredTracksKey
.initialize());
23
ATH_CHECK
(
m_resolvedTracksKey
.initialize());
24
m_trackInCount
=0;
25
m_trackOutCount
=0;
26
return
StatusCode::SUCCESS;
27
}
28
29
//-------------------------------------------------------------------------
30
StatusCode
31
Trk::TrkAmbiguitySolver::execute
(
const
EventContext& ctx)
const
32
{
33
ATH_MSG_VERBOSE
(
"TrkAmbiguitySolver::execute()"
);
34
SG::ReadHandle<TracksScores>
scoredTracksHandle(
m_scoredTracksKey
, ctx);
35
if
( !scoredTracksHandle.
isValid
() )
ATH_MSG_ERROR
(
"Could not read scoredTracks."
);
36
const
int
nInput = scoredTracksHandle->size();
37
m_trackInCount
+= nInput;
38
39
std::unique_ptr<const TrackCollection> resolvedTracks;
40
resolvedTracks.reset(
m_ambiTool
->process(ctx, scoredTracksHandle.
cptr
()));
//note: take ownership and delete
41
m_trackOutCount
+= resolvedTracks->size();
42
43
SG::WriteHandle<TrackCollection>
resolvedTracksHandle(
m_resolvedTracksKey
, ctx);
44
ATH_MSG_DEBUG
(
"Saving "
<<resolvedTracks->size()<<
" tracks of "
<< nInput);
45
if
(!resolvedTracksHandle.
put
(std::move(resolvedTracks))) {
46
ATH_MSG_ERROR
(
"Can't record tracks as "
<<
m_resolvedTracksKey
.key());
47
return
StatusCode::FAILURE;
48
}
49
return
StatusCode::SUCCESS;
50
}
51
52
//---------------------------------------------------------------------------
53
54
StatusCode
55
Trk::TrkAmbiguitySolver::finalize
(){
56
if
(
m_ambiTool
.isEnabled()) {
57
m_ambiTool
->statistics();
58
}
59
ATH_MSG_DEBUG
(
"Finalizing with "
<<
m_trackInCount
<<
" tracks input, and "
<<
m_trackOutCount
<<
" output"
);
60
return
StatusCode::SUCCESS;
61
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ITrackAmbiguityProcessorTool.h
ITrackAmbiguityScoreProcessorTool.h
TrkAmbiguitySolver.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::put
const_pointer_type put(std::unique_ptr< T > data, bool returnExisting=false) const
Record an object to the store.
Trk::TrkAmbiguitySolver::~TrkAmbiguitySolver
~TrkAmbiguitySolver(void)
Trk::TrkAmbiguitySolver::finalize
StatusCode finalize(void) override
Definition
TrkAmbiguitySolver.cxx:55
Trk::TrkAmbiguitySolver::m_scoredTracksKey
SG::ReadHandleKey< TracksScores > m_scoredTracksKey
<where to find tracks (set in jobOptions and can be multiple collections
Definition
TrkAmbiguitySolver.h:46
Trk::TrkAmbiguitySolver::m_resolvedTracksKey
SG::WriteHandleKey< TrackCollection > m_resolvedTracksKey
Definition
TrkAmbiguitySolver.h:49
Trk::TrkAmbiguitySolver::TrkAmbiguitySolver
TrkAmbiguitySolver(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TrkAmbiguitySolver.cxx:9
Trk::TrkAmbiguitySolver::m_trackOutCount
std::atomic< long int > m_trackOutCount
Number of tracks passing Ambi solving.
Definition
TrkAmbiguitySolver.h:55
Trk::TrkAmbiguitySolver::execute
StatusCode execute(const EventContext &ctx) const override
Definition
TrkAmbiguitySolver.cxx:31
Trk::TrkAmbiguitySolver::m_trackInCount
std::atomic< long int > m_trackInCount
Number of tracks input.
Definition
TrkAmbiguitySolver.h:53
Trk::TrkAmbiguitySolver::m_ambiTool
ToolHandle< ITrackAmbiguityProcessorTool > m_ambiTool
Definition
TrkAmbiguitySolver.h:50
Trk::TrkAmbiguitySolver::initialize
StatusCode initialize(void) override
Definition
TrkAmbiguitySolver.cxx:18
Generated on
for ATLAS Offline Software by
1.17.0