1 #ifndef RecoTracker_MkFitCore_interface_TrackStructures_h 2 #define RecoTracker_MkFitCore_interface_TrackStructures_h 14 class IterationParams;
47 if (module_id ==
M[0].m_module_id) {
48 if (
chi2 <
M[0].m_chi2) {
52 }
else if (module_id ==
M[1].m_module_id) {
53 if (
chi2 <
M[1].m_chi2) {
58 if (
M[0].m_chi2 >
M[1].m_chi2) {
59 if (
chi2 <
M[0].m_chi2) {
60 M[0] = {hit_idx, module_id,
chi2};
63 if (
chi2 <
M[1].m_chi2) {
64 M[1] = {hit_idx, module_id,
chi2};
71 if (module_id ==
M[0].m_module_id) {
72 if (
M[1].m_hit_idx >= 0)
74 }
else if (module_id ==
M[1].m_module_id) {
75 if (
M[0].m_hit_idx >= 0)
78 if (
M[0].m_chi2 <=
M[1].m_chi2) {
79 if (
M[0].m_hit_idx >= 0)
82 if (
M[1].m_hit_idx >= 0)
117 throw std::bad_alloc();
150 template <
class T,
class U>
152 return a.pool_id() ==
b.pool_id();
220 int nMonoDecoded(
const int& encoded)
const {
return (encoded / 10000) % 100; }
223 return encoded % 100 + (encoded / 100) % 100 + (encoded / 10000) % 100 - encoded / 1000000;
260 bool penalizeTailMissHits =
false,
261 bool inFindCandidates =
false) {
266 float pt = cand1.
pT();
271 return score_func(nfoundhits, ntailmisshits, noverlaphits, nmisshits,
chi2,
pt, inFindCandidates);
294 m_seed_algo(
o.m_seed_algo),
295 m_seed_label(
o.m_seed_label),
311 m_seed_algo(
o.m_seed_algo),
312 m_seed_label(
o.m_seed_label),
336 m_seed_algo =
o.m_seed_algo;
337 m_seed_label =
o.m_seed_label;
343 tc.setCombCandidate(
this);
359 void reset(
int max_cands_per_seed,
int expected_num_hots) {
360 std::vector<TrackCand, CcAlloc<TrackCand>>
tmp(
m_trk_cands.get_allocator());
372 m_hots.reserve(expected_num_hots);
416 int seed_algo()
const {
return m_seed_algo; }
417 int seed_label()
const {
return m_seed_label; }
431 int m_seed_label = 0;
468 if (hot_node.
m_hot.
index < 0 || !((0 <= tl && tl <= 3) || (18 <= tl && tl <= 20) || (45 <= tl && tl <= 47))) {
470 }
else if ((0 <= tl && tl <= 3) || (18 <= tl && tl <= 20) || (45 <= tl && tl <= 47)) {
499 bool prevStereo =
false;
502 int pix = 0, stereo = 0, mono = 0,
matched = 0;
503 int doubleStereo = -1;
508 bool cStereo = trk_inf[thisL].is_stereo();
509 if (trk_inf[thisL].is_pixel())
514 doubleStereo = thisL;
518 if (prevStereo && thisL == prevL - 1)
520 else if (thisL == prevL && thisL == doubleStereo - 1)
524 prevStereo = cStereo;
528 return pix + 100 * stereo + 10000 * mono + 1000000 *
matched;
533 bool prevStereo =
false;
536 int pix = 0, stereo = 0, mono = 0,
matched = 0;
542 bool cStereo = trk_inf[thisL].is_stereo();
543 if (trk_inf[thisL].is_pixel())
550 if (prevStereo && thisL == prevL - 1)
554 prevStereo = cStereo;
558 return pix + 100 * stereo + 10000 * mono + 1000000 *
matched;
592 std::vector<CombCandidate>
tmp;
601 void reset(
int new_capacity,
int max_cands_per_seed,
int expected_num_hots = 128) {
602 m_cc_pool.reset(new_capacity * max_cands_per_seed);
605 std::vector<CombCandidate>
tmp(new_capacity, alloc);
609 for (
int s = 0;
s < new_capacity; ++
s) {
610 m_candidates[
s].reset(max_cands_per_seed, expected_num_hots);
int nInsideMinusOneHits() const
void setOriginIndex(int oi)
float getScoreCand(const track_score_func &score_func, const Track &cand1, bool penalizeTailMissHits=false, bool inFindCandidates=false)
void addHitIdx(int hitIdx, int hitLyr, float chi2)
T * allocate(std::size_t n)
void reset(std::size_t size)
void deallocate(T *p, std::size_t n) noexcept
void mergeCandsAndBestShortOne(const IterationParams ¶ms, const track_score_func &score_func, bool update_score, bool sort_cands)
std::vector< CombCandidate > m_candidates
HitMatchPair m_overlap_hits
HitOnTrack getLastHitOnTrack() const
std::vector< TrackCand, CcAlloc< TrackCand > > trk_cand_vec_type
void reset(int max_cands_per_seed, int expected_num_hots)
bool operator==(const CcAlloc< T > &a, const CcAlloc< U > &b)
Track exportTrack(bool remove_missing_hits=false) const
void setNOverlapHits(int n)
int nHitsByTypeEncoded(const TrackerInfo &trk_inf) const
void resizeAfterFiltering(int n_removed)
void consider_hit_for_overlap(int hit_idx, int module_id, float chi2)
CombCandidate * m_comb_candidate
const HoTNode & hot_node(int i) const
CombCandidate & operator=(CombCandidate &&o)
TrackCand m_best_short_cand
TrackCand(const TrackBase &base, CombCandidate *ccand)
HitMatch * findOverlap(int hit_idx, int module_id)
short int m_nInsideMinusOneHits_before_bkwsearch
ret
prodAgent to be discontinued
const CombCandidate & operator[](int i) const
void resize(trk_cand_vec_type::size_type count)
uint32_t cc[maxCellsPerHit]
int nTailMinusOneHits() const
int nMatchedDecoded(const int &encoded) const
void setLastCcIndex(int i)
void setNInsideMinusOneHits(int n)
void setState(SeedState_e ss)
HitMatch * find_overlap(int hit_idx, int module_id)
void setNFoundHits(int n)
CombCandidate(const CombCandidate &o)
short int m_nTailMinusOneHits_before_bkwsearch
trk_cand_vec_type::reference emplace_back(TrackCand &tc)
short int nTailMinusOneHits_
int nTotMatchDecoded(const int &encoded) const
CombCandidate(const allocator_type &alloc)
TrackCand & operator[](int i)
CcPool< TrackCand > m_cc_pool
bool cands_in_backward_rep() const
const TrackCand & operator[](int i) const
void setNTailMinusOneHits(int n)
std::function< track_score_cf > track_score_func
bool m_cands_in_backward_rep
HoTNode & refLastHoTNode()
void compactifyHitStorageForBestCand(bool remove_seed_hits, int backward_fit_min_hits)
void insertSeed(const Track &seed, const track_score_func &score_func, int region, int pos)
const TrackCand & front() const
const HoTNode * hotsData() const
int nLayersByTypeEncoded(const TrackerInfo &trk_inf) const
EventOfCombCandidates(int size=0)
void setNMissingHits(int n)
void reset(int new_capacity, int max_cands_per_seed, int expected_num_hots=128)
CombCandidate & cand(int i)
CombCandidate & operator[](int i)
void considerHitForOverlap(int hit_idx, int module_id, float chi2)
CombCandidate * combCandidate() const
float getScoreWorstPossible()
int getLastFoundHitLyr() const
int nUniqueLayers() const
void compactifyHitStorageForBestCand(bool remove_seed_hits, int backward_fit_min_hits)
trk_cand_vec_type::size_type size() const
void repackCandPostBkwSearch(int i)
const std::vector< CombCandidate > & refCandidates() const
HoTNode & hot_node_nc(int i)
bool sortByScoreTrackCand(const TrackCand &cand1, const TrackCand &cand2)
int nStereoDecoded(const int &encoded) const
std::vector< CombCandidate > & refCandidates_nc()
short int m_lastHitIdx_before_bkwsearch
void setCombCandidate(CombCandidate *cc)
void deallocate(T *p, std::size_t n) noexcept
static constexpr int kHitCCCFilterIdx
const void * pool_id() const
trk_cand_vec_type m_trk_cands
int getLastHitIdx() const
int addHit(const HitOnTrack &hot, float chi2, int prev_idx)
int getLastHitLyr() const
HitOnTrack hot(int i) const
const TrackCand & refBestShortCand() const
CombCandidate(CombCandidate &&o)
T * allocate(std::size_t n)
static constexpr int kHitMissIdx
short int nInsideMinusOneHits_
CcPool(std::size_t size=0)
int getLastFoundPixelHitLyr() const
SeedState_e state() const
int nPixelDecoded(const int &encoded) const
void setBestShortCand(const TrackCand &tc)
int nMonoDecoded(const int &encoded) const
std::vector< HoTNode > m_hots
void importSeed(const Track &seed, const track_score_func &score_func, int region)