CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
tmtt::HTcell Class Reference

#include <HTcell.h>

Public Member Functions

void disableBendFilter ()
 
void end ()
 
 HTcell (const Settings *settings, unsigned int iPhiSec, unsigned int iEtaReg, float etaMinSector, float etaMaxSector, float qOverPt, unsigned int ibin_qOverPt, bool mergedCell, bool miniHTcell=false)
 
bool mergedCell () const
 
unsigned int numLayers () const
 
unsigned int numLayersSubSec () const
 
unsigned int numStubs () const
 
unsigned int numUnfilteredStubs () const
 
void store (Stub *stub)
 
void store (Stub *stub, const std::vector< bool > &inSubSecs)
 
bool stubInCell (const Stub *stub) const
 
const std::vector< Stub * > & stubs () const
 
bool stubStoredInCell (const Stub *stub) const
 
bool trackCandFound () const
 

Private Member Functions

std::vector< Stub * > bendFilter (const std::vector< Stub * > &stubs) const
 
unsigned int calcNumFilteredLayers () const
 
unsigned int calcNumFilteredLayers (unsigned int iSubSec) const
 
float dphi (float rad) const
 
std::vector< Stub * > maxStubCountFilter (const std::vector< Stub * > &stubs) const
 

Private Attributes

float etaMaxSector_
 
float etaMinSector_
 
unsigned int ibin_qOverPt_
 
unsigned int iEtaReg_
 
float invPtToDphi_
 
unsigned int iPhiSec_
 
unsigned int maxStubsInCell_
 
bool mergedCell_
 
bool miniHTcell_
 
unsigned int numFilteredLayersInCell_
 
unsigned int numFilteredLayersInCellBestSubSec_
 
unsigned int numSubSecs_
 
float qOverPtCell_
 
const Settingssettings_
 
std::map< const Stub
*, std::vector< bool > > 
subSectors_
 
bool useBendFilter_
 
std::vector< Stub * > vFilteredStubs_
 
std::vector< Stub * > vStubs_
 

Detailed Description

Definition at line 20 of file HTcell.h.

Constructor & Destructor Documentation

tmtt::HTcell::HTcell ( const Settings settings,
unsigned int  iPhiSec,
unsigned int  iEtaReg,
float  etaMinSector,
float  etaMaxSector,
float  qOverPt,
unsigned int  ibin_qOverPt,
bool  mergedCell,
bool  miniHTcell = false 
)

Definition at line 14 of file HTcell.cc.

References tmtt::Settings::maxStubsInCell(), maxStubsInCell_, tmtt::Settings::maxStubsInCellMiniHough(), and miniHTcell_.

23  : settings_(settings),
24  // Sector number
25  iPhiSec_(iPhiSec),
26  iEtaReg_(iEtaReg),
27  // Rapidity range of sector.
28  etaMinSector_(etaMinSector),
29  etaMaxSector_(etaMaxSector),
30  // Track q/Pt.
31  qOverPtCell_(qOverPt),
32  // Note bin number of cell along q/Pt axis of r-phi HT array. (Not used if r-z HT).
33  ibin_qOverPt_(ibin_qOverPt),
35  // Is cell in Mini-HT?
36  miniHTcell_(miniHTcell),
37  invPtToDphi_(settings->invPtToDphi()), // B*c/2E11
38  // Use filter in each HT cell using only stubs which have consistent bend?
39  useBendFilter_(settings->useBendFilter()),
40  // Check if subsectors are being used within each sector. These are only ever used for r-phi HT.
41  numSubSecs_(settings->numSubSecsEta()) {
42  // A filter is used each HT cell, which prevents more than the specified number of stubs being stored in the cell. (Reflecting memory limit of hardware).
43  if (miniHTcell_) {
44  maxStubsInCell_ = settings->maxStubsInCellMiniHough();
45  } else {
46  maxStubsInCell_ = settings->maxStubsInCell();
47  }
48  }
bool mergedCell() const
Definition: HTcell.h:53
unsigned int iPhiSec_
Definition: HTcell.h:118
float invPtToDphi_
Definition: HTcell.h:134
unsigned int numSubSecs_
Definition: HTcell.h:142
bool mergedCell_
Definition: HTcell.h:129
unsigned int iEtaReg_
Definition: HTcell.h:119
unsigned int ibin_qOverPt_
Definition: HTcell.h:127
unsigned int maxStubsInCell_
Definition: HTcell.h:139
const Settings * settings_
Definition: HTcell.h:116
float qOverPtCell_
Definition: HTcell.h:124
bool miniHTcell_
Definition: HTcell.h:132
float etaMinSector_
Definition: HTcell.h:121
float etaMaxSector_
Definition: HTcell.h:122
bool useBendFilter_
Definition: HTcell.h:137

