34 float phiCentreSector,
36 :
HTbase(settings, iPhiSec, iEtaReg, settings->houghNbinsPt(), settings->houghNbinsPhi()),
37 invPtToDphi_((settings->invPtToDphi())),
38 shape_(static_cast<
HTshape>(settings->shape())),
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;
169 std::vector<std::pair<float, float> > binCenters;
171 binCenters.push_back(this->helix2Dhough(
m,
c));
184 unsigned int jPhiTrkBinMinLast = 0;
185 unsigned int jPhiTrkBinMaxLast = 99999;
193 pair<unsigned int, unsigned int> jRange = this->
iPhiRange(stub,
i);
194 unsigned int jPhiTrkBinMin = jRange.first;
195 unsigned int jPhiTrkBinMax = jRange.second;
198 for (
unsigned int j = jPhiTrkBinMin;
j <= jPhiTrkBinMax;
j++) {
199 bool canStoreStub =
true;
200 unsigned int iStore =
i;
201 unsigned int jStore =
j;
216 canStoreStub =
false;
226 this->
countFirmwareErrors(
i, jPhiTrkBinMin, jPhiTrkBinMax, jPhiTrkBinMinLast, jPhiTrkBinMaxLast);
227 jPhiTrkBinMinLast = jPhiTrkBinMin;
228 jPhiTrkBinMaxLast = jPhiTrkBinMax;
254 float phiTrkMin = phiTrk - phiTrkVar;
255 float phiTrkMax = phiTrk + phiTrkVar;
266 std::pair<bool, unsigned int> binCenter;
267 std::pair<bool, unsigned int>
binMin;
268 std::pair<bool, unsigned int>
binMax;
269 binCenter.second = iCenter / 3;
272 binCenter.first = !(iCenter % 3 == 2);
273 binMin.first = (iMin % 3 == 0);
274 binMax.first = (iMax % 3 == 0);
290 float phiTrkMin = phiTrk - phiTrkVar;
291 float phiTrkMax = phiTrk + phiTrkVar;
294 std::pair<bool, unsigned int>
binMin;
295 std::pair<bool, unsigned int>
binMax;
298 binMin.first = (iMin % 2 ==
i % 2);
299 binMax.first = (iMax % 2 ==
i % 2);
320 unsigned int mBinOrder;
328 if (mBinOrder == 99999)
329 throw cms::Exception(
"LogicError") <<
"HTrphi::getMbinRange() mBinOrder calculation wrong.";
338 throw cms::Exception(
"LogicError") <<
"HTrphi::getMbinRange() messed up";
363 float phiTrkMin = phiTrk - phiTrkVar;
364 float phiTrkMax = phiTrk + phiTrkVar;
368 pair<float, float> phiTrkRange(deltaPhiMin, deltaPhiMax);
374 return iPhiTrkBinRange;
380 unsigned int jPhiTrkBinMin,
381 unsigned int jPhiTrkBinMax,
382 unsigned int jPhiTrkBinMinLast,
383 unsigned int jPhiTrkBinMaxLast) {
385 if (jPhiTrkBinMax >= jPhiTrkBinMin) {
388 bool OK_a = (jPhiTrkBinMin + 1 >= jPhiTrkBinMinLast) && (jPhiTrkBinMax <= jPhiTrkBinMaxLast + 1);
390 bool OK_b = (jPhiTrkBinMax - jPhiTrkBinMin + 1 <= 2);
405 unsigned int qOverPtBin =
i;
406 unsigned int phiTrkBin =
j;
423 float qOverPtBinCenter = .5;
424 float phiTrkBinCenter = .5;
427 qOverPtBinCenter = 0.;
429 float evenPhiPos = 0., oddPhiPos = 0.;
431 evenPhiPos = 1. / 6.;
440 phiTrkBinCenter = (qOverPtBin % 2 == 0) ? evenPhiPos : oddPhiPos;
453 return pair<float, float>(qOverPt, phiTrk);
464 float qOverPt = helix2Dht.first;
467 return pair<float, float>(qOverPt, phi0);
475 float qOverPt =
tp->qOverPt();
500 return pair<unsigned int, unsigned int>(iQoverPt, iPhiTrk);
508 bool beamConstraint = fitTrk->
done_bcon();
516 int iQoverPt = 999999;
517 int iPhiTrk = 999999;
552 for (
auto cellCenter : binCenters) {
575 return pair<unsigned int, unsigned int>(iQoverPt, iPhiTrk);
585 unsigned int i = iQoverPtBin;
591 unsigned int numQoverPtBinsToMerge = 2 *
min((
unsigned int)(std::round(fMergeBins)), (
nBinsQoverPtAxis_ / 4));
592 const float small = 0.001;
594 numQoverPtBinsToMerge++;
596 if (
min(
i, iB) < numQoverPtBinsToMerge)
622 list<L1track2D> outTracks;
625 unsigned int nStubsOut = 0;
631 unsigned int nStubs = trk.numStubs();
634 nStubsOutInRange[mBinRange] += nStubs;
644 outTracks.push_back(trk);
659 vector<unsigned int> iOrder;
662 const bool oddNumRows = (numRows % 2 == 1);
666 unsigned int middleRow = (numRows - 1) / 2;
667 iOrder.push_back(middleRow);
668 for (
unsigned int i = 1;
i <= (numRows - 1) / 2;
i++) {
669 iOrder.push_back(middleRow -
i);
670 iOrder.push_back(middleRow +
i);
673 unsigned int startRowPos = numRows / 2;
674 unsigned int startRowNeg = startRowPos - 1;
675 for (
unsigned int i = 0;
i < numRows / 2;
i++) {
676 iOrder.push_back(startRowNeg -
i);
677 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
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
int merge(int argc, char *argv[])
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_
auto const & tracks
cannot be loose
=== 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_