10 #include "GaudiKernel/MsgStream.h"
31 return fit(r_segment, r_selection, curved_track);
37 std::unique_ptr<StraightPatRec> sfitter = std::make_unique<StraightPatRec>();
41 std::vector<unsigned int> hit_index;
42 unsigned int try_nb_hits;
43 bool segment_found(
false);
49 std::vector<Amg::Vector3D>
points;
62 throw std::runtime_error(
63 Form(
"File: %s, Line: %d\nCurvedPatRec::fit - Size of selection vector does not match the number of hits on track!", __FILE__,
76 if (sfitter->
fit(r_segment, r_selection,
track)) { est_dir =
track.directionVector(); }
81 if (r_selection[
k] == 0 && hit->sigmaDriftRadius() < 100) { loc_track_hits.push_back(hit); };
86 if (loc_track_hits.size() < 4) {
return false; }
92 try_nb_hits = loc_track_hits.size();
97 while (!segment_found && try_nb_hits > 3) {
106 log << MSG::WARNING <<
"Class CurvedPatRec, method fit: time-out for track finding after " <<
m_time_out <<
" seconds!"
118 for (
unsigned int k = 0;
k < try_nb_hits; ++
k) { track_hits.push_back(loc_track_hits[hit_index[
k] - 1]); }
125 segment_found =
true;
128 std::vector<Amg::Vector3D>
errors(track_hits.size());
129 for (
unsigned int k = 0;
k <
errors.size();
k++) {
130 if (track_hits[
k]->sigmaDriftRadius() > 0.0) {
144 double tmp_chi2(0.0);
145 for (
auto & track_hit : track_hits) {
150 if (track_hit->sigma2DriftRadius() != 0) {
151 tmp_chi2 = tmp_chi2 +
std::pow(
d - track_hit->driftRadius(), 2) / track_hit->sigma2DriftRadius();
153 tmp_chi2 = tmp_chi2 +
std::pow(
d - track_hit->driftRadius(), 2) / 0.01;
160 curved_track = aux_line;
162 stored_track_hits = track_hits;
167 try_nb_hits = try_nb_hits - 1;
170 if (!segment_found) {
return false; }
178 std::vector<Amg::Vector3D>
errors(stored_track_hits.size());
179 for (
unsigned int k = 0;
k <
errors.size();
k++) {
180 if (stored_track_hits[
k]->sigmaDriftRadius() > 0.0) {
195 for (
auto & stored_track_hit : stored_track_hits) {
200 if (stored_track_hit->sigma2DriftRadius() != 0) {
201 chi2 +=
std::pow(
d - stored_track_hit->driftRadius(), 2) / stored_track_hit->sigma2DriftRadius();
203 chi2 +=
std::pow(
d - stored_track_hit->driftRadius(), 2) / 0.01;
218 double dist_err(1.0);
219 hit->setDistanceToTrack(dist, dist_err);
222 if (std::isnan(
chi2)) {
chi2 = 1.0e6; }
244 Amg::Vector3D point_2 = hit->localPosition() + hit->driftRadius() * (point - hit->localPosition()).
unit();
254 std::vector<Amg::Vector3D> hit_vec;
260 for (
const auto & track_hit : track_hits) { hit_vec.emplace_back(
getHitPoint(track_hit, straight_track)); }
274 std::vector<Amg::Vector3D> hit_vec;
280 for (
const auto & track_hit : track_hits) {
281 hit_vec.emplace_back(
getHitPoint(track_hit, curved_track.
getTangent((track_hit->localPosition()).z())));