64 wds_token = consumes<CSCWireDigiCollection>(
edm::InputTag(
"simMuonCSCDigis",
"MuonCSCWireDigi") );
65 sds_token = consumes<CSCStripDigiCollection>(
edm::InputTag(
"simMuonCSCDigis",
"MuonCSCStripDigi") );
66 wdr_token = consumes<CSCWireDigiCollection>(
edm::InputTag(
"muonCSCDigis",
"MuonCSCWireDigi") );
67 sdr_token = consumes<CSCStripDigiCollection>(
edm::InputTag(
"muonCSCDigis",
"MuonCSCStripDigi") );
85 makeHistogramsForMessyEvents = pset.
getUntrackedParameter<
bool>(
"makeHistogramsForMessyEvebts",
false);
103 <<
"\n\t===== CSCSkim =====\n" 104 <<
"\t\ttype of skim ...............................\t" << typeOfSkim
105 <<
"\t\tminimum number of layers with hits .........\t" << nLayersWithHitsMinimum
106 <<
"\n\t\tminimum number of chambers w/ hit layers..\t" << minimumHitChambers
107 <<
"\n\t\tminimum number of segments ...............\t" << minimumSegments
108 <<
"\n\t\tdemand chambers on both sides.............\t" << demandChambersBothSides
109 <<
"\n\t\tmake histograms...........................\t" << makeHistograms
110 <<
"\n\t\t..for messy events........................\t" << makeHistogramsForMessyEvents
111 <<
"\n\t===================\n\n";
132 nEventsChambersBothSides = 0;
133 nEventsOverlappingChambers = 0;
135 nEventsCertainChamber = 0;
136 nEventsDTOverlap = 0;
138 nEventsLongSATrack = 0;
139 nEventsForBFieldStudies = 0;
143 if (makeHistograms || makeHistogramsForMessyEvents) {
146 theHistogramFile =
new TFile(histogramFileName.c_str(),
"RECREATE");
147 theHistogramFile->cd();
149 if (makeHistograms) {
151 hxnRecHits =
new TH1F(
"hxnRecHits",
"n RecHits",61,-0.5,60.5);
152 hxnSegments =
new TH1F(
"hxnSegments",
"n Segments",11,-0.5,10.5);
153 hxnHitChambers =
new TH1F(
"hxnHitsChambers",
"n chambers with hits",11,-0.5,10.5);
154 hxnRecHitsSel =
new TH1F(
"hxnRecHitsSel",
"n RecHits selected",61,-0.5,60.5);
156 xxP =
new TH1F(
"xxP",
"P global",100,0.,200.);
157 xxnValidHits =
new TH1F(
"xxnValidHits",
"n valid hits global",61,-0.5,60.5);
158 xxnTrackerHits =
new TH1F(
"xxnTrackerHits",
"n tracker hits global",61,-0.5,60.5);
159 xxnCSCHits =
new TH1F(
"xxnCSCHits",
"n CSC hits global",41,-0.5,40.5);
160 xxredChiSq =
new TH1F(
"xxredChiSq",
"red chisq global",100,0.,100.);
165 if (makeHistogramsForMessyEvents) {
167 mevnRecHits0 =
new TH1F(
"mevnRecHits0",
"n RecHits",121,-0.5,120.5);
168 mevnChambers0 =
new TH1F(
"mevnChambers0",
"n chambers with hits",21,-0.5,20.5);
169 mevnSegments0 =
new TH1F(
"mevnSegments0",
"n Segments",21,-0.5,20.5);
170 mevnRecHits1 =
new TH1F(
"mevnRecHits1",
"n RecHits",100,0.,300.);
171 mevnChambers1 =
new TH1F(
"mevnChambers1",
"n chambers with hits",50,0.,50.);
172 mevnSegments1 =
new TH1F(
"mevnSegments1",
"n Segments",30,0.,30.);
187 if (nEventsAnalyzed > 0) {fraction = (
float)nEventsSelected / (
float)nEventsAnalyzed;}
190 <<
"\n\n\t====== CSCSkim ==========================================================\n" 191 <<
"\t\ttype of skim ...............................\t" << typeOfSkim <<
"\n" 192 <<
"\t\tevents analyzed ..............\t" << nEventsAnalyzed <<
"\n" 193 <<
"\t\tevents selected ..............\t" << nEventsSelected <<
"\tfraction= " << fraction << std::endl
194 <<
"\t\tevents chambers both sides ...\t" << nEventsChambersBothSides <<
"\n" 195 <<
"\t\tevents w/ overlaps .......... \t" << nEventsOverlappingChambers <<
"\n" 196 <<
"\t\tevents lots of hit chambers . \t" << nEventsMessy <<
"\n" 197 <<
"\t\tevents from certain chamber . \t" << nEventsCertainChamber <<
"\n" 198 <<
"\t\tevents in DT-CSC overlap .... \t" << nEventsDTOverlap <<
"\n" 199 <<
"\t\tevents halo-like ............ \t" << nEventsHaloLike <<
"\n" 200 <<
"\t\tevents w/ long SA track ..... \t" << nEventsLongSATrack <<
"\n" 201 <<
"\t\tevents good for BField ..... \t" << nEventsForBFieldStudies <<
"\n" 202 <<
"\t=========================================================================\n\n";
204 if (makeHistograms || makeHistogramsForMessyEvents) {
206 LogDebug(
"[CSCSkim]") <<
"======= write out my histograms ====\n" ;
207 theHistogramFile->cd();
208 if (makeHistograms) {
210 hxnSegments->Write();
211 hxnHitChambers->Write();
212 hxnRecHitsSel->Write();
214 if (makeHistogramsForMessyEvents) {
215 mevnRecHits0->Write();
216 mevnChambers0->Write();
217 mevnSegments0->Write();
218 mevnRecHits1->Write();
219 mevnChambers1->Write();
220 mevnSegments1->Write();
222 theHistogramFile->Close();
235 iRun =
event.id().run();
236 iEvent =
event.id().event();
238 LogDebug(
"[CSCSkim] EventInfo") <<
"Run: " << iRun <<
"\tEvent: " <<
iEvent <<
"\tn Analyzed: " << nEventsAnalyzed;
249 event.getByToken(wdr_token,wires);
250 event.getByToken(sdr_token,strips);
253 event.getByToken(wds_token,wires);
254 event.getByToken(sds_token,strips);
259 event.getByToken(rh_token,cscRecHits);
263 event.getByToken(seg_token,cscSegments);
267 if (typeOfSkim == 8) {
268 event.getByToken(sam_token,saMuons);
274 if (typeOfSkim == 9) {
275 event.getByToken(sam_token,saMuons);
276 event.getByToken(trk_token,tracks);
277 event.getByToken(glm_token,gMuons);
287 bool basicEvent =
false;
288 if (typeOfSkim == 1 || typeOfSkim == 2) {
289 basicEvent = doCSCSkimming(cscRecHits,cscSegments);
293 bool goodOverlapEvent =
false;
294 if (typeOfSkim == 3) {
295 goodOverlapEvent = doOverlapSkimming(cscSegments);
296 if (goodOverlapEvent) {nEventsOverlappingChambers++;}
300 bool messyEvent =
false;
301 if (typeOfSkim == 4) {
302 messyEvent = doMessyEventSkimming(cscRecHits,cscSegments);
303 if (messyEvent) {nEventsMessy++;}
307 bool hasChamber =
false;
308 if (typeOfSkim == 5) {
309 hasChamber = doCertainChamberSelection(wires,strips);
310 if (hasChamber) {nEventsCertainChamber++;}
314 bool DTOverlapCandidate =
false;
315 if (typeOfSkim == 6) {
316 DTOverlapCandidate = doDTOverlap(cscSegments);
317 if (DTOverlapCandidate) {nEventsDTOverlap++;}
321 bool HaloLike =
false;
322 if (typeOfSkim == 7) {
323 HaloLike = doHaloLike(cscSegments);
324 if (HaloLike) {nEventsHaloLike++;}
328 bool LongSATrack =
false;
329 if (typeOfSkim == 8) {
330 LongSATrack = doLongSATrack(saMuons);
331 if (LongSATrack) {nEventsLongSATrack++;}
335 bool GoodForBFieldStudy =
false;
336 if (typeOfSkim == 9) {
337 GoodForBFieldStudy = doBFieldStudySelection(saMuons,tracks,gMuons);
338 if (GoodForBFieldStudy) {nEventsForBFieldStudies++;}
343 bool selectThisEvent =
false;
344 if (typeOfSkim == 1 || typeOfSkim == 2) {selectThisEvent = basicEvent;}
345 if (typeOfSkim == 3) {selectThisEvent = goodOverlapEvent;}
346 if (typeOfSkim == 4) {selectThisEvent = messyEvent;}
347 if (typeOfSkim == 5) {selectThisEvent = hasChamber;}
348 if (typeOfSkim == 6) {selectThisEvent = DTOverlapCandidate;}
349 if (typeOfSkim == 7) {selectThisEvent = HaloLike;}
350 if (typeOfSkim == 8) {selectThisEvent = LongSATrack;}
351 if (typeOfSkim == 9) {selectThisEvent = GoodForBFieldStudy;}
353 if (selectThisEvent) {nEventsSelected++;}
355 return selectThisEvent;
368 int nRecHits = cscRecHits->size();
372 for (
int i = 0;
i < 600;
i++) {
381 for (recIt = cscRecHits->begin(); recIt != cscRecHits->end(); recIt++) {
385 int kEndcap = idrec.
endcap();
386 int kRing = idrec.
ring();
387 int kStation = idrec.
station();
388 int kChamber = idrec.
chamber();
392 int kSerial = chamberSerial( kEndcap, kStation, kRing, kChamber ) ;
396 int kDigit = (
int)
pow((
float)10.,(
float)(kLayer-1));
397 cntRecHit[kSerial] += kDigit;
406 int nChambersWithMinimalHits = 0;
407 int nChambersWithMinimalHitsPOS = 0;
408 int nChambersWithMinimalHitsNEG = 0;
410 for (
int i = 0;
i < 600;
i++) {
411 if (cntRecHit[
i] > 0) {
412 int nLayersWithHits = 0;
414 for (
int j = 5; j > -1; j--) {
415 float digit = dummy /
pow( (
float)10., (
float)j );
416 int kCount = (
int) digit;
417 if (kCount > 0) nLayersWithHits++;
418 dummy = dummy - ( (
float) kCount) *
pow( (
float)10., (
float)j );
420 if (nLayersWithHits > nLayersWithHitsMinimum) {
421 if (
i < 300) {nChambersWithMinimalHitsPOS++;}
422 else {nChambersWithMinimalHitsNEG++;}
426 nChambersWithMinimalHits = nChambersWithMinimalHitsPOS + nChambersWithMinimalHitsNEG;
430 int nSegments = cscSegments->size();
436 if (makeHistograms) {
437 hxnRecHits->Fill(nRecHits);
439 hxnSegments->Fill(nSegments);
440 hxnHitChambers->Fill(nChambersWithMinimalHits);
442 if (nChambersWithMinimalHits > 0) {
443 hxnRecHitsSel->Fill(nRecHits);
450 bool basicEvent = ( nChambersWithMinimalHits >= minimumHitChambers ) && ( nSegments >= minimumSegments );
452 bool chambersOnBothSides = ((nChambersWithMinimalHitsPOS >= minimumHitChambers) && (nChambersWithMinimalHitsNEG >= minimumHitChambers));
454 if (chambersOnBothSides) {nEventsChambersBothSides++;}
456 bool selectEvent =
false;
457 if (typeOfSkim == 1) {selectEvent = basicEvent;}
458 if (typeOfSkim == 2) {selectEvent = chambersOnBothSides;}
462 LogDebug(
"[CSCSkim]") <<
"----- nRecHits = " << nRecHits
463 <<
"\tnChambersWithMinimalHits = " << nChambersWithMinimalHits
464 <<
"\tnSegments = " << nSegments
465 <<
"\tselect? " << selectEvent << std::endl;
495 const int nhitsMinimum = 4;
496 const float chisqMaximum = 100.;
497 const int nAllMaximum = 3;
505 for (
int i=0;
i<600;
i++) {
517 int kEndcap =
id.
endcap();
518 int kStation =
id.station();
519 int kRing =
id.ring();
520 int kChamber =
id.chamber();
521 int kSerial = chamberSerial( kEndcap, kStation, kRing, kChamber);
524 float chisq = (*it).chi2();
525 int nhits = (*it).nRecHits();
528 bool goodSegment = (nhits >= nhitsMinimum) && (chisq < chisqMaximum) ;
542 if (goodSegment) nGood[kSerial]++;
551 bool messyChamber =
false;
552 for (
int i = 0;
i < 600;
i++) {
553 if (nAll[
i] > nAllMaximum) messyChamber =
true;
558 bool consecutiveChambers =
false;
559 for (
int i = 0;
i < 599;
i++) {
560 if ( (nGood[
i]>0) && (nGood[
i+1]>0) ) consecutiveChambers =
true;
563 bool selectThisEvent = !messyChamber && consecutiveChambers;
565 return selectThisEvent;
578 int nRecHits = cscRecHits->size();
582 for (
int i = 0;
i < 600;
i++) {
591 for (recIt = cscRecHits->begin(); recIt != cscRecHits->end(); recIt++) {
595 int kEndcap = idrec.
endcap();
596 int kRing = idrec.
ring();
597 int kStation = idrec.
station();
598 int kChamber = idrec.
chamber();
602 int kSerial = chamberSerial( kEndcap, kStation, kRing, kChamber ) ;
606 int kDigit = (
int)
pow((
float)10.,(
float)(kLayer-1));
607 cntRecHit[kSerial] += kDigit;
616 int nChambersWithMinimalHits = 0;
617 int nChambersWithMinimalHitsPOS = 0;
618 int nChambersWithMinimalHitsNEG = 0;
620 for (
int i = 0;
i < 600;
i++) {
621 if (cntRecHit[
i] > 0) {
622 int nLayersWithHits = 0;
624 for (
int j = 5; j > -1; j--) {
625 float digit = dummy /
pow( (
float)10., (
float)j );
626 int kCount = (
int) digit;
627 if (kCount > 0) nLayersWithHits++;
628 dummy = dummy - ( (
float) kCount) *
pow( (
float)10., (
float)j );
630 if (nLayersWithHits > nLayersWithHitsMinimum) {
631 if (
i < 300) {nChambersWithMinimalHitsPOS++;}
632 else {nChambersWithMinimalHitsNEG++;}
636 nChambersWithMinimalHits = nChambersWithMinimalHitsPOS + nChambersWithMinimalHitsNEG;
640 int nSegments = cscSegments->size();
646 if (makeHistogramsForMessyEvents) {
648 mevnRecHits0->Fill(nRecHits);
649 mevnChambers0->Fill(nChambersWithMinimalHits);
650 mevnSegments0->Fill(nSegments);
653 double dummy = (double) nRecHits;
654 if (dummy > 299.9) dummy = 299.9;
655 mevnRecHits1->Fill(dummy);
656 dummy = (double) nChambersWithMinimalHits;
657 if (dummy > 49.9) dummy = 49.9;
658 mevnChambers1->Fill(dummy);
659 dummy = (double) nSegments;
660 if (dummy > 29.9) dummy = 29.9;
661 mevnSegments1->Fill(dummy);
669 bool selectEvent =
false;
670 if ( (nRecHits > 54) && (nChambersWithMinimalHits > 5) ) {selectEvent =
true;}
673 LogDebug(
"[CSCSkim]") <<
"----- nRecHits = " << nRecHits
674 <<
"\tnChambersWithMinimalHits = " << nChambersWithMinimalHits
675 <<
"\tnSegments = " << nSegments
676 <<
"\tselect? " << selectEvent << std::endl;
710 bool certainChamberIsPresentInWires =
false;
713 int kEndcap =
id.
endcap();
714 int kRing =
id.ring();
715 int kStation =
id.station();
716 int kChamber =
id.chamber();
717 if ( (kEndcap == whichEndcap) &&
718 (kStation == whichStation) &&
719 (kRing == whichRing) &&
720 (kChamber == whichChamber) )
721 {certainChamberIsPresentInWires =
true;}
726 bool certainChamberIsPresentInStrips =
false;
729 int kEndcap =
id.
endcap();
730 int kRing =
id.ring();
731 int kStation =
id.station();
732 int kChamber =
id.chamber();
733 if ( (kEndcap == whichEndcap) &&
734 (kStation == whichStation) &&
735 (kRing == whichRing) &&
736 (kChamber == whichChamber) )
737 {certainChamberIsPresentInStrips =
true;}
740 bool certainChamberIsPresent = certainChamberIsPresentInWires || certainChamberIsPresentInStrips;
742 return certainChamberIsPresent;
753 const float chisqMax = 100.;
754 const int nhitsMin = 5;
755 const int maxNSegments = 3;
758 bool DTOverlapCandidate =
false;
765 for (
int i=0;
i<36; ++
i) {
778 int nSegments = cscSegments->size();
779 if (nSegments < 2)
return DTOverlapCandidate;
784 int kEndcap =
id.
endcap();
785 int kStation =
id.station();
786 int kRing =
id.ring();
787 int kChamber =
id.chamber();
789 float chisq = (*it).chi2();
790 int nhits = (*it).nRecHits();
791 bool goodSegment = (chisq < chisqMax) && (nhits >= nhitsMin) ;
793 if ( (kStation == 1) && (kRing == 3) ) {
794 if (kEndcap == 1) {cntMEP13[kChamber-1]++;}
795 if (kEndcap == 2) {cntMEN13[kChamber-1]++;}
797 if ( (kStation == 2) && (kRing == 2) ) {
798 if (kEndcap == 1) {cntMEP22[kChamber-1]++;}
799 if (kEndcap == 2) {cntMEN22[kChamber-1]++;}
801 if ( (kStation == 3) && (kRing == 2) ) {
802 if (kEndcap == 1) {cntMEP32[kChamber-1]++;}
803 if (kEndcap == 2) {cntMEN32[kChamber-1]++;}
811 bool tooManySegments =
false;
812 for (
int i=0;
i<36; ++
i) {
813 if ( (cntMEP13[
i] > maxNSegments) ||
814 (cntMEN13[
i] > maxNSegments) ||
815 (cntMEP22[
i] > maxNSegments) ||
816 (cntMEN22[
i] > maxNSegments) ||
817 (cntMEP32[
i] > maxNSegments) ||
818 (cntMEN32[
i] > maxNSegments) ) tooManySegments =
true;
820 if (tooManySegments) {
821 return DTOverlapCandidate;
827 bool matchup =
false;
828 for (
int i=0;
i<36; ++
i) {
829 if ( (cntMEP13[
i] > 0) && (cntMEP22[
i]+cntMEP32[
i] > 0) ) {matchup =
true;}
830 if ( (cntMEN13[
i] > 0) && (cntMEN22[
i]+cntMEN32[
i] > 0) ) {matchup =
true;}
847 DTOverlapCandidate = matchup;
848 return DTOverlapCandidate;
861 const float chisqMax = 100.;
862 const int nhitsMin = 5;
863 const int maxNSegments = 3;
866 bool HaloLike =
false;
877 for (
int i=0;
i<36; ++
i) {
893 int nSegments = cscSegments->size();
894 if (nSegments < 4)
return HaloLike;
899 int kEndcap =
id.
endcap();
900 int kStation =
id.station();
901 int kRing =
id.ring();
902 int kChamber =
id.chamber();
904 float chisq = (*it).chi2();
905 int nhits = (*it).nRecHits();
906 bool goodSegment = (chisq < chisqMax) && (nhits >= nhitsMin) ;
908 if ( (kStation == 1) && (kRing == 1) ) {
909 if (kEndcap == 1) {cntMEP11[kChamber-1]++;}
910 if (kEndcap == 2) {cntMEN11[kChamber-1]++;}
912 if ( (kStation == 1) && (kRing == 2) ) {
913 if (kEndcap == 1) {cntMEP12[kChamber-1]++;}
914 if (kEndcap == 2) {cntMEN12[kChamber-1]++;}
916 if ( (kStation == 2) && (kRing == 1) ) {
917 if (kEndcap == 1) {cntMEP21[kChamber-1]++;}
918 if (kEndcap == 2) {cntMEN21[kChamber-1]++;}
920 if ( (kStation == 3) && (kRing == 1) ) {
921 if (kEndcap == 1) {cntMEP31[kChamber-1]++;}
922 if (kEndcap == 2) {cntMEN31[kChamber-1]++;}
924 if ( (kStation == 4) && (kRing == 1) ) {
925 if (kEndcap == 1) {cntMEP41[kChamber-1]++;}
926 if (kEndcap == 2) {cntMEN41[kChamber-1]++;}
934 bool tooManySegments =
false;
935 for (
int i=0;
i<36; ++
i) {
936 if ( (cntMEP11[
i] > 3*maxNSegments) ||
937 (cntMEN11[
i] > 3*maxNSegments) ||
938 (cntMEP12[
i] > maxNSegments) ||
939 (cntMEN12[
i] > maxNSegments) ||
940 (cntMEP21[
i] > maxNSegments) ||
941 (cntMEN21[
i] > maxNSegments) ||
942 (cntMEP31[
i] > maxNSegments) ||
943 (cntMEN31[
i] > maxNSegments) ||
944 (cntMEP41[
i] > maxNSegments) ||
945 (cntMEN41[
i] > maxNSegments) ) tooManySegments =
true;
947 if (tooManySegments) {
954 bool matchup =
false;
955 for (
int i=0;
i<36; ++
i) {
956 if ( (cntMEP11[
i]+cntMEP12[
i] > 0) &&
959 (cntMEP41[
i] > 0) ) {matchup =
true;}
960 if ( (cntMEN11[
i]+cntMEN12[
i] > 0) &&
963 (cntMEN41[
i] > 0) ) {matchup =
true;}
1007 const float zDistanceMax = 2500.;
1008 const float zDistanceMin = 700.;
1009 const int nCSCHitsMin = 25;
1010 const int nCSCHitsMax = 50;
1011 const float zInnerMax = 80000.;
1013 const int nNiceMuonsMin = 1;
1021 for(reco::TrackCollection::const_iterator
muon = saMuons->begin();
muon != saMuons->end(); ++
muon ) {
1027 GlobalPoint ip(innerPo.x(), innerPo.y(),innerPo.z());
1029 GlobalPoint op(outerPo.x(), outerPo.y(),outerPo.z());
1030 float zInner = ip.
z();
1031 float zOuter = op.z();
1032 float zDistance = fabs(zOuter-zInner);
1040 const DetId detId( (*hit)->geographicalId() );
1056 if ( (zDistance < zDistanceMax) && (zDistance > zDistanceMin)
1057 && (nCSCHits > nCSCHitsMin) && (nCSCHits < nCSCHitsMax)
1058 && (
min ( fabs(zInner), fabs(zOuter) ) < zInnerMax)
1059 && (fabs(innerMo.z()) > 0.000000001) ) {
1064 bool select = (nNiceMuons >= nNiceMuonsMin);
1083 bool acceptThisEvent =
false;
1088 int nGoodSAMuons = 0;
1089 for (reco::TrackCollection::const_iterator
muon = saMuons->begin();
muon != saMuons->end(); ++
muon ) {
1090 float preco =
muon->p();
1093 GlobalPoint iPnt(innerPo.x(), innerPo.y(),innerPo.z());
1095 GlobalPoint oPnt(outerPo.x(), outerPo.y(),outerPo.z());
1096 float zLength =
abs( iPnt.z() - oPnt.z() );
1099 GlobalVector iP(innerMom.x(), innerMom.y(), innerMom.z() );
1101 GlobalVector oP(outerMom.x(), outerMom.y(), outerMom.z() );
1103 const float zRef = 300.;
1104 float xExt = 10000.;
1105 float yExt = 10000.;
1106 if (
abs(oPnt.z()) <
abs(iPnt.z())) {
1109 deltaZ = zRef - oPnt.
z();
1111 deltaZ = -zRef - oPnt.z();
1113 xExt = oPnt.x() + deltaZ * oP.x() / oP.z();
1114 yExt = oPnt.y() + deltaZ * oP.y() / oP.z();
1118 deltaZ = zRef - iPnt.z();
1120 deltaZ = -zRef - iPnt.z();
1122 xExt = iPnt.x() + deltaZ * iP.x() / iP.z();
1123 yExt = iPnt.y() + deltaZ * iP.y() / iP.z();
1125 float rExt =
sqrt( xExt*xExt + yExt*yExt );
1132 const DetId detId( (*hit)->geographicalId() );
1144 if (nCSCHits >= nCSCHitsMin) {
1145 if (
abs(iPnt.z()) <
abs(iPnt.z())) {
1152 bool goodSAMuon = (preco >
pMin)
1153 && ( zLength > zLengthMin )
1154 && ( nCSCHits >= nCSCHitsMin )
1155 && ( zInner < zInnerMax )
1156 && ( rExt < rExtMax ) ;
1158 if (goodSAMuon) {nGoodSAMuons++;}
1168 int nGoodTracks = 0;
1169 for (reco::TrackCollection::const_iterator
track = tracks->begin();
track != tracks->end(); ++
track ) {
1170 float preco =
track->p();
1171 int n =
track->recHitsSize();
1174 GlobalPoint iPnt(innerPo.x(), innerPo.y(),innerPo.z());
1176 GlobalPoint oPnt(outerPo.x(), outerPo.y(),outerPo.z());
1177 float zLength =
abs( iPnt.z() - oPnt.z() );
1180 GlobalVector iP(innerMom.x(), innerMom.y(), innerMom.z() );
1182 GlobalVector oP(outerMom.x(), outerMom.y(), outerMom.z() );
1184 const float zRef = 300.;
1185 float xExt = 10000.;
1186 float yExt = 10000.;
1187 if (
abs(oPnt.z()) >
abs(iPnt.z())) {
1190 deltaZ = zRef - oPnt.
z();
1192 deltaZ = -zRef - oPnt.z();
1194 xExt = oPnt.x() + deltaZ * oP.x() / oP.z();
1195 yExt = oPnt.y() + deltaZ * oP.y() / oP.z();
1199 deltaZ = zRef - iPnt.z();
1201 deltaZ = -zRef - iPnt.z();
1203 xExt = iPnt.x() + deltaZ * iP.x() / iP.z();
1204 yExt = iPnt.y() + deltaZ * iP.y() / iP.z();
1206 float rExt =
sqrt( xExt*xExt + yExt*yExt );
1209 && (n >= nTrHitsMin)
1210 && (zLength > zLengthTrMin)
1211 && ( rExt < rExtMax ) ;
1213 if (goodTrack) {nGoodTracks++;}
1221 int nGoodGlobalMuons = 0;
1222 for (reco::MuonCollection::const_iterator global = gMuons->begin(); global != gMuons->end(); ++global ) {
1224 if (global->isGlobalMuon()) {
1226 float pDef = global->p();
1227 float redChiSq = global->globalTrack()->normalizedChi2();
1238 const DetId detId( (*hit)->geographicalId() );
1249 bool goodGlobalMuon = (pDef >
pMin)
1250 && ( nTrackerHits >= nValidHitsMin )
1251 && ( nCSCHits >= nCSCHitsMin )
1252 && ( redChiSq < redChiSqMax );
1254 if (goodGlobalMuon) {nGoodGlobalMuons++;}
1263 acceptThisEvent = ( (nGoodSAMuons > 0) && (nGoodTracks > 0) ) || (nGoodGlobalMuons > 0) ;
1265 return acceptThisEvent;
1273 int kSerial = kChamber;
1274 if (kStation == 1 && kRing == 1) {kSerial = kChamber;}
1275 if (kStation == 1 && kRing == 2) {kSerial = kChamber + 36;}
1276 if (kStation == 1 && kRing == 3) {kSerial = kChamber + 72;}
1277 if (kStation == 1 && kRing == 4) {kSerial = kChamber;}
1278 if (kStation == 2 && kRing == 1) {kSerial = kChamber + 108;}
1279 if (kStation == 2 && kRing == 2) {kSerial = kChamber + 126;}
1280 if (kStation == 3 && kRing == 1) {kSerial = kChamber + 162;}
1281 if (kStation == 3 && kRing == 2) {kSerial = kChamber + 180;}
1282 if (kStation == 4 && kRing == 1) {kSerial = kChamber + 216;}
1283 if (kStation == 4 && kRing == 2) {kSerial = kChamber + 234;}
1284 if (kEndcap == 2) {kSerial = kSerial + 300;}
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EventAuxiliary const & eventAuxiliary() const override
bool filter(edm::Event &event, const edm::EventSetup &eventSetup) override
bool doLongSATrack(edm::Handle< reco::TrackCollection > saTracks)
bool doOverlapSkimming(edm::Handle< CSCSegmentCollection > cscSegments)
bool doDTOverlap(edm::Handle< CSCSegmentCollection > cscSegments)
C::const_iterator const_iterator
constant access iterator type
#define DEFINE_FWK_MODULE(type)
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
Abs< T >::type abs(const T &t)
static const std::string kLayer("layer")
bool doCSCSkimming(edm::Handle< CSCRecHit2DCollection > cscRecHits, edm::Handle< CSCSegmentCollection > cscSegments)
bool doCertainChamberSelection(edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCStripDigiCollection > strips)
bool doBFieldStudySelection(edm::Handle< reco::TrackCollection > saTracks, edm::Handle< reco::TrackCollection > Tracks, edm::Handle< reco::MuonCollection > gMuons)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
int numberOfValidTrackerHits() const
bool doMessyEventSkimming(edm::Handle< CSCRecHit2DCollection > cscRecHits, edm::Handle< CSCSegmentCollection > cscSegments)
int chamberSerial(int kE, int kS, int kR, int kCh)
CSCSkim(const edm::ParameterSet &pset)
Power< A, B >::type pow(const A &a, const B &b)
bool doHaloLike(edm::Handle< CSCSegmentCollection > cscSegments)