10 #include "GaudiKernel/MsgStream.h"
17 std::vector<FPGATrackSimTrack>::const_iterator
getBestChi2(std::vector<FPGATrackSimTrack>
const & tracks);
18 bool hasGoodFit(std::vector<FPGATrackSimTrack>
const & track_cands,
float minchi2);
26 const std::vector<const FPGATrackSimFitConstantBank*>& droppedLayerbanks,
bool guessingHits) :
34 for (
auto bank : droppedLayerbanks)
56 int TrackFitter::fitTracks(
const std::vector<std::shared_ptr<const FPGATrackSimRoad>>& roads, std::vector<FPGATrackSimTrack>& tracks) {
58 for (
const std::shared_ptr<const FPGATrackSimRoad>& cur_road : roads) {
59 std::vector<FPGATrackSimTrack>
t;
62 else tracks.insert(tracks.end(),
t.begin(),
t.end());
74 int TrackFitter::fitTracks(
const std::shared_ptr<const FPGATrackSimRoad> &road, std::vector<FPGATrackSimTrack>& tracks)
88 ATH_MSG_DEBUG(
"Attempting to fit Hough road with y = " <<
y <<
", x = " <<
x <<
", sector = " << road->getSector());
92 int sector = road->getSector();
102 ATH_MSG_WARNING(
"Constants for sector " << sector <<
" are not valid");
112 getMissingInfo(*road, nMissing, missPixel, missStrip, missing_mask, norecovery_mask);
139 std::vector<FPGATrackSimTrack> track_cands;
144 for (
size_t icomb = 0; icomb < nFits; icomb++)
148 bool ok = track_cands[icomb].isValidCand();
160 if (!( (missing_mask >>
ic) & 0
x1))
break;
169 track_cands[icomb].setOrigChi2(track_cands[icomb].
getChi2());
171 if (track_cands[icomb].getNMissing() == 0) {
177 bitmask &= ~(1 << icoord);
179 bitmask &= ~(1 << (icoord+1));
191 tracks.push_back(track_cands[icomb]);
254 missing_mask |= 1 << ix;
259 missing_mask |= (1<<ix) | (1<<iy);
266 else missPixel =
true;
269 else if (!((wclayers >>
layer) & 1)) {
274 missing_mask |= 1 << ix;
279 missing_mask |= (1<<ix) | (1<<iy);
285 norecovery_mask |= (1<<
layer);
303 track_cands.resize(combs.size(), temp);
308 for (
size_t icomb = 0; icomb < combs.size(); icomb++)
311 track_cands[icomb].setTrackID(
m_idbase + icomb);
317 std::vector<int>
const & hit_indices = combs[icomb];
320 if (hit_indices[
layer] < 0)
328 if (wcbits & (1 <<
layer ) ) {
333 track_cands[icomb].setFPGATrackSimHit(
layer, newhit);
337 const std::shared_ptr<const FPGATrackSimHit> hit = road.
getHits(
layer)[hit_indices[
layer]];
345 track_cands[icomb].setValidCand(
false);
348 track_cands[icomb].setFPGATrackSimHit(
layer, *hit);
371 float best_chi2ndof =
t.getChi2ndof();
378 if (norecovery_mask & (1<<
layer))
continue;
386 recovered_tracks[
layer].setFPGATrackSimHit(
layer,newhit);
390 unsigned int missing_mask =
t.getHitMap();
391 missing_mask &= ~(1 << ix);
395 recovered_tracks[
layer].setHitMap(missing_mask);
399 recovered_tracks[
layer].setQOverPt(qoverpt);
409 if (recovered_tracks[
layer].getChi2ndof() < best_chi2ndof)
411 best_chi2ndof = recovered_tracks[
layer].getChi2ndof();
417 return recovered_tracks[best_i];
429 std::vector<FPGATrackSimMultiTruth> mtv;
435 if (
layer <
t.getFPGATrackSimHits().size()) mtv.push_back(
t.getFPGATrackSimHits().at(
layer).getTruth());
438 mtv.back().assign_equal_normalization();
446 const bool ok = mt.
best(tbarcode, tfrac);
449 t.setEventIndex(tbarcode.first);
450 t.setBarcode(tbarcode.second);
451 t.setBarcodeFrac(tfrac);
461 bool hasGoodFit(std::vector<FPGATrackSimTrack>
const & track_cands,
float minchi2ndof)
465 if (
t.getChi2ndof() > 0 &&
t.getChi2ndof() < minchi2ndof)