CMS 3D CMS Logo

Enumerations | Functions
tmtt::Utility Namespace Reference

Enumerations

enum  AlgoStep { HT, SEED, DUP, FIT }
 

Functions

unsigned int countLayers (const Settings *settings, const std::vector< const Stub * > &stubs, bool disableReducedLayerID=false, bool onlyPS=false)
 
unsigned int countLayers (const Settings *settings, const std::vector< Stub * > &stubs, bool disableReducedLayerID=false, bool onlyPS=false)
 
const TPmatchingTP (const Settings *settings, const std::vector< const Stub * > &vstubs, unsigned int &nMatchedLayersBest, std::vector< const Stub * > &matchedStubsBest)
 
const TPmatchingTP (const Settings *settings, const std::vector< Stub * > &vstubs, unsigned int &nMatchedLayersBest, std::vector< const Stub * > &matchedStubsBest)
 
unsigned int numLayerCut (Utility::AlgoStep algo, const Settings *settings, unsigned int iPhiSec, unsigned int iEtaReg, float invPt, float eta=0.)
 

Enumeration Type Documentation

◆ AlgoStep

Enumerator
HT 
SEED 
DUP 
FIT 

Definition at line 28 of file Utility.h.

28 { HT, SEED, DUP, FIT };

Function Documentation

◆ countLayers() [1/2]

unsigned int tmtt::Utility::countLayers ( const Settings settings,
const std::vector< const Stub * > &  stubs,
bool  disableReducedLayerID = false,
bool  onlyPS = false 
)

Definition at line 25 of file Utility.cc.

28  {
29  //=== Unpack configuration parameters
30 
31  // Note if using reduced layer ID, so tracker layer can be encoded in 3 bits.
32  const bool reduceLayerID = settings->reduceLayerID();
33 
34  // Disable use of reduced layer ID if requested, otherwise take from cfg.
35  bool reduce = (disableReducedLayerID) ? false : reduceLayerID;
36 
37  // Count layers using CMSSW layer ID.
38  unordered_set<unsigned int> foundLayers;
39  for (const Stub* stub : vstubs) {
40  if ((!onlyPS) || stub->psModule()) { // Consider only stubs in PS modules if that option specified.
41  // Use either normal or reduced layer ID depending on request.
42  int layerID = reduce ? stub->layerIdReduced() : stub->layerId();
43  foundLayers.insert(layerID);
44  }
45  }
46 
47  return foundLayers.size();
48  }

References tmtt::Settings::reduceLayerID().

Referenced by tmtt::HTcell::calcNumFilteredLayers(), tmtt::TP::calcNumLayers(), tmtt::L1track3D::cheat(), countLayers(), tmtt::Histos::fillInputData(), tmtt::TP::fillUseForAlgEff(), tmtt::TrkRZfilter::filterTracks(), tmtt::ChiSquaredFitBase::fit(), tmtt::L1fittedTrack::L1fittedTrack(), tmtt::L1track2D::L1track2D(), tmtt::L1track3D::L1track3D(), matchingTP(), and tmtt::TrkRZfilter::seedFilter().

◆ countLayers() [2/2]

unsigned int tmtt::Utility::countLayers ( const Settings settings,
const std::vector< Stub * > &  stubs,
bool  disableReducedLayerID = false,
bool  onlyPS = false 
)

Definition at line 17 of file Utility.cc.

20  {
21  std::vector<const Stub*> stubsConst(stubs.begin(), stubs.end());
22  return countLayers(settings, stubsConst, disableReducedLayerID, onlyPS);
23  }

References countLayers().

◆ matchingTP() [1/2]

const TP * tmtt::Utility::matchingTP ( const Settings settings,
const std::vector< const Stub * > &  vstubs,
unsigned int &  nMatchedLayersBest,
std::vector< const Stub * > &  matchedStubsBest 
)

Definition at line 63 of file Utility.cc.

