34 float phiCentreSector,
36 :
HTbase(settings, iPhiSec, iEtaReg, settings->houghNbinsPt(), settings->houghNbinsPhi()),
37 invPtToDphi_((settings->invPtToDphi())),
41 maxAbsQoverPtAxis_(1. / settings->houghMinPt()),
42 nBinsQoverPtAxis_(settings->houghNbinsPt()),
43 binSizeQoverPtAxis_(2 * maxAbsQoverPtAxis_ / nBinsQoverPtAxis_),
47 chosenRofPhi_(settings->chosenRofPhi()),
48 phiCentreSector_(phiCentreSector),
49 maxAbsPhiTrkAxis_(
M_PI /
float(settings->numPhiSectors())),
50 nBinsPhiTrkAxis_(settings->houghNbinsPhi()),
51 binSizePhiTrkAxis_(2 * maxAbsPhiTrkAxis_ / nBinsPhiTrkAxis_),
80 throw cms::Exception(
"BadConfig") <<
"HTrphi: You are not allowed to set EnableMerge2x2 or MiniHTstage = True if " 81 "you have an odd number of bins " 106 bool rescaleMbins =
false;
111 unsigned int nTotalBins = 0;
118 throw cms::Exception(
"BadConfig") <<
"HTrphi: BusySectorUserMbin error";
134 float qOverPt = helix.first;
141 std::make_unique<HTcell>(settings, iPhiSec, iEtaReg, etaMinSector, etaMaxSector, qOverPt,
i,
mergedCell);
145 std::stringstream
text;
147 text <<
"=== R-PHI HOUGH TRANSFORM AXES RANGES: abs(q/Pt) < " <<
maxAbsQoverPtAxis_ <<
" & abs(track-phi) < " 154 text <<
"=== R-PHI HOUGH TRANSFORM WARNING: Rescaled m bin ranges specified by cfg parameter " 155 "BusySectorMbinRanges, as they were inconsistent with total number of m bins in HT.\n";
156 text <<
"=== Rescaled values for BusySectorMbinRanges =";
162 static std::once_flag printOnce;
168 std::vector<std::pair<float, float> > binCenters;
170 binCenters.push_back(this->helix2Dhough(
m,
c));
183 unsigned int jPhiTrkBinMinLast = 0;
184 unsigned int jPhiTrkBinMaxLast = 99999;
192 pair<unsigned int, unsigned int> jRange = this->
iPhiRange(stub,
i);
193 unsigned int jPhiTrkBinMin = jRange.first;
194 unsigned int jPhiTrkBinMax = jRange.second;
197 for (
unsigned int j = jPhiTrkBinMin;
j <= jPhiTrkBinMax;
j++) {
198 bool canStoreStub =
true;
199 unsigned int iStore =
i;
200 unsigned int jStore =
j;
215 canStoreStub =
false;
225 this->
countFirmwareErrors(
i, jPhiTrkBinMin, jPhiTrkBinMax, jPhiTrkBinMinLast, jPhiTrkBinMaxLast);
226 jPhiTrkBinMinLast = jPhiTrkBinMin;
227 jPhiTrkBinMaxLast = jPhiTrkBinMax;
253 float phiTrkMin = phiTrk - phiTrkVar;
254 float phiTrkMax = phiTrk + phiTrkVar;
265 std::pair<bool, unsigned int> binCenter;
266 std::pair<bool, unsigned int>
binMin;
267 std::pair<bool, unsigned int>
binMax;
268 binCenter.second = iCenter / 3;
271 binCenter.first = !(iCenter % 3 == 2);
272 binMin.first = (iMin % 3 == 0);
273 binMax.first = (iMax % 3 == 0);
289 float phiTrkMin = phiTrk - phiTrkVar;
290 float phiTrkMax = phiTrk + phiTrkVar;
293 std::pair<bool, unsigned int>
binMin;
294 std::pair<bool, unsigned int>
binMax;
297 binMin.first = (iMin % 2 ==
i % 2);
298 binMax.first = (iMax % 2 ==
i % 2);
319 unsigned int mBinOrder;
327 if (mBinOrder == 99999)
328 throw cms::Exception(
"LogicError") <<
"HTrphi::getMbinRange() mBinOrder calculation wrong.";
337 throw cms::Exception(
"LogicError") <<
"HTrphi::getMbinRange() messed up";
362 float phiTrkMin = phiTrk - phiTrkVar;
363 float phiTrkMax = phiTrk + phiTrkVar;
367 pair<float, float> phiTrkRange(deltaPhiMin, deltaPhiMax);
373 return iPhiTrkBinRange;
379 unsigned int jPhiTrkBinMin,
380 unsigned int jPhiTrkBinMax,
381 unsigned int jPhiTrkBinMinLast,
382 unsigned int jPhiTrkBinMaxLast) {
384 if (jPhiTrkBinMax >= jPhiTrkBinMin) {
387 bool OK_a = (jPhiTrkBinMin + 1 >= jPhiTrkBinMinLast) && (jPhiTrkBinMax <= jPhiTrkBinMaxLast + 1);
389 bool OK_b = (jPhiTrkBinMax - jPhiTrkBinMin + 1 <= 2);
404 unsigned int qOverPtBin =
i;
405 unsigned int phiTrkBin =
j;
422 float qOverPtBinCenter = .5;
423 float phiTrkBinCenter = .5;
426 qOverPtBinCenter = 0.;
428 float evenPhiPos = 0., oddPhiPos = 0.;
430 evenPhiPos = 1. / 6.;
439 phiTrkBinCenter = (qOverPtBin % 2 == 0) ? evenPhiPos : oddPhiPos;
452 return pair<float, float>(qOverPt, phiTrk);
463 float qOverPt = helix2Dht.first;
466 return pair<float, float>(qOverPt, phi0);
474 float qOverPt =
tp->qOverPt();
499 return pair<unsigned int, unsigned int>(iQoverPt, iPhiTrk);
507 bool beamConstraint = fitTrk->
done_bcon();
515 int iQoverPt = 999999;
516 int iPhiTrk = 999999;
551 for (
auto cellCenter : binCenters) {
574 return pair<unsigned int, unsigned int>(iQoverPt, iPhiTrk);
584 unsigned int i = iQoverPtBin;
590 unsigned int numQoverPtBinsToMerge = 2 *
min((
unsigned int)(std::round(fMergeBins)), (
nBinsQoverPtAxis_ / 4));
591 const float small = 0.001;
593 numQoverPtBinsToMerge++;
595 if (
min(
i, iB) < numQoverPtBinsToMerge)
621 list<L1track2D> outTracks;
624 unsigned int nStubsOut = 0;
630 unsigned int nStubs = trk.numStubs();
633 nStubsOutInRange[mBinRange] += nStubs;
643 outTracks.push_back(trk);
658 vector<unsigned int> iOrder;
661 const bool oddNumRows = (numRows % 2 == 1);
665 unsigned int middleRow = (numRows - 1) / 2;
666 iOrder.push_back(middleRow);
667 for (
unsigned int i = 1;
i <= (numRows - 1) / 2;
i++) {
668 iOrder.push_back(middleRow -
i);
669 iOrder.push_back(middleRow +
i);
672 unsigned int startRowPos = numRows / 2;
673 unsigned int startRowNeg = startRowPos - 1;
674 for (
unsigned int i = 0;
i < numRows / 2;
i++) {
675 iOrder.push_back(startRowNeg -
i);
676 iOrder.push_back(startRowPos +
i);
constexpr double deltaPhi(double phi1, double phi2)
std::vector< unsigned int > busySectorMbinRanges_
unsigned int killSomeHTCellsRphi() const
bool mergedCell(unsigned int iQoverPtBin, unsigned int jPhiTrkBin) const
int merge(int argc, char *argv[])
float binSizeQoverPtAxis_
void store(Stub *stub, const std::vector< bool > &inEtaSubSecs)
virtual std::pair< unsigned int, unsigned int > convertCoordRangeToBinRange(std::pair< float, float > coordRange, unsigned int nBinsAxis, float coordAxisMin, float coordAxisBinSize, unsigned int killSomeHTcells) const
std::vector< unsigned int > busySectorMbinLow_
std::vector< unsigned int > busySectorMbinOrder_
const std::vector< unsigned int > & busySectorMbinRanges() const
unsigned int killSomeHTCellsRphi_
unsigned int nBinsPhiTrkAxis_
unsigned int busyInputSectorNumStubs_
float qOverPt_bcon() const
std::pair< unsigned int, unsigned int > iPhiRange(const Stub *stub, unsigned int iQoverPtBin, bool debug=false) const
std::pair< unsigned int, unsigned int > cellLocationHT() const override
std::atomic< float > maxLineGradient
Array2D< std::unique_ptr< HTcell > > htArray_
std::atomic< unsigned int > numErrorsNorm
bool busySectorUseMbinOrder_
unsigned int busySectorNumStubs() const
std::atomic< unsigned int > numErrorsTypeA
std::vector< unsigned int > rowOrder(unsigned int numRows) const override
std::pair< unsigned int, unsigned int > trueCell(const TP *tp) const override
const std::vector< unsigned int > & busySectorMbinOrder() const
std::pair< unsigned int, unsigned int > cell(const L1fittedTrack *fitTrk) const override
double maxPtToMerge2x2() const
std::pair< float, float > helix2Dhough(unsigned int i, unsigned int j) const override
float qOverPt() const override
Abs< T >::type abs(const T &t)
std::pair< float, float > helix2Dconventional(unsigned int i, unsigned int j) const override
bool busySectorUseMbinRanges_
unsigned int busyInputSectorNumStubs() const
const Settings * settings_
void countFirmwareErrors(unsigned int iQoverPtBin, unsigned int iPhiTrkBinMin, unsigned int iPhiTrkBinMax, unsigned int jPhiTrkBinMinLast, unsigned int jPhiTrkBinMaxLast)
float minInvPtToMerge2x2_
unsigned int busySectorNumStubs_
=== This is the base class for the linearised chi-squared track fit algorithms.
bool enableMerge2x2() const
unsigned int nReceivedStubs_
float phiAtChosenR(bool beamConstraint) const
unsigned int getMbinRange(const L1track2D &trk) const
std::atomic< unsigned int > numErrorsTypeB
bool busyInputSectorKill_
std::vector< std::vector< std::pair< float, float > > > cellCenters_
bool busySectorKill() const
float calcLineGradArray(float r) const
std::list< L1track2D > killTracksBusySec(const std::list< L1track2D > &tracks) const override
bool busyInputSectorKill() const
unsigned int nBinsQoverPtAxis_
Power< A, B >::type pow(const A &a, const B &b)
std::vector< unsigned int > busySectorMbinHigh_