|
||||
File indexing completed on 2024-04-06 12:21:48
0001 #ifndef L1Trigger_TrackFindingTMTT_HTrphi_h 0002 #define L1Trigger_TrackFindingTMTT_HTrphi_h 0003 0004 #include "L1Trigger/TrackFindingTMTT/interface/HTbase.h" 0005 0006 #include <vector> 0007 #include <list> 0008 #include <utility> 0009 #include <atomic> 0010 0011 //=== The r-phi Hough Transform array for a single (eta,phi) sector. 0012 //=== 0013 //=== Its axes are (q/Pt, phiTrk), where phiTrk is the phi at which the track crosses a 0014 //=== user-configurable radius from the beam-line. 0015 0016 namespace tmtt { 0017 0018 class Settings; 0019 class Stub; 0020 class TP; 0021 class L1fittedTrack; 0022 0023 class HTrphi : public HTbase { 0024 public: 0025 enum class HTshape { square, diamond, hexagon, brick }; 0026 0027 //--- Error monitoring 0028 0029 struct ErrorMonitor { 0030 // Maximum |gradient| of line corresponding to any stub. FW assumes it's < 1.0. 0031 std::atomic<float> maxLineGradient; 0032 // Error count when stub added to cell not NE, E or SE of cell stub added to in previous HT column. 0033 std::atomic<unsigned int> numErrorsTypeA; 0034 // Error count when stub added to more than 2 cells in one HT column 0035 std::atomic<unsigned int> numErrorsTypeB; 0036 // Error count normalisation 0037 std::atomic<unsigned int> numErrorsNorm; 0038 }; 0039 0040 // Initialization with sector number, eta range covered by sector and phi coordinate of its centre. 0041 HTrphi(const Settings* settings, 0042 unsigned int iPhiSec, 0043 unsigned int iEtaReg, 0044 float etaMinSector, 0045 float etaMaxSector, 0046 float phiCentreSector, 0047 ErrorMonitor* errMon = nullptr); 0048 0049 ~HTrphi() override = default; 0050 0051 // Add stub to HT array. 0052 // If eta subsectors are being used within each sector, specify which ones the stub is compatible with. 0053 void store(Stub* stub, const std::vector<bool>& inEtaSubSecs); 0054 0055 // Termination. Causes HT array to search for tracks etc. 0056 // ... function end() is in base class ... 0057 0058 //=== Info about track candidates found. 0059 0060 // ... is available via base class ... 0061 0062 //=== Utilities 0063 0064 // Get the values of the track helix params corresponding to middle of a specified HT cell (i,j). 0065 // The helix parameters returned will be those corresponding to the two axes of the HT array. 0066 // So they might be (q/pt, phi0) or (q/pt, phi65) etc. depending on the configuration. 0067 std::pair<float, float> helix2Dhough(unsigned int i, unsigned int j) const override; 0068 0069 // Get the values of the track helix params corresponding to middle of a specified HT cell (i,j). 0070 // The helix parameters returned will be always be (q/pt, phi0), irrespective of how the axes 0071 // of the HT array are defined. 0072 std::pair<float, float> helix2Dconventional(unsigned int i, unsigned int j) const override; 0073 0074 // Which cell in HT array should this TP be in, based on its true trajectory? 0075 // (If TP is outside HT array, it it put in the closest bin inside it). 0076 std::pair<unsigned int, unsigned int> trueCell(const TP* tp) const override; 0077 0078 // Which cell in HT array should this fitted track be in, based on its fitted trajectory? 0079 // Always uses beam-spot constrained trajectory if available. 0080 // (If fitted track is outside HT array, it it put in the closest bin inside it). 0081 std::pair<unsigned int, unsigned int> cell(const L1fittedTrack* fitTrk) const override; 0082 0083 // Check if specified cell has been merged with its 2x2 neighbours into a single cell, 0084 // as it is in low Pt region. 0085 bool mergedCell(unsigned int iQoverPtBin, unsigned int jPhiTrkBin) const; 0086 0087 // Number of stubs received from GP, irrespective of whether the stub was actually stored in 0088 // a cell in the HT array. 0089 unsigned int nReceivedStubs() const { return nReceivedStubs_; } 0090 0091 // Determine which m-bin (q/pt) range the specified track is in. (Used if outputting each m bin range on a different opto-link). 0092 unsigned int getMbinRange(const L1track2D& trk) const; 0093 0094 private: 0095 // For a given Q/Pt bin, find the range of phi bins that a given stub is consistent with. 0096 std::pair<unsigned int, unsigned int> iPhiRange(const Stub* stub, 0097 unsigned int iQoverPtBin, 0098 bool debug = false) const; 0099 0100 // Check that limitations of firmware would not prevent stub being stored correctly in this HT column. 0101 void countFirmwareErrors(unsigned int iQoverPtBin, 0102 unsigned int iPhiTrkBinMin, 0103 unsigned int iPhiTrkBinMax, 0104 unsigned int jPhiTrkBinMinLast, 0105 unsigned int jPhiTrkBinMaxLast); 0106 0107 // Calculate line |gradient| of stubs in HT array, so can check it doesn't exceed 1. 0108 float calcLineGradArray(float r) const; 0109 0110 // If requested, kill those tracks in this sector that can't be read out during the time-multiplexed period, because 0111 // the HT has associated too many stubs to tracks. 0112 std::list<L1track2D> killTracksBusySec(const std::list<L1track2D>& tracks) const override; 0113 0114 // Define the order in which the hardware processes rows of the HT array when it outputs track candidates. 0115 // Currently corresponds to highest Pt tracks first. 0116 // If two tracks have the same Pt, the -ve charge one is output before the +ve charge one. 0117 std::vector<unsigned int> rowOrder(unsigned int numRows) const override; 0118 0119 private: 0120 float invPtToDphi_; // conversion constant. 0121 0122 HTshape shape_; 0123 std::vector<std::vector<std::pair<float, float> > > cellCenters_; 0124 0125 //--- Specifications of HT array. 0126 0127 float maxAbsQoverPtAxis_; // Max. |q/Pt| covered by HT array. 0128 unsigned int nBinsQoverPtAxis_; // Number of bins in HT array in q/Pt. 0129 float binSizeQoverPtAxis_; // HT array bin size in q/Pt. 0130 0131 float chosenRofPhi_; // Use phi of track at radius="chosenRofPhi" to define one of the r-phi HT axes. 0132 float phiCentreSector_; // phiTrk angle of centre of this (eta,phi) sector. 0133 float maxAbsPhiTrkAxis_; // Half-width of phiTrk axis in HT array. 0134 unsigned int nBinsPhiTrkAxis_; // Number of bins in HT array in phiTrk axis. 0135 float binSizePhiTrkAxis_; // HT array bin size in phiTrk 0136 // Optionally merge 2x2 neighbouring cells into a single cell at low Pt, to reduce efficiency loss due to scattering. (Used also by mini-HT). 0137 bool enableMerge2x2_; 0138 float minInvPtToMerge2x2_; 0139 0140 //--- Options when filling HT array. 0141 0142 // Take all cells in HT array crossed by line corresponding to each stub (= 0) or take only some to reduce rate at cost of efficiency ( > 0) 0143 unsigned int killSomeHTCellsRphi_; 0144 // Options for killing stubs/tracks that cant be sent within time-multiplexed period. 0145 bool busyInputSectorKill_; 0146 bool busySectorKill_; 0147 unsigned int busyInputSectorNumStubs_; 0148 unsigned int busySectorNumStubs_; 0149 std::vector<unsigned int> busySectorMbinRanges_; 0150 std::vector<unsigned int> busySectorMbinOrder_; 0151 bool busySectorUseMbinRanges_; 0152 bool busySectorUseMbinOrder_; 0153 std::vector<unsigned int> busySectorMbinLow_; 0154 std::vector<unsigned int> busySectorMbinHigh_; 0155 0156 // Number of stubs received from GP, irrespective of whether the stub was actually stored in 0157 // a cell in the HT array. 0158 unsigned int nReceivedStubs_; 0159 0160 // Error monitoring. 0161 ErrorMonitor* errMon_; 0162 0163 // ... The Hough transform array data is in the base class ... 0164 0165 // ... The list of found track candidates is in the base class ... 0166 }; 0167 0168 } // namespace tmtt 0169 0170 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |