Skip to content

Commit

Permalink
Use CMSSW naming convention for hit index constants and move to Hit c…
Browse files Browse the repository at this point in the history
…lass
  • Loading branch information
mmasciov committed Apr 19, 2022
1 parent 65220bd commit 9211e52
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
9 changes: 0 additions & 9 deletions RecoTracker/MkFitCore/interface/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ namespace mkfit {
constexpr float mag_b1 = 7.53701e-06;
constexpr float mag_a = 2.43878e-11;

// Config for "fake" hit addition
// Only if fake_hit_idx==-1, then count as missing hit for candidate score
constexpr int hit_miss_idx_ = -1; // hit is missed
constexpr int hit_stop_idx_ = -2; // track is stopped
constexpr int hit_edge_idx_ = -3; // track not in sensitive region of detector
constexpr int hit_maxcluster_idx_ = -5; // hit cluster size > maxClusterSize
constexpr int hit_gap_idx_ = -7; // track passing through inactive module
constexpr int hit_cccfilter_idx_ = -9; // hit filtered via CCC (unused)

// Config for SelectHitIndices
// Use extra arrays to store phi and q of hits.
// MT: This would in principle allow fast selection of good hits, if
Expand Down
9 changes: 9 additions & 0 deletions RecoTracker/MkFitCore/interface/Hit.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ namespace mkfit {
int layer(const MCHitInfoVec& globalMCHitInfo) const { return globalMCHitInfo[mcHitID_].layer(); }
int mcTrackID(const MCHitInfoVec& globalMCHitInfo) const { return globalMCHitInfo[mcHitID_].mcTrackID(); }

// Indices for "fake" hit addition
// Only if fake_hit_idx==-1, then count as missing hit for candidate score
static constexpr int kHitMissIdx = -1; // hit is missed
static constexpr int kHitStopIdx = -2; // track is stopped
static constexpr int kHitEdgeIdx = -3; // track not in sensitive region of detector
static constexpr int kHitMaxClusterIdx = -5; // hit cluster size > maxClusterSize
static constexpr int kHitInGapIdx = -7; // track passing through inactive module
static constexpr int kHitCCCFilterIdx = -9; // hit filtered via CCC (unused)

static constexpr int kMinChargePerCM = 1620;
static constexpr int kChargePerCMBits = 8;
static constexpr int kDetIdInLayerBits = 12;
Expand Down
10 changes: 5 additions & 5 deletions RecoTracker/MkFitCore/interface/HitStructures.h
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ namespace mkfit {
while (--nh >= 0) {
const HoTNode& hot_node = m_comb_candidate->hot_node(ch);
int thisL = hot_node.m_hot.layer;
if (thisL >= 0 && (hot_node.m_hot.index >= 0 || hot_node.m_hot.index == Config::hit_cccfilter_idx_) &&
if (thisL >= 0 && (hot_node.m_hot.index >= 0 || hot_node.m_hot.index == Hit::kHitCCCFilterIdx) &&
thisL != prevL) {
++nUL;
prevL = thisL;
Expand All @@ -717,7 +717,7 @@ namespace mkfit {
while (--nh >= 0) {
const HoTNode& hot_node = m_comb_candidate->hot_node(ch);
int thisL = hot_node.m_hot.layer;
if (thisL >= 0 && (hot_node.m_hot.index >= 0 || hot_node.m_hot.index == Config::hit_cccfilter_idx_)) {
if (thisL >= 0 && (hot_node.m_hot.index >= 0 || hot_node.m_hot.index == Hit::kHitCCCFilterIdx)) {
if (trk_inf[thisL].is_pixel())
++pix;
else if (trk_inf[thisL].is_stereo()) {
Expand Down Expand Up @@ -749,7 +749,7 @@ namespace mkfit {
while (--nh >= 0) {
const HoTNode& hot_node = m_comb_candidate->hot_node(ch);
int thisL = hot_node.m_hot.layer;
if (thisL >= 0 && (hot_node.m_hot.index >= 0 || hot_node.m_hot.index == Config::hit_cccfilter_idx_) &&
if (thisL >= 0 && (hot_node.m_hot.index >= 0 || hot_node.m_hot.index == Hit::kHitCCCFilterIdx) &&
thisL != prevL) {
if (trk_inf[thisL].is_pixel())
++pix;
Expand Down Expand Up @@ -778,7 +778,7 @@ namespace mkfit {
inline void TrackCand::addHitIdx(int hitIdx, int hitLyr, float chi2) {
lastHitIdx_ = m_comb_candidate->addHit({hitIdx, hitLyr}, chi2, lastHitIdx_);

if (hitIdx >= 0 || hitIdx == Config::hit_cccfilter_idx_) {
if (hitIdx >= 0 || hitIdx == Hit::kHitCCCFilterIdx) {
++nFoundHits_;
chi2_ += chi2;
nInsideMinusOneHits_ += nTailMinusOneHits_;
Expand All @@ -787,7 +787,7 @@ namespace mkfit {
//Note that for tracks passing through an inactive module (hitIdx = -7), we do not count the -7 hit against the track when scoring.
else {
++nMissingHits_;
if (hitIdx == Config::hit_miss_idx_)
if (hitIdx == Hit::kHitMissIdx)
++nTailMinusOneHits_;
}
}
Expand Down
34 changes: 17 additions & 17 deletions RecoTracker/MkFitCore/src/MkFinder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -808,16 +808,16 @@ namespace mkfit {

add_hit(itrack, bestHit[itrack], layer_of_hits.layer_id());
} else {
int fake_hit_idx = Config::hit_miss_idx_;
int fake_hit_idx = Hit::kHitMissIdx;

if (m_XWsrResult[itrack].m_wsr == WSR_Edge) {
// YYYYYY Config::store_missed_layers
fake_hit_idx = Config::hit_edge_idx_;
fake_hit_idx = Hit::kHitEdgeIdx;
} else if (num_all_minus_one_hits(itrack)) {
fake_hit_idx = Config::hit_stop_idx_;
fake_hit_idx = Hit::kHitStopIdx;
}

dprint("ADD FAKE HIT FOR TRACK #" << itrack << " withinBounds=" << (fake_hit_idx != Config::hit_edge_idx_)
dprint("ADD FAKE HIT FOR TRACK #" << itrack << " withinBounds=" << (fake_hit_idx != Hit::kHitEdgeIdx)
<< " r=" << std::hypot(m_Par[iP](itrack, 0, 0), m_Par[iP](itrack, 1, 0)));

m_msErr.setDiagonal3x3(itrack, 666);
Expand Down Expand Up @@ -1140,23 +1140,23 @@ namespace mkfit {

int fake_hit_idx = ((num_all_minus_one_hits(itrack) < m_iteration_params->maxHolesPerCand) &&
(m_NTailMinusOneHits(itrack, 0, 0) < m_iteration_params->maxConsecHoles))
? Config::hit_miss_idx_
: Config::hit_stop_idx_;
? Hit::kHitMissIdx
: Hit::kHitStopIdx;

if (m_XWsrResult[itrack].m_wsr == WSR_Edge) {
// YYYYYY m_iteration_params->store_missed_layers
fake_hit_idx = Config::hit_edge_idx_;
fake_hit_idx = Hit::kHitEdgeIdx;
}
//now add fake hit for tracks that passsed through inactive modules
else if (m_XWsrResult[itrack].m_in_gap == true && nHitsAdded[itrack] == 0) {
fake_hit_idx = Config::hit_gap_idx_;
fake_hit_idx = Hit::kHitInGapIdx;
}
//now add fake hit for cases where hit cluster size is larger than maxClusterSize
else if (isTooLargeCluster[itrack] == true && nHitsAdded[itrack] == 0) {
fake_hit_idx = Config::hit_maxcluster_idx_;
fake_hit_idx = Hit::kHitMaxClusterIdx;
}

dprint("ADD FAKE HIT FOR TRACK #" << itrack << " withinBounds=" << (fake_hit_idx != Config::hit_edge_idx_)
dprint("ADD FAKE HIT FOR TRACK #" << itrack << " withinBounds=" << (fake_hit_idx != Hit::kHitEdgeIdx)
<< " r=" << std::hypot(m_Par[iP](itrack, 0, 0), m_Par[iP](itrack, 1, 0)));

// QQQ as above, only create and add if score better
Expand Down Expand Up @@ -1334,28 +1334,28 @@ namespace mkfit {
// int fake_hit_idx = num_all_minus_one_hits(itrack) < m_iteration_params->maxHolesPerCand ? -1 : -2;
int fake_hit_idx = ((num_all_minus_one_hits(itrack) < m_iteration_params->maxHolesPerCand) &&
(m_NTailMinusOneHits(itrack, 0, 0) < m_iteration_params->maxConsecHoles))
? Config::hit_miss_idx_
: Config::hit_stop_idx_;
? Hit::kHitMissIdx
: Hit::kHitStopIdx;

if (m_XWsrResult[itrack].m_wsr == WSR_Edge) {
fake_hit_idx = Config::hit_edge_idx_;
fake_hit_idx = Hit::kHitEdgeIdx;
}
//now add fake hit for tracks that passsed through inactive modules
else if (m_XWsrResult[itrack].m_in_gap == true && nHitsAdded[itrack] == 0) {
fake_hit_idx = Config::hit_gap_idx_;
fake_hit_idx = Hit::kHitInGapIdx;
}
//now add fake hit for cases where hit cluster size is larger than maxClusterSize
else if (isTooLargeCluster[itrack] == true && nHitsAdded[itrack] == 0) {
fake_hit_idx = Config::hit_maxcluster_idx_;
fake_hit_idx = Hit::kHitMaxClusterIdx;
}

IdxChi2List tmpList;
tmpList.trkIdx = m_CandIdx(itrack, 0, 0);
tmpList.hitIdx = fake_hit_idx;
tmpList.module = -1;
tmpList.nhits = m_NFoundHits(itrack, 0, 0);
tmpList.ntailholes = (fake_hit_idx == Config::hit_miss_idx_ ? m_NTailMinusOneHits(itrack, 0, 0) + 1
: m_NTailMinusOneHits(itrack, 0, 0));
tmpList.ntailholes = (fake_hit_idx == Hit::kHitMissIdx ? m_NTailMinusOneHits(itrack, 0, 0) + 1
: m_NTailMinusOneHits(itrack, 0, 0));
tmpList.noverlaps = m_NOverlapHits(itrack, 0, 0);
tmpList.nholes = num_inside_minus_one_hits(itrack);
tmpList.pt = std::abs(1.0f / m_Par[iP].At(itrack, 3, 0));
Expand Down

0 comments on commit 9211e52

Please sign in to comment.