10 #include "GaudiKernel/MsgStream.h"
29 log <<
MSG::VERBOSE <<
"LocalSegmentResolver::resolve: <to few hits, cannot resolve direction>" <<
endmsg;
41 if (lineIndex < 0)
return false;
52 double x1 = hpos1.x();
53 double y1 = hpos1.y();
56 double x2 = hpos2.x();
57 double y2 = hpos2.y();
60 double DeltaX =
x2 -
x1;
61 double DeltaY =
y2 -
y1;
62 double DistanceOfCenters = std::hypot(DeltaX, DeltaY);
63 double Alpha0 = std::atan2(DeltaY, DeltaX);
69 log <<
MSG::VERBOSE <<
"LocalSegmentResolver::getLines: calculating Lines (" <<
x1 <<
"," <<
y1 <<
") " << r1 <<
" ("
71 log <<
MSG::VERBOSE <<
"LocalSegmentResolver::getLines: general dir " << (hpos2 - hpos1).
unit()
76 if (r1 == 0. && r2 == 0.) {
83 list_of_lines.push_back(std::make_pair(
pos,
dir));
88 double RSum = r1 + r2;
89 double Alpha1 = std::asin(RSum / DistanceOfCenters);
91 double line_phi = Alpha0 + Alpha1;
98 log <<
MSG::VERBOSE <<
"LocalSegmentResolver::getLines: line pos " << pos1 <<
" dir " << dir1 <<
endmsg;
101 list_of_lines.push_back(std::make_pair(pos1, dir1));
103 line_phi = Alpha0 - Alpha1;
110 log <<
MSG::VERBOSE <<
"LocalSegmentResolver::getLines: line pos " << pos2 <<
" dir " << dir2 <<
endmsg;
113 list_of_lines.push_back(std::make_pair(pos2, dir2));
116 if (r1 == 0. || r2 == 0.)
return list_of_lines;
119 double DeltaR = std::abs(r2 - r1);
120 double Alpha2 = std::asin(
DeltaR / DistanceOfCenters);
128 line_phi = Alpha0 + Alpha2;
135 log <<
MSG::VERBOSE <<
"LocalSegmentResolver::getLines: line pos " << pos3 <<
" dir " << dir3 <<
endmsg;
138 list_of_lines.push_back(std::make_pair(pos3, dir3));
140 line_phi = Alpha0 - Alpha2;
147 log <<
MSG::VERBOSE <<
"LocalSegmentResolver::getLines: line pos " << pos4 <<
" dir " << dir4 <<
endmsg;
150 list_of_lines.push_back(std::make_pair(pos4, dir4));
158 line_phi = Alpha0 + Alpha2;
165 log <<
MSG::VERBOSE <<
"LocalSegmentResolver::getLines: line pos " << pos3 <<
" dir " << dir3 <<
endmsg;
168 list_of_lines.push_back(std::make_pair(pos3, dir3));
170 line_phi = Alpha0 - Alpha2;
177 log <<
MSG::VERBOSE <<
"LocalSegmentResolver::getLines: line pos " << pos4 <<
" dir " << dir4 <<
endmsg;
180 list_of_lines.push_back(std::make_pair(pos4, dir4));
183 return list_of_lines;
188 LineVec::const_iterator lit = localTracks.begin();
189 LineVec::const_iterator lit_end = localTracks.end();
192 double ressummin = 1e20;
193 unsigned int resnum = 0;
195 for (; lit != lit_end; ++lit) {
199 double alpha = std::atan2(lit->second.y(), lit->second.x());
211 log <<
MSG::VERBOSE <<
" angle " << alpha * 57.32 <<
" trk dir in trk frame " << lTrkDir <<
" pos " << avePosTrk
215 LocalSegmentResolver::HitVec::const_iterator
it =
hits.begin();
216 LocalSegmentResolver::HitVec::const_iterator it_end =
hits.end();
217 for (;
it != it_end; ++
it) {
223 double r = std::abs((*it)->driftRadius());
226 double res =
r - std::abs(sposAve.y());
238 log << MSG::INFO <<
" line " << lit - localTracks.begin() <<
" residual sum " << ressum <<
endmsg;
240 if (ressum < ressummin) {
242 resnum = lit - localTracks.begin();
248 log << MSG::INFO <<
" Done selected line: ressum " << ressummin <<
" ## " << resnum <<
endmsg;
249 log << MSG::INFO <<
" Position " << localTracks[resnum].first <<
" direction " << localTracks[resnum].second <<
endmsg;
251 if (resnum >= localTracks.size()) {
253 log << MSG::WARNING <<
"wrong line index" <<
endmsg;