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;
270 binMin.second = iMin / 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;
296 binMin.second = iMin / 2;
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);