12 #include "GaudiKernel/MsgStream.h"
13 #include "GaudiKernel/SmartDataPtr.h"
25 m_trackDiffTool(
"Trk::TrackDiff/TrackDiff"),
26 m_referenceTrackCollection(
"simulatedTracks"),
27 m_comparedTrackCollection(
"Tracks")
39 msg(MSG::INFO) <<
"SingleTrackDiffAlg initialize()" <<
endmsg;
45 msg(
MSG::FATAL) <<
"Could not retrieve "<< m_trackDiffTool <<
" (to compare tracks) "<<
endmsg;
49 return StatusCode::SUCCESS;
60 if (!m_referenceTrackCollection.empty()) {
61 sc = evtStore()->retrieve(referenceTracks, m_referenceTrackCollection);
63 msg(MSG::ERROR) <<
"Reference tracks not found: " << m_referenceTrackCollection <<
endmsg;
64 return StatusCode::FAILURE;
69 msg(MSG::ERROR) <<
"No reference Track collection given!" <<
endmsg;
70 return StatusCode::FAILURE;
73 if (!m_comparedTrackCollection.empty()) {
74 sc = evtStore()->retrieve(comparedTracks, m_comparedTrackCollection);
76 msg(MSG::ERROR) <<
"Tracks for comparison not found: " << m_comparedTrackCollection <<
endmsg;
77 return StatusCode::FAILURE;
82 msg(MSG::ERROR) <<
"No Track collection for comparison given!" <<
endmsg;
83 return StatusCode::FAILURE;
89 if ( refTrackIterator == referenceTracks->
end() ) {
91 return StatusCode::SUCCESS;
93 if ( compTrackIterator == comparedTracks->
end() ) {
94 msg(MSG::INFO) <<
"collection for comparison containes no tracks in contrast to the reference collection" <<
endmsg;
95 return StatusCode::SUCCESS;
97 if (!(*refTrackIterator)) {
98 msg(MSG::WARNING) <<
"reference track collection containes a NULL pointer" <<
endmsg;
99 return StatusCode::SUCCESS;
102 const Perigee* refPerigee = (*refTrackIterator)->perigeeParameters();
103 const Track* compTrack =
nullptr;
106 double minChi2 = 1.e30;
107 for (; compTrackIterator != comparedTracks->
end(); ++compTrackIterator) {
108 if (!(*compTrackIterator)) {
109 msg(MSG::WARNING) <<
"track collection for comparison containes a NULL pointer" <<
endmsg;
112 const Perigee* compPerigee = (*compTrackIterator)->perigeeParameters();
115 if (compPerigee->covariance()) {
117 AmgVector(5) paramdiff = refPerigee->parameters() - compPerigee->parameters();
118 chi2 = paramdiff.transpose() *
weight * paramdiff;
119 if (
chi2 < minChi2) {
121 compTrack = (*compTrackIterator);
138 sc = m_trackDiffTool->diff( *(*refTrackIterator), *(compTrack) );
140 return StatusCode::SUCCESS;
149 msg(MSG::INFO) <<
"SingleTrackDiffAlg finalize()" <<
endmsg;
151 return StatusCode::SUCCESS;