Member Function Documentation

vector< Stub * > tmtt::HTcell::bendFilter ( const std::vector< Stub * > &  stubs) const
private

Definition at line 103 of file HTcell.cc.

References ibin_qOverPt_, cms::cuda::allocator::maxBin, mergedCell_, cms::cuda::allocator::minBin, and alignCSCRings::s.

Referenced by end().

103  {
104  // Create bend-filtered stub collection.
105  vector<Stub*> filteredStubs;
106  for (Stub* s : stubs) {
107  // Require stub bend to be consistent with q/Pt of this cell.
108 
109  unsigned int minBin = s->min_qOverPt_bin();
110  unsigned int maxBin = s->max_qOverPt_bin();
111  if (mergedCell_) {
112  if (minBin % 2 == 1)
113  minBin--;
114  }
115  if (minBin <= ibin_qOverPt_ && ibin_qOverPt_ <= maxBin)
116  filteredStubs.push_back(s);
117  }
118 
119  return filteredStubs;
120  }
constexpr unsigned int maxBin
bool mergedCell_
Definition: HTcell.h:129
unsigned int ibin_qOverPt_
Definition: HTcell.h:127
const std::vector< Stub * > & stubs() const
Definition: HTcell.h:60
constexpr unsigned int minBin
unsigned int tmtt::HTcell::calcNumFilteredLayers ( ) const
inlineprivate

Definition at line 97 of file HTcell.h.

References tmtt::Utility::countLayers(), settings_, and vFilteredStubs_.

Referenced by end().

std::vector< Stub * > vFilteredStubs_
Definition: HTcell.h:147
const Settings * settings_
Definition: HTcell.h:116
unsigned int countLayers(const Settings *settings, const std::vector< const Stub * > &stubs, bool disableReducedLayerID=false, bool onlyPS=false)
Definition: Utility.cc:25
unsigned int tmtt::HTcell::calcNumFilteredLayers ( unsigned int  iSubSec) const
private

Definition at line 90 of file HTcell.cc.

References tmtt::Utility::countLayers(), alignCSCRings::s, settings_, subSectors_, and vFilteredStubs_.

90  {
91  vector<const Stub*> stubsInSubSec;
92  for (const Stub* s : vFilteredStubs_) {
93  const vector<bool>& inSubSec = subSectors_.at(s); // Find out which subsectors this stub is in.
94  if (inSubSec[iSubSec])
95  stubsInSubSec.push_back(s);
96  }
97  return Utility::countLayers(settings_, stubsInSubSec);
98  }
std::vector< Stub * > vFilteredStubs_
Definition: HTcell.h:147
std::map< const Stub *, std::vector< bool > > subSectors_
Definition: HTcell.h:151
const Settings * settings_
Definition: HTcell.h:116
unsigned int countLayers(const Settings *settings, const std::vector< const Stub * > &stubs, bool disableReducedLayerID=false, bool onlyPS=false)
Definition: Utility.cc:25
void tmtt::HTcell::disableBendFilter ( )
inline

Definition at line 93 of file HTcell.h.

References useBendFilter_.

Referenced by tmtt::MiniHTstage::exec().

93 { useBendFilter_ = false; }
bool useBendFilter_
Definition: HTcell.h:137
float tmtt::HTcell::dphi ( float  rad) const
inlineprivate

Definition at line 104 of file HTcell.h.

References invPtToDphi_, and qOverPtCell_.

104 { return (invPtToDphi_ * rad * qOverPtCell_); }
float invPtToDphi_
Definition: HTcell.h:134
float qOverPtCell_
Definition: HTcell.h:124
void tmtt::HTcell::end ( void  )

Definition at line 52 of file HTcell.cc.

References bendFilter(), calcNumFilteredLayers(), mps_fire::i, SiStripPI::max, maxStubCountFilter(), maxStubsInCell_, numFilteredLayersInCell_, numFilteredLayersInCellBestSubSec_, numSubSecs_, useBendFilter_, vFilteredStubs_, and vStubs_.

52  {
53  // Produce list of filtered stubs by applying all requested filters (e.g. on stub bend).
54  // (If no filters are requested, then filtered & unfiltered stub collections will be identical).
55 
56  // N.B. Other filters, such as the r-z filters, which the firmware runs after the HT because they are too slow within it,
57  // are not defined here, but instead inside class TrkFilterAfterRphiHT.
58 
60  if (useBendFilter_)
62 
63  // Prevent too many stubs being stored in a single HT cell if requested (to reflect hardware memory limits).
64  // N.B. This MUST be the last filter applied.
65  constexpr unsigned int disableThreshold = 999;
66  if (maxStubsInCell_ < disableThreshold)
68 
69  // Calculate the number of layers the filtered stubs in this cell are in.
71 
72  if (numSubSecs_ > 1) {
73  // If using subsectors within each sector, calculate the number of layers the filters stubs in this cell are in,
74  // when one considers only the subset of the stubs within each subsector.
75  // Look for the "best" subsector.
77  for (unsigned int i = 0; i < numSubSecs_; i++) {
78  unsigned int numLaySubSec = this->calcNumFilteredLayers(i);
80  }
81  } else {
82  // If only 1 sub-sector, then subsector and sector are identical.
84  }
85  }
unsigned int calcNumFilteredLayers() const
Definition: HTcell.h:97
unsigned int numSubSecs_
Definition: HTcell.h:142
unsigned int numFilteredLayersInCellBestSubSec_
Definition: HTcell.h:150
std::vector< Stub * > maxStubCountFilter(const std::vector< Stub * > &stubs) const
Definition: HTcell.cc:125
std::vector< Stub * > vFilteredStubs_
Definition: HTcell.h:147
std::vector< Stub * > vStubs_
Definition: HTcell.h:146
unsigned int maxStubsInCell_
Definition: HTcell.h:139
unsigned int numFilteredLayersInCell_
Definition: HTcell.h:149
std::vector< Stub * > bendFilter(const std::vector< Stub * > &stubs) const
Definition: HTcell.cc:103
bool useBendFilter_
Definition: HTcell.h:137
vector< Stub * > tmtt::HTcell::maxStubCountFilter ( const std::vector< Stub * > &  stubs) const
private

Definition at line 125 of file HTcell.cc.

References mps_fire::i, maxStubsInCell_, and stubs().

Referenced by end().

125  {
126  vector<Stub*> filteredStubs;
127  // If there are too many stubs in a cell, the hardware keeps (maxStubsInCell - 1) of the first stubs in the list
128  // plus the last stub.
129  if (stubs.size() > maxStubsInCell_) {
130  for (unsigned int i = 0; i < maxStubsInCell_ - 1; i++) { // first stubs
131  filteredStubs.push_back(stubs[i]);
132  }
133  filteredStubs.push_back(stubs[stubs.size() - 1]); // plus last stub
134  } else {
135  filteredStubs = stubs;
136  }
137  return filteredStubs;
138  }
unsigned int maxStubsInCell_
Definition: HTcell.h:139
const std::vector< Stub * > & stubs() const
Definition: HTcell.h:60
bool tmtt::HTcell::mergedCell ( ) const
inline

Definition at line 53 of file HTcell.h.

References mergedCell_.

53 { return mergedCell_; }
bool mergedCell_
Definition: HTcell.h:129
unsigned int tmtt::HTcell::numLayers ( ) const
inline

Definition at line 74 of file HTcell.h.

References numFilteredLayersInCell_.

74 { return numFilteredLayersInCell_; }
unsigned int numFilteredLayersInCell_
Definition: HTcell.h:149
unsigned int tmtt::HTcell::numLayersSubSec ( ) const
inline

Definition at line 76 of file HTcell.h.

References numFilteredLayersInCellBestSubSec_.

unsigned int numFilteredLayersInCellBestSubSec_
Definition: HTcell.h:150
unsigned int tmtt::HTcell::numStubs ( ) const
inline

Definition at line 72 of file HTcell.h.

References vFilteredStubs_.

72 { return vFilteredStubs_.size(); }
std::vector< Stub * > vFilteredStubs_
Definition: HTcell.h:147
unsigned int tmtt::HTcell::numUnfilteredStubs ( ) const
inline

Definition at line 79 of file HTcell.h.

References vStubs_.

79 { return vStubs_.size(); } // Number of unfiltered stubs
std::vector< Stub * > vStubs_
Definition: HTcell.h:146
void tmtt::HTcell::store ( Stub stub)
inline

Definition at line 37 of file HTcell.h.

References vStubs_.

Referenced by store().

37 { vStubs_.push_back(stub); }
std::vector< Stub * > vStubs_
Definition: HTcell.h:146
void tmtt::HTcell::store ( Stub stub,
const std::vector< bool > &  inSubSecs 
)
inline

Definition at line 40 of file HTcell.h.

References numSubSecs_, store(), and subSectors_.

40  {
41  this->store(stub);
42  subSectors_[stub] = inSubSecs;
43  if (inSubSecs.size() != numSubSecs_)
44  throw cms::Exception("LogicError") << "HTcell: Wrong number of subsectors!";
45  }
unsigned int numSubSecs_
Definition: HTcell.h:142
std::map< const Stub *, std::vector< bool > > subSectors_
Definition: HTcell.h:151
void store(Stub *stub)
Definition: HTcell.h:37
bool tmtt::HTcell::stubInCell ( const Stub stub) const
inline

Definition at line 63 of file HTcell.h.

References submitPVResolutionJobs::count, and vFilteredStubs_.

63  {
64  return (std::count(vFilteredStubs_.begin(), vFilteredStubs_.end(), stub) > 0);
65  }
std::vector< Stub * > vFilteredStubs_
Definition: HTcell.h:147
const std::vector<Stub*>& tmtt::HTcell::stubs ( ) const
inline

Definition at line 60 of file HTcell.h.

References vFilteredStubs_.

Referenced by maxStubCountFilter().

60 { return vFilteredStubs_; }
std::vector< Stub * > vFilteredStubs_
Definition: HTcell.h:147
bool tmtt::HTcell::stubStoredInCell ( const Stub stub) const
inline

Definition at line 68 of file HTcell.h.

References submitPVResolutionJobs::count, and vStubs_.

68 { return (std::count(vStubs_.begin(), vStubs_.end(), stub) > 0); }
std::vector< Stub * > vStubs_
Definition: HTcell.h:146
bool tmtt::HTcell::trackCandFound ( ) const
inline

Definition at line 86 of file HTcell.h.

References funct::abs(), tmtt::Utility::HT, iEtaReg_, iPhiSec_, numFilteredLayersInCellBestSubSec_, tmtt::Utility::numLayerCut(), qOverPtCell_, and settings_.

86  {
89  }
unsigned int iPhiSec_
Definition: HTcell.h:118
unsigned int iEtaReg_
Definition: HTcell.h:119
unsigned int numFilteredLayersInCellBestSubSec_
Definition: HTcell.h:150
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const Settings * settings_
Definition: HTcell.h:116
float qOverPtCell_
Definition: HTcell.h:124
unsigned int numLayerCut(Utility::AlgoStep algo, const Settings *settings, unsigned int iPhiSec, unsigned int iEtaReg, float invPt, float eta=0.)
Definition: Utility.cc:141

Member Data Documentation

float tmtt::HTcell::etaMaxSector_
private

Definition at line 122 of file HTcell.h.

float tmtt::HTcell::etaMinSector_
private

Definition at line 121 of file HTcell.h.

unsigned int tmtt::HTcell::ibin_qOverPt_
private

Definition at line 127 of file HTcell.h.

Referenced by bendFilter().

unsigned int tmtt::HTcell::iEtaReg_
private

Definition at line 119 of file HTcell.h.

Referenced by trackCandFound().

float tmtt::HTcell::invPtToDphi_
private

Definition at line 134 of file HTcell.h.

Referenced by dphi().

unsigned int tmtt::HTcell::iPhiSec_
private

Definition at line 118 of file HTcell.h.

Referenced by trackCandFound().

unsigned int tmtt::HTcell::maxStubsInCell_
private

Definition at line 139 of file HTcell.h.

Referenced by end(), HTcell(), and maxStubCountFilter().

bool tmtt::HTcell::mergedCell_
private

Definition at line 129 of file HTcell.h.

Referenced by bendFilter(), and mergedCell().

bool tmtt::HTcell::miniHTcell_
private

Definition at line 132 of file HTcell.h.

Referenced by HTcell().

unsigned int tmtt::HTcell::numFilteredLayersInCell_
private

Definition at line 149 of file HTcell.h.

Referenced by end(), and numLayers().

unsigned int tmtt::HTcell::numFilteredLayersInCellBestSubSec_
private

Definition at line 150 of file HTcell.h.

Referenced by end(), numLayersSubSec(), and trackCandFound().

unsigned int tmtt::HTcell::numSubSecs_
private

Definition at line 142 of file HTcell.h.

Referenced by end(), and store().

float tmtt::HTcell::qOverPtCell_
private

Definition at line 124 of file HTcell.h.

Referenced by dphi(), and trackCandFound().

const Settings* tmtt::HTcell::settings_
private

Definition at line 116 of file HTcell.h.

Referenced by calcNumFilteredLayers(), and trackCandFound().

std::map<const Stub*, std::vector<bool> > tmtt::HTcell::subSectors_
private

Definition at line 151 of file HTcell.h.

Referenced by calcNumFilteredLayers(), and store().

bool tmtt::HTcell::useBendFilter_
private

Definition at line 137 of file HTcell.h.

Referenced by disableBendFilter(), and end().

std::vector<Stub*> tmtt::HTcell::vFilteredStubs_
private

Definition at line 147 of file HTcell.h.

Referenced by calcNumFilteredLayers(), end(), numStubs(), stubInCell(), and stubs().

std::vector<Stub*> tmtt::HTcell::vStubs_
private

Definition at line 146 of file HTcell.h.

Referenced by end(), numUnfilteredStubs(), store(), and stubStoredInCell().