diff --git a/L1Trigger/TrackFindingTMTT/interface/KFbase.h b/L1Trigger/TrackFindingTMTT/interface/KFbase.h index 57bfcf7a450d9..1a6e3ecaff2a3 100644 --- a/L1Trigger/TrackFindingTMTT/interface/KFbase.h +++ b/L1Trigger/TrackFindingTMTT/interface/KFbase.h @@ -48,24 +48,18 @@ namespace tmtt { // Do KF fit L1fittedTrack fit(const L1track3D &l1track3D) override; - static const unsigned int nEta = 16; - static const unsigned int nGPlayID = 7; - static constexpr unsigned int invalidKFlayer = 7; + static const unsigned int nKFlayer_ = 7; + static const unsigned int nEta_ = 16; + static const unsigned int nGPlayer_ = 7; + static constexpr unsigned int invalidKFlayer_ = nKFlayer_; // index across is GP encoded layer ID (where barrel layers=1,2,7,5,4,3 & endcap wheels=3,4,5,6,7 & 0 never occurs) // index down is eta reg // element.first is kalman layer when stub is from barrel, 7 is invalid // element.second is kalman layer when stub is from endcap, 7 is invalid - static constexpr std::pair layerMap[nEta / 2][nGPlayID + 1] = { - {{7, 7}, - {0, 7}, - {1, 7}, - {5, 7}, - {4, 7}, - {3, 7}, - {7, 7}, - {2, 7}}, // B1 B2 B3 B4 B5 B6 -- Ultimate config with "maybe layer" + static constexpr std::pair layerMap_[nEta_ / 2][nGPlayer_ + 1] = { + {{7, 7}, {0, 7}, {1, 7}, {5, 7}, {4, 7}, {3, 7}, {7, 7}, {2, 7}}, // B1 B2 B3 B4 B5 B6 {{7, 7}, {0, 7}, {1, 7}, {5, 7}, {4, 7}, {3, 7}, {7, 7}, {2, 7}}, // B1 B2 B3 B4 B5 B6 {{7, 7}, {0, 7}, {1, 7}, {5, 7}, {4, 7}, {3, 7}, {7, 7}, {2, 7}}, // B1 B2 B3 B4 B5 B6 {{7, 7}, {0, 7}, {1, 7}, {5, 7}, {4, 7}, {3, 7}, {7, 7}, {2, 7}}, // B1 B2 B3 B4 B5 B6 diff --git a/L1Trigger/TrackFindingTMTT/src/KFbase.cc b/L1Trigger/TrackFindingTMTT/src/KFbase.cc index 05c32312d2bd6..286701d638af0 100644 --- a/L1Trigger/TrackFindingTMTT/src/KFbase.cc +++ b/L1Trigger/TrackFindingTMTT/src/KFbase.cc @@ -202,7 +202,7 @@ namespace tmtt { // Get Kalman encoded layer ID for this stub. int kalmanLay = this->kalmanLayer(etaReg, stub->layerIdReduced(), stub->barrel(), stub->r(), stub->z()); - if (kalmanLay != invalidKFlayer) { + if (kalmanLay != invalidKFlayer_) { if (layerStubs[kalmanLay].size() < settings_->kalmanMaxStubsPerLayer()) { layerStubs[kalmanLay].push_back(stub); } else { @@ -266,7 +266,7 @@ namespace tmtt { if (kfDeadLayers.find(layer + 1) != kfDeadLayers.end() && layerStubs[layer + 1].empty()) { nextlay_stubs = layerStubs[layer + 2]; nSkippedDeadLayers_nextStubs++; - } else if (this->kalmanAmbiguousLayer(etaReg, layer) && layerStubs[layer + 1].empty()) { + } else if (this->kalmanAmbiguousLayer(etaReg, layer + 1) && layerStubs[layer + 1].empty()) { nextlay_stubs = layerStubs[layer + 2]; nSkippedAmbiguousLayers_nextStubs++; } else { @@ -342,19 +342,6 @@ namespace tmtt { new_states.insert(new_states.end(), next_states.begin(), next_states.end()); new_states.insert(new_states.end(), next_states_skipped.begin(), next_states_skipped.end()); - /* - i = 0; - for (auto state : next_states) { - new_states.push_back(state); - i++; - } - - i = 0; - for (auto state : next_states_skipped) { - new_states.push_back(state); - i++; - } -*/ } //end of state loop // copy new_states into prev_states for next iteration or end if we are on @@ -374,7 +361,7 @@ namespace tmtt { // We're done. prev_states.clear(); new_states.clear(); - + break; } else { // Continue iterating. prev_states = new_states; @@ -695,9 +682,9 @@ namespace tmtt { unsigned int KFbase::kalmanLayer( unsigned int iEtaReg, unsigned int layerIDreduced, bool barrel, float r, float z) const { - if (nEta != numEtaRegions_) + if (nEta_ != numEtaRegions_) throw cms::Exception("LogicError") - << "ERROR KFbase::getKalmanLayer hardwired value of nEta differs from NumEtaRegions cfg param"; + << "ERROR KFbase::getKalmanLayer hardwired value of nEta_ differs from NumEtaRegions cfg param"; unsigned int kfEtaReg; // KF VHDL eta sector def: small in barrel & large in endcap. if (iEtaReg < numEtaRegions_ / 2) { @@ -707,7 +694,7 @@ namespace tmtt { } unsigned int kalmanLay = - barrel ? layerMap[kfEtaReg][layerIDreduced].first : layerMap[kfEtaReg][layerIDreduced].second; + barrel ? layerMap_[kfEtaReg][layerIDreduced].first : layerMap_[kfEtaReg][layerIDreduced].second; // Switch back to the layermap that is consistent with current FW when "maybe layer" is not used if (not settings_->kfUseMaybeLayers()) { @@ -764,9 +751,7 @@ namespace tmtt { // Only helps in extreme forward sector, and there not significantly. // UNDERSTAND IF CAN BE USED ELSEWHERE. - const unsigned int nEta = 16; - const unsigned int nKFlayer = 7; - constexpr bool ambiguityMap[nEta / 2][nKFlayer] = { + constexpr bool ambiguityMap[nEta_ / 2][nKFlayer_] = { {false, false, false, false, false, false, false}, {false, false, false, false, false, false, false}, {false, false, false, false, false, false, false}, @@ -785,7 +770,7 @@ namespace tmtt { } bool ambiguous = false; - if (settings_->kfUseMaybeLayers()) + if (settings_->kfUseMaybeLayers() && kfLayer < nKFlayer_) ambiguous = ambiguityMap[kfEtaReg][kfLayer]; return ambiguous; diff --git a/L1Trigger/TrackTrigger/src/HitPatternHelper.cc b/L1Trigger/TrackTrigger/src/HitPatternHelper.cc index b35dc0fadafa6..8beaef9352ae0 100644 --- a/L1Trigger/TrackTrigger/src/HitPatternHelper.cc +++ b/L1Trigger/TrackTrigger/src/HitPatternHelper.cc @@ -18,21 +18,21 @@ namespace hph { setupTT_(setupTT), layerIds_(), layermap_(), - nEtaRegions_(tmtt::KFbase::nEta / 2), - nKalmanLayers_(tmtt::KFbase::invalidKFlayer) { + nEtaRegions_(tmtt::KFbase::nEta_ / 2), + nKalmanLayers_(tmtt::KFbase::nKFlayer_) { for (const tt::SensorModule& sm : setupTT_.sensorModules()) { layerIds_.push_back(std::make_pair(sm.layerId(), sm.barrel())); } sort(layerIds_.begin(), layerIds_.end(), smallerID); layerIds_.erase(unique(layerIds_.begin(), layerIds_.end(), equalID), layerIds_.end()); //Keep only unique layerIds - // Converting tmtt::KFbase::layerMap to a format that is acceptatble by HitPatternHelper + // Converting tmtt::KFbase::layerMap_ to a format that is acceptatble by HitPatternHelper for (int i = 0; i < nEtaRegions_; i++) { for (int j = 0; j < (int)layerIds_.size(); j++) { int layer = nKalmanLayers_; if (layerIds_[j].second) { - layer = tmtt::KFbase::layerMap[i][tmtt::TrackerModule::calcLayerIdReduced(layerIds_[j].first)].first; + layer = tmtt::KFbase::layerMap_[i][tmtt::TrackerModule::calcLayerIdReduced(layerIds_[j].first)].first; } else { - layer = tmtt::KFbase::layerMap[i][tmtt::TrackerModule::calcLayerIdReduced(layerIds_[j].first)].second; + layer = tmtt::KFbase::layerMap_[i][tmtt::TrackerModule::calcLayerIdReduced(layerIds_[j].first)].second; } if (layer < nKalmanLayers_) { layermap_[i][layer].push_back(layerIds_[j].first);