46 theCrackEtas(
pset.getParameter<
std::
vector<double> >(
"crackEtas")),
47 theCrackWindow(
pset.getParameter<double>(
"crackWindow")),
49 pset.existsAs<double>(
"deltaPhiSearchWindow") ?
pset.getParameter<double>(
"deltaPhiSearchWindow") : 0.25),
51 pset.existsAs<double>(
"deltaEtaSearchWindow") ?
pset.getParameter<double>(
"deltaEtaSearchWindow") : 0.2),
52 theDeltaCrackWindow(
pset.existsAs<double>(
"deltaEtaCrackSearchWindow")
53 ?
pset.getParameter<double>(
"deltaEtaCrackSearchWindow")
72 std::vector<MuonRecHitContainer>&
result) {
80 vector<const DetLayer*> dtLayers = muonLayers->
allDTLayers();
91 const DetLayer* ME4Bwd = cscBackwardLayers[4];
92 const DetLayer* ME3Bwd = cscBackwardLayers[3];
93 const DetLayer* ME2Bwd = cscBackwardLayers[2];
94 const DetLayer* ME12Bwd = cscBackwardLayers[1];
95 const DetLayer* ME11Bwd = cscBackwardLayers[0];
98 const DetLayer* ME11Fwd = cscForwardLayers[0];
99 const DetLayer* ME12Fwd = cscForwardLayers[1];
100 const DetLayer* ME2Fwd = cscForwardLayers[2];
101 const DetLayer* ME3Fwd = cscForwardLayers[3];
102 const DetLayer* ME4Fwd = cscForwardLayers[4];
105 const DetLayer* MB4DL = dtLayers[3];
106 const DetLayer* MB3DL = dtLayers[2];
107 const DetLayer* MB2DL = dtLayers[1];
108 const DetLayer* MB1DL = dtLayers[0];
113 double barreldThetaCut = 0.2;
115 double endcapdThetaCut = 1.0;
127 bool* MB1 =
zero(list8.size());
128 bool* MB2 =
zero(list7.size());
129 bool* MB3 =
zero(list6.size());
133 if (!me0ForwardLayers.empty()) {
134 const DetLayer* ME0Fwd = me0ForwardLayers[0];
137 if (!me0BackwardLayers.empty()) {
138 const DetLayer* ME0Bwd = me0BackwardLayers[0];
173 if (list9.size() < 100) {
174 for (MuonRecHitContainer::iterator iter = list9.begin(); iter != list9.end(); iter++) {
176 seedSegments.push_back(*iter);
180 if (
check(seedSegments))
181 result.push_back(seedSegments);
185 if (list6.size() < 100) {
189 seedSegments.push_back(list6[
counter]);
193 if (
check(seedSegments))
194 result.push_back(seedSegments);
199 if (list7.size() < 100) {
203 seedSegments.push_back(list7[
counter]);
207 if (seedSegments.size() > 1 || (seedSegments.size() == 1 && seedSegments[0]->dimension() == 4)) {
208 result.push_back(seedSegments);
214 if (list8.size() < 100) {
218 seedSegments.push_back(list8[
counter]);
222 if (seedSegments.size() > 1 || (seedSegments.size() == 1 && seedSegments[0]->dimension() == 4)) {
223 result.push_back(seedSegments);
238 barreldThetaCut = 0.2;
239 endcapdThetaCut = 0.2;
254 if (!me0BackwardLayers.empty()) {
255 const DetLayer* ME0Bwd = me0BackwardLayers[0];
259 if (!me0ForwardLayers.empty()) {
260 const DetLayer* ME0Fwd = me0ForwardLayers[0];
294 for (MuonRecHitContainer::const_iterator segmentItr =
all.begin(); segmentItr !=
all.end(); ++segmentItr) {
296 singleSegmentContainer.push_back(*segmentItr);
297 result.push_back(singleSegmentContainer);
305 result =
new bool[listSize];
306 for (
size_t i = 0;
i < listSize;
i++)
324 std::vector<MuonRecHitContainer>&
result) {
332 std::vector<MuonRecHitContainer> patterns;
349 list21.reserve(list21.size() +
me0.size());
350 copy(
me0.begin(),
me0.end(), back_inserter(list21));
357 if (list21.empty()) {
362 if (list24.size() < list23.size() && !list24.empty()) {
367 if (list23.empty()) {
376 if (list12.empty()) {
378 if (list11.size() <= list13.size() && !list11.empty()) {
387 if (list13.empty()) {
388 if (list11.size() <= list12.size() && !list11.empty()) {
397 if (!list12.empty() && !list13.empty()) {
398 if (list11.size() <= list12.size() && list11.size() <= list13.size() && !list11.empty()) {
399 if (list12.size() > list13.size()) {
403 }
else if (list12.size() <= list13.size()) {
405 if (list11.size() <= list13.size() && !list11.empty()) {
414 if (list11.size() <= list12.size() && !list11.empty()) {
424 bool* ME2 =
zero(list2.size());
425 bool* ME3 =
zero(list3.size());
426 bool* ME4 =
zero(list4.size());
427 bool* ME5 =
zero(list5.size());
430 for (MuonRecHitContainer::iterator iter = list1.begin(); iter != list1.end(); iter++) {
431 if ((*iter)->recHits().size() < 4 && !list3.empty())
435 seedSegments.push_back(*iter);
443 if (
check(seedSegments))
444 patterns.push_back(seedSegments);
452 seedSegments.push_back(list2[
counter]);
459 if (
check(seedSegments))
460 patterns.push_back(seedSegments);
464 if (list3.size() < 20) {
468 seedSegments.push_back(list3[
counter]);
474 if (
check(seedSegments))
475 patterns.push_back(seedSegments);
480 if (list4.size() < 20) {
484 seedSegments.push_back(list4[
counter]);
489 if (
check(seedSegments))
490 patterns.push_back(seedSegments);
504 if (!patterns.empty()) {
505 result.insert(
result.end(), patterns.begin(), patterns.end());
507 if (!crackSegments.empty()) {
509 for (MuonRecHitContainer::const_iterator crackSegmentItr = crackSegments.begin();
510 crackSegmentItr != crackSegments.end();
513 singleSegmentPattern.push_back(*crackSegmentItr);
514 result.push_back(singleSegmentPattern);
531 float deta = fabs(ptg1.eta() - ptg2.
eta());
542 good_rhit.push_back(
recHit);
549 if (best && best->isValid())
550 seedSegments.push_back(best);
556 if (good_rhit.size() == 1)
558 double bestDiscrim = 10000.;
559 for (MuonRecHitContainer::iterator iter = good_rhit.begin(); iter != good_rhit.end(); iter++) {
561 if (discrim < bestDiscrim) {
562 bestDiscrim = discrim;
585 return fabs(dphig / penalty);
590 if (dphid2 >
M_PI * .5)
591 dphid2 =
M_PI - dphid2;
596 float chisq = ((dphig / 0.02) * (dphig / 0.02) + (dthetag / 0.003) * (dthetag / 0.003) +
597 (dphid2 / 0.06) * (dphid2 / 0.06) + (dthetad2 / 0.08) * (dthetad2 / 0.08));
598 return chisq / penalty;
608 if (detId.
ring() == 4) {
609 std::vector<unsigned> chamberHitNs;
610 for (
unsigned i = 0;
i <
recHits.size(); ++
i) {
612 chamberHitNs.push_back(
i);
615 if (chamberHitNs.size() == 3) {
616 for (
unsigned i = 0;
i < 3; ++
i) {
617 used[chamberHitNs[
i]] =
true;
626 double absEta = fabs(segment->globalPosition().eta());
638 for (MuonRecHitContainer::const_iterator segmentItr = segments.begin(); segmentItr != segments.end(); ++segmentItr) {
639 if ((**segmentItr).hit()->dimension() == 4 &&
isCrack(*segmentItr)) {
640 crackSegments.push_back(*segmentItr);
643 if ((*segmentItr)->isME0() &&
std::abs((*segmentItr)->globalPosition().eta()) > 2.4) {
644 crackSegments.push_back(*segmentItr);
653 for (MuonRecHitContainer::const_iterator segmentItr = segments.begin(); segmentItr != segments.end(); ++segmentItr) {
662 for (MuonRecHitContainer::const_iterator segmentItr = segments.begin(); segmentItr != segments.end(); ++segmentItr) {
663 double dtheta = (*segmentItr)->globalDirection().theta() - (*segmentItr)->globalPosition().theta();
664 if ((*segmentItr)->isDT()) {
666 if ((*segmentItr)->dimension() == 2 || fabs(dtheta) < dThetaCut) {
667 result.push_back(*segmentItr);
670 <<
" because dtheta = " << dtheta;
673 }
else if ((*segmentItr)->isCSC()) {
674 if (fabs(dtheta) < dThetaCut) {
675 result.push_back(*segmentItr);
678 <<
" because dtheta = " << dtheta;
680 }
else if ((*segmentItr)->isME0()) {
681 if (fabs(dtheta) < dThetaCut) {
682 result.push_back(*segmentItr);
685 <<
" because dtheta = " << dtheta;
694 if (segments.empty())
698 double dphiCut = 0.05;
699 double detaCut = 0.05;
700 std::vector<unsigned> toKill;
701 std::vector<unsigned> me1aOverlaps;
704 unsigned nseg = segments.size();
705 for (
unsigned i = 0;
i < nseg - 1; ++
i) {
707 for (
unsigned j =
i + 1;
j < nseg; ++
j) {
709 if (segments[
i]->geographicalId().rawId() != segments[
j]->geographicalId().rawId() &&
712 << theDumper.
dumpMuonId(segments[
j]->geographicalId());
716 me1aOverlaps.push_back(
i);
717 me1aOverlaps.push_back(
j);
727 for (
unsigned i = 0;
i < me1aOverlaps.size(); ++
i) {
728 DetId detId(segments[me1aOverlaps[
i]]->geographicalId());
729 vector<unsigned> inSameChamber;
730 for (
unsigned j = 0;
j < nseg; ++
j) {
731 if (
i !=
j && segments[
j]->geographicalId() == detId) {
732 inSameChamber.push_back(
j);
735 if (inSameChamber.size() == 2) {
736 toKill.push_back(inSameChamber[0]);
737 toKill.push_back(inSameChamber[1]);
742 for (
unsigned i = 0;
i < nseg; ++
i) {
743 if (
std::find(toKill.begin(), toKill.end(),
i) == toKill.end()) {
751 return segment->isCSC() &&
CSCDetId(segment->geographicalId()).
ring() == 4;
756 vector<TrackingRecHit*>
components = (*segment).recHits();
757 for (vector<TrackingRecHit*>::const_iterator component =
components.begin(); component !=
components.end();
759 int componentSize = (**component).recHits().size();
760 count += (componentSize == 0) ? 1 : componentSize;