CMS 3D CMS Logo

HTcell.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTMTT_HTcell_h
2 #define L1Trigger_TrackFindingTMTT_HTcell_h
3 
7 
8 #include <vector>
9 #include <map>
10 #include <algorithm>
11 #include <utility>
12 
13 //=== A single cell in a Hough Transform array.
14 
15 namespace tmtt {
16 
17  class Settings;
18  class Stub;
19 
20  class HTcell {
21  public:
22  // Initialization with cfg params,
23  // sector number, rapidity range of current sector, estimated q/Pt of cell,
24  // and the bin number of the cell along the q/Pt axis of the r-phi HT array,
25  // and a flag indicating if this cell is the merge of smaller HT cells.
26  HTcell(const Settings* settings,
27  unsigned int iPhiSec,
28  unsigned int iEtaReg,
29  float etaMinSector,
30  float etaMaxSector,
31  float qOverPt,
32  unsigned int ibin_qOverPt,
33  bool mergedCell,
34  bool miniHTcell = false);
35 
36  // Add stub to this cell in HT array.
37  void store(Stub* stub) { vStubs_.push_back(stub); }
38 
39  // Add stub to this cell in HT array, indicating also which subsectors within the sector is consistent with.
40  void store(Stub* stub, const std::vector<bool>& inSubSecs) {
41  this->store(stub);
42  subSectors_[stub] = inSubSecs;
43  if (inSubSecs.size() != numSubSecs_)
44  throw cms::Exception("LogicError") << "HTcell: Wrong number of subsectors!";
45  }
46 
47  // Termination. Search for track in this HT cell etc.
48  void end();
49 
50  //=== Cfg of cell
51 
52  // Does this HTcell correspond to merged HT cells (e.g. 2x2)?
53  bool mergedCell() const { return mergedCell_; }
54 
55  //=== Get results
56  //=== Most of these functions operate on the filtered stubs, which are stubs passing any requested stub filters (e.g. bend filter).
57  //=== If no filters were requested, they are identical to the unfiltered stubs.)
58 
59  // Get filtered stubs in this cell in HT array.
60  const std::vector<Stub*>& stubs() const { return vFilteredStubs_; }
61 
62  // Check if a specific stub is in this cell and survived filtering.
63  bool stubInCell(const Stub* stub) const {
64  return (std::count(vFilteredStubs_.begin(), vFilteredStubs_.end(), stub) > 0);
65  }
66 
67  // Check if a specific stub was stored to this cell (without checking if it survived filtering).
68  bool stubStoredInCell(const Stub* stub) const { return (std::count(vStubs_.begin(), vStubs_.end(), stub) > 0); }
69 
70  //-- Return info useful for deciding if there is a track candidate in this cell.
71  // Number of filtered stubs
72  unsigned int numStubs() const { return vFilteredStubs_.size(); }
73  // Number of tracker layers with filtered stubs
74  unsigned int numLayers() const { return numFilteredLayersInCell_; }
75  // Number of tracker layers with filtered stubs, requiring all stubs to be in same subsector to be counted. The number returned is the highest layer count found in any of the subsectors in this sector. If subsectors are not used, it is equal to numLayers().
76  unsigned int numLayersSubSec() const { return numFilteredLayersInCellBestSubSec_; }
77 
78  // Useful for debugging.
79  unsigned int numUnfilteredStubs() const { return vStubs_.size(); } // Number of unfiltered stubs
80 
81  //=== Check if stubs in this cell form valid track candidate.
82 
83  // N.B. If subsectors within a sector are not being used, then numFilteredLayersInCellBestSubSec_ = numFilteredLayersInCell_.
84  // WARNING: If some tracks are killed as the r-phi HT array can't read them out within the TM period,
85  // killed tracks are still found by this function. It is in HTbase::calcTrackCands2D() that they are killed.
86  bool trackCandFound() const {
89  }
90 
91  //=== Disable filters (used for debugging).
92 
93  void disableBendFilter() { useBendFilter_ = false; }
94 
95  private:
96  // Calculate how many tracker layers the filtered stubs in this cell are in
98 
99  // Calculate how many tracker layers the filter stubs in this cell are in, when only the subset of those stubs
100  // that are in the specified subsector are counted.
101  unsigned int calcNumFilteredLayers(unsigned int iSubSec) const;
102 
103  // Estimate track bend angle at a given radius, derived using the track q/Pt at the centre of this HT cell, ignoring scattering.
104  float dphi(float rad) const { return (invPtToDphi_ * rad * qOverPtCell_); }
105 
106  // Produce a filtered collection of stubs in this cell that all have consistent bend
107  std::vector<Stub*> bendFilter(const std::vector<Stub*>& stubs) const;
108 
109  // Filter stubs so as to prevent more than specified number of stubs being stored in one cell.
110  // This reflects finite memory of hardware.
111  std::vector<Stub*> maxStubCountFilter(const std::vector<Stub*>& stubs) const;
112 
113  private:
114  //=== Configuration parameters
115 
117 
118  unsigned int iPhiSec_; // Sector number
119  unsigned int iEtaReg_;
120 
121  float etaMinSector_; // rapidity range of this sector.
123 
124  float qOverPtCell_; // track q/Pt corresponding to centre of this cell.
125 
126  // Note bin number of cell along q/Pt axis of r-phi HT array. (Not used for r-z HT).
127  unsigned int ibin_qOverPt_;
128  // Is this HT cell the merge of smaller HT cells?
130 
131  // Is this cell in Mini-HT?
133 
134  float invPtToDphi_; // B*c/2E11
135 
136  // Use filter in each HT cell using only stubs which have consistent bend?
138  // 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).
139  unsigned int maxStubsInCell_;
140 
141  // Number of subsectors (if any) within each sector.
142  unsigned int numSubSecs_;
143 
144  //=== data
145 
146  std::vector<Stub*> vStubs_; // Stubs in this cell
147  std::vector<Stub*> vFilteredStubs_; // Ditto after all requested stub filters (e.g. bend filter)
148 
151  std::map<const Stub*, std::vector<bool>> subSectors_; // Subsectors in sector stub consistent with.
152  };
153 
154 } // namespace tmtt
155 #endif
tmtt::HTcell::store
void store(Stub *stub)
Definition: HTcell.h:37
tmtt::HTcell::invPtToDphi_
float invPtToDphi_
Definition: HTcell.h:134
tmtt::HTcell::numSubSecs_
unsigned int numSubSecs_
Definition: HTcell.h:142
tmtt::HTcell::numFilteredLayersInCell_
unsigned int numFilteredLayersInCell_
Definition: HTcell.h:149
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
Stub.h
tmtt::HTcell::mergedCell
bool mergedCell() const
Definition: HTcell.h:53
tmtt::HTcell::settings_
const Settings * settings_
Definition: HTcell.h:116
tmtt::HTcell::ibin_qOverPt_
unsigned int ibin_qOverPt_
Definition: HTcell.h:127
tmtt::HTcell::stubStoredInCell
bool stubStoredInCell(const Stub *stub) const
Definition: HTcell.h:68
tmtt::HTcell::stubInCell
bool stubInCell(const Stub *stub) const
Definition: HTcell.h:63
tmtt::HTcell::calcNumFilteredLayers
unsigned int calcNumFilteredLayers() const
Definition: HTcell.h:97
tmtt::Utility::HT
Definition: Utility.h:28
tmtt::HTcell::numStubs
unsigned int numStubs() const
Definition: HTcell.h:72
Utility.h
tmtt::HTcell::etaMinSector_
float etaMinSector_
Definition: HTcell.h:121
tmtt::HTcell::numFilteredLayersInCellBestSubSec_
unsigned int numFilteredLayersInCellBestSubSec_
Definition: HTcell.h:150
tmtt::HTcell::maxStubCountFilter
std::vector< Stub * > maxStubCountFilter(const std::vector< Stub * > &stubs) const
Definition: HTcell.cc:125
tmtt::HTcell::bendFilter
std::vector< Stub * > bendFilter(const std::vector< Stub * > &stubs) const
Definition: HTcell.cc:103
tmtt::HTcell::numLayersSubSec
unsigned int numLayersSubSec() const
Definition: HTcell.h:76
tmtt::HTcell::dphi
float dphi(float rad) const
Definition: HTcell.h:104
tmtt::HTcell::mergedCell_
bool mergedCell_
Definition: HTcell.h:129
tmtt::HTcell::vStubs_
std::vector< Stub * > vStubs_
Definition: HTcell.h:146
tmtt::HTcell::vFilteredStubs_
std::vector< Stub * > vFilteredStubs_
Definition: HTcell.h:147
tmtt::HTcell::disableBendFilter
void disableBendFilter()
Definition: HTcell.h:93
tmtt::HTcell::stubs
const std::vector< Stub * > & stubs() const
Definition: HTcell.h:60
tmtt::HTcell::numLayers
unsigned int numLayers() const
Definition: HTcell.h:74
tmtt::HTcell
Definition: HTcell.h:20
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
tmtt::Settings
Definition: Settings.h:17
tmtt::HTcell::end
void end()
Definition: HTcell.cc:52
tmtt::Utility::numLayerCut
unsigned int numLayerCut(Utility::AlgoStep algo, const Settings *settings, unsigned int iPhiSec, unsigned int iEtaReg, float invPt, float eta=0.)
Definition: Utility.cc:141
tmtt::HTcell::miniHTcell_
bool miniHTcell_
Definition: HTcell.h:132
tmtt::HTcell::useBendFilter_
bool useBendFilter_
Definition: HTcell.h:137
tmtt::HTcell::trackCandFound
bool trackCandFound() const
Definition: HTcell.h:86
tmtt::HTcell::subSectors_
std::map< const Stub *, std::vector< bool > > subSectors_
Definition: HTcell.h:151
tmtt::HTcell::maxStubsInCell_
unsigned int maxStubsInCell_
Definition: HTcell.h:139
tmtt::HTcell::iEtaReg_
unsigned int iEtaReg_
Definition: HTcell.h:119
Exception.h
tmtt::HTcell::numUnfilteredStubs
unsigned int numUnfilteredStubs() const
Definition: HTcell.h:79
tmtt::HTcell::etaMaxSector_
float etaMaxSector_
Definition: HTcell.h:122
cms::Exception
Definition: Exception.h:70
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tmtt::HTcell::qOverPtCell_
float qOverPtCell_
Definition: HTcell.h:124
tmtt::HTcell::iPhiSec_
unsigned int iPhiSec_
Definition: HTcell.h:118
tmtt::Stub
Definition: Stub.h:43
tmtt::HTcell::store
void store(Stub *stub, const std::vector< bool > &inSubSecs)
Definition: HTcell.h:40
tmtt
=== This is the base class for the linearised chi-squared track fit algorithms.
Definition: ChiSquaredFit4.h:6
tmtt::HTcell::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: HTcell.cc:14