Analyze.
476 std::vector<std::vector<int>> probe_coll_GEM_region;
477 std::vector<std::vector<int>> probe_coll_GEM_lay;
478 std::vector<std::vector<int>> probe_coll_GEM_chamber;
479 std::vector<std::vector<float>> probe_coll_GEM_pt;
480 std::vector<std::vector<float>> probe_coll_GEM_eta;
481 std::vector<std::vector<float>> probe_coll_GEM_phi;
482 std::vector<std::vector<int>> probe_coll_GEM_sta;
483 std::vector<std::vector<float>> probe_coll_GEM_dx;
484 std::vector<uint8_t> probe_coll_GEM_staMatch;
487 std::vector<std::vector<int>> probe_coll_ME0_region;
488 std::vector<std::vector<int>> probe_coll_ME0_roll;
489 std::vector<std::vector<int>> probe_coll_ME0_lay;
490 std::vector<std::vector<int>> probe_coll_ME0_chamber;
491 std::vector<std::vector<float>> probe_coll_ME0_pt;
492 std::vector<std::vector<float>> probe_coll_ME0_eta;
493 std::vector<std::vector<float>> probe_coll_ME0_phi;
494 std::vector<std::vector<int>> probe_coll_ME0_sta;
495 std::vector<std::vector<float>> probe_coll_ME0_dx;
496 std::vector<uint8_t> probe_coll_ME0_staMatch;
498 std::vector<unsigned> probe_indices;
503 for (
const auto i : probe_indices) {
505 std::vector<int> probe_GEM_region;
506 std::vector<int> probe_GEM_sta;
507 std::vector<int> probe_GEM_lay;
508 std::vector<int> probe_GEM_chamber;
509 std::vector<float> probe_GEM_pt;
510 std::vector<float> probe_GEM_eta;
511 std::vector<float> probe_GEM_phi;
512 std::vector<float> probe_GEM_dx;
514 uint8_t GEM_stationMatching = 0;
516 std::vector<int> probe_ME0_region;
517 std::vector<int> probe_ME0_roll;
518 std::vector<int> probe_ME0_sta;
519 std::vector<int> probe_ME0_lay;
520 std::vector<int> probe_ME0_chamber;
521 std::vector<float> probe_ME0_pt;
522 std::vector<float> probe_ME0_eta;
523 std::vector<float> probe_ME0_phi;
524 std::vector<float> probe_ME0_dx;
525 uint8_t ME0_stationMatching = 0;
527 bool gem_matched =
false;
529 for (
const auto& chambMatch : (*muons).at(
i).matches()) {
535 GEMDetId chId(chambMatch.id.rawId());
537 const int roll = chId.roll();
538 const int region = chId.region();
539 const int station = chId.station();
540 const int layer = chId.layer();
541 const int chamber = chId.chamber();
542 const float pt = (*muons).at(
i).pt();
543 const float eta = (*muons).at(
i).eta();
544 const float phi = (*muons).at(
i).phi();
547 double smallestDx = 99999.;
548 double matched_GEMHit_x = 99999.;
550 for (
auto& gemHit : chambMatch.gemHitMatches) {
552 if (
dx < smallestDx) {
554 closest_matchedHit = gemHit;
555 matched_GEMHit_x = gemHit.
x;
560 double smallestDx_seg = 99999.;
562 for (
auto& seg : chambMatch.gemMatches) {
563 float dx_seg =
std::abs(chambMatch.x - seg.x);
564 if (dx_seg < smallestDx_seg) {
565 smallestDx_seg = dx_seg;
566 closest_matchedSegment = seg;
570 m_histos.find(
"GEMhit_dx")->second->Fill(smallestDx);
571 m_histos.find(
"GEMhit_x")->second->Fill(matched_GEMHit_x);
572 m_histos.find(
"Cham_x")->second->Fill(chambMatch.x);
573 m_histos.find(
"GEMseg_dx")->second->Fill(smallestDx_seg);
575 m_histos.find(
"GEMhit_dx_GE2")->second->Fill(smallestDx);
576 m_histos.find(
"GEMhit_x_GE2")->second->Fill(matched_GEMHit_x);
577 m_histos.find(
"Cham_x_GE2")->second->Fill(chambMatch.x);
581 GEM_stationMatching = GEM_stationMatching | (1 << (
station - 1));
583 probe_GEM_region.push_back(
region);
584 probe_GEM_sta.push_back(
station);
585 probe_GEM_lay.push_back(
layer);
586 probe_GEM_chamber.push_back(
chamber);
587 probe_GEM_pt.push_back(
pt);
588 probe_GEM_eta.push_back(
eta);
589 probe_GEM_phi.push_back(
phi);
590 probe_GEM_dx.push_back(smallestDx);
596 double smallestDx_ME0 = 99999.;
597 for (
auto& seg : chambMatch.gemMatches) {
599 if (
dx < smallestDx_ME0) {
601 closest_matchedSegment_ME0 = seg;
604 ME0_stationMatching = ME0_stationMatching | (1 << (
station - 1));
605 probe_ME0_region.push_back(
region);
606 probe_ME0_roll.push_back(
roll);
607 probe_ME0_sta.push_back(
station);
608 probe_ME0_lay.push_back(
layer);
609 probe_ME0_chamber.push_back(
chamber);
610 probe_ME0_pt.push_back(
pt);
611 probe_ME0_eta.push_back(
eta);
612 probe_ME0_phi.push_back(
phi);
613 probe_ME0_dx.push_back(smallestDx_ME0);
622 m_histos.find(
"probeEta")->second->Fill(
abs((*muons).at(
i).eta()));
623 m_histos.find(
"probePhi")->second->Fill((*muons).at(
i).phi());
624 m_histos.find(
"probeNumberOfMatchedStations")->second->Fill((*muons).at(
i).numberOfMatchedStations());
625 m_histos.find(
"probePt")->second->Fill((*muons).at(
i).pt());
634 probe_coll_GEM_region.push_back(probe_GEM_region);
635 probe_coll_GEM_sta.push_back(probe_GEM_sta);
636 probe_coll_GEM_lay.push_back(probe_GEM_lay);
637 probe_coll_GEM_chamber.push_back(probe_GEM_chamber);
638 probe_coll_GEM_pt.push_back(probe_GEM_pt);
639 probe_coll_GEM_eta.push_back(probe_GEM_eta);
640 probe_coll_GEM_phi.push_back(probe_GEM_phi);
641 probe_coll_GEM_dx.push_back(probe_GEM_dx);
642 probe_coll_GEM_staMatch.push_back(GEM_stationMatching);
645 probe_coll_ME0_region.push_back(probe_ME0_region);
646 probe_coll_ME0_roll.push_back(probe_ME0_roll);
647 probe_coll_ME0_sta.push_back(probe_ME0_sta);
648 probe_coll_ME0_lay.push_back(probe_ME0_lay);
649 probe_coll_ME0_chamber.push_back(probe_ME0_chamber);
650 probe_coll_ME0_pt.push_back(probe_ME0_pt);
651 probe_coll_ME0_eta.push_back(probe_ME0_eta);
652 probe_coll_ME0_phi.push_back(probe_ME0_phi);
653 probe_coll_ME0_dx.push_back(probe_ME0_dx);
654 probe_coll_ME0_staMatch.push_back(ME0_stationMatching);
659 for (
unsigned i = 0;
i < probe_indices.size(); ++
i) {
660 uint8_t GEM_matchPatt = probe_coll_GEM_staMatch.at(
i);
664 unsigned nME0_matches = probe_coll_ME0_region.at(
i).size();
665 for (
unsigned j = 0;
j < nME0_matches; ++
j) {
667 int ME0_region = probe_coll_ME0_region.at(
i).at(
j);
669 int ME0_sta = probe_coll_ME0_sta.at(
i).at(
j);
671 int ME0_chamber = probe_coll_ME0_chamber.at(
i).at(
j);
673 float ME0_dx = probe_coll_ME0_dx.at(
i).at(
j);
679 m_histos.find(
"ME0_nPassingProbe_chamber_1D")->second->Fill(ME0_chamber);
681 m_histos.find(
"GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(4, ME0_chamber);
682 else if (ME0_region > 0)
683 m_histos.find(
"GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(5, ME0_chamber);
685 m_histos.find(
"ME0_nFailingProbe_chamber_1D")->second->Fill(ME0_chamber);
687 m_histos.find(
"GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(4, ME0_chamber);
688 else if (ME0_region > 0)
689 m_histos.find(
"GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(5, ME0_chamber);
696 unsigned nGEM_matches = probe_coll_GEM_region.at(
i).size();
697 for (
unsigned j = 0;
j < nGEM_matches; ++
j) {
699 int GEM_region = probe_coll_GEM_region.at(
i).at(
j);
700 int GEM_sta = probe_coll_GEM_sta.at(
i).at(
j);
701 int GEM_lay = probe_coll_GEM_lay.at(
i).at(
j);
702 int GEM_chamber = probe_coll_GEM_chamber.at(
i).at(
j);
703 float GEM_pt = probe_coll_GEM_pt.at(
i).at(
j);
704 float GEM_dx = probe_coll_GEM_dx.at(
i).at(
j);
705 float GEM_eta = probe_coll_GEM_eta.at(
i).at(
j);
706 float GEM_phi = probe_coll_GEM_phi.at(
i).at(
j);
709 if (((GEM_matchPatt & (1 << (GEM_sta - 1))) != 0) && GEM_sta != 0)
712 if (GEM_region == 1 && GEM_lay == 0 && GEM_sta == 2 && GEM_chamber == 16)
714 m_histos.find(
"GEM_nPassingProbe_Ch_region")->second->Fill(GEM_region, GEM_chamber);
715 m_histos.find(
"GEM_nPassingProbe_Ch_eta")->second->Fill(
abs(GEM_eta), GEM_chamber);
716 m_histos.find(
"GEM_nPassingProbe_Ch_phi")->second->Fill(GEM_phi, GEM_chamber);
717 m_histos.find(
"GEM_nPassingProbe_allCh_1D")->second->Fill(GEM_region);
718 m_histos.find(
"GEM_nPassingProbe_chamber_1D")->second->Fill(GEM_chamber);
719 if (GEM_region < 0) {
720 if (GEM_sta == 2 and GEM_lay == 2)
721 m_histos.find(
"GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(0, GEM_chamber);
722 else if (GEM_sta == 2 and GEM_lay == 1)
723 m_histos.find(
"GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(1, GEM_chamber);
724 else if (GEM_sta == 1 and GEM_lay == 2)
725 m_histos.find(
"GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(2, GEM_chamber);
726 else if (GEM_sta == 1 and GEM_lay == 1)
727 m_histos.find(
"GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(3, GEM_chamber);
729 if (GEM_region > 0) {
730 if (GEM_sta == 1 and GEM_lay == 1)
731 m_histos.find(
"GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(6, GEM_chamber);
732 else if (GEM_sta == 1 and GEM_lay == 2)
733 m_histos.find(
"GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(7, GEM_chamber);
734 else if (GEM_sta == 2 and GEM_lay == 1)
735 m_histos.find(
"GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(8, GEM_chamber);
736 else if (GEM_sta == 2 and GEM_lay == 2)
737 m_histos.find(
"GEM_nPassingProbe_Ch_region_layer_phase2")->second->Fill(9, GEM_chamber);
739 if (GEM_region == -1 && GEM_sta == 1) {
740 m_histos.find(
"GEM_nPassingProbe_Ch_region_GE1_NoL")->second->Fill(0, GEM_chamber);
741 }
else if (GEM_region == 1 && GEM_sta == 1) {
742 m_histos.find(
"GEM_nPassingProbe_Ch_region_GE1_NoL")->second->Fill(1, GEM_chamber);
745 if (GEM_region == 1 && GEM_lay == 1 && GEM_sta == 1) {
746 m_histos.find(
"GEM_nPassingProbe_chamber_p1_1D")->second->Fill(GEM_chamber);
747 m_histos.find(
"GEM_nPassingProbe_Ch_region_GE1")->second->Fill(2, GEM_chamber);
748 m_histos.find(
"GEM_nPassingProbe_pt_p1_1D")->second->Fill(GEM_pt);
749 m_histos.find(
"GEM_nPassingProbe_eta_p1_1D")->second->Fill(
abs(GEM_eta));
750 m_histos.find(
"GEM_nPassingProbe_phi_p1_1D")->second->Fill(GEM_phi);
751 }
else if (GEM_region == 1 && GEM_lay == 2 && GEM_sta == 1) {
752 m_histos.find(
"GEM_nPassingProbe_chamber_p2_1D")->second->Fill(GEM_chamber);
753 m_histos.find(
"GEM_nPassingProbe_Ch_region_GE1")->second->Fill(3, GEM_chamber);
754 m_histos.find(
"GEM_nPassingProbe_pt_p2_1D")->second->Fill(GEM_pt);
755 m_histos.find(
"GEM_nPassingProbe_eta_p2_1D")->second->Fill(
abs(GEM_eta));
756 m_histos.find(
"GEM_nPassingProbe_phi_p2_1D")->second->Fill(GEM_phi);
757 }
else if (GEM_region == -1 && GEM_lay == 1 && GEM_sta == 1) {
758 m_histos.find(
"GEM_nPassingProbe_chamber_n1_1D")->second->Fill(GEM_chamber);
759 m_histos.find(
"GEM_nPassingProbe_Ch_region_GE1")->second->Fill(1, GEM_chamber);
760 m_histos.find(
"GEM_nPassingProbe_pt_n1_1D")->second->Fill(GEM_pt);
761 m_histos.find(
"GEM_nPassingProbe_eta_n1_1D")->second->Fill(
abs(GEM_eta));
762 m_histos.find(
"GEM_nPassingProbe_phi_n1_1D")->second->Fill(GEM_phi);
763 }
else if (GEM_region == -1 && GEM_lay == 2 && GEM_sta == 1) {
764 m_histos.find(
"GEM_nPassingProbe_chamber_n2_1D")->second->Fill(GEM_chamber);
765 m_histos.find(
"GEM_nPassingProbe_Ch_region_GE1")->second->Fill(0, GEM_chamber);
766 m_histos.find(
"GEM_nPassingProbe_pt_n2_1D")->second->Fill(GEM_pt);
767 m_histos.find(
"GEM_nPassingProbe_eta_n2_1D")->second->Fill(
abs(GEM_eta));
768 m_histos.find(
"GEM_nPassingProbe_phi_n2_1D")->second->Fill(GEM_phi);
770 m_histos.find(
"GEM_nPassingProbe_pt_1D")->second->Fill(GEM_pt);
771 m_histos.find(
"GEM_nPassingProbe_eta_1D")->second->Fill(
abs(GEM_eta));
772 m_histos.find(
"GEM_nPassingProbe_phi_1D")->second->Fill(GEM_phi);
774 if (GEM_region == 1 && GEM_lay == 0 && GEM_sta == 2 && GEM_chamber == 16)
776 m_histos.find(
"GEM_nFailingProbe_Ch_region")->second->Fill(GEM_region, GEM_chamber);
777 m_histos.find(
"GEM_nFailingProbe_Ch_eta")->second->Fill(
abs(GEM_eta), GEM_chamber);
778 m_histos.find(
"GEM_nFailingProbe_Ch_phi")->second->Fill(GEM_phi, GEM_chamber);
779 m_histos.find(
"GEM_nFailingProbe_allCh_1D")->second->Fill(GEM_region);
780 m_histos.find(
"GEM_nFailingProbe_chamber_1D")->second->Fill(GEM_chamber);
781 if (GEM_region < 0) {
782 if (GEM_sta == 2 and GEM_lay == 2)
783 m_histos.find(
"GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(0, GEM_chamber);
784 else if (GEM_sta == 2 and GEM_lay == 1)
785 m_histos.find(
"GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(1, GEM_chamber);
786 else if (GEM_sta == 1 and GEM_lay == 2)
787 m_histos.find(
"GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(2, GEM_chamber);
788 else if (GEM_sta == 1 and GEM_lay == 1)
789 m_histos.find(
"GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(3, GEM_chamber);
791 if (GEM_region > 0) {
792 if (GEM_sta == 1 and GEM_lay == 1)
793 m_histos.find(
"GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(6, GEM_chamber);
794 else if (GEM_sta == 1 and GEM_lay == 2)
795 m_histos.find(
"GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(7, GEM_chamber);
796 else if (GEM_sta == 2 and GEM_lay == 1)
797 m_histos.find(
"GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(8, GEM_chamber);
798 else if (GEM_sta == 2 and GEM_lay == 2)
799 m_histos.find(
"GEM_nFailingProbe_Ch_region_layer_phase2")->second->Fill(9, GEM_chamber);
801 if (GEM_region == -1 && GEM_sta == 1) {
802 m_histos.find(
"GEM_nFailingProbe_Ch_region_GE1_NoL")->second->Fill(0, GEM_chamber);
803 }
else if (GEM_region == 1 && GEM_sta == 1) {
804 m_histos.find(
"GEM_nFailingProbe_Ch_region_GE1_NoL")->second->Fill(1, GEM_chamber);
807 if (GEM_region == 1 && GEM_lay == 1 && GEM_sta == 1) {
808 m_histos.find(
"GEM_nFailingProbe_chamber_p1_1D")->second->Fill(GEM_chamber);
809 m_histos.find(
"GEM_nFailingProbe_Ch_region_GE1")->second->Fill(2, GEM_chamber);
810 m_histos.find(
"GEM_nFailingProbe_pt_p1_1D")->second->Fill(GEM_pt);
811 m_histos.find(
"GEM_nFailingProbe_eta_p1_1D")->second->Fill(
abs(GEM_eta));
812 m_histos.find(
"GEM_nFailingProbe_phi_p1_1D")->second->Fill(GEM_phi);
813 }
else if (GEM_region == 1 && GEM_lay == 2 && GEM_sta == 1) {
814 m_histos.find(
"GEM_nFailingProbe_chamber_p2_1D")->second->Fill(GEM_chamber);
815 m_histos.find(
"GEM_nFailingProbe_Ch_region_GE1")->second->Fill(3, GEM_chamber);
816 m_histos.find(
"GEM_nFailingProbe_pt_p2_1D")->second->Fill(GEM_pt);
817 m_histos.find(
"GEM_nFailingProbe_eta_p2_1D")->second->Fill(
abs(GEM_eta));
818 m_histos.find(
"GEM_nFailingProbe_phi_p2_1D")->second->Fill(GEM_phi);
819 }
else if (GEM_region == -1 && GEM_lay == 1 && GEM_sta == 1) {
820 m_histos.find(
"GEM_nFailingProbe_chamber_n1_1D")->second->Fill(GEM_chamber);
821 m_histos.find(
"GEM_nFailingProbe_Ch_region_GE1")->second->Fill(1, GEM_chamber);
822 m_histos.find(
"GEM_nFailingProbe_pt_n1_1D")->second->Fill(GEM_pt);
823 m_histos.find(
"GEM_nFailingProbe_eta_n1_1D")->second->Fill(
abs(GEM_eta));
824 m_histos.find(
"GEM_nFailingProbe_phi_n1_1D")->second->Fill(GEM_phi);
825 }
else if (GEM_region == -1 && GEM_lay == 2 && GEM_sta == 1) {
826 m_histos.find(
"GEM_nFailingProbe_chamber_n2_1D")->second->Fill(GEM_chamber);
827 m_histos.find(
"GEM_nFailingProbe_Ch_region_GE1")->second->Fill(0, GEM_chamber);
828 m_histos.find(
"GEM_nFailingProbe_pt_n2_1D")->second->Fill(GEM_pt);
829 m_histos.find(
"GEM_nFailingProbe_eta_n2_1D")->second->Fill(
abs(GEM_eta));
830 m_histos.find(
"GEM_nFailingProbe_phi_n2_1D")->second->Fill(GEM_phi);
832 m_histos.find(
"GEM_nFailingProbe_pt_1D")->second->Fill(GEM_pt);
833 m_histos.find(
"GEM_nFailingProbe_eta_1D")->second->Fill(
abs(GEM_eta));
834 m_histos.find(
"GEM_nFailingProbe_phi_1D")->second->Fill(GEM_phi);
const edm::EDGetTokenT< reco::MuonCollection > m_muToken
std::vector< std::vector< unsigned > > m_probeIndices
const bool m_detailedAnalysis
Abs< T >::type abs(const T &t)
std::map< std::string, MonitorElement * > m_histos
void analyze(const edm::Event &event, const edm::EventSetup &context) override
Analyze.