15 std::shared_ptr<GlobalCoordsObtainer> &globalcoordsobtainer) {
29 LogDebug(
"MuonPathAssociator") <<
"MuonPathAssociator: constructor";
34 std::ifstream ifin3(shift_filename_.fullPath());
38 <<
"MuonPathAnalyzerPerSL::MuonPathAnalyzerPerSL() - Cannot find " << shift_filename_.fullPath();
40 while (ifin3.good()) {
41 ifin3 >> rawId >>
shift;
42 shiftinfo_[rawId] =
shift;
51 LogDebug(
"MuonPathAssociator") <<
"MuonPathAssociator: destructor";
59 LogDebug(
"MuonPathAssociator") <<
"MuonPathAssociator::initialiase";
69 std::vector<metaPrimitive> &inMPaths,
70 std::vector<metaPrimitive> &outMPaths) {
71 if (dT0_correlate_TP_)
72 correlateMPaths(digis, inMPaths, outMPaths);
74 outMPaths.insert(outMPaths.end(), inMPaths.begin(), inMPaths.end());
80 LogDebug(
"MuonPathAssociator") <<
"MuonPathAssociator: finish";
84 std::vector<metaPrimitive> &inMPaths,
85 std::vector<metaPrimitive> &outMPaths) {
87 LogDebug(
"MuonPathAssociator") <<
"starting correlation";
89 for (
int wh = -2; wh <= 2; wh++) {
90 for (
int st = 1; st <= 4; st++) {
91 for (
int se = 1; se <= 14; se++) {
92 if (se >= 13 && st != 4)
100 std::vector<metaPrimitive> SL1metaPrimitives;
101 for (
const auto &metaprimitiveIt : inMPaths) {
102 if (metaprimitiveIt.rawId == sl1Id.
rawId())
103 SL1metaPrimitives.push_back(metaprimitiveIt);
107 std::vector<metaPrimitive> SL3metaPrimitives;
108 for (
const auto &metaprimitiveIt : inMPaths) {
109 if (metaprimitiveIt.rawId == sl3Id.
rawId())
110 SL3metaPrimitives.push_back(metaprimitiveIt);
113 if (SL1metaPrimitives.empty() and SL3metaPrimitives.empty())
117 LogDebug(
"MuonPathAssociator") <<
"correlating " << SL1metaPrimitives.size() <<
" metaPrim in SL1 and "
118 << SL3metaPrimitives.size() <<
" in SL3 for " << sl3Id;
120 bool at_least_one_correlation =
false;
121 bool at_least_one_SL1_confirmation =
false;
122 bool at_least_one_SL3_confirmation =
false;
124 bool useFitSL1[SL1metaPrimitives.size()];
125 for (
unsigned int i = 0;
i < SL1metaPrimitives.size();
i++)
126 useFitSL1[
i] =
false;
127 bool useFitSL3[SL3metaPrimitives.size()];
128 for (
unsigned int i = 0;
i < SL3metaPrimitives.size();
i++)
129 useFitSL3[
i] =
false;
132 vector<metaPrimitive> chamberMetaPrimitives;
133 vector<metaPrimitive> confirmedMetaPrimitives;
134 vector<metaPrimitive> normalMetaPrimitives;
137 for (
auto SL1metaPrimitive = SL1metaPrimitives.begin(); SL1metaPrimitive != SL1metaPrimitives.end();
138 ++SL1metaPrimitive, sl1++, sl3 = -1) {
139 if (clean_chi2_correlation_)
140 at_least_one_correlation =
false;
141 for (
auto SL3metaPrimitive = SL3metaPrimitives.begin(); SL3metaPrimitive != SL3metaPrimitives.end();
142 ++SL3metaPrimitive, sl3++) {
143 if (
std::abs(SL1metaPrimitive->tanPhi - SL3metaPrimitive->tanPhi) > dTanPsi_correlate_TP_)
145 if (useBX_correlation_) {
147 round(SL3metaPrimitive->t0 / (
float)LHC_CLK_FREQ)) > dBX_correlate_TP_)
150 if (
std::abs(SL1metaPrimitive->t0 - SL3metaPrimitive->t0) >= dT0_correlate_TP_)
155 double NewSlope = -999.;
157 long int pos = (PosSL3 + PosSL1) / 2;
160 if (((PosSL3 + PosSL1) % 2 != 0) && (pos < 0)) {
164 long int difPos_mm_x4 = PosSL3 - PosSL1;
170 double MeanT0 = (SL1metaPrimitive->t0 + SL3metaPrimitive->t0) / 2;
180 if (shift_sl1 < shift_sl3) {
185 int wi[8], tdc[8], lat[8];
186 wi[0] = SL1metaPrimitive->wi1;
187 tdc[0] = SL1metaPrimitive->tdc1;
188 lat[0] = SL1metaPrimitive->lat1;
189 wi[1] = SL1metaPrimitive->wi2;
190 tdc[1] = SL1metaPrimitive->tdc2;
191 lat[1] = SL1metaPrimitive->lat2;
192 wi[2] = SL1metaPrimitive->wi3;
193 tdc[2] = SL1metaPrimitive->tdc3;
194 lat[2] = SL1metaPrimitive->lat3;
195 wi[3] = SL1metaPrimitive->wi4;
196 tdc[3] = SL1metaPrimitive->tdc4;
197 lat[3] = SL1metaPrimitive->lat4;
198 wi[4] = SL3metaPrimitive->wi1;
199 tdc[4] = SL3metaPrimitive->tdc1;
200 lat[4] = SL3metaPrimitive->lat1;
201 wi[5] = SL3metaPrimitive->wi2;
202 tdc[5] = SL3metaPrimitive->tdc2;
203 lat[5] = SL3metaPrimitive->lat2;
204 wi[6] = SL3metaPrimitive->wi3;
205 tdc[6] = SL3metaPrimitive->tdc3;
206 lat[6] = SL3metaPrimitive->lat3;
207 wi[7] = SL3metaPrimitive->wi4;
208 tdc[7] = SL3metaPrimitive->tdc4;
209 lat[7] = SL3metaPrimitive->lat4;
213 long int Z_FACTOR_CORR[8] = {-6, -2, 2, 6, -6, -2, 2, 6};
215 for (
int i = 0;
i < 8;
i++) {
216 int sign = 2 * (
i / 4) - 1;
219 long int sum_A, sum_B;
221 long int shift, slTime;
224 slTime = SL1metaPrimitive->t0;
227 slTime = SL3metaPrimitive->t0;
230 long int drift_dist_um_x4 =
DRIFT_SPEED_X4 * (((
long int)tdc[
i]) - slTime);
231 long int wireHorizPos_x4 =
236 pos_mm_x4 = wireHorizPos_x4 - (drift_dist_um_x4 >> 10);
238 pos_mm_x4 = wireHorizPos_x4 + (drift_dist_um_x4 >> 10);
243 chi2 += ((sum_A - sum_B) * (sum_A - sum_B)) >> 2;
249 if (newChi2 > chi2corTh_)
253 useFitSL1[sl1] =
true;
254 useFitSL3[sl3] =
true;
257 if (SL3metaPrimitive->quality ==
LOWQ and SL1metaPrimitive->quality ==
LOWQ)
260 if ((SL3metaPrimitive->quality ==
HIGHQ && SL1metaPrimitive->quality ==
LOWQ)
or
261 (SL1metaPrimitive->quality ==
HIGHQ && SL3metaPrimitive->quality ==
LOWQ))
264 if (SL3metaPrimitive->quality ==
HIGHQ && SL1metaPrimitive->quality ==
HIGHQ)
269 double phi_cmssw = -999.;
270 double phiB_cmssw = -999.;
274 GlobalPoint jm_x_cmssw_global = dtGeo_->chamber(ChId)->toGlobal(
276 int thisec = ChId.
sector();
281 phi_cmssw = jm_x_cmssw_global.
phi() -
PHI_CONV * (thisec - 1);
282 double psi = atan(NewSlope);
283 phiB_cmssw = hasPosRF(ChId.
wheel(), ChId.
sector()) ? psi - phi_cmssw : -psi - phi_cmssw;
286 phi = global_coords[0];
287 phiB = global_coords[1];
289 if (!clean_chi2_correlation_)
290 outMPaths.emplace_back(ChId.
rawId(),
300 SL1metaPrimitive->wi1,
301 SL1metaPrimitive->tdc1,
302 SL1metaPrimitive->lat1,
303 SL1metaPrimitive->wi2,
304 SL1metaPrimitive->tdc2,
305 SL1metaPrimitive->lat2,
306 SL1metaPrimitive->wi3,
307 SL1metaPrimitive->tdc3,
308 SL1metaPrimitive->lat3,
309 SL1metaPrimitive->wi4,
310 SL1metaPrimitive->tdc4,
311 SL1metaPrimitive->lat4,
312 SL3metaPrimitive->wi1,
313 SL3metaPrimitive->tdc1,
314 SL3metaPrimitive->lat1,
315 SL3metaPrimitive->wi2,
316 SL3metaPrimitive->tdc2,
317 SL3metaPrimitive->lat2,
318 SL3metaPrimitive->wi3,
319 SL3metaPrimitive->tdc3,
320 SL3metaPrimitive->lat3,
321 SL3metaPrimitive->wi4,
322 SL3metaPrimitive->tdc4,
323 SL3metaPrimitive->lat4);
325 chamberMetaPrimitives.emplace_back(ChId.
rawId(),
335 SL1metaPrimitive->wi1,
336 SL1metaPrimitive->tdc1,
337 SL1metaPrimitive->lat1,
338 SL1metaPrimitive->wi2,
339 SL1metaPrimitive->tdc2,
340 SL1metaPrimitive->lat2,
341 SL1metaPrimitive->wi3,
342 SL1metaPrimitive->tdc3,
343 SL1metaPrimitive->lat3,
344 SL1metaPrimitive->wi4,
345 SL1metaPrimitive->tdc4,
346 SL1metaPrimitive->lat4,
347 SL3metaPrimitive->wi1,
348 SL3metaPrimitive->tdc1,
349 SL3metaPrimitive->lat1,
350 SL3metaPrimitive->wi2,
351 SL3metaPrimitive->tdc2,
352 SL3metaPrimitive->lat2,
353 SL3metaPrimitive->wi3,
354 SL3metaPrimitive->tdc3,
355 SL3metaPrimitive->lat3,
356 SL3metaPrimitive->wi4,
357 SL3metaPrimitive->tdc4,
358 SL3metaPrimitive->lat4);
360 at_least_one_correlation =
true;
363 if (at_least_one_correlation ==
false &&
364 allow_confirmation_ ==
true) {
365 int matched_digis = 0;
366 double minx = minx_match_2digis_;
367 double min2x = minx_match_2digis_;
377 for (
const auto &dtLayerId_It : *dtdigis) {
378 const DTLayerId dtLId = dtLayerId_It.first;
381 if (dtSLId.rawId() != sl3Id.
rawId())
384 if (dtLId.
layer() == 4)
386 else if (dtLId.
layer() == 3)
388 else if (dtLId.
layer() == 2)
390 else if (dtLId.
layer() == 1)
392 double x_inSL3 = SL1metaPrimitive->x - SL1metaPrimitive->tanPhi * (
VERT_PHI1_PHI3 + l_shift);
393 for (
auto digiIt = (dtLayerId_It.second).first; digiIt != (dtLayerId_It.second).
second; ++digiIt) {
394 DTWireId wireId(dtLId, (*digiIt).wire());
396 shiftinfo_[wireId.rawId()] + ((*digiIt).time() - SL1metaPrimitive->t0) *
DRIFT_SPEED / 10.;
398 shiftinfo_[wireId.rawId()] - ((*digiIt).time() - SL1metaPrimitive->t0) *
DRIFT_SPEED / 10.;
401 x_wire = x_wire_left;
404 if (
std::abs(x_inSL3 - x_wire) < minx) {
407 next_wire = best_wire;
409 next_layer = best_layer;
412 best_wire = (*digiIt).wire();
413 best_tdc = (*digiIt).time();
414 best_layer = dtLId.
layer();
417 }
else if ((
std::abs(x_inSL3 - x_wire) >= minx) && (
std::abs(x_inSL3 - x_wire) < min2x)) {
419 next_wire = (*digiIt).wire();
420 next_tdc = (*digiIt).time();
421 next_layer = dtLId.
layer();
427 if (matched_digis >= 2 and best_layer != -1 and next_layer != -1) {
429 if (SL1metaPrimitive->quality ==
LOWQ)
445 if (next_layer == 1) {
450 if (next_layer == 2) {
455 if (next_layer == 3) {
460 if (next_layer == 4) {
466 if (best_layer == 1) {
471 if (best_layer == 2) {
476 if (best_layer == 3) {
481 if (best_layer == 4) {
487 if (!clean_chi2_correlation_)
489 SL1metaPrimitive->t0,
491 SL1metaPrimitive->tanPhi,
492 SL1metaPrimitive->phi,
493 SL1metaPrimitive->phiB,
494 SL1metaPrimitive->phi_cmssw,
495 SL1metaPrimitive->phiB_cmssw,
496 SL1metaPrimitive->chi2,
498 SL1metaPrimitive->wi1,
499 SL1metaPrimitive->tdc1,
500 SL1metaPrimitive->lat1,
501 SL1metaPrimitive->wi2,
502 SL1metaPrimitive->tdc2,
503 SL1metaPrimitive->lat2,
504 SL1metaPrimitive->wi3,
505 SL1metaPrimitive->tdc3,
506 SL1metaPrimitive->lat3,
507 SL1metaPrimitive->wi4,
508 SL1metaPrimitive->tdc4,
509 SL1metaPrimitive->lat4,
525 SL1metaPrimitive->t0,
527 SL1metaPrimitive->tanPhi,
528 SL1metaPrimitive->phi,
529 SL1metaPrimitive->phiB,
530 SL1metaPrimitive->phi_cmssw,
531 SL1metaPrimitive->phiB_cmssw,
532 SL1metaPrimitive->chi2,
534 SL1metaPrimitive->wi1,
535 SL1metaPrimitive->tdc1,
536 SL1metaPrimitive->lat1,
537 SL1metaPrimitive->wi2,
538 SL1metaPrimitive->tdc2,
539 SL1metaPrimitive->lat2,
540 SL1metaPrimitive->wi3,
541 SL1metaPrimitive->tdc3,
542 SL1metaPrimitive->lat3,
543 SL1metaPrimitive->wi4,
544 SL1metaPrimitive->tdc4,
545 SL1metaPrimitive->lat4,
559 useFitSL1[sl1] =
true;
560 at_least_one_SL1_confirmation =
true;
569 for (
auto SL3metaPrimitive = SL3metaPrimitives.begin(); SL3metaPrimitive != SL3metaPrimitives.end();
570 ++SL3metaPrimitive, sl3++) {
573 if ((at_least_one_correlation ==
false || clean_chi2_correlation_) &&
574 allow_confirmation_) {
576 int matched_digis = 0;
577 double minx = minx_match_2digis_;
578 double min2x = minx_match_2digis_;
589 for (
const auto &dtLayerId_It : *dtdigis) {
590 const DTLayerId dtLId = dtLayerId_It.first;
593 if (dtSLId.rawId() != sl1Id.
rawId())
596 if (dtLId.
layer() == 4)
598 if (dtLId.
layer() == 3)
600 if (dtLId.
layer() == 2)
602 if (dtLId.
layer() == 1)
604 double x_inSL1 = SL3metaPrimitive->x + SL3metaPrimitive->tanPhi * (
VERT_PHI1_PHI3 - l_shift);
605 for (
auto digiIt = (dtLayerId_It.second).first; digiIt != (dtLayerId_It.second).
second; ++digiIt) {
606 DTWireId wireId(dtLId, (*digiIt).wire());
608 shiftinfo_[wireId.rawId()] + ((*digiIt).time() - SL3metaPrimitive->t0) *
DRIFT_SPEED / 10.;
610 shiftinfo_[wireId.rawId()] - ((*digiIt).time() - SL3metaPrimitive->t0) *
DRIFT_SPEED / 10.;
613 x_wire = x_wire_left;
616 if (
std::abs(x_inSL1 - x_wire) < minx) {
618 next_wire = best_wire;
620 next_layer = best_layer;
623 best_wire = (*digiIt).wire();
624 best_tdc = (*digiIt).time();
625 best_layer = dtLId.
layer();
628 }
else if ((
std::abs(x_inSL1 - x_wire) >= minx) && (
std::abs(x_inSL1 - x_wire) < min2x)) {
630 next_wire = (*digiIt).wire();
631 next_tdc = (*digiIt).time();
632 next_layer = dtLId.
layer();
638 if (matched_digis >= 2 and best_layer != -1 and next_layer != -1) {
640 if (SL3metaPrimitive->quality ==
LOWQ)
656 if (next_layer == 1) {
661 if (next_layer == 2) {
666 if (next_layer == 3) {
671 if (next_layer == 4) {
677 if (best_layer == 1) {
682 if (best_layer == 2) {
687 if (best_layer == 3) {
692 if (best_layer == 4) {
698 if (!clean_chi2_correlation_)
700 SL3metaPrimitive->t0,
702 SL3metaPrimitive->tanPhi,
703 SL3metaPrimitive->phi,
704 SL3metaPrimitive->phiB,
705 SL3metaPrimitive->phi_cmssw,
706 SL3metaPrimitive->phiB_cmssw,
707 SL3metaPrimitive->chi2,
721 SL3metaPrimitive->wi1,
722 SL3metaPrimitive->tdc1,
723 SL3metaPrimitive->lat1,
724 SL3metaPrimitive->wi2,
725 SL3metaPrimitive->tdc2,
726 SL3metaPrimitive->lat2,
727 SL3metaPrimitive->wi3,
728 SL3metaPrimitive->tdc3,
729 SL3metaPrimitive->lat3,
730 SL3metaPrimitive->wi4,
731 SL3metaPrimitive->tdc4,
732 SL3metaPrimitive->lat4,
736 SL3metaPrimitive->t0,
738 SL3metaPrimitive->tanPhi,
739 SL3metaPrimitive->phi,
740 SL3metaPrimitive->phiB,
741 SL3metaPrimitive->phi_cmssw,
742 SL3metaPrimitive->phiB_cmssw,
743 SL3metaPrimitive->chi2,
757 SL3metaPrimitive->wi1,
758 SL3metaPrimitive->tdc1,
759 SL3metaPrimitive->lat1,
760 SL3metaPrimitive->wi2,
761 SL3metaPrimitive->tdc2,
762 SL3metaPrimitive->lat2,
763 SL3metaPrimitive->wi3,
764 SL3metaPrimitive->tdc3,
765 SL3metaPrimitive->lat3,
766 SL3metaPrimitive->wi4,
767 SL3metaPrimitive->tdc4,
768 SL3metaPrimitive->lat4,
770 useFitSL3[sl3] =
true;
771 at_least_one_SL3_confirmation =
true;
776 if (clean_chi2_correlation_) {
778 LogDebug(
"MuonPathAssociator") <<
"Pushing back correlated MPs to the MPs collection";
779 removeSharingFits(chamberMetaPrimitives, outMPaths);
781 if (clean_chi2_correlation_) {
783 LogDebug(
"MuonPathAssociator") <<
"Pushing back confirmed MPs to the complete vector";
784 removeSharingHits(confirmedMetaPrimitives, chamberMetaPrimitives, outMPaths);
788 if (at_least_one_correlation ==
false || clean_chi2_correlation_) {
789 if (
debug_ && !at_least_one_correlation)
791 <<
"correlation we found zero correlations, adding both collections as they are to the outMPaths";
794 <<
"correlation sizes:" << SL1metaPrimitives.size() <<
" " << SL3metaPrimitives.size();
795 if (at_least_one_SL1_confirmation ==
false || clean_chi2_correlation_) {
797 for (
auto SL1metaPrimitive = SL1metaPrimitives.begin(); SL1metaPrimitive != SL1metaPrimitives.end();
798 ++SL1metaPrimitive, sl1++) {
805 SL1metaPrimitive->t0,
807 SL1metaPrimitive->tanPhi,
808 SL1metaPrimitive->phi,
809 SL1metaPrimitive->phiB,
810 SL1metaPrimitive->phi_cmssw,
811 SL1metaPrimitive->phiB_cmssw,
812 SL1metaPrimitive->chi2,
813 SL1metaPrimitive->quality,
814 SL1metaPrimitive->wi1,
815 SL1metaPrimitive->tdc1,
816 SL1metaPrimitive->lat1,
817 SL1metaPrimitive->wi2,
818 SL1metaPrimitive->tdc2,
819 SL1metaPrimitive->lat2,
820 SL1metaPrimitive->wi3,
821 SL1metaPrimitive->tdc3,
822 SL1metaPrimitive->lat3,
823 SL1metaPrimitive->wi4,
824 SL1metaPrimitive->tdc4,
825 SL1metaPrimitive->lat4,
850 if (!clean_chi2_correlation_)
851 outMPaths.push_back(newSL1metaPrimitive);
853 normalMetaPrimitives.push_back(newSL1metaPrimitive);
856 if (at_least_one_SL3_confirmation ==
false || clean_chi2_correlation_) {
858 for (
auto SL3metaPrimitive = SL3metaPrimitives.begin(); SL3metaPrimitive != SL3metaPrimitives.end();
859 ++SL3metaPrimitive, sl3++) {
865 SL3metaPrimitive->t0,
867 SL3metaPrimitive->tanPhi,
868 SL3metaPrimitive->phi,
869 SL3metaPrimitive->phiB,
870 SL3metaPrimitive->phi_cmssw,
871 SL3metaPrimitive->phiB_cmssw,
872 SL3metaPrimitive->chi2,
873 SL3metaPrimitive->quality,
886 SL3metaPrimitive->wi1,
887 SL3metaPrimitive->tdc1,
888 SL3metaPrimitive->lat1,
889 SL3metaPrimitive->wi2,
890 SL3metaPrimitive->tdc2,
891 SL3metaPrimitive->lat2,
892 SL3metaPrimitive->wi3,
893 SL3metaPrimitive->tdc3,
894 SL3metaPrimitive->lat3,
895 SL3metaPrimitive->wi4,
896 SL3metaPrimitive->tdc4,
897 SL3metaPrimitive->lat4,
900 if (!clean_chi2_correlation_)
901 outMPaths.push_back(newSL3metaPrimitive);
903 normalMetaPrimitives.push_back(newSL3metaPrimitive);
908 SL1metaPrimitives.clear();
909 SL1metaPrimitives.erase(SL1metaPrimitives.begin(), SL1metaPrimitives.end());
910 SL3metaPrimitives.clear();
911 SL3metaPrimitives.erase(SL3metaPrimitives.begin(), SL3metaPrimitives.end());
913 vector<metaPrimitive> auxMetaPrimitives;
914 if (clean_chi2_correlation_) {
916 LogDebug(
"MuonPathAssociator") <<
"Pushing back normal MPs to the auxiliar vector";
917 removeSharingHits(normalMetaPrimitives, confirmedMetaPrimitives, auxMetaPrimitives);
919 if (clean_chi2_correlation_) {
921 LogDebug(
"MuonPathAssociator") <<
"Pushing back normal MPs to the MPs collection";
922 removeSharingHits(auxMetaPrimitives, chamberMetaPrimitives, outMPaths);
929 std::vector<metaPrimitive> SL2metaPrimitives;
931 for (
int wh = -2; wh <= 2; wh++) {
932 for (
int st = 1; st <= 4; st++) {
933 for (
int se = 1; se <= 14; se++) {
934 if (se >= 13 && st != 4)
941 for (
auto metaprimitiveIt = inMPaths.begin(); metaprimitiveIt != inMPaths.end(); ++metaprimitiveIt)
942 if (metaprimitiveIt->rawId == sl2Id.
rawId()) {
943 SL2metaPrimitives.push_back(*metaprimitiveIt);
945 printmPC(*metaprimitiveIt);
946 outMPaths.push_back(*metaprimitiveIt);
952 LogDebug(
"MuonPathAssociator") <<
"\t etaTP: added " << SL2metaPrimitives.size() <<
"to outMPaths" << std::endl;
954 SL2metaPrimitives.clear();
955 SL2metaPrimitives.erase(SL2metaPrimitives.begin(), SL2metaPrimitives.end());
959 bool useFit[chamberMPaths.size()];
960 for (
unsigned int i = 0;
i < chamberMPaths.size();
i++) {
963 for (
unsigned int i = 0;
i < chamberMPaths.size();
i++) {
965 LogDebug(
"MuonPathAssociator") <<
"Looking at prim" <<
i;
968 for (
unsigned int j = i + 1;
j < chamberMPaths.size();
j++) {
970 LogDebug(
"MuonPathAssociator") <<
"Comparing with prim " <<
j;
975 if (shareFit(first, second)) {
992 printmPC(chamberMPaths[i]);
993 allMPaths.push_back(chamberMPaths[i]);
997 LogDebug(
"MuonPathAssociator") <<
"---Swapping chamber---";
1001 std::vector<metaPrimitive> &secondMPaths,
1002 std::vector<metaPrimitive> &allMPaths) {
1003 for (
auto &firstMP : firstMPaths) {
1005 LogDebug(
"MuonPathAssociator") <<
"----------------------------------";
1007 LogDebug(
"MuonPathAssociator") <<
"Turn for ";
1011 for (
auto &secondMP : secondMPaths) {
1013 LogDebug(
"MuonPathAssociator") <<
"Comparing with ";
1016 if (!isNotAPrimo(firstMP, secondMP)) {
1022 allMPaths.push_back(firstMP);
1027 LogDebug(
"MuonPathAssociator") <<
"----------------------------------";
1032 bool lay1 = (first.
wi1 == second.
wi1) && (first.
tdc1 = second.
tdc1);
1033 bool lay2 = (first.
wi2 == second.
wi2) && (first.
tdc2 = second.
tdc2);
1034 bool lay3 = (first.
wi3 == second.
wi3) && (first.
tdc3 = second.
tdc3);
1035 bool lay4 = (first.
wi4 == second.
wi4) && (first.
tdc4 = second.
tdc4);
1036 bool lay5 = (first.
wi5 == second.
wi5) && (first.
tdc5 = second.
tdc5);
1037 bool lay6 = (first.
wi6 == second.
wi6) && (first.
tdc6 = second.
tdc6);
1038 bool lay7 = (first.
wi7 == second.
wi7) && (first.
tdc7 = second.
tdc7);
1039 bool lay8 = (first.
wi8 == second.
wi8) && (first.
tdc8 = second.
tdc8);
1041 if (lay1 && lay2 && lay3 && lay4) {
1042 if (lay5 || lay6 || lay7 || lay8)
1046 }
else if (lay5 && lay6 && lay7 && lay8) {
1047 if (lay1 || lay2 || lay3 || lay4)
1056 int hitsSL1 = (first.
wi1 != -1) + (first.
wi2 != -1) + (first.
wi3 != -1) + (first.
wi4 != -1);
1057 int hitsSL3 = (first.
wi5 != -1) + (first.
wi6 != -1) + (first.
wi7 != -1) + (first.
wi8 != -1);
1059 bool lay1 = (first.
wi1 == second.
wi1) && (first.
tdc1 = second.
tdc1) && (first.
wi1 != -1);
1060 bool lay2 = (first.
wi2 == second.
wi2) && (first.
tdc2 = second.
tdc2) && (first.
wi2 != -1);
1061 bool lay3 = (first.
wi3 == second.
wi3) && (first.
tdc3 = second.
tdc3) && (first.
wi3 != -1);
1062 bool lay4 = (first.
wi4 == second.
wi4) && (first.
tdc4 = second.
tdc4) && (first.
wi4 != -1);
1063 bool lay5 = (first.
wi5 == second.
wi5) && (first.
tdc5 = second.
tdc5) && (first.
wi5 != -1);
1064 bool lay6 = (first.
wi6 == second.
wi6) && (first.
tdc6 = second.
tdc6) && (first.
wi6 != -1);
1065 bool lay7 = (first.
wi7 == second.
wi7) && (first.
tdc7 = second.
tdc7) && (first.
wi7 != -1);
1066 bool lay8 = (first.
wi8 == second.
wi8) && (first.
tdc8 = second.
tdc8) && (first.
wi8 != -1);
1068 return (((!lay1 && !lay2 && !lay3 && !lay4) || hitsSL1 < 3) && ((!lay5 && !lay6 && !lay7 && !lay8) || hitsSL3 < 3));
1073 LogDebug(
"MuonPathAssociator") << ChId <<
"\t"
1074 <<
" " << setw(2) << left << mP.
wi1 <<
" " << setw(2) << left << mP.
wi2 <<
" "
1075 << setw(2) << left << mP.
wi3 <<
" " << setw(2) << left << mP.
wi4 <<
" " << setw(2)
1076 << left << mP.
wi5 <<
" " << setw(2) << left << mP.
wi6 <<
" " << setw(2) << left
1077 << mP.
wi7 <<
" " << setw(2) << left << mP.
wi8 <<
" " << setw(5) << left << mP.
tdc1
1078 <<
" " << setw(5) << left << mP.
tdc2 <<
" " << setw(5) << left << mP.
tdc3 <<
" "
1079 << setw(5) << left << mP.
tdc4 <<
" " << setw(5) << left << mP.
tdc5 <<
" " << setw(5)
1080 << left << mP.
tdc6 <<
" " << setw(5) << left << mP.
tdc7 <<
" " << setw(5) << left
1081 << mP.
tdc8 <<
" " << setw(2) << left << mP.
lat1 <<
" " << setw(2) << left << mP.
lat2
1082 <<
" " << setw(2) << left << mP.
lat3 <<
" " << setw(2) << left << mP.
lat4 <<
" "
1083 << setw(2) << left << mP.
lat5 <<
" " << setw(2) << left << mP.
lat6 <<
" " << setw(2)
1084 << left << mP.
lat7 <<
" " << setw(2) << left << mP.
lat8 <<
" " << setw(10) << right
1085 << mP.
x <<
" " << setw(9) << left << mP.
tanPhi <<
" " << setw(5) << left << mP.
t0
1086 <<
" " << setw(13) << left << mP.
chi2 <<
" \n";
bool isNotAPrimo(cmsdt::metaPrimitive first, cmsdt::metaPrimitive second)
constexpr int CH_CENTER_TO_MID_SL_X2
T getUntrackedParameter(std::string const &, T const &) const
Point3DBase< Scalar, LocalTag > LocalPoint
constexpr int DRIFT_SPEED_X4
void correlateMPaths(edm::Handle< DTDigiCollection > digis, std::vector< cmsdt::metaPrimitive > &inMPaths, std::vector< cmsdt::metaPrimitive > &outMPaths)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Geom::Phi< T > phi() const
constexpr uint32_t rawId() const
get the raw id
void run(edm::Event &iEvent, const edm::EventSetup &iEventSetup, edm::Handle< DTDigiCollection > digis, std::vector< cmsdt::metaPrimitive > &inMPaths, std::vector< cmsdt::metaPrimitive > &outMPaths)
constexpr int VERT_PHI1_PHI3_INV
int layer() const
Return the layer number.
std::map< std::string, int, std::less< std::string > > psi
constexpr int CELL_LENGTH
constexpr int CELL_SEMILENGTH
U second(std::pair< T, U > const &p)
void removeSharingHits(std::vector< cmsdt::metaPrimitive > &firstMPaths, std::vector< cmsdt::metaPrimitive > &secondMPaths, std::vector< cmsdt::metaPrimitive > &allMPaths)
constexpr int INCREASED_RES_SLOPE_POW
constexpr float Z_SHIFT_MB4
Abs< T >::type abs(const T &t)
constexpr int CELL_HEIGHT
constexpr double X_POS_L4
void printmPC(cmsdt::metaPrimitive mP)
constexpr double PHI_CONV
constexpr int NUM_LAYERS_2SL
constexpr float VERT_PHI1_PHI3
T getParameter(std::string const &) const
bool shareFit(cmsdt::metaPrimitive first, cmsdt::metaPrimitive second)
constexpr int LHC_CLK_FREQ
void initialise(const edm::EventSetup &iEventSetup)
static unsigned int const shift
constexpr int INCREASED_RES_POS_POW
void removeSharingFits(std::vector< cmsdt::metaPrimitive > &chamberMPaths, std::vector< cmsdt::metaPrimitive > &allMPaths)
MuonPathAssociator(const edm::ParameterSet &pset, edm::ConsumesCollector &iC, std::shared_ptr< GlobalCoordsObtainer > &globalcoordsobtainer)
int station() const
Return the station number.
T first(std::pair< T, U > const &p)
int wheel() const
Return the wheel number.
Power< A, B >::type pow(const A &a, const B &b)
constexpr float DRIFT_SPEED
constexpr double X_POS_L3
constexpr int INCREASED_RES_POS