66  {
67  // Get matching criteria
68  const double minFracMatchStubsOnReco = settings->minFracMatchStubsOnReco();
69  const double minFracMatchStubsOnTP = settings->minFracMatchStubsOnTP();
70  const unsigned int minNumMatchLayers = settings->minNumMatchLayers();
71  const unsigned int minNumMatchPSLayers = settings->minNumMatchPSLayers();
72 
73  // Loop over the given stubs, looking at the TP that produced each one.
74 
75  map<const TP*, vector<const Stub*> > tpsToStubs;
76  map<const TP*, vector<const Stub*> > tpsToStubsStrict;
77 
78  for (const Stub* s : vstubs) {
79  // If this stub was produced by one or more TPs, store a link from the TPs to the stub.
80  // (The assocated TPs here are influenced by config param "StubMatchStrict").
81  for (const TP* tp_i : s->assocTPs()) {
82  tpsToStubs[tp_i].push_back(s);
83  }
84  // To resolve tie-break situations, do the same, but now only considering strictly associated TP, where the TP contributed
85  // to both clusters making up stub.
86  if (s->assocTP() != nullptr) {
87  tpsToStubsStrict[s->assocTP()].push_back(s);
88  }
89  }
90 
91  // Loop over all the TP that matched the given stubs, looking for the best matching TP.
92 
93  nMatchedLayersBest = 0;
94  unsigned int nMatchedLayersStrictBest = 0;
95  matchedStubsBest.clear();
96  const TP* tpBest = nullptr;
97 
98  for (const auto& iter : tpsToStubs) {
99  const TP* tp = iter.first;
100  const vector<const Stub*> matchedStubsFromTP = iter.second;
101 
102  const vector<const Stub*> matchedStubsStrictFromTP =
103  tpsToStubsStrict[tp]; // Empty vector, if this TP didnt produce both clusters in stub.
104 
105  // Count number of the given stubs that came from this TP.
106  unsigned int nMatchedStubs = matchedStubsFromTP.size();
107  // Count number of tracker layers in which the given stubs came from this TP.
108  unsigned int nMatchedLayers = Utility::countLayers(settings, matchedStubsFromTP, true);
109  unsigned int nMatchedPSLayers = Utility::countLayers(settings, matchedStubsFromTP, true, true);
110 
111  // For tie-breaks, count number of tracker layers in which both clusters of the given stubs came from this TP.
112  unsigned int nMatchedLayersStrict = Utility::countLayers(settings, matchedStubsStrictFromTP, true);
113 
114  // If enough layers matched, then accept this tracking particle.
115  // Of the three criteria used here, usually only one is used, with the cuts on the other two set ultra loose.
116 
117  if (nMatchedStubs >=
118  minFracMatchStubsOnReco * vstubs.size() && // Fraction of matched stubs relative to number of given stubs
119  nMatchedStubs >= minFracMatchStubsOnTP *
120  tp->numAssocStubs() && // Fraction of matched stubs relative to number of stubs on TP.
121  nMatchedLayers >= minNumMatchLayers &&
122  nMatchedPSLayers >= minNumMatchPSLayers) { // Number of matched layers
123  // In case more than one matching TP found in this cell, note best match based on number of matching layers.
124  // In tie-break situation, count layers in which both clusters in stub came from same TP.
125  if (nMatchedLayersBest < nMatchedLayers ||
126  (nMatchedLayersBest == nMatchedLayers && nMatchedLayersStrictBest < nMatchedLayersStrict)) {
127  // Store data for this TP match.
128  nMatchedLayersBest = nMatchedLayers;
129  matchedStubsBest = matchedStubsFromTP;
130  tpBest = tp;
131  }
132  }
133  }
134 
135  return tpBest;
136  }

References countLayers(), tmtt::Settings::minFracMatchStubsOnReco(), tmtt::Settings::minFracMatchStubsOnTP(), tmtt::Settings::minNumMatchLayers(), tmtt::Settings::minNumMatchPSLayers(), alignCSCRings::s, and cmsswSequenceInfo::tp.

Referenced by tmtt::L1track3D::cheat(), tmtt::L1fittedTrack::L1fittedTrack(), tmtt::L1track2D::L1track2D(), tmtt::L1track3D::L1track3D(), and matchingTP().

◆ matchingTP() [2/2]

const TP * tmtt::Utility::matchingTP ( const Settings settings,
const std::vector< Stub * > &  vstubs,
unsigned int &  nMatchedLayersBest,
std::vector< const Stub * > &  matchedStubsBest 
)

Definition at line 55 of file Utility.cc.

58  {
59  std::vector<const Stub*> stubsConst(vstubs.begin(), vstubs.end());
60  return matchingTP(settings, stubsConst, nMatchedLayersBest, matchedStubsBest);
61  }

References matchingTP().

◆ numLayerCut()

unsigned int tmtt::Utility::numLayerCut ( Utility::AlgoStep  algo,
const Settings settings,
unsigned int  iPhiSec,
unsigned int  iEtaReg,
float  invPt,
float  eta = 0. 
)

Definition at line 141 of file Utility.cc.

146  {
147  if (algo == HT || algo == SEED || algo == DUP || algo == FIT) {
148  unsigned int nLayCut = settings->minStubLayers();
149 
150  //--- Check if should reduce cut on number of layers by 1 for any reason.
151 
152  bool reduce = false;
153 
154  // to increase efficiency for high Pt tracks.
155  bool applyMinPt = (settings->minPtToReduceLayers() > 0);
156  if (applyMinPt && std::abs(invPt) < 1 / settings->minPtToReduceLayers())
157  reduce = true;
158 
159  // or to increase efficiency in the barrel-endcap transition or very forward regions.
160  const vector<unsigned int>& etaSecsRed = settings->etaSecsReduceLayers();
161  if (std::count(etaSecsRed.begin(), etaSecsRed.end(), iEtaReg) != 0)
162  reduce = true;
163 
164  // or to increase efficiency in sectors containing dead modules (hard-wired in KF only)
165  // Not implemented here.
166 
167  if (reduce)
168  nLayCut--;
169 
170  constexpr unsigned int minLayCut = 4; // Minimum viable layer cut.
171  nLayCut = std::max(nLayCut, minLayCut);
172 
173  // Seed Filter & Track Fitters require only 4 layers.
174  constexpr unsigned int nFitLayCut = 4;
175  if (algo == SEED || algo == FIT)
176  nLayCut = nFitLayCut;
177 
178  return nLayCut;
179  } else {
180  throw cms::Exception("LogicError") << "Utility::numLayerCut() called with invalid algo argument! " << algo;
181  }
182  }

References funct::abs(), KineDebug3::count(), DUP, tmtt::Settings::etaSecsReduceLayers(), Exception, FIT, SiStripPI::max, tmtt::Settings::minPtToReduceLayers(), tmtt::Settings::minStubLayers(), and SEED.

Referenced by tmtt::SimpleLR4::fit(), tmtt::ChiSquaredFitBase::fit(), tmtt::TrkRZfilter::seedFilter(), and tmtt::HTcell::trackCandFound().

tmtt::Utility::countLayers
unsigned int countLayers(const Settings *settings, const std::vector< const Stub * > &stubs, bool disableReducedLayerID=false, bool onlyPS=false)
Definition: Utility.cc:25
DigiToRawDM_cff.TP
TP
Definition: DigiToRawDM_cff.py:51
tmtt::Utility::HT
Definition: Utility.h:28
cmsdt::algo
algo
Definition: constants.h:164
tmtt::Utility::FIT
Definition: Utility.h:28
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HT
Definition: HT.h:21
tmtt::Utility::SEED
Definition: Utility.h:28
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
tmtt::Utility::matchingTP
const TP * matchingTP(const Settings *settings, const std::vector< const Stub * > &vstubs, unsigned int &nMatchedLayersBest, std::vector< const Stub * > &matchedStubsBest)
Definition: Utility.cc:63
Exception
Definition: hltDiff.cc:246
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tmtt::Utility::DUP
Definition: Utility.h:28