49 theCrackEtas(
pset.getParameter<
std::vector<double> >(
"crackEtas")),
50 theCrackWindow(
pset.getParameter<double>(
"crackWindow")),
52 pset.existsAs<double>(
"deltaPhiSearchWindow") ?
pset.getParameter<double>(
"deltaPhiSearchWindow") : 0.25),
54 pset.existsAs<double>(
"deltaEtaSearchWindow") ?
pset.getParameter<double>(
"deltaEtaSearchWindow") : 0.2),
55 theDeltaCrackWindow(
pset.existsAs<double>(
"deltaEtaCrackSearchWindow")
56 ?
pset.getParameter<double>(
"deltaEtaCrackSearchWindow")
74 std::vector<MuonRecHitContainer>&
result) {
83 vector<const DetLayer*> dtLayers = muonLayers->
allDTLayers();
94 const DetLayer* ME4Bwd = cscBackwardLayers[4];
95 const DetLayer* ME3Bwd = cscBackwardLayers[3];
96 const DetLayer* ME2Bwd = cscBackwardLayers[2];
97 const DetLayer* ME12Bwd = cscBackwardLayers[1];
98 const DetLayer* ME11Bwd = cscBackwardLayers[0];
101 const DetLayer* ME11Fwd = cscForwardLayers[0];
102 const DetLayer* ME12Fwd = cscForwardLayers[1];
103 const DetLayer* ME2Fwd = cscForwardLayers[2];
104 const DetLayer* ME3Fwd = cscForwardLayers[3];
105 const DetLayer* ME4Fwd = cscForwardLayers[4];
108 const DetLayer* MB4DL = dtLayers[3];
109 const DetLayer* MB3DL = dtLayers[2];
110 const DetLayer* MB2DL = dtLayers[1];
111 const DetLayer* MB1DL = dtLayers[0];
116 double barreldThetaCut = 0.2;
118 double endcapdThetaCut = 1.0;
130 bool* MB1 =
zero(list8.size());
131 bool* MB2 =
zero(list7.size());
132 bool* MB3 =
zero(list6.size());
136 if (!me0ForwardLayers.empty()) {
137 const DetLayer* ME0Fwd = me0ForwardLayers[0];
140 if (!me0BackwardLayers.empty()) {
141 const DetLayer* ME0Bwd = me0BackwardLayers[0];
176 if (list9.size() < 100) {
177 for (MuonRecHitContainer::iterator iter = list9.begin(); iter != list9.end(); iter++) {
179 seedSegments.push_back(*iter);
183 if (
check(seedSegments))
184 result.push_back(seedSegments);
188 if (list6.size() < 100) {
192 seedSegments.push_back(list6[
counter]);
196 if (
check(seedSegments))
197 result.push_back(seedSegments);
202 if (list7.size() < 100) {
206 seedSegments.push_back(list7[
counter]);
210 if (seedSegments.size() > 1 || (seedSegments.size() == 1 && seedSegments[0]->dimension() == 4)) {
211 result.push_back(seedSegments);
217 if (list8.size() < 100) {
221 seedSegments.push_back(list8[
counter]);
225 if (seedSegments.size() > 1 || (seedSegments.size() == 1 && seedSegments[0]->dimension() == 4)) {
226 result.push_back(seedSegments);
241 barreldThetaCut = 0.2;
242 endcapdThetaCut = 0.2;
257 if (!me0BackwardLayers.empty()) {
258 const DetLayer* ME0Bwd = me0BackwardLayers[0];
262 if (!me0ForwardLayers.empty()) {
263 const DetLayer* ME0Fwd = me0ForwardLayers[0];
297 for (MuonRecHitContainer::const_iterator segmentItr =
all.begin(); segmentItr !=
all.end(); ++segmentItr) {
299 singleSegmentContainer.push_back(*segmentItr);
300 result.push_back(singleSegmentContainer);
308 result =
new bool[listSize];
309 for (
size_t i = 0;
i < listSize;
i++)
327 std::vector<MuonRecHitContainer>&
result) {
335 std::vector<MuonRecHitContainer> patterns;
352 list21.reserve(list21.size() +
me0.size());
353 copy(
me0.begin(),
me0.end(), back_inserter(list21));
360 if (list21.empty()) {
365 if (list24.size() < list23.size() && !list24.empty()) {
370 if (list23.empty()) {
379 if (list12.empty()) {
381 if (list11.size() <= list13.size() && !list11.empty()) {
390 if (list13.empty()) {
391 if (list11.size() <= list12.size() && !list11.empty()) {
400 if (!list12.empty() && !list13.empty()) {
401 if (list11.size() <= list12.size() && list11.size() <= list13.size() && !list11.empty()) {
402 if (list12.size() > list13.size()) {
406 }
else if (list12.size() <= list13.size()) {
408 if (list11.size() <= list13.size() && !list11.empty()) {
417 if (list11.size() <= list12.size() && !list11.empty()) {
427 bool* ME2 =
zero(list2.size());
428 bool* ME3 =
zero(list3.size());
429 bool* ME4 =
zero(list4.size());
430 bool* ME5 =
zero(list5.size());
433 for (MuonRecHitContainer::iterator iter = list1.begin(); iter != list1.end(); iter++) {
434 if ((*iter)->recHits().size() < 4 && !list3.empty())
438 seedSegments.push_back(*iter);
446 if (
check(seedSegments))
447 patterns.push_back(seedSegments);
455 seedSegments.push_back(list2[
counter]);
462 if (
check(seedSegments))
463 patterns.push_back(seedSegments);
467 if (list3.size() < 20) {
471 seedSegments.push_back(list3[
counter]);
477 if (
check(seedSegments))
478 patterns.push_back(seedSegments);
483 if (list4.size() < 20) {
487 seedSegments.push_back(list4[
counter]);
492 if (
check(seedSegments))
493 patterns.push_back(seedSegments);
507 if (!patterns.empty()) {
508 result.insert(
result.end(), patterns.begin(), patterns.end());
510 if (!crackSegments.empty()) {
512 for (MuonRecHitContainer::const_iterator crackSegmentItr = crackSegments.begin();
513 crackSegmentItr != crackSegments.end();
516 singleSegmentPattern.push_back(*crackSegmentItr);
517 result.push_back(singleSegmentPattern);
534 float deta = fabs(ptg1.eta() - ptg2.
eta());
545 good_rhit.push_back(
recHit);
552 if (best && best->isValid())
553 seedSegments.push_back(best);
559 if (good_rhit.size() == 1)
561 double bestDiscrim = 10000.;
562 for (MuonRecHitContainer::iterator iter = good_rhit.begin(); iter != good_rhit.end(); iter++) {
564 if (discrim < bestDiscrim) {
565 bestDiscrim = discrim;
588 return fabs(dphig / penalty);
593 if (dphid2 >
M_PI * .5)
594 dphid2 =
M_PI - dphid2;
599 float chisq = ((dphig / 0.02) * (dphig / 0.02) + (dthetag / 0.003) * (dthetag / 0.003) +
600 (dphid2 / 0.06) * (dphid2 / 0.06) + (dthetad2 / 0.08) * (dthetad2 / 0.08));
601 return chisq / penalty;
611 if (detId.
ring() == 4) {
612 std::vector<unsigned> chamberHitNs;
613 for (
unsigned i = 0;
i <
recHits.size(); ++
i) {
615 chamberHitNs.push_back(
i);
618 if (chamberHitNs.size() == 3) {
619 for (
unsigned i = 0;
i < 3; ++
i) {
620 used[chamberHitNs[
i]] =
true;
629 double absEta = fabs(segment->globalPosition().eta());
641 for (MuonRecHitContainer::const_iterator segmentItr = segments.begin(); segmentItr != segments.end(); ++segmentItr) {
642 if ((**segmentItr).hit()->dimension() == 4 &&
isCrack(*segmentItr)) {
643 crackSegments.push_back(*segmentItr);
646 if ((*segmentItr)->isME0() &&
std::abs((*segmentItr)->globalPosition().eta()) > 2.4) {
647 crackSegments.push_back(*segmentItr);
656 for (MuonRecHitContainer::const_iterator segmentItr = segments.begin(); segmentItr != segments.end(); ++segmentItr) {
665 for (MuonRecHitContainer::const_iterator segmentItr = segments.begin(); segmentItr != segments.end(); ++segmentItr) {
666 double dtheta = (*segmentItr)->globalDirection().theta() - (*segmentItr)->globalPosition().theta();
667 if ((*segmentItr)->isDT()) {
669 if ((*segmentItr)->dimension() == 2 || fabs(dtheta) < dThetaCut) {
670 result.push_back(*segmentItr);
673 <<
" because dtheta = " << dtheta;
676 }
else if ((*segmentItr)->isCSC()) {
677 if (fabs(dtheta) < dThetaCut) {
678 result.push_back(*segmentItr);
681 <<
" because dtheta = " << dtheta;
683 }
else if ((*segmentItr)->isME0()) {
684 if (fabs(dtheta) < dThetaCut) {
685 result.push_back(*segmentItr);
688 <<
" because dtheta = " << dtheta;
697 if (segments.empty())
701 double dphiCut = 0.05;
702 double detaCut = 0.05;
703 std::vector<unsigned> toKill;
704 std::vector<unsigned> me1aOverlaps;
707 unsigned nseg = segments.size();
708 for (
unsigned i = 0;
i < nseg - 1; ++
i) {
710 for (
unsigned j =
i + 1;
j < nseg; ++
j) {
712 if (segments[
i]->geographicalId().rawId() != segments[
j]->geographicalId().rawId() &&
715 << theDumper.
dumpMuonId(segments[
j]->geographicalId());
719 me1aOverlaps.push_back(
i);
720 me1aOverlaps.push_back(
j);
730 for (
unsigned i = 0;
i < me1aOverlaps.size(); ++
i) {
731 DetId detId(segments[me1aOverlaps[
i]]->geographicalId());
732 vector<unsigned> inSameChamber;
733 for (
unsigned j = 0;
j < nseg; ++
j) {
734 if (
i !=
j && segments[
j]->geographicalId() == detId) {
735 inSameChamber.push_back(
j);
738 if (inSameChamber.size() == 2) {
739 toKill.push_back(inSameChamber[0]);
740 toKill.push_back(inSameChamber[1]);
745 for (
unsigned i = 0;
i < nseg; ++
i) {
746 if (
std::find(toKill.begin(), toKill.end(),
i) == toKill.end()) {
754 return segment->isCSC() &&
CSCDetId(segment->geographicalId()).
ring() == 4;
759 vector<TrackingRecHit*>
components = (*segment).recHits();
760 for (vector<TrackingRecHit*>::const_iterator component =
components.begin(); component !=
components.end();
762 int componentSize = (**component).recHits().size();
763 count += (componentSize == 0) ? 1 : componentSize;