CMS 3D CMS Logo

HTbase.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTMTT_HTbase_h
2 #define L1Trigger_TrackFindingTMTT_HTbase_h
3 
6 
7 #include <boost/numeric/ublas/matrix.hpp>
8 
9 #include <vector>
10 #include <list>
11 #include <utility>
12 #include <memory>
13 
15 
16 //=== Base class for Hough Transform array for a single (eta,phi) sector.
17 
18 namespace tmtt {
19 
20  class Settings;
21  class Stub;
22  class TP;
23  class L1fittedTrack;
24 
25  class HTbase {
26  public:
27  // Initialization.
28  HTbase(
29  const Settings* settings, unsigned int iPhiSec, unsigned int iEtaReg, unsigned int nBinsX, unsigned int nBinsY);
30 
31  virtual ~HTbase() = default;
32 
33  // Termination. Causes HT array to search for tracks etc.
34  virtual void end();
35 
36  //=== Get info about filtered stubs in HT array.
37  //=== (N.B. The `filtered stubs' are stubs passing any requested stub filters, e.g. bend and/or rapidity.
38  //=== If no filters were requested, they are identical to the unfiltered stubs.)
39 
40  // Get sum of number of filtered stubs stored in each cell of HT array (so a stub appearing in multiple cells is counted multiple times).
41  virtual unsigned int numStubsInc() const;
42 
43  // Get sum the number of filtered stubs in the HT array, where each individual stub is counted only once, even if it appears in multiple cells.
44  virtual unsigned int numStubsExc() const;
45 
46  // Get all the cells that make up the array, which in turn give access to the stubs inside them.
47  // N.B. You can use allCells().size1() and allCells().size2() to get the dimensions ofthe array.
48  virtual const matrix<std::unique_ptr<HTcell>>& allCells() const { return htArray_; }
49 
50  //=== Info about track candidates found.
51 
52  // N.B. If a duplicate track filter was run inside the HT, this will contain the reduced list of tracks passing this filter.
53  // N.B. If some tracks could not be read out during the TM period, then such tracks are deleted from this list.
54 
55  // Get list of all track candidates found in this HT array, giving access to stubs on each track
56  // and helix parameters.
57  virtual const std::list<L1track2D>& trackCands2D() const { return trackCands2D_; }
58 
59  // Number of track candidates found in this HT array.
60  // If a duplicate track filter was run, this will contain the reduced list of tracks passing this filter.
61  virtual unsigned int numTrackCands2D() const { return trackCands2D_.size(); }
62 
63  // Get number of filtered stubs assigned to track candidates found in this HT array.
64  virtual unsigned int numStubsOnTrackCands2D() const;
65 
66  // Get all reconstructed tracks that were associated to the given tracking particle.
67  // (If the std::vector is empty, then the tracking particle was not reconstructed in this sector).
68  virtual std::vector<const L1track2D*> assocTrackCands2D(const TP& tp) const;
69 
70  //=== Function to replace the collection of 2D tracks found by this HT.
71 
72  // (This is used by classes MuxHToutputs & MiniHTstage).
73  virtual void replaceTrackCands2D(const std::list<L1track2D>& newTracks) { trackCands2D_ = newTracks; }
74 
75  //=== Utilities
76 
77  // Get the values of the track helix params corresponding to middle of a specified HT cell (i,j).
78  // The helix parameters returned will be those corresponding to the two axes of the HT array.
79  // So they might be (q/pt, phi65), (eta, z0) or (z110, z0) etc. depending on the configuration.
80  virtual std::pair<float, float> helix2Dhough(unsigned int i, unsigned int j) const = 0;
81 
82  // Get the values of the track helix params corresponding to middle of a specified HT cell (i,j).
83  // The helix parameters returned will be always be (q/Pt, phi0) or (tan_lambda, z0), irrespective of
84  // how the axes of the HT array are defined.
85  virtual std::pair<float, float> helix2Dconventional(unsigned int i, unsigned int j) const = 0;
86 
87  // Which cell in HT array should this TP be in, based on its true trajectory?
88  // Returns 999999 in at least one index if TP not expected to be in any cell in this array.
89  virtual std::pair<unsigned int, unsigned int> trueCell(const TP* tp) const = 0;
90 
91  // Which cell in HT array should this fitted track be in, based on its fitted trajectory?
92  // Returns 999999 in at least one index if fitted track not expected to be in any cell in this array.
93  virtual std::pair<unsigned int, unsigned int> cell(const L1fittedTrack* fitTrk) const = 0;
94 
95  // Disable filters (used for debugging).
96  virtual void disableBendFilter();
97 
98  protected:
99  // Given a range in one of the coordinates specified by coordRange, calculate the corresponding range of bins. The other arguments specify the axis. And also if some cells nominally associated to stub are to be killed.
100  virtual std::pair<unsigned int, unsigned int> convertCoordRangeToBinRange(std::pair<float, float> coordRange,
101  unsigned int nBinsAxis,
102  float coordAxisMin,
103  float coordAxisBinSize,
104  unsigned int killSomeHTcells) const;
105 
106  private:
107  // Return a list of all track candidates found in this array, giving access to all the stubs on each one
108  // and the track helix parameters, plus the associated truth particle (if any).
109  virtual std::list<L1track2D> calcTrackCands2D() const;
110 
111  // If requested, kill those tracks in this sector that can't be read out during the time-multiplexed period, because
112  // the HT has associated too many stubs to tracks.
113  virtual std::list<L1track2D> killTracksBusySec(const std::list<L1track2D>& tracks) const = 0;
114 
115  // Define the order in which the hardware processes rows of the HT array when it outputs track candidates.
116  virtual std::vector<unsigned int> rowOrder(unsigned int numRows) const = 0;
117 
118  // Calculate output opto-link ID from HT, assuming there is no MUX stage.
119  virtual unsigned int calcOptoLinkID() const {
120  unsigned int numPhiSecPerNon = settings_->numPhiSectors() / settings_->numPhiNonants();
121  return (iEtaReg_ * numPhiSecPerNon + iPhiSec_);
122  }
123 
124  protected:
125  const Settings* settings_; // configuration parameters.
126 
127  unsigned int iPhiSec_; // Sector number.
128  unsigned int iEtaReg_;
129 
130  unsigned int nBinsX_; // Bins in HT array.
131  unsigned int nBinsY_;
132 
133  // Hough transform array.
134  // This has two dimensions, representing the two track helix parameters being varied.
135  matrix<std::unique_ptr<HTcell>> htArray_;
136 
137  unsigned int optoLinkID_; // ID of opto-link from HT to Track Fitter.
138 
139  // List of all track candidates found by HT & their associated properties.
140  // If a duplicate track filter was run inside the HT, this will contain the reduced list of tracks passing this filter.
141  // If some tracks could not be read out during the TM period, then such tracks are deleted from this list.
142  std::list<L1track2D> trackCands2D_;
143  };
144 
145 } // namespace tmtt
146 
147 #endif
tmtt::HTbase::calcTrackCands2D
virtual std::list< L1track2D > calcTrackCands2D() const
Definition: HTbase.cc:186
tmtt::HTbase
Definition: HTbase.h:25
tmtt::HTbase::htArray_
matrix< std::unique_ptr< HTcell > > htArray_
Definition: HTbase.h:135
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
tmtt::Settings::numPhiNonants
unsigned int numPhiNonants() const
Definition: Settings.h:109
tmtt::HTbase::numTrackCands2D
virtual unsigned int numTrackCands2D() const
Definition: HTbase.h:61
makeMuonMisalignmentScenario.matrix
list matrix
Definition: makeMuonMisalignmentScenario.py:141
tmtt::HTbase::convertCoordRangeToBinRange
virtual std::pair< unsigned int, unsigned int > convertCoordRangeToBinRange(std::pair< float, float > coordRange, unsigned int nBinsAxis, float coordAxisMin, float coordAxisBinSize, unsigned int killSomeHTcells) const
Definition: HTbase.cc:122
tmtt::HTbase::disableBendFilter
virtual void disableBendFilter()
Definition: HTbase.cc:111
tmtt::HTbase::cell
virtual std::pair< unsigned int, unsigned int > cell(const L1fittedTrack *fitTrk) const =0
tmtt::HTbase::trackCands2D
virtual const std::list< L1track2D > & trackCands2D() const
Definition: HTbase.h:57
DigiToRawDM_cff.TP
TP
Definition: DigiToRawDM_cff.py:51
tmtt::HTbase::~HTbase
virtual ~HTbase()=default
tmtt::HTbase::settings_
const Settings * settings_
Definition: HTbase.h:125
tmtt::TP
Definition: TP.h:23
tmtt::HTbase::allCells
virtual const matrix< std::unique_ptr< HTcell > > & allCells() const
Definition: HTbase.h:48
tmtt::HTbase::rowOrder
virtual std::vector< unsigned int > rowOrder(unsigned int numRows) const =0
tmtt::HTbase::helix2Dconventional
virtual std::pair< float, float > helix2Dconventional(unsigned int i, unsigned int j) const =0
tmtt::HTbase::replaceTrackCands2D
virtual void replaceTrackCands2D(const std::list< L1track2D > &newTracks)
Definition: HTbase.h:73
tmtt::HTbase::numStubsInc
virtual unsigned int numStubsInc() const
Definition: HTbase.cc:47
tmtt::HTbase::optoLinkID_
unsigned int optoLinkID_
Definition: HTbase.h:137
tmtt::HTbase::nBinsX_
unsigned int nBinsX_
Definition: HTbase.h:130
tmtt::HTbase::killTracksBusySec
virtual std::list< L1track2D > killTracksBusySec(const std::list< L1track2D > &tracks) const =0
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
tmtt::L1fittedTrack
Definition: L1fittedTrack.h:30
tmtt::HTbase::trueCell
virtual std::pair< unsigned int, unsigned int > trueCell(const TP *tp) const =0
tmtt::HTbase::assocTrackCands2D
virtual std::vector< const L1track2D * > assocTrackCands2D(const TP &tp) const
Definition: HTbase.cc:95
HTcell.h
tmtt::HTbase::calcOptoLinkID
virtual unsigned int calcOptoLinkID() const
Definition: HTbase.h:119
tmtt::HTbase::helix2Dhough
virtual std::pair< float, float > helix2Dhough(unsigned int i, unsigned int j) const =0
tmtt::Settings
Definition: Settings.h:17
tmtt::Settings::numPhiSectors
unsigned int numPhiSectors() const
Definition: Settings.h:110
L1track2D.h
tmtt::HTbase::trackCands2D_
std::list< L1track2D > trackCands2D_
Definition: HTbase.h:142
tmtt::HTbase::numStubsExc
virtual unsigned int numStubsExc() const
Definition: HTbase.cc:62
tmtt::HTbase::iPhiSec_
unsigned int iPhiSec_
Definition: HTbase.h:127
tmtt::HTbase::HTbase
HTbase(const Settings *settings, unsigned int iPhiSec, unsigned int iEtaReg, unsigned int nBinsX, unsigned int nBinsY)
Definition: HTbase.cc:14
tmtt::HTbase::nBinsY_
unsigned int nBinsY_
Definition: HTbase.h:131
tmtt::HTbase::numStubsOnTrackCands2D
virtual unsigned int numStubsOnTrackCands2D() const
Definition: HTbase.cc:81
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
tmtt
=== This is the base class for the linearised chi-squared track fit algorithms.
Definition: ChiSquaredFit4.h:6
tmtt::HTbase::iEtaReg_
unsigned int iEtaReg_
Definition: HTbase.h:128
tmtt::HTbase::end
virtual void end()
Definition: HTbase.cc:26