ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetValidation
InDetTrackValidation
src
InDetSplittedTracksCreator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
InDetTrackValidation/InDetSplittedTracksCreator.h
"
6
#include "
TrkTrack/TrackCollection.h
"
7
#include "
TrkTrack/Track.h
"
8
//#include "TrkParameters/MeasuredPerigee.h"
9
#include "
InDetTrackSplitterTool/IInDetTrackSplitterTool.h
"
10
11
12
13
15
InDet::InDetSplittedTracksCreator::InDetSplittedTracksCreator
(
const
std::string& name, ISvcLocator* pSvcLocator) :
16
AthReentrantAlgorithm
(name, pSvcLocator),
17
// m_sgSvc(0),
18
m_TrackCol
(
"Tracks"
),
19
m_trackSplitterTool
()
20
21
{
22
// Properties go here
23
declareProperty
(
"TrackCollection"
,
m_TrackCol
);
24
declareProperty
(
"OutputTrackCollection"
,
m_OutputTrackCol
);
25
declareProperty
(
"TrackSplitterTool"
,
m_trackSplitterTool
);
26
declareProperty
(
"makeSiOnlyTracks"
,
m_makeSiOnlyTracks
=
false
);
27
declareProperty
(
"takeUpperSegment"
,
m_takeUpperSegment
=
true
);
28
declareProperty
(
"takeLowerSegment"
,
m_takeLowerSegment
=
true
);
29
}
30
31
InDet::InDetSplittedTracksCreator::~InDetSplittedTracksCreator
() =
default
;
32
33
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
34
StatusCode
InDet::InDetSplittedTracksCreator::initialize
(){
35
36
ATH_MSG_DEBUG
(
"InDetSplittedTracksCreator initialize()"
);
37
38
if
(
m_trackSplitterTool
.empty()) {
39
ATH_MSG_DEBUG
(
"No track splitter tool configured"
);
40
}
else
if
(
m_trackSplitterTool
.retrieve().isFailure()) {
41
if
(
msgLvl
(MSG::WARNING))
msg
(MSG::WARNING)<<
"Could not retrieve InDetTrackSplitterTool"
<<
endmsg
;
42
}
else
{
43
ATH_MSG_VERBOSE
(
"Retrieved tool InDetTrackSplitterTool"
);
44
}
45
ATH_CHECK
(
m_TrackCol
.initialize() );
46
ATH_CHECK
(
m_OutputTrackCol
.initialize() );
47
return
StatusCode::SUCCESS;
48
}
49
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
50
StatusCode
InDet::InDetSplittedTracksCreator::execute
(
const
EventContext& ctx)
const
{
51
ATH_MSG_DEBUG
(
"InDetSplittedTracksCreator execute()"
);
52
ATH_MSG_DEBUG
(
"Input Track Collection: "
<<
m_TrackCol
);
53
54
//return if no input collection is found
55
SG::ReadHandle<TrackCollection>
trks(
m_TrackCol
,ctx);
56
if
(!trks.
isValid
()) {
57
ATH_MSG_ERROR
(
" Could not retrieve the track collection "
<<
m_TrackCol
.key() );
58
return
StatusCode::SUCCESS;
59
}
60
61
// @In athenaMT the algorithm should not be scheduled if the splitted tracks exist already or they are overwritten
62
// TrackCollection* splittedTracks=0;
63
// if ((not evtStore()->contains<TrackCollection>(m_OutputTrackCol)) or
64
// (evtStore()->retrieve(splittedTracks,m_OutputTrackCol)).isFailure()) {
65
// splittedTracks = new TrackCollection;
66
// } else {
67
// ATH_MSG_WARNING("Output split track collection already exists: " << m_OutputTrackCol.key() << ". Quitting.");
68
// return StatusCode::SUCCESS;
69
// }
70
71
SG::WriteHandle<TrackCollection>
splittedTracks(
m_OutputTrackCol
,ctx);
72
if
(splittedTracks.
record
( std::make_unique<TrackCollection>() ).isFailure()){
73
ATH_MSG_ERROR
(
"Failed to record output collection "
<<
m_OutputTrackCol
.key());
74
return
StatusCode::FAILURE;
75
}
76
77
78
//loop over tracks and split them in upper and lower part
79
TrackCollection::const_iterator
it = trks->begin();
80
TrackCollection::const_iterator
itE = trks->end();
81
for
(; it != itE; ++it){
82
ATH_MSG_VERBOSE
(
"Splitting Track"
);
83
std::pair<Trk::Track*, Trk::Track*> splitTracks = std::pair<Trk::Track*, Trk::Track*> (0,0);
84
splitTracks =
m_trackSplitterTool
->splitInUpperLowerTrack(**it,
m_makeSiOnlyTracks
);
85
//only save them if both track fits succeeded
86
if
(splitTracks.first && splitTracks.second){
87
if
(
m_takeUpperSegment
) {
88
ATH_MSG_DEBUG
(
"** InDetSplittedTracksCreator ** Accept upper segment "
);
89
splittedTracks->push_back( splitTracks.first );
90
}
91
if
(
m_takeLowerSegment
) {
92
ATH_MSG_DEBUG
(
"** InDetSplittedTracksCreator ** Accept lower segment "
);
93
splittedTracks->push_back( splitTracks.second );
94
}
95
}
else
{
96
delete
splitTracks.first;
delete
splitTracks.second;
97
}
98
99
}
100
ATH_MSG_DEBUG
(
"** InDetSplittedTracksCreator ** SplittedTracks->size() "
<< splittedTracks->size() <<
" stored in "
<<
m_OutputTrackCol
.key() );
101
102
103
return
StatusCode::SUCCESS;
104
}
105
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
106
StatusCode
InDet::InDetSplittedTracksCreator::finalize
() {
107
ATH_MSG_VERBOSE
(
"InDetSplittedTracksCreator finalize()"
);
108
return
StatusCode::SUCCESS;
109
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
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
IInDetTrackSplitterTool.h
InDetSplittedTracksCreator.h
TrackCollection.h
Track.h
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition
AthCommonMsg.h:30
AthCommonAlgorithm< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
DataVector< Trk::Track >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
InDet::InDetSplittedTracksCreator::m_trackSplitterTool
ToolHandle< InDet::IInDetTrackSplitterTool > m_trackSplitterTool
instances of IInDet
Definition
InDetSplittedTracksCreator.h:56
InDet::InDetSplittedTracksCreator::InDetSplittedTracksCreator
InDetSplittedTracksCreator(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Definition
InDetSplittedTracksCreator.cxx:15
InDet::InDetSplittedTracksCreator::m_takeUpperSegment
bool m_takeUpperSegment
flag to accept the upper segment
Definition
InDetSplittedTracksCreator.h:52
InDet::InDetSplittedTracksCreator::m_makeSiOnlyTracks
bool m_makeSiOnlyTracks
flag for using TRT standalone tracks
Definition
InDetSplittedTracksCreator.h:50
InDet::InDetSplittedTracksCreator::initialize
StatusCode initialize()
standard Athena-Algorithm method
Definition
InDetSplittedTracksCreator.cxx:34
InDet::InDetSplittedTracksCreator::finalize
StatusCode finalize()
standard Athena-Algorithm method
Definition
InDetSplittedTracksCreator.cxx:106
InDet::InDetSplittedTracksCreator::m_OutputTrackCol
SG::WriteHandleKey< TrackCollection > m_OutputTrackCol
holds the names the output track collection written to store gate
Definition
InDetSplittedTracksCreator.h:46
InDet::InDetSplittedTracksCreator::m_takeLowerSegment
bool m_takeLowerSegment
flag to accept the lower segment
Definition
InDetSplittedTracksCreator.h:54
InDet::InDetSplittedTracksCreator::execute
StatusCode execute(const EventContext &ctx) const
standard Athena-Algorithm method
Definition
InDetSplittedTracksCreator.cxx:50
InDet::InDetSplittedTracksCreator::~InDetSplittedTracksCreator
~InDetSplittedTracksCreator()
Default Destructor.
InDet::InDetSplittedTracksCreator::m_TrackCol
SG::ReadHandleKey< TrackCollection > m_TrackCol
holds the name of the track coll to be used
Definition
InDetSplittedTracksCreator.h:44
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Generated on
for ATLAS Offline Software by
1.17.0