Skip to content

Commit

Permalink
Add a boolean config param (cms-sw#55)
Browse files Browse the repository at this point in the history
* Enable Maybe Layer

* Setting up the config parameter for maybe layer

* Setting up the config parameter for maybe layer

* Update Settings.h

* Fix Bug

* Maybe layer Update

* Fix Bug

* Remove cout and turn on maybelayer for hybrid

Co-authored-by: Jack Li <jingyan.li@cern.ch>
  • Loading branch information
2 people authored and tomalin committed Dec 7, 2020
1 parent ec02a1c commit 1aa8ffa
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
3 changes: 3 additions & 0 deletions L1Trigger/TrackFindingTMTT/interface/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ namespace tmtt {
unsigned int kalmanMaxSkipLayersEasy() const { return kalmanMaxSkipLayersEasy_; }
// Max #stubs an input track can have to be defined "easy".
unsigned int kalmanMaxStubsEasy() const { return kalmanMaxStubsEasy_; }
// Enable "maybe layer"
bool KFUseMaybeLayers() const { return KFUseMaybeLayers_; }
// Cuts applied to KF states as a function of the last KF tracker layer they had a stub in.
// (If "4" or "5" in name, cut only applies to 4 or 5 param helix fit).
const std::vector<double>& kfLayerVsPtToler() const { return kfLayerVsPtToler_; }
Expand Down Expand Up @@ -593,6 +595,7 @@ namespace tmtt {
unsigned int kalmanMaxSkipLayersHard_;
unsigned int kalmanMaxSkipLayersEasy_;
unsigned int kalmanMaxStubsEasy_;
bool KFUseMaybeLayers_;

std::vector<double> kfLayerVsPtToler_;
std::vector<double> kfLayerVsD0Cut5_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
KalmanMaxSkipLayersHard = cms.uint32(1), # For HT tracks with many stubs
KalmanMaxSkipLayersEasy = cms.uint32(2), # For HT tracks with few stubs
KalmanMaxStubsEasy = cms.uint32(10), # Max stubs an HT track can have to be "easy".
KFUseMaybeLayers = cms.bool(False), # Disable "maybe layer" to match with firmware
#--- Cuts applied to KF states as a function of the last KF tracker layer they had a stub in.
# (If "4" or "5" in name, cut only applies to 4 or 5 param helix fit).
KFLayerVsPtToler = cms.vdouble(999., 999., 0.1 , 0.1 , 0.05, 0.05, 0.05),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
TMTrackProducer.TrackFitSettings.KalmanHOalpha = 1
TMTrackProducer.TrackFitSettings.KalmanHOprojZcorr = 1
TMTrackProducer.TrackFitSettings.KalmanHOfw = False
TMTrackProducer.TrackFitSettings.KFUseMaybeLayers = True

#--- Switch on 2nd stage Mini HT with 2 GeV Pt threshold & allow it to find tracks with stubs in as few as 4 layers.

Expand Down
37 changes: 25 additions & 12 deletions L1Trigger/TrackFindingTMTT/src/KFbase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -699,19 +699,14 @@ namespace tmtt {
// In cases where identical GP encoded layer ID present in this sector from both barrel & endcap, this array filled considering barrel. The endcap is fixed by subsequent code.

constexpr unsigned layerMap[nEta / 2][nGPlayID + 1] = {
{7, 0, 1, 5, 4, 3, 7, 2}, // B1 B2 B3 B4 B5 B6
{7, 0, 1, 5, 4, 3, 7, 2}, // B1 B2 B3 B4 B5 B6 -- current FW
{7, 0, 1, 5, 4, 3, 7, 2}, // B1 B2 B3 B4 B5 B6
{7, 0, 1, 5, 4, 3, 7, 2}, // B1 B2 B3 B4 B5 B6
{7, 0, 1, 5, 4, 3, 7, 2}, // B1 B2 B3 B4 B5 B6
{7, 0, 1, 5, 4, 3, 7, 2}, // B1 B2 B3 B4(/D3) B5(/D2) B6(/D1)

{7, 0, 1, 3, 4, 2, 5, 2}, // B1 B2 B3(/D5)+B4(/D3) D1 D2 X D4 -- current FW
//{ 7, 0, 1, 3, 4, 3, 6, 2 }, // B1 B2 B3(/D5) D1+B4(/D3) D2 X D4 -- for use with "Fix cases" below.

{7, 0, 1, 2, 3, 4, 5, 6}, // B1 B2+D1 D2 D3 D5 D6

//{ 7, 0, 7, 1, 2, 3, 4, 5 }, // B1 D1 D2 D3 D4 D5 = current FW (or when Ambiguous function used)
{7, 0, 7, 1, 2, 3, 4, 5}, // Avoid effi loss for eta > 2.3 when Ambiguous function not used.
{7, 0, 1, 3, 4, 2, 6, 2}, // B1 B2 B3(/D5)+B4(/D3) D1 D2 X D4
{7, 0, 1, 1, 2, 3, 4, 5}, // B1 B2+D1 D2 D3 D5 D6
{7, 0, 7, 1, 2, 3, 4, 5}, // B1 D1 D2 D3 D4 D5
};

unsigned int kfEtaReg; // KF VHDL eta sector def: small in barrel & large in endcap.
Expand All @@ -722,6 +717,24 @@ namespace tmtt {
}

unsigned int kalmanLay = layerMap[kfEtaReg][layerIDreduced];

// Fixes to layermap when "maybe layer" used
if (settings_->KFUseMaybeLayers()) {
switch (kfEtaReg) {
case 5: //case 5: B1 B2 (B3+B4)* D1 D2 D3+D4 D5+D6 -- B3 is combined with B4 and is flagged as "maybe layer"
if (layerIDreduced == 6) {
kalmanLay = 5;
}
break;
case 6: //case 6: B1* B2* D1 D2 D3 D4 D5 -- B1 and B2 are flagged as "maybe layer"
if (layerIDreduced > 2) {
kalmanLay++;
}
break;
default:
break;
}
}

// Fixes to endcap stubs, for cases where identical GP encoded layer ID present in this sector from both barrel & endcap.

Expand Down Expand Up @@ -811,9 +824,9 @@ namespace tmtt {
kfEtaReg = iEtaReg - numEtaRegions_ / 2;
}

bool ambiguous = ambiguityMap[kfEtaReg][kfLayer];

//bool ambiguous = false;
bool ambiguous = false;
if (settings_->KFUseMaybeLayers()) ambiguous = ambiguityMap[kfEtaReg][kfLayer];
return ambiguous;
}

Expand Down
2 changes: 2 additions & 0 deletions L1Trigger/TrackFindingTMTT/src/Settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace tmtt {
kalmanMaxSkipLayersHard_(1), // On "hard" input tracks
kalmanMaxSkipLayersEasy_(2), // On "easy" input tracks
kalmanMaxStubsEasy_(10), // Max. #stubs an input track can have to be defined "easy"
KFUseMaybeLayers_(true),
kfLayerVsPtToler_({999., 999., 0.1, 0.1, 0.05, 0.05, 0.05}),
kfLayerVsD0Cut5_({999., 999., 999., 10., 10., 10., 10.}),
kfLayerVsZ0Cut5_({999., 999., 25.5, 25.5, 25.5, 25.5, 25.5}),
Expand Down Expand Up @@ -273,6 +274,7 @@ namespace tmtt {
kalmanMaxSkipLayersHard_(trackFitSettings_.getParameter<unsigned>("KalmanMaxSkipLayersHard")),
kalmanMaxSkipLayersEasy_(trackFitSettings_.getParameter<unsigned>("KalmanMaxSkipLayersEasy")),
kalmanMaxStubsEasy_(trackFitSettings_.getParameter<unsigned>("KalmanMaxStubsEasy")),
KFUseMaybeLayers_(trackFitSettings_.getParameter<bool>("KFUseMaybeLayers")),

kfLayerVsPtToler_(trackFitSettings_.getParameter<vector<double>>("KFLayerVsPtToler")),
kfLayerVsD0Cut5_(trackFitSettings_.getParameter<vector<double>>("KFLayerVsD0Cut5")),
Expand Down

0 comments on commit 1aa8ffa

Please sign in to comment.