16 using namespace cmsdt;
22 unsigned short int sumhqa = 0;
23 unsigned short int sumhqb = 0;
24 unsigned short int sumlqa = 0;
25 unsigned short int sumlqb = 0;
29 for (
unsigned short int lay = 0; lay < 8; lay++) {
30 sumhqa += (
unsigned short int)
a.isThereHitInLayer_[lay];
31 sumhqb += (
unsigned short int)
b.isThereHitInLayer_[lay];
32 sumlqa += (
unsigned short int)
a.isThereNeighBourHitInLayer_[lay];
33 sumlqb += (
unsigned short int)
b.isThereNeighBourHitInLayer_[lay];
34 sumdista +=
a.xDistToPattern_[lay];
35 sumdistb +=
b.xDistToPattern_[lay];
38 if (
a.nLayersWithHits_ !=
b.nLayersWithHits_)
39 return (
a.nLayersWithHits_ >
b.nLayersWithHits_);
40 else if (sumhqa != sumhqb)
41 return (sumhqa > sumhqb);
42 else if (sumlqa != sumlqb)
43 return (sumlqa > sumlqb);
44 else if (
a.nHitsDiff_ !=
b.nHitsDiff_)
45 return (
a.nHitsDiff_ <
b.nHitsDiff_);
47 return (sumdista < sumdistb);
49 }
const HoughOrdering;
58 LogDebug(
"HoughGrouping") <<
"HoughGrouping: constructor";
86 LogDebug(
"HoughGrouping") <<
"HoughGrouping: destructor" << endl;
94 LogDebug(
"HoughGrouping") <<
"initialise";
98 maxrads_ = 0.5 *
M_PI - atan(angletan_);
100 halfanglebins_ = round(maxrads_ / minangle_ + 1);
101 anglebins_ = (
unsigned short int)2 * halfanglebins_;
102 oneanglebin_ = maxrads_ / halfanglebins_;
104 maxdeltaAng_ = maxdeltaAngDeg_ * 2 *
M_PI / 360;
109 for (
unsigned short int ab = 0; ab < halfanglebins_; ab++) {
115 for (
unsigned short int ab = halfanglebins_; ab < anglebins_; ab++) {
122 <<
"\nHoughGrouping::ResetAttributes - Information from the initialisation of HoughGrouping:";
123 LogDebug(
"HoughGrouping") <<
"ResetAttributes - maxrads: " << maxrads_;
124 LogDebug(
"HoughGrouping") <<
"ResetAttributes - anglebinwidth: " << anglebinwidth_;
125 LogDebug(
"HoughGrouping") <<
"ResetAttributes - minangle: " << minangle_;
126 LogDebug(
"HoughGrouping") <<
"ResetAttributes - halfanglebins: " << halfanglebins_;
127 LogDebug(
"HoughGrouping") <<
"ResetAttributes - anglebins: " << anglebins_;
128 LogDebug(
"HoughGrouping") <<
"ResetAttributes - oneanglebin: " << oneanglebin_;
129 LogDebug(
"HoughGrouping") <<
"ResetAttributes - posbinwidth: " << posbinwidth_;
133 dtGeo_ = &
geom.get(dtGeomH);
141 LogDebug(
"HoughGrouping") <<
"\nHoughGrouping::run";
146 LogDebug(
"HoughGrouping") <<
"run - Beginning digis' loop...";
150 const DTLayer* lay = dtGeo_->layer((*dtLayerIdIt).first);
152 digiIt != ((*dtLayerIdIt).second).second;
155 LogDebug(
"HoughGrouping") <<
"\nHoughGrouping::run - Digi number " << idigi_;
156 LogDebug(
"HoughGrouping") <<
"run - Wheel: " << (*dtLayerIdIt).first.wheel();
157 LogDebug(
"HoughGrouping") <<
"run - Chamber: " << (*dtLayerIdIt).first.station();
158 LogDebug(
"HoughGrouping") <<
"run - Sector: " << (*dtLayerIdIt).first.sector();
159 LogDebug(
"HoughGrouping") <<
"run - Superlayer: " << (*dtLayerIdIt).first.superLayer();
160 LogDebug(
"HoughGrouping") <<
"run - Layer: " << (*dtLayerIdIt).first.layer();
161 LogDebug(
"HoughGrouping") <<
"run - Wire: " << (*digiIt).wire();
164 LogDebug(
"HoughGrouping") <<
"run - First wire x: " 166 LogDebug(
"HoughGrouping") <<
"run - Last wire x: " 171 if ((*dtLayerIdIt).first.superLayer() == 2)
175 wirePosGlob = lay->
toGlobal(wirePosInLay);
178 if ((*dtLayerIdIt).first.superLayer() == 3) {
179 digimap_[(*dtLayerIdIt).first.layer() + 3][(*digiIt).wire()] =
DTPrimitive();
180 digimap_[(*dtLayerIdIt).first.layer() + 3][(*digiIt).wire()].setTDCTimeStamp((*digiIt).time());
181 digimap_[(*dtLayerIdIt).first.layer() + 3][(*digiIt).wire()].setChannelId((*digiIt).wire());
182 digimap_[(*dtLayerIdIt).first.layer() + 3][(*digiIt).wire()].setLayerId((*dtLayerIdIt).first.layer());
183 digimap_[(*dtLayerIdIt).first.layer() + 3][(*digiIt).wire()].setSuperLayerId((*dtLayerIdIt).first.superLayer());
184 digimap_[(*dtLayerIdIt).first.layer() + 3][(*digiIt).wire()].setCameraId((*dtLayerIdIt).first.rawId());
186 digimap_[(*dtLayerIdIt).first.layer() - 1][(*digiIt).wire()] =
DTPrimitive();
187 digimap_[(*dtLayerIdIt).first.layer() - 1][(*digiIt).wire()].setTDCTimeStamp((*digiIt).time());
188 digimap_[(*dtLayerIdIt).first.layer() - 1][(*digiIt).wire()].setChannelId((*digiIt).wire());
189 digimap_[(*dtLayerIdIt).first.layer() - 1][(*digiIt).wire()].setLayerId((*dtLayerIdIt).first.layer());
190 digimap_[(*dtLayerIdIt).first.layer() - 1][(*digiIt).wire()].setSuperLayerId((*dtLayerIdIt).first.superLayer());
191 digimap_[(*dtLayerIdIt).first.layer() - 1][(*digiIt).wire()].setCameraId((*dtLayerIdIt).first.rawId());
195 if (xlowlim_ == 0 && xhighlim_ == 0 && zlowlim_ == 0 && zhighlim_ == 0) {
196 thewheel_ = (*dtLayerIdIt).first.wheel();
197 thestation_ = (*dtLayerIdIt).first.station();
198 thesector_ = (*dtLayerIdIt).first.sector();
199 obtainGeometricalBorders(lay);
203 LogDebug(
"HoughGrouping") <<
"run - X position of the cell (chamber frame of reference): " 204 << wirePosInChamber.
x();
205 LogDebug(
"HoughGrouping") <<
"run - Y position of the cell (chamber frame of reference): " 206 << wirePosInChamber.
y();
207 LogDebug(
"HoughGrouping") <<
"run - Z position of the cell (chamber frame of reference): " 208 << wirePosInChamber.
z();
211 hitvec_.push_back({wirePosInChamber.
x() - 1.05, wirePosInChamber.
z()});
212 hitvec_.push_back({wirePosInChamber.
x() + 1.05, wirePosInChamber.
z()});
220 LogDebug(
"HoughGrouping") <<
"\nHoughGrouping::run - nhits: " << nhits_;
221 LogDebug(
"HoughGrouping") <<
"run - idigi: " << idigi_;
224 if (hitvec_.empty()) {
226 LogDebug(
"HoughGrouping") <<
"run - No digis present in this chamber.";
234 maxima_ = getMaximaVector();
235 resetPosElementsOfLinespace();
237 if (maxima_.empty()) {
239 LogDebug(
"HoughGrouping") <<
"run - No good maxima found in this event.";
243 DTChamberId TheChambId(thewheel_, thestation_, thesector_);
244 const DTChamber* TheChamb = dtGeo_->chamber(TheChambId);
245 std::vector<ProtoCand>
cands;
247 for (
unsigned short int ican = 0; ican < maxima_.size(); ican++) {
249 LogDebug(
"HoughGrouping") <<
"\nHoughGrouping::run - Candidate number: " << ican;
250 cands.push_back(associateHits(TheChamb, maxima_.at(ican).first, maxima_.at(ican).second));
254 orderAndFilter(
cands, outMpath);
256 LogDebug(
"HoughGrouping") <<
"run - now we have our muonpaths! It has " << outMpath.size() <<
" elements";
264 LogDebug(
"HoughGrouping") <<
"finish";
273 LogDebug(
"HoughGrouping") <<
"ResetAttributes";
295 for (
unsigned short int abslay = 0; abslay < 8; abslay++)
296 digimap_[abslay].
clear();
301 LogDebug(
"HoughGrouping") <<
"ResetPosElementsOfLinespace";
302 for (
unsigned short int ab = 0; ab < anglebins_; ab++) {
303 linespace_[ab].clear();
310 LogDebug(
"HoughGrouping") <<
"ObtainGeometricalBorders";
326 unsigned short int upsl = thestation_ == 4 ? 3 : 3;
328 LogDebug(
"HoughGrouping") <<
"ObtainGeometricalBorders - uppersuperlayer: " << upsl;
342 spacebins_ = round(
std::abs(xhighlim_ - xlowlim_) / posbinwidth_);
347 LogDebug(
"HoughGrouping") <<
"DoHoughTransform";
352 LogDebug(
"HoughGrouping") <<
"DoHoughTransform - maxrads: " << maxrads_;
353 LogDebug(
"HoughGrouping") <<
"DoHoughTransform - minangle: " << minangle_;
354 LogDebug(
"HoughGrouping") <<
"DoHoughTransform - halfanglebins: " << halfanglebins_;
355 LogDebug(
"HoughGrouping") <<
"DoHoughTransform - anglebins: " << anglebins_;
356 LogDebug(
"HoughGrouping") <<
"DoHoughTransform - oneanglebin: " << oneanglebin_;
357 LogDebug(
"HoughGrouping") <<
"DoHoughTransform - spacebins: " << spacebins_;
360 double rho = 0,
phi = 0, sbx = 0;
361 double lowinitsb = xlowlim_ + posbinwidth_ / 2;
364 linespace_.resize(anglebins_, std::vector<unsigned short int>(spacebins_));
365 for (
unsigned short int ab = 0; ab < anglebins_; ab++) {
367 for (
unsigned short int sb = 0; sb < spacebins_; sb++) {
369 linespace_[ab][sb] = 0;
375 for (
unsigned short int i = 0;
i < hitvec_.size();
i++) {
376 for (
unsigned short int ab = 0; ab < anglebins_; ab++) {
379 sbx = lowinitsb - posbinwidth_ / 2;
380 for (
unsigned short int sb = 0; sb < spacebins_; sb++) {
382 linespace_[ab][sb]++;
393 LogDebug(
"HoughGrouping") <<
"getMaximaVector";
396 bool flagsearched =
false;
397 unsigned short int numbertolookat = upperNumber_;
399 while (!flagsearched) {
400 for (
unsigned short int ab = 0; ab < anglebins_; ab++) {
401 for (
unsigned short int sb = 0; sb < spacebins_; sb++) {
402 if (linespace_[ab][sb] >= numbertolookat)
403 tmpvec.push_back({anglemap_[ab], posmap_[sb], linespace_[ab][sb]});
406 if (((numbertolookat - 1) < lowerNumber_) || (!tmpvec.empty()))
412 if (tmpvec.empty()) {
414 LogDebug(
"HoughGrouping") <<
"GetMaximaVector - No maxima could be found";
421 for (
unsigned short int i = 0;
i < finalvec.size();
i++)
422 finalvec.at(
i) = transformPair(finalvec.at(
i));
429 LogDebug(
"HoughGrouping") <<
"transformPair";
431 if (inputpair.first == 0)
432 return {1000, -1000 * inputpair.second};
434 return {-1. /
tan(inputpair.first), inputpair.second /
sin(inputpair.first)};
439 LogDebug(
"HoughGrouping") <<
"findTheMaxima";
440 bool fullyreduced =
false;
441 unsigned short int ind = 0;
443 std::vector<unsigned short int> chosenvec;
448 LogDebug(
"HoughGrouping") <<
"findTheMaxima - prewhile";
449 while (!fullyreduced) {
451 LogDebug(
"HoughGrouping") <<
"\nHoughGrouping::findTheMaxima - New iteration";
452 LogDebug(
"HoughGrouping") <<
"findTheMaxima - inputvec size: " << inputvec.size();
453 LogDebug(
"HoughGrouping") <<
"findTheMaxima - ind: " << ind;
454 LogDebug(
"HoughGrouping") <<
"findTheMaxima - maximum deltaang: " << maxdeltaAng_
455 <<
" and maximum deltapos: " << maxdeltaPos_;
460 LogDebug(
"HoughGrouping") <<
"findTheMaxima - Ours have " << get<2>(inputvec.at(ind))
461 <<
" entries, ang.: " << get<0>(inputvec.at(ind))
462 <<
" and pos.: " << get<1>(inputvec.at(ind));
464 for (
unsigned short int j = ind + 1;
j < inputvec.size();
j++) {
465 if (getTwoDelta(inputvec.at(ind), inputvec.at(
j)).
first <= maxdeltaAng_ &&
466 getTwoDelta(inputvec.at(ind), inputvec.at(
j)).
second <= maxdeltaPos_) {
467 chosenvec.push_back(
j);
469 LogDebug(
"HoughGrouping") <<
"findTheMaxima - - Adding num. " <<
j 470 <<
" with deltaang: " << getTwoDelta(inputvec.at(ind), inputvec.at(
j)).
first 471 <<
", and deltapos: " << getTwoDelta(inputvec.at(ind), inputvec.at(
j)).
second 472 <<
" and with " << get<2>(inputvec.at(
j))
473 <<
" entries, ang.: " << get<0>(inputvec.at(
j))
474 <<
" and pos.: " << get<1>(inputvec.at(
j));
476 LogDebug(
"HoughGrouping") <<
"findTheMaxima - - Ignoring num. " <<
j 477 <<
" with deltaang: " << getTwoDelta(inputvec.at(ind), inputvec.at(
j)).
first 478 <<
", and deltapos: " << getTwoDelta(inputvec.at(ind), inputvec.at(
j)).
second 479 <<
" and with " << get<2>(inputvec.at(
j)) <<
" entries.";
483 LogDebug(
"HoughGrouping") <<
"findTheMaxima - chosenvecsize: " << chosenvec.size();
485 if (chosenvec.empty()) {
486 if (ind + 1 >= (
unsigned short int)inputvec.size())
488 if ((get<0>(inputvec.at(ind)) <= maxrads_) || (get<0>(inputvec.at(ind)) >=
M_PI - maxrads_))
489 resultvec.push_back({get<0>(inputvec.at(ind)), get<1>(inputvec.at(ind))});
491 LogDebug(
"HoughGrouping") <<
"findTheMaxima - - Candidate dropped due to an excess in angle";
497 finalpair = getAveragePoint(inputvec, ind, chosenvec);
500 inputvec.erase(inputvec.begin() + ind);
501 for (
short int j = chosenvec.size() - 1;
j > -1;
j--) {
503 LogDebug(
"HoughGrouping") <<
"findTheMaxima - erasing index: " << chosenvec.at(
j) - 1;
504 inputvec.erase(inputvec.begin() + chosenvec.at(
j) - 1);
508 LogDebug(
"HoughGrouping") <<
"findTheMaxima - inputvec size: " << inputvec.size();
511 if ((finalpair.first <= maxrads_) || (finalpair.first >=
M_PI - maxrads_))
512 resultvec.push_back(finalpair);
514 LogDebug(
"HoughGrouping") <<
"findTheMaxima - - Candidate dropped due to an excess in angle";
516 if (ind + 1 >= (
unsigned short int)inputvec.size())
519 LogDebug(
"HoughGrouping") <<
"findTheMaxima - iteration ends";
523 LogDebug(
"HoughGrouping") <<
"findTheMaxima - postwhile";
529 LogDebug(
"HoughGrouping") <<
"getTwoDelta";
530 return {
abs(get<0>(pair1) - get<0>(pair2)),
abs(get<1>(pair1) - get<1>(pair2))};
535 const std::vector<unsigned short int>& indexlist) {
537 LogDebug(
"HoughGrouping") <<
"getAveragePoint";
538 std::vector<double> xs;
539 std::vector<double> ys;
540 std::vector<double>
ws;
541 xs.push_back(get<0>(inputvec.at(
firstindex)));
542 ys.push_back(get<1>(inputvec.at(
firstindex)));
544 for (
unsigned short int i = 0;
i < indexlist.size();
i++) {
545 xs.push_back(get<0>(inputvec.at(indexlist.at(
i))));
546 ys.push_back(get<1>(inputvec.at(indexlist.at(
i))));
547 ws.push_back(
exp(get<2>(inputvec.at(indexlist.at(
i)))));
554 LogDebug(
"HoughGrouping") <<
"associateHits";
555 LocalPoint tmpLocal, AWireLocal, AWireLocalCh, tmpLocalCh, thepoint;
558 unsigned short int tmpwire = 0;
559 unsigned short int abslay = 0;
562 bool isright =
false;
573 LogDebug(
"HoughGrouping") <<
"associateHits - Beginning SL loop";
574 for (
unsigned short int sl = 1; sl < 3 + 1; sl++) {
578 LogDebug(
"HoughGrouping") <<
"associateHits - SL: " << sl;
580 for (
unsigned short int l = 1;
l < 4 + 1;
l++) {
582 LogDebug(
"HoughGrouping") <<
"associateHits - L: " <<
l;
595 AWireLocalCh = thechamb->
toLocal(AWireGlobal);
596 tmpx = (AWireLocalCh.
z() -
n) /
m;
598 if ((tmpx <= xlowlim_) || (tmpx >= xhighlim_)) {
606 LogDebug(
"HoughGrouping") <<
"associateHits - Wire number: " << tmpwire;
608 LogDebug(
"HoughGrouping") <<
"associateHits - First channel in layer: " 610 if ((digimap_[abslay]).
count(tmpwire)) {
614 tmpLocalCh = thechamb->
toLocal(tmpGlobal);
616 if (
abs(tmpLocalCh.
x() - thepoint.
x()) >= maxDistanceToWire_) {
618 if ((tmpLocalCh.
x() - thepoint.
x()) > 0)
638 LogDebug(
"HoughGrouping") <<
"associateHits - No hit in the crossing cell";
639 if ((digimap_[abslay]).
count(tmpwire - 1))
641 if ((digimap_[abslay]).
count(tmpwire + 1))
644 LogDebug(
"HoughGrouping") <<
"associateHits - There is in the left: " << (
int)isleft;
646 LogDebug(
"HoughGrouping") <<
"associateHits - There is in the right: " << (
int)isright;
648 if ((isleft) && (!isright)) {
651 tmpLocalCh = thechamb->
toLocal(tmpGlobal);
660 }
else if ((!isleft) && (isright)) {
663 tmpLocalCh = thechamb->
toLocal(tmpGlobal);
671 }
else if ((isleft) && (isright)) {
686 bool isDistRight =
std::abs(thepoint.
x() - tmpLocalCh_l.
x()) <
std::abs(thepoint.
x() - tmpLocalCh_r.
x());
703 setDifferenceBetweenSL(returnPC);
705 LogDebug(
"HoughGrouping") <<
"associateHits - Finishing with the candidate. We have found the following of it:";
707 for (
unsigned short int lay = 0; lay < 8; lay++) {
708 LogDebug(
"HoughGrouping") <<
"associateHits - For absolute layer: " << lay;
712 LogDebug(
"HoughGrouping") <<
"associateHits - Abs. diff. between SL1 and SL3 hits: " << returnPC.
nHitsDiff_;
713 for (
unsigned short int lay = 0; lay < 8; lay++) {
714 LogDebug(
"HoughGrouping") <<
"associateHits - For absolute layer: " << lay;
723 LogDebug(
"HoughGrouping") <<
"setDifferenceBetweenSL";
724 short int absres = 0;
725 for (
unsigned short int lay = 0; lay < 8; lay++) {
726 if (tupl.
dtHits_[lay].channelId() > 0) {
742 LogDebug(
"HoughGrouping") <<
"orderAndFilter";
750 std::vector<unsigned short int> elstoremove;
753 LogDebug(
"HoughGrouping") <<
"orderAndFilter - First ordering";
754 std::sort(invector.begin(), invector.end(), HoughOrdering);
757 unsigned short int ind = 0;
760 LogDebug(
"HoughGrouping") <<
"orderAndFilter - Entering while";
763 LogDebug(
"HoughGrouping") <<
"\nHoughGrouping::orderAndFilter - New iteration with ind: " << ind;
765 for (
unsigned short int i = ind + 1;
i < invector.size();
i++) {
767 LogDebug(
"HoughGrouping") <<
"orderAndFilter - Checking index: " <<
i;
768 for (
unsigned short int lay = 0; lay < 8; lay++) {
770 LogDebug(
"HoughGrouping") <<
"orderAndFilter - Checking layer number: " << lay;
771 if (invector.at(
i).dtHits_[lay].channelId() == invector.at(ind).dtHits_[lay].channelId() &&
772 invector.at(ind).dtHits_[lay].channelId() != -1) {
773 invector.at(
i).nLayersWithHits_--;
774 invector.at(
i).isThereHitInLayer_[lay] =
false;
775 invector.at(
i).isThereNeighBourHitInLayer_[lay] =
false;
776 setDifferenceBetweenSL(invector.at(
i));
778 if (invector.at(
i).dtHits_[lay].laterality() != invector.at(ind).dtHits_[lay].laterality())
779 invector.at(ind).dtHits_[lay].setLaterality(
NONE);
786 <<
"orderAndFilter - Finished checking all the layers, now seeing if we should remove the " 789 if (!areThereEnoughHits(invector.at(
i))) {
791 LogDebug(
"HoughGrouping") <<
"orderAndFilter - This candidate shall be removed!";
792 elstoremove.push_back((
unsigned short int)
i);
797 LogDebug(
"HoughGrouping") <<
"orderAndFilter - We are gonna erase " << elstoremove.size() <<
" elements";
799 for (
short int el = (elstoremove.size() - 1); el > -1; el--) {
800 invector.erase(invector.begin() + elstoremove.at(el));
803 if (ind + 1 == (
unsigned short int)invector.size())
806 std::sort(invector.begin() + ind + 1, invector.end(), HoughOrdering);
811 for (
short int el = (invector.size() - 1); el > -1; el--) {
812 if (!areThereEnoughHits(invector.at(el))) {
813 invector.erase(invector.begin() + el);
817 if (invector.empty()) {
819 LogDebug(
"HoughGrouping") <<
"OrderAndFilter - We do not have candidates with the minimum hits required.";
822 LogDebug(
"HoughGrouping") <<
"OrderAndFilter - At the end, we have only " << invector.size() <<
" good paths!";
825 for (
unsigned short int i = 0;
i < invector.size();
i++) {
827 unsigned short int tmplowfill = 0;
828 unsigned short int tmpupfill = 0;
829 for (
unsigned short int lay = 0; lay < 8; lay++) {
830 auto dtAux = std::make_shared<DTPrimitive>(invector.at(
i).dtHits_[lay]);
831 ptrPrimitive.push_back(
std::move(dtAux));
833 LogDebug(
"HoughGrouping") <<
"\nHoughGrouping::OrderAndFilter - cameraid: " << ptrPrimitive[lay]->cameraId();
834 LogDebug(
"HoughGrouping") <<
"OrderAndFilter - channelid (GOOD): " << ptrPrimitive[lay]->channelId();
835 LogDebug(
"HoughGrouping") <<
"OrderAndFilter - channelid (AM): " << ptrPrimitive[lay]->channelId() - 1;
838 if (ptrPrimitive[lay]->channelId() != -1)
839 ptrPrimitive[lay]->setChannelId(ptrPrimitive[lay]->channelId() - 1);
841 if (ptrPrimitive[lay]->cameraId() > 0) {
849 auto ptrMuonPath = std::make_shared<MuonPath>(ptrPrimitive, tmplowfill, tmpupfill);
850 outMuonPath.push_back(ptrMuonPath);
852 for (
unsigned short int lay = 0; lay < 8; lay++) {
853 LogDebug(
"HoughGrouping") <<
"OrderAndFilter - Final cameraID: " 854 << outMuonPath.back()->primitive(lay)->cameraId();
855 LogDebug(
"HoughGrouping") <<
"OrderAndFilter - Final channelID: " 856 << outMuonPath.back()->primitive(lay)->channelId();
857 LogDebug(
"HoughGrouping") <<
"OrderAndFilter - Final time: " 858 << outMuonPath.back()->primitive(lay)->tdcTimeStamp();
867 LogDebug(
"HoughGrouping") <<
"areThereEnoughHits";
868 unsigned short int numhitssl1 = 0;
869 unsigned short int numhitssl3 = 0;
870 for (
unsigned short int lay = 0; lay < 8; lay++) {
871 if ((tupl.
dtHits_[lay].channelId() > 0) && (lay < 4))
873 else if (tupl.
dtHits_[lay].channelId() > 0)
878 LogDebug(
"HoughGrouping") <<
"areThereEnoughHits - Hits in SL1: " << numhitssl1;
880 LogDebug(
"HoughGrouping") <<
"areThereEnoughHits - Hits in SL3: " << numhitssl3;
882 if ((numhitssl1 != 0) && (numhitssl3 != 0)) {
883 if ((numhitssl1 + numhitssl3) >= minNLayerHits_) {
884 if (numhitssl1 > numhitssl3) {
885 return ((numhitssl1 >= minSingleSLHitsMax_) && (numhitssl3 >= minSingleSLHitsMin_));
886 }
else if (numhitssl3 > numhitssl1) {
887 return ((numhitssl3 >= minSingleSLHitsMax_) && (numhitssl1 >= minSingleSLHitsMin_));
891 }
else if (allowUncorrelatedPatterns_) {
892 return ((numhitssl1 + numhitssl3) >= minNLayerHits_);
std::vector< DTPrimitivePtr > DTPrimitivePtrs
std::tuple< double, double, unsigned short int > PointTuple
unsigned short int lowerNumber_
unsigned short int minNLayerHits_
unsigned short int nLayersWithHits_
Point3DBase< Scalar, LocalTag > LocalPoint
constexpr double convertDegToRad(NumType degrees)
PointInPlane getTwoDelta(const PointTuple &pair1, const PointTuple &pair2)
void setDifferenceBetweenSL(ProtoCand &tupl)
void run(edm::Event &iEvent, const edm::EventSetup &iEventSetup, const DTDigiCollection &digis, MuonPathPtrs &outMpath) override
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
double maxDistanceToWire_
unsigned short int upperNumber_
ProtoCand associateHits(const DTChamber *thechamb, double m, double n)
std::vector< MuonPathPtr > MuonPathPtrs
unsigned short int minUncorrelatedHits_
Sin< T >::type sin(const T &t)
bool allowUncorrelatedPatterns_
void orderAndFilter(std::vector< ProtoCand > &invector, MuonPathPtrs &outMuonPath)
const DTChamber * chamber() const
PointsInPlane getMaximaVector()
unsigned short int minSingleSLHitsMin_
void initialise(const edm::EventSetup &iEventSetup) override
PointsInPlane findTheMaxima(PointTuples &inputvec)
int firstChannel() const
Returns the wire number of the first wire.
U second(std::pair< T, U > const &p)
HoughGrouping(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return the superlayer corresponding to the given id.
float cellWidth() const
Returns the cell width.
PointInPlane getAveragePoint(const PointTuples &inputvec, unsigned short int firstindex, const std::vector< unsigned short int > &indexlist)
const DTLayer * layer(const DTLayerId &id) const
Return the layer corresponding to the given id.
Cos< T >::type cos(const T &t)
PointInPlane transformPair(const PointInPlane &inputpair)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
void obtainGeometricalBorders(const DTLayer *lay)
const DTTopology & specificTopology() const
unsigned short int minSingleSLHitsMax_
std::vector< PointInPlane > PointsInPlane
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomH
void resetPosElementsOfLinespace()
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
std::pair< double, double > PointInPlane
std::vector< PointTuple > PointTuples
std::vector< double > xDistToPattern_
unsigned short int nHitsDiff_
~HoughGrouping() override
constexpr int NUM_LAYERS_2SL
std::vector< DigiType >::const_iterator const_iterator
bool areThereEnoughHits(const ProtoCand &tupl)
void clear(HadCaloObj &c)
int channel(const LocalPoint &p) const override
int lastChannel() const
Returns the wire number of the last wire.
std::vector< bool > isThereHitInLayer_
std::vector< bool > isThereNeighBourHitInLayer_
float cellHeight() const
Returns the cell height.
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.