76 edm::LogVerbatim(
"CSCSegment") <<
"CSCSegAlgoST: with factored conditioned segment fit";
88 LogTrace(
"CSCSegAlgoST") <<
"[CSCSegAlgoST::run] Start building segments in chamber " <<
theChamber->
id();
91 std::vector<CSCSegment> segments_temp;
92 std::vector<CSCSegment> segments;
93 std::vector<ChamberHitContainer> rechits_clusters;
98 for (
int a = 0;
a < 5; ++
a) {
99 for (
int b = 0;
b < 5; ++
b) {
129 for (std::vector<ChamberHitContainer>::iterator sub_rechits = rechits_clusters.begin();
130 sub_rechits != rechits_clusters.end();
133 segments_temp.clear();
137 segments.insert(segments.end(), segments_temp.begin(), segments_temp.end());
141 segments_temp.clear();
144 segments.swap(segments_temp);
156 segments_temp.clear();
159 segments.swap(segments_temp);
182 std::vector<CSCSegment> segments_temp;
183 std::vector<ChamberHitContainer> rechits_clusters;
189 int hit_nr_worst = -1;
192 for (std::vector<CSCSegment>::iterator
it = segments.begin();
it != segments.end(); ++
it) {
197 if (!use_brute_force) {
199 float chisq = (*it).chi2();
200 int nhits = (*it).nRecHits();
207 globZ = globalPosition.
z();
211 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
212 std::vector<CSCRecHit2D>::const_iterator iRH_worst;
215 float xdist_local_worst_sig = -99999.;
216 float xdist_local_2ndworst_sig = -99999.;
217 float xdist_local_sig = -99999.;
223 for (std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); ++iRH) {
228 float loc_x_at_target;
237 LocalPoint localPositionRH = (*iRH).localPosition();
240 LocalError rerrlocal = (*iRH).localPositionError();
241 float xxerr = rerrlocal.
xx();
243 float target_z = globalPositionRH.
z();
246 loc_x_at_target = localPos.
x() + (segDir.
x() / fabs(segDir.
z()) * (target_z - globZ));
250 loc_x_at_target = localPos.
x() + ((-1) * segDir.
x() / fabs(segDir.
z()) * (target_z - globZ));
257 xdist_local_sig = fabs((localPositionRH.
x() - loc_x_at_target) / (xxerr));
259 if (xdist_local_sig > xdist_local_worst_sig) {
260 xdist_local_2ndworst_sig = xdist_local_worst_sig;
261 xdist_local_worst_sig = xdist_local_sig;
264 hit_nr_worst = hit_nr;
265 }
else if (xdist_local_sig > xdist_local_2ndworst_sig) {
266 xdist_local_2ndworst_sig = xdist_local_sig;
275 if (xdist_local_worst_sig / xdist_local_2ndworst_sig < 1.5) {
285 std::vector<CSCRecHit2D>
buffer;
286 std::vector<std::vector<CSCRecHit2D> > reduced_segments;
287 std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
288 float best_red_seg_prob = 0.0;
297 if (use_brute_force) {
298 for (
size_t bi = 0; bi <
buffer.size(); ++bi) {
299 reduced_segments.push_back(
buffer);
300 reduced_segments[bi].erase(reduced_segments[bi].
begin() + (bi), reduced_segments[bi].
begin() + (bi + 1));
304 if (hit_nr_worst >= 0 && hit_nr_worst <=
int(
buffer.size())) {
307 reduced_segments.push_back(
buffer);
310 reduced_segments.push_back(
buffer);
316 for (
size_t iSegment = 0; iSegment < reduced_segments.size(); ++iSegment) {
319 for (
size_t m = 0;
m < reduced_segments[iSegment].size(); ++
m) {
357 double oldchi2 = (*it).
chi2();
358 double olddof = 2 * (*it).nRecHits() - 4;
359 double newchi2 =
temp.chi2();
360 double newdof = 2 *
temp.nRecHits() - 4;
384 std::vector<ChamberHitContainer> rechits_clusters;
390 float dXclus_box = 0.0;
391 float dYclus_box = 0.0;
393 std::vector<const CSCRecHit2D*>
temp;
395 std::vector<ChamberHitContainer>
seeds;
397 std::vector<float> running_meanX;
398 std::vector<float> running_meanY;
400 std::vector<float> seed_minX;
401 std::vector<float> seed_maxX;
402 std::vector<float> seed_minY;
403 std::vector<float> seed_maxY;
412 for (
unsigned int i = 0;
i < rechits.size(); ++
i) {
415 temp.push_back(rechits[
i]);
422 running_meanX.push_back(rechits[
i]->localPosition().
x());
423 running_meanY.push_back(rechits[
i]->localPosition().
y());
426 seed_minX.push_back(rechits[
i]->localPosition().
x());
427 seed_maxX.push_back(rechits[
i]->localPosition().
x());
428 seed_minY.push_back(rechits[
i]->localPosition().
y());
429 seed_maxY.push_back(rechits[
i]->localPosition().
y());
434 for (
size_t NNN = 0; NNN <
seeds.size(); ++NNN) {
435 for (
size_t MMM = NNN + 1; MMM <
seeds.size(); ++MMM) {
436 if (running_meanX[MMM] == 999999. || running_meanX[NNN] == 999999.) {
438 <<
"[CSCSegAlgoST::clusterHits] ALARM! Skipping used seeds, this should not happen - inform CSC DPG";
448 if (running_meanX[NNN] > running_meanX[MMM])
449 dXclus_box = seed_minX[NNN] - seed_maxX[MMM];
451 dXclus_box = seed_minX[MMM] - seed_maxX[NNN];
452 if (running_meanY[NNN] > running_meanY[MMM])
453 dYclus_box = seed_minY[NNN] - seed_maxY[MMM];
455 dYclus_box = seed_minY[MMM] - seed_maxY[NNN];
462 running_meanX[MMM] = (running_meanX[NNN] *
seeds[NNN].size() + running_meanX[MMM] *
seeds[MMM].size()) /
464 running_meanY[MMM] = (running_meanY[NNN] *
seeds[NNN].size() + running_meanY[MMM] *
seeds[MMM].size()) /
468 if (seed_minX[NNN] <= seed_minX[MMM])
469 seed_minX[MMM] = seed_minX[NNN];
470 if (seed_maxX[NNN] > seed_maxX[MMM])
471 seed_maxX[MMM] = seed_maxX[NNN];
472 if (seed_minY[NNN] <= seed_minY[MMM])
473 seed_minY[MMM] = seed_minY[NNN];
474 if (seed_maxY[NNN] > seed_maxY[MMM])
475 seed_maxY[MMM] = seed_maxY[NNN];
481 running_meanX[NNN] = 999999.;
482 running_meanY[NNN] = 999999.;
493 for (
size_t NNN = 0; NNN <
seeds.size(); ++NNN) {
494 if (running_meanX[NNN] == 999999.)
496 rechits_clusters.push_back(
seeds[NNN]);
501 return rechits_clusters;
506 std::vector<ChamberHitContainer> rechits_chains;
508 std::vector<const CSCRecHit2D*>
temp;
510 std::vector<ChamberHitContainer>
seeds;
512 std::vector<bool> usedCluster;
518 for (
unsigned int i = 0;
i < rechits.size(); ++
i) {
520 temp.push_back(rechits[
i]);
522 usedCluster.push_back(
false);
531 for (
size_t NNN = 0; NNN <
seeds.size(); ++NNN) {
532 for (
size_t MMM = NNN + 1; MMM <
seeds.size(); ++MMM) {
533 if (usedCluster[MMM] || usedCluster[NNN]) {
556 usedCluster[NNN] =
true;
568 for (
size_t NNN = 0; NNN <
seeds.size(); ++NNN) {
569 if (usedCluster[NNN])
571 rechits_chains.push_back(
seeds[NNN]);
576 return rechits_chains;
580 for (
size_t iRH_new = 0; iRH_new < newChain.size(); ++iRH_new) {
581 int layer_new = newChain[iRH_new]->cscDetId().layer() - 1;
582 int middleStrip_new = newChain[iRH_new]->nStrips() / 2;
583 int centralStrip_new = newChain[iRH_new]->channels(middleStrip_new);
584 int centralWire_new = newChain[iRH_new]->hitWire();
585 bool layerRequirementOK =
false;
586 bool stripRequirementOK =
false;
587 bool wireRequirementOK =
false;
588 bool goodToMerge =
false;
589 for (
size_t iRH_old = 0; iRH_old < oldChain.size(); ++iRH_old) {
590 int layer_old = oldChain[iRH_old]->cscDetId().layer() - 1;
591 int middleStrip_old = oldChain[iRH_old]->nStrips() / 2;
592 int centralStrip_old = oldChain[iRH_old]->channels(middleStrip_old);
593 int centralWire_old = oldChain[iRH_old]->hitWire();
602 if (layer_new == layer_old + 1 || layer_new == layer_old - 1 || layer_new == layer_old + 2 ||
603 layer_new == layer_old - 2 || layer_new == layer_old + 3 || layer_new == layer_old - 3 ||
604 layer_new == layer_old + 4 || layer_new == layer_old - 4) {
605 layerRequirementOK =
true;
611 if (centralStrip_new == centralStrip_old || centralStrip_new == centralStrip_old + 1 ||
612 centralStrip_new == centralStrip_old - 1 || centralStrip_new == centralStrip_old + 2 ||
613 centralStrip_new == centralStrip_old - 2) {
614 stripRequirementOK =
true;
617 if (centralWire_new == centralWire_old || centralWire_new == centralWire_old + 1 ||
618 centralWire_new == centralWire_old - 1 || centralWire_new == centralWire_old + 2 ||
619 centralWire_new == centralWire_old - 2) {
620 wireRequirementOK =
true;
624 if (centralStrip_new == centralStrip_old + 1 - allStrips ||
625 centralStrip_new == centralStrip_old - 1 - allStrips ||
626 centralStrip_new == centralStrip_old + 2 - allStrips ||
627 centralStrip_new == centralStrip_old - 2 - allStrips ||
628 centralStrip_new == centralStrip_old + 1 + allStrips ||
629 centralStrip_new == centralStrip_old - 1 + allStrips ||
630 centralStrip_new == centralStrip_old + 2 + allStrips ||
631 centralStrip_new == centralStrip_old - 2 + allStrips) {
632 stripRequirementOK =
true;
635 if (layerRequirementOK && stripRequirementOK && wireRequirementOK) {
645 double coordinate_1,
double coordinate_2,
double coordinate_3,
float layer_1,
float layer_2,
float layer_3) {
646 double sub_weight = 0;
647 sub_weight = fabs(((coordinate_2 - coordinate_3) / (layer_2 - layer_3)) -
648 ((coordinate_1 - coordinate_2) / (layer_1 - layer_2)));
658 std::vector<CSCSegment> segmentInChamber;
659 segmentInChamber.clear();
662 unsigned int thering = 999;
663 unsigned int thestation = 999;
666 std::vector<int> hits_onLayerNumber(6);
670 return segmentInChamber;
672 for (
int iarray = 0; iarray < 6; ++iarray) {
674 hits_onLayerNumber[iarray] = 0;
717 int midlayer_pointer[6] = {0, 0, 2, 3, 3, 4};
720 int n_layers_occupied_tot = 0;
721 int n_layers_processed = 0;
723 float min_weight_A = 99999.9;
724 float min_weight_noLx_A = 99999.9;
733 int best_noLx_pseg = -1;
734 int best_Layer_noLx = -1;
747 for (
size_t M = 0; M < rechits.size(); ++M) {
749 hits_onLayerNumber[rechits[M]->cscDetId().layer() - 1] += 1;
750 if (hits_onLayerNumber[rechits[M]->cscDetId().
layer() - 1] == 1)
751 n_layers_occupied_tot += 1;
753 PAhits_onLayer[rechits[M]->cscDetId().layer() - 1].push_back(rechits[M]);
764 for (
size_t i = 0;
i < hits_onLayerNumber.size(); ++
i) {
766 tothits += hits_onLayerNumber[
i];
767 if (hits_onLayerNumber[
i] > maxhits) {
768 nextlayer = maxlayer;
771 maxhits = hits_onLayerNumber[
i];
772 }
else if (hits_onLayerNumber[
i] > nexthits) {
774 nexthits = hits_onLayerNumber[
i];
778 if (tothits > (
int)UpperLimit) {
779 if (n_layers_occupied_tot > 4) {
780 tothits = tothits - hits_onLayerNumber[maxlayer];
781 n_layers_occupied_tot = n_layers_occupied_tot - 1;
783 hits_onLayerNumber[maxlayer] = 0;
787 if (tothits > (
int)UpperLimit) {
788 if (n_layers_occupied_tot > 4) {
789 tothits = tothits - hits_onLayerNumber[nextlayer];
790 n_layers_occupied_tot = n_layers_occupied_tot - 1;
792 hits_onLayerNumber[nextlayer] = 0;
796 if (tothits > (
int)UpperLimit) {
806 return segmentInChamber;
807 if (segShower.
chi2() == -1)
808 return segmentInChamber;
809 segmentInChamber.push_back(segShower);
810 return segmentInChamber;
814 CSCDetId id = rechits[0]->cscDetId();
815 edm::LogVerbatim(
"CSCSegment|CSC") <<
"[CSCSegAlgoST::buildSegments] No. of rechits in the cluster/chamber > " 816 << UpperLimit <<
" ... Segment finding canceled in CSC" <<
id;
817 return segmentInChamber;
824 if (!rechits.empty()) {
825 thering = rechits[0]->cscDetId().ring();
826 thestation = rechits[0]->cscDetId().station();
834 return segmentInChamber;
850 n_layers_processed += 1;
854 int orig_number_of_psegs =
Psegments.size();
866 if (orig_number_of_psegs == 0) {
903 if (orig_number_of_noL1_psegs == 0) {
922 for (
int pseg = 0; pseg < orig_number_of_psegs; ++pseg) {
923 int pseg_pos = (pseg) + ((
hit)*orig_number_of_psegs);
924 int pseg_noL1_pos = (pseg) + ((
hit)*orig_number_of_noL1_psegs);
925 int pseg_noL2_pos = (pseg) + ((
hit)*orig_number_of_noL2_psegs);
926 int pseg_noL3_pos = (pseg) + ((
hit)*orig_number_of_noL3_psegs);
927 int pseg_noL4_pos = (pseg) + ((
hit)*orig_number_of_noL4_psegs);
928 int pseg_noL5_pos = (pseg) + ((
hit)*orig_number_of_noL5_psegs);
929 int pseg_noL6_pos = (pseg) + ((
hit)*orig_number_of_noL6_psegs);
940 if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs)
942 if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs)
944 if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs)
946 if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs)
948 if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs)
950 if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs)
954 if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs)
956 if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs)
958 if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs)
960 if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs)
962 if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs)
964 if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs)
968 if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs)
970 if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs)
972 if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs)
974 if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs)
976 if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs)
978 if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs)
982 if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs)
984 if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs)
986 if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs)
988 if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs)
990 if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs)
992 if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs)
997 if (n_layers_processed != 2 && pseg < orig_number_of_noL1_psegs)
999 if (n_layers_processed != 2 && pseg < orig_number_of_noL2_psegs)
1001 if (n_layers_processed != 3 && pseg < orig_number_of_noL3_psegs)
1003 if (n_layers_processed != 4 && pseg < orig_number_of_noL4_psegs)
1005 if (n_layers_processed != 5 && pseg < orig_number_of_noL5_psegs)
1007 if (n_layers_processed != 6 && pseg < orig_number_of_noL6_psegs)
1032 if (
int(
Psegments[pseg_pos].
size()) == n_layers_occupied_tot) {
1035 (*(
Psegments[pseg_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 1]))->localPosition().
x(),
1036 (*(
Psegments[pseg_pos].
end() - n_layers_occupied_tot))->localPosition().
x(),
1039 (*(
Psegments[pseg_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 1]))->cscDetId().
layer()),
1040 float((*(
Psegments[pseg_pos].
end() - n_layers_occupied_tot))->cscDetId().
layer()));
1048 if (
weight_A[pseg_pos] < min_weight_A) {
1052 best_pseg = pseg_pos;
1060 if (n_layers_occupied_tot > 3) {
1061 if (pseg < orig_number_of_noL1_psegs && (n_layers_processed != 2)) {
1087 (*(
Psegments_noL1[pseg_noL1_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1090 (*(
Psegments_noL1[pseg_noL1_pos].
end() - (n_layers_occupied_tot - 1)))->localPosition().
x(),
1092 float((*(
Psegments_noL1[pseg_noL1_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1108 best_noLx_pseg = pseg_noL1_pos;
1109 best_Layer_noLx = 1;
1119 if (n_layers_occupied_tot > 3) {
1120 if (pseg < orig_number_of_noL2_psegs && (n_layers_processed != 2)) {
1146 (*(
Psegments_noL2[pseg_noL2_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1149 (*(
Psegments_noL2[pseg_noL2_pos].
end() - (n_layers_occupied_tot - 1)))->localPosition().
x(),
1151 float((*(
Psegments_noL2[pseg_noL2_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1167 best_noLx_pseg = pseg_noL2_pos;
1168 best_Layer_noLx = 2;
1178 if (n_layers_occupied_tot > 3) {
1179 if (pseg < orig_number_of_noL3_psegs && (n_layers_processed != 3)) {
1205 (*(
Psegments_noL3[pseg_noL3_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1208 (*(
Psegments_noL3[pseg_noL3_pos].
end() - (n_layers_occupied_tot - 1)))->localPosition().
x(),
1210 float((*(
Psegments_noL3[pseg_noL3_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1226 best_noLx_pseg = pseg_noL3_pos;
1227 best_Layer_noLx = 3;
1237 if (n_layers_occupied_tot > 3) {
1238 if (pseg < orig_number_of_noL4_psegs && (n_layers_processed != 4)) {
1264 (*(
Psegments_noL4[pseg_noL4_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1267 (*(
Psegments_noL4[pseg_noL4_pos].
end() - (n_layers_occupied_tot - 1)))->localPosition().
x(),
1269 float((*(
Psegments_noL4[pseg_noL4_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1285 best_noLx_pseg = pseg_noL4_pos;
1286 best_Layer_noLx = 4;
1296 if (n_layers_occupied_tot > 4) {
1297 if (pseg < orig_number_of_noL5_psegs && (n_layers_processed != 5)) {
1323 (*(
Psegments_noL5[pseg_noL5_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1326 (*(
Psegments_noL5[pseg_noL5_pos].
end() - (n_layers_occupied_tot - 1)))->localPosition().
x(),
1328 float((*(
Psegments_noL5[pseg_noL5_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1344 best_noLx_pseg = pseg_noL5_pos;
1345 best_Layer_noLx = 5;
1355 if (n_layers_occupied_tot > 5) {
1356 if (pseg < orig_number_of_noL6_psegs && (n_layers_processed != 6)) {
1382 (*(
Psegments_noL6[pseg_noL6_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1385 (*(
Psegments_noL6[pseg_noL6_pos].
end() - (n_layers_occupied_tot - 1)))->localPosition().
x(),
1387 float((*(
Psegments_noL6[pseg_noL6_pos].
end() - midlayer_pointer[n_layers_occupied_tot - 2]))
1403 best_noLx_pseg = pseg_noL6_pos;
1404 best_Layer_noLx = 6;
1436 int chosen_pseg = best_pseg;
1437 if (best_pseg < 0) {
1438 return segmentInChamber;
1443 float hit_drop_limit = -999999.999;
1446 switch (n_layers_processed) {
1458 if ((best_Layer_noLx < 1) || (best_Layer_noLx > 4)) {
1461 if ((best_Layer_noLx == 2) || (best_Layer_noLx == 3))
1462 hit_drop_limit = hit_drop_limit * (1. / 2.);
1466 if ((best_Layer_noLx < 1) || (best_Layer_noLx > 5)) {
1469 if ((best_Layer_noLx == 2) || (best_Layer_noLx == 4))
1470 hit_drop_limit = hit_drop_limit * (1. / 2.);
1471 if (best_Layer_noLx == 3)
1472 hit_drop_limit = hit_drop_limit * (1. / 3.);
1476 if ((best_Layer_noLx < 1) || (best_Layer_noLx > 6)) {
1479 if ((best_Layer_noLx == 2) || (best_Layer_noLx == 5))
1480 hit_drop_limit = hit_drop_limit * (1. / 2.);
1481 if ((best_Layer_noLx == 3) || (best_Layer_noLx == 4))
1482 hit_drop_limit = hit_drop_limit * (1. / 3.);
1488 <<
"[CSCSegAlgoST::buildSegments] Unexpected number of layers with hits - please inform CSC DPG.";
1489 hit_drop_limit = 0.1;
1493 switch (best_Layer_noLx) {
1537 if (min_weight_A > 0.) {
1538 if (min_weight_noLx_A / min_weight_A < hit_drop_limit) {
1543 chosen_pseg = best_noLx_pseg;
1557 for (
unsigned int iSegment = 0; iSegment <
GoodSegments.size(); ++iSegment) {
1581 LogTrace(
"CSCWeirdSegment") <<
"[CSCSegAlgoST::buildSegments] Segment ErrXX scaled and refit " << std::endl;
1589 <<
"[CSCSegAlgoST::buildSegments] Segment ErrXY changed to match cond. number and refit " << std::endl;
1601 <<
"[CSCSegAlgoST::buildSegments] Scale factor chi2uCorrection too big, pre-Prune and refit " << std::endl;
1625 segmentInChamber.push_back(
temp);
1627 return segmentInChamber;
1637 std::vector<float>& chosen_weight,
1639 int SumCommonHits = 0;
1641 int nr_remaining_candidates;
1642 unsigned int nr_of_segment_candidates;
1644 nr_remaining_candidates = nr_of_segment_candidates = chosen_segments.size();
1649 float chosen_weight_temp = 999999.;
1650 int chosen_seg_temp = -1;
1653 while (nr_remaining_candidates > 0) {
1654 for (
unsigned int iCand = 0; iCand < nr_of_segment_candidates; ++iCand) {
1656 if (chosen_weight[iCand] < 0.)
1660 for (
int ihits = 0; ihits <
int(chosen_segments[iCand].
size());
1662 if (chosen_segments[iCand][ihits] == chosen_segments[chosen_seg][ihits]) {
1668 if (SumCommonHits > 1) {
1669 chosen_weight[iCand] = -1.;
1670 nr_remaining_candidates -= 1;
1673 if (chosen_weight[iCand] < chosen_weight_temp) {
1674 chosen_weight_temp = chosen_weight[iCand];
1675 chosen_seg_temp = iCand;
1680 if (chosen_seg_temp > -1)
1681 GoodSegments.push_back(chosen_segments[chosen_seg_temp]);
1683 chosen_seg = chosen_seg_temp;
1685 chosen_weight_temp = 999999;
1686 chosen_seg_temp = -1;
1692 std::vector<unsigned int> BadCandidate;
1693 int SumCommonHits = 0;
1695 BadCandidate.clear();
1696 for (
unsigned int iCand = 0; iCand <
Psegments.size(); ++iCand) {
1698 for (
unsigned int iiCand = iCand + 1; iiCand <
Psegments.size(); ++iiCand) {
1703 <<
"[CSCSegAlgoST::ChooseSegments2] ALARM!! Should not happen - please inform CSC DPG";
1712 if (SumCommonHits > 1) {
1714 BadCandidate.push_back(iCand);
1717 BadCandidate.push_back(iiCand);
1724 for (
unsigned int isegm = 0; isegm <
Psegments.size(); ++isegm) {
1728 for (
unsigned int ibad = 0; ibad < BadCandidate.size(); ++ibad) {
1730 if (isegm == BadCandidate[ibad]) {
1746 for (std::vector<CSCSegment>::iterator
it = segments.begin();
it != segments.end(); ++
it) {
1747 std::vector<CSCSegment*> duplicateSegments;
1748 for (std::vector<CSCSegment>::iterator it2 = segments.begin(); it2 != segments.end(); ++it2) {
1750 bool allShared =
true;
1752 allShared =
it->sharesRecHits(*it2);
1758 duplicateSegments.push_back(&(*it2));
1761 it->setDuplicateSegments(duplicateSegments);
1774 <<
"\ntime = " << seg.
time();
double yweightPenaltyThreshold
std::vector< float > curv_noL1_A
Log< level::Info, true > LogVerbatim
std::vector< CSCSegment > run(const CSCChamber *aChamber, const ChamberHitContainer &rechits) override
std::vector< float > curv_noL4_A
T getParameter(std::string const &) const
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
bool preClustering_useChaining
LocalPoint localPosition() const override
std::vector< float > weight_noL1_B
bool condpass1
Flag whether to 'improve' covariance matrix.
CSCSegment showerSeg(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
const CSCChamber * theChamber
std::vector< float > weight_A
std::vector< float > weight_noL5_B
void ChooseSegments2(int best_seg)
void ChooseSegments3(int best_seg)
LocalPoint intercept() const
std::vector< ChamberHitContainer > Psegments_noL2
const edm::ParameterSet & pset(void) const
CSCSegAlgoST(const edm::ParameterSet &ps)
Constructor.
bool isGoodToMerge(bool isME11a, ChamberHitContainer &newChain, ChamberHitContainer &oldChain)
std::vector< float > weight_noL6_B
std::vector< ChamberHitContainer > Psegments_noL3
std::string chamberTypeName() const
ChamberHitContainer protoSegment
std::vector< float > curv_noL2_A
std::vector< float > weight_noL1_A
std::vector< std::vector< const CSCRecHit2D * > > clusterHits(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
double chi2() const override
Chi2 of the segment fit.
std::vector< float > curv_noL5_A
T getUntrackedParameter(std::string const &, T const &) const
std::vector< float > weight_B
LocalVector localDirection() const override
Local direction.
CSCSegAlgoShowering * showering_
std::vector< float > weight_noL3_B
std::vector< float > curv_noL6_A
const CSCChamber * chamber() const
double curvePenaltyThreshold
std::vector< std::vector< const CSCRecHit2D * > > chainHits(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
std::vector< float > weight_noL3_A
std::vector< float > chosen_weight_A
std::vector< CSCSegment > buildSegments(const ChamberHitContainer &rechits)
float ChiSquaredProbability(double chiSquared, double nrDOF)
~CSCSegAlgoST() override
Destructor.
std::vector< CSCSegment > prune_bad_hits(const CSCChamber *aChamber, std::vector< CSCSegment > &segments)
std::vector< float > weight_noL4_A
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
std::vector< ChamberHitContainer > Psegments_noLx
std::vector< const CSCRecHit2D * > ChamberHitContainer
Typedefs.
std::vector< ChamberHitContainer > Psegments_noL6
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
std::vector< float > weight_noL4_B
LocalError localDirectionError() const override
Error on the local direction.
bool adjustCovariance(void)
std::vector< float > curv_A
std::vector< float > curv_noL3_A
ChamberHitContainer Psegments_hits
AlgebraicSymMatrix covarianceMatrix(void)
void findDuplicates(std::vector< CSCSegment > &segments)
std::vector< ChamberHitContainer > Psegments_noL5
std::vector< ChamberHitContainer > Psegments
void setScaleXError(double factor)
AlgebraicSymMatrix parametersError() const override
Covariance matrix of parameters()
double theWeight(double coordinate_1, double coordinate_2, double coordinate_3, float layer_1, float layer_2, float layer_3)
Utility functions.
std::vector< float > weight_noL5_A
std::vector< ChamberHitContainer > Psegments_noL1
std::vector< float > weight_noL6_A
bool prePrun_
Chi^2 normalization for the initial fit.
const std::vector< CSCRecHit2D > & specificRecHits() const
bool gangedStrips() const
LocalVector localdir() const
float a_yweightPenaltyThreshold[5][5]
void ChooseSegments2a(std::vector< ChamberHitContainer > &best_segments, int best_seg)
void dumpSegment(const CSCSegment &seg) const
std::vector< ChamberHitContainer > Psegments_noL4
LocalError localPositionError() const override
double scaleXError(void) const
std::vector< float > weight_noL2_A
std::vector< ChamberHitContainer > chosen_Psegments
void fit(bool condpass1=false, bool condpass2=false)
const CSCChamberSpecs * specs() const
std::vector< float > weight_noLx_A
ChamberHitContainer PAhits_onLayer[6]
CSCDetId id() const
Get the (concrete) DetId.
std::vector< float > weight_noL2_B