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;
258 inline float getScoreCand(
const TrackCand& cand1,
bool penalizeTailMissHits =
false,
bool inFindCandidates =
false) {
263 float pt = cand1.
pT();
268 return getScoreCalc(nfoundhits, ntailmisshits, noverlaphits, nmisshits,
chi2,
pt, inFindCandidates);
291 m_seed_algo(
o.m_seed_algo),
292 m_seed_label(
o.m_seed_label),
308 m_seed_algo(
o.m_seed_algo),
309 m_seed_label(
o.m_seed_label),
333 m_seed_algo =
o.m_seed_algo;
334 m_seed_label =
o.m_seed_label;
340 tc.setCombCandidate(
this);
356 void reset(
int max_cands_per_seed,
int expected_num_hots) {
357 std::vector<TrackCand, CcAlloc<TrackCand>>
tmp(
m_trk_cands.get_allocator());
369 m_hots.reserve(expected_num_hots);
405 int seed_algo()
const {
return m_seed_algo; }
406 int seed_label()
const {
return m_seed_label; }
420 int m_seed_label = 0;
457 if (hot_node.
m_hot.
index < 0 || !((0 <= tl && tl <= 3) || (18 <= tl && tl <= 20) || (45 <= tl && tl <= 47))) {
459 }
else if ((0 <= tl && tl <= 3) || (18 <= tl && tl <= 20) || (45 <= tl && tl <= 47)) {
488 bool prevStereo =
false;
491 int pix = 0, stereo = 0, mono = 0,
matched = 0;
492 int doubleStereo = -1;
497 if (trk_inf[thisL].is_pixel())
499 else if (trk_inf[thisL].is_stereo()) {
502 doubleStereo = thisL;
506 if (prevStereo && thisL == prevL - 1)
508 else if (thisL == prevL && thisL == doubleStereo - 1)
516 return pix + 100 * stereo + 10000 * mono + 1000000 *
matched;
521 bool prevStereo =
false;
524 int pix = 0, stereo = 0, mono = 0,
matched = 0;
530 if (trk_inf[thisL].is_pixel())
532 else if (trk_inf[thisL].is_stereo())
537 if (prevStereo && thisL == prevL - 1)
545 return pix + 100 * stereo + 10000 * mono + 1000000 *
matched;
579 std::vector<CombCandidate>
tmp;
588 void reset(
int new_capacity,
int max_cands_per_seed,
int expected_num_hots = 128) {
589 m_cc_pool.reset(new_capacity * max_cands_per_seed);
592 std::vector<CombCandidate>
tmp(new_capacity, alloc);
596 for (
int s = 0;
s < new_capacity; ++
s) {
597 m_candidates[
s].reset(max_cands_per_seed, expected_num_hots);
int nInsideMinusOneHits() const
void setOriginIndex(int oi)
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
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)
void mergeCandsAndBestShortOne(const IterationParams ¶ms, bool update_score, bool sort_cands)
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)
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)
float getScoreCalc(const int nfoundhits, const int ntailholes, const int noverlaphits, const int nmisshits, const float chi2, const float pt, const bool inFindCandidates=false)
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
const TrackCand & operator[](int i) const
void setNTailMinusOneHits(int n)
HoTNode & refLastHoTNode()
void compactifyHitStorageForBestCand(bool remove_seed_hits, int backward_fit_min_hits)
const TrackCand & front() const
const HoTNode * hotsData() const
int nLayersByTypeEncoded(const TrackerInfo &trk_inf) const
EventOfCombCandidates(int size=0)
void setNMissingHits(int n)
float getScoreCand(const Track &cand1, bool penalizeTailMissHits=false, bool inFindCandidates=false)
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)
void insertSeed(const Track &seed, int region, int pos)
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
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
void importSeed(const Track &seed, int region)
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