diff --git a/DQM/L1TMonitor/interface/L1TStage2CPPF.h b/DQM/L1TMonitor/interface/L1TStage2CPPF.h index 480ff735a6cf6..0505c62d68c94 100644 --- a/DQM/L1TMonitor/interface/L1TStage2CPPF.h +++ b/DQM/L1TMonitor/interface/L1TStage2CPPF.h @@ -69,27 +69,24 @@ // class decleration -class L1TStage2CPPF: public DQMEDAnalyzer { - +class L1TStage2CPPF : public DQMEDAnalyzer { public: - -// class constructor - L1TStage2CPPF(const edm::ParameterSet & ps); -// class destructor + // class constructor + L1TStage2CPPF(const edm::ParameterSet& ps); + // class destructor ~L1TStage2CPPF() override; -// member functions - edm::ESHandle rpcGeom; + // member functions + edm::ESHandle rpcGeom; protected: - virtual void analyze(const edm::Event&, const edm::EventSetup&) override; - virtual void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override ; - -// data members -private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override; + // data members +private: std::string monitorDir; - bool verbose ; + bool verbose; float global_phi; const edm::EDGetTokenT cppfDigiToken_; int EMTF_sector; @@ -103,7 +100,7 @@ class L1TStage2CPPF: public DQMEDAnalyzer { std::vector EMTFsector5bins; std::vector EMTFsector6bins; - std::map> fill_info; + std::map> fill_info; MonitorElement* Occupancy_EMTFSector; MonitorElement* Track_Bx; diff --git a/DQM/L1TMonitor/interface/L1TdeStage2CPPF.h b/DQM/L1TMonitor/interface/L1TdeStage2CPPF.h index 0df4e1ec036f1..5b84ec92cbe5b 100644 --- a/DQM/L1TMonitor/interface/L1TdeStage2CPPF.h +++ b/DQM/L1TMonitor/interface/L1TdeStage2CPPF.h @@ -14,19 +14,16 @@ #include "DataFormats/L1TMuon/interface/CPPFDigi.h" - class L1TdeStage2CPPF : public DQMEDAnalyzer { - - public: +public: L1TdeStage2CPPF(const edm::ParameterSet& ps); ~L1TdeStage2CPPF() override; - protected: - +protected: void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override; void analyze(const edm::Event&, const edm::EventSetup&) override; - private: +private: int occupancy_value(int region_, int station_, int ring_); int bx_value(int region_, int emtfsector_); int GetSubsector(int emtfsector_, int lsubsector_); @@ -51,13 +48,10 @@ class L1TdeStage2CPPF : public DQMEDAnalyzer { MonitorElement* h2_Matching_SameKey_OnTheta_phi_Ce_phi_Cu_bx; MonitorElement* h2_Matching_SameKey_OnTheta_theta_Ce_theta_Cu_bx; MonitorElement* h2_Matching_SameKey_OnTheta_zone_Ce_zone_Cu_bx; - + MonitorElement* h2_Matching_SameKey_OffTheta_phi_Ce_phi_Cu_bx; MonitorElement* h2_Matching_SameKey_OffTheta_theta_Ce_theta_Cu_bx; MonitorElement* h2_Matching_SameKey_OffTheta_zone_Ce_zone_Cu_bx; - - - }; #endif diff --git a/DQM/L1TMonitor/src/L1TStage2CPPF.cc b/DQM/L1TMonitor/src/L1TStage2CPPF.cc index 5d5ad4108f927..241855e4d48b7 100644 --- a/DQM/L1TMonitor/src/L1TStage2CPPF.cc +++ b/DQM/L1TMonitor/src/L1TStage2CPPF.cc @@ -6,31 +6,23 @@ #include "DQM/L1TMonitor/interface/L1TStage2CPPF.h" -L1TStage2CPPF::L1TStage2CPPF(const edm::ParameterSet & ps): - monitorDir(ps.getUntrackedParameter("monitorDir","")), -// cppfdigiLabel(ps.getParameter("cppfdigiLabel")), - verbose(ps.getUntrackedParameter("verbose", false)), - global_phi(-1000), - cppfDigiToken_(consumes(ps.getParameter("cppfSource"))) -{ +L1TStage2CPPF::L1TStage2CPPF(const edm::ParameterSet& ps) + : monitorDir(ps.getUntrackedParameter("monitorDir", "")), + // cppfdigiLabel(ps.getParameter("cppfdigiLabel")), + verbose(ps.getUntrackedParameter("verbose", false)), + global_phi(-1000), + cppfDigiToken_(consumes(ps.getParameter("cppfSource"))) {} -} - -L1TStage2CPPF::~L1TStage2CPPF() -{ -} +L1TStage2CPPF::~L1TStage2CPPF() {} -void L1TStage2CPPF::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& iRun, const edm::EventSetup& eveSetup) -{ +void L1TStage2CPPF::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& iRun, const edm::EventSetup& eveSetup) { ibooker.setCurrentFolder(monitorDir); - - Occupancy_EMTFSector = ibooker.book2D("Occupancy_EMTFSector", "Occupancy_EMTFSector", 36, 1., 37., 12, 1.,13.); - Track_Bx = ibooker.book2D("Track_Bx","Track_Bx", 12, 1., 13., 7,-3.,4.); + Occupancy_EMTFSector = ibooker.book2D("Occupancy_EMTFSector", "Occupancy_EMTFSector", 36, 1., 37., 12, 1., 13.); + Track_Bx = ibooker.book2D("Track_Bx", "Track_Bx", 12, 1., 13., 7, -3., 4.); } -void L1TStage2CPPF::analyze(const edm::Event & eve, const edm::EventSetup & eveSetup) -{ +void L1TStage2CPPF::analyze(const edm::Event& eve, const edm::EventSetup& eveSetup) { if (verbose) { edm::LogInfo("L1TStage2CPPF") << "L1TStage2CPPF: analyze...." << std::endl; } @@ -38,17 +30,16 @@ void L1TStage2CPPF::analyze(const edm::Event & eve, const edm::EventSetup & eveS edm::Handle CppfDigis; eve.getByToken(cppfDigiToken_, CppfDigis); - -//Fill the specific bin for each EMTF sector - for(int i = 1; i < 7; i++ ){ + //Fill the specific bin for each EMTF sector + for (int i = 1; i < 7; i++) { EMTFsector1bins.push_back(i); - EMTFsector2bins.push_back(i+6); - EMTFsector3bins.push_back(i+12); - EMTFsector4bins.push_back(i+18); - EMTFsector5bins.push_back(i+24); - EMTFsector6bins.push_back(i+30); + EMTFsector2bins.push_back(i + 6); + EMTFsector3bins.push_back(i + 12); + EMTFsector4bins.push_back(i + 18); + EMTFsector5bins.push_back(i + 24); + EMTFsector6bins.push_back(i + 30); } - //FIll the map for each EMTF sector + //FIll the map for each EMTF sector fill_info[1] = EMTFsector1bins; fill_info[2] = EMTFsector2bins; fill_info[3] = EMTFsector3bins; @@ -56,91 +47,92 @@ void L1TStage2CPPF::analyze(const edm::Event & eve, const edm::EventSetup & eveS fill_info[5] = EMTFsector5bins; fill_info[6] = EMTFsector6bins; - for(auto& cppf_digis : *CppfDigis){ - + for (auto& cppf_digis : *CppfDigis) { RPCDetId rpcId = cppf_digis.rpcId(); int ring = rpcId.ring(); int station = rpcId.station(); int region = rpcId.region(); int subsector = rpcId.subsector(); + //TOBECHECKED why rpcId.sector() sometimes return 7 ? + if (cppf_digis.emtf_sector() != -99) { + std::cout << " L1TStage2CPPF::analyze cppf_digis.emtf_sector=" << cppf_digis.emtf_sector() << std::endl; + } + if (rpcId.sector() >= 7 or rpcId.sector() < 1) { + std::cout << " L1TStage2CPPF::analyze rpcId.sector=" << rpcId.sector() + << " emtf_sector=" << cppf_digis.emtf_sector() << std::endl; + continue; + } -//TOBECHECKED why rpcId.sector() sometimes return 7 ? -if(cppf_digis.emtf_sector()!=-99) {std::cout<<" L1TStage2CPPF::analyze cppf_digis.emtf_sector="<=7 or rpcId.sector()<1) { std::cout<<" L1TStage2CPPF::analyze rpcId.sector="<(ps.getParameter("dataSource"))), emulToken(consumes(ps.getParameter("emulSource"))), @@ -11,36 +10,161 @@ L1TdeStage2CPPF::L1TdeStage2CPPF(const edm::ParameterSet& ps) L1TdeStage2CPPF::~L1TdeStage2CPPF() {} - void L1TdeStage2CPPF::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) { - ibooker.setCurrentFolder(monitorDir); - - h2_Matching_SameKey_OnPhi_phi_Ce_phi_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OnPhi_phi_Ce_phi_Cu_bx","Matching && Same SubSector && OnPhi ; Emulator #phi ; Unpacker #phi", 62, 0.0, 1240., 62, 0.0, 1240.); - h2_Matching_SameKey_OnPhi_theta_Ce_theta_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OnPhi_theta_Ce_theta_Cu_bx","Matching && Same SubSector && bx==0 && OnPhi ; Emulator #theta ; Unpacker #theta ", 32, 0, 32., 32, 0, 32.); - h2_Matching_SameKey_OnPhi_zone_Ce_zone_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OnPhi_zone_Ce_zone_Cu_bx","Matching && Same SubSector && bx==0 && OnPhi ;Emulator Zone ;Unpacker Zone ", 15, 0, 15, 15, 0, 15); - h2_Matching_SameKey_OnPhi_ID_Ce_ID_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OnPhi_ID_Ce_ID_Cu_bx","Matching && Same SubSector && bx==0 && OnPhi ; Emulator Chamber ID;Unpacker Chamber ID ", 38, 0, 38, 38, 0, 38); - h2_Matching_SameKey_OnPhi_ID_Ce_roll_Ce_bx = ibooker.book2D("h2_Matching_SameKey_OnPhi_ID_Ce_roll_Ce_bx","Matching && Same SubSector && bx==0 && OnPhi ;Emulator Chamber ID ;Emulator Roll ", 38, 0, 38, 4, 0, 4); - - h2_Matching_SameKey_OffPhi_phi_Ce_phi_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OffPhi_phi_Ce_phi_Cu_bx","Matching && Same SubSector && OffPhi ; Emulator #phi ; Unpacker #phi", 62, 0.0, 1240., 62, 0.0, 1240.); - h2_Matching_SameKey_OffPhi_theta_Ce_theta_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OffPhi_theta_Ce_theta_Cu_bx","Matching && Same SubSector && bx==0 && OffPhi ; Emulator #theta ; Unpacker #theta ", 32, 0, 32., 32, 0, 32.); - h2_Matching_SameKey_OffPhi_zone_Ce_zone_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OffPhi_zone_Ce_zone_Cu_bx","Matching && Same SubSector && bx==0 && OffPhi ;Emulator Zone ;Unpacker Zone ", 15, 0, 15, 15, 0, 15); - h2_Matching_SameKey_OffPhi_ID_Ce_ID_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OffPhi_ID_Ce_ID_Cu_bx","Matching && Same SubSector && bx==0 && OffPhi ; Emulator Chamber ID;Unpacker Chamber ID ", 38, 0, 38, 38, 0, 38); - h2_Matching_SameKey_OffPhi_ID_Ce_roll_Ce_bx = ibooker.book2D("h2_Matching_SameKey_OffPhi_ID_Ce_roll_Ce_bx","Matching && Same SubSector && bx==0 && OffPhi ;Emulator Chamber ID ;Emulator Roll ", 38, 0, 38, 4, 0, 4); - - h2_Matching_SameKey_OnTheta_phi_Ce_phi_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OnTheta_phi_Ce_phi_Cu_bx","Matching && Same SubSector && OnTheta ; Emulator #phi ; Unpacker #phi", 62, 0.0, 1240., 62, 0.0, 1240.); - h2_Matching_SameKey_OnTheta_theta_Ce_theta_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OnTheta_theta_Ce_theta_Cu_bx","Matching && Same SubSector && bx==0 && OnTheta ; Emulator #theta ; Unpacker #theta ", 32, 0, 32., 32, 0, 32.); - h2_Matching_SameKey_OnTheta_zone_Ce_zone_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OnTheta_zone_Ce_zone_Cu_bx","Matching && Same SubSector && bx==0 && OnTheta ;Emulator Zone ;Unpacker Zone ", 15, 0, 15, 15, 0, 15); - - h2_Matching_SameKey_OffTheta_phi_Ce_phi_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OffTheta_phi_Ce_phi_Cu_bx","Matching && Same SubSector && OffTheta ; Emulator #phi ; Unpacker #phi", 62, 0.0, 1240., 62, 0.0, 1240.); - h2_Matching_SameKey_OffTheta_theta_Ce_theta_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OffTheta_theta_Ce_theta_Cu_bx","Matching && Same SubSector && bx==0 && OffTheta ; Emulator #theta ; Unpacker #theta ", 32, 0, 32., 32, 0, 32.); - h2_Matching_SameKey_OffTheta_zone_Ce_zone_Cu_bx = ibooker.book2D("h2_Matching_SameKey_OffTheta_zone_Ce_zone_Cu_bx","Matching && Same SubSector && bx==0 && OffTheta ;Emulator Zone ;Unpacker Zone ", 15, 0, 15, 15, 0, 15); + h2_Matching_SameKey_OnPhi_phi_Ce_phi_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OnPhi_phi_Ce_phi_Cu_bx", + "Matching && Same SubSector && OnPhi ; Emulator #phi ; Unpacker #phi", + 62, + 0.0, + 1240., + 62, + 0.0, + 1240.); + h2_Matching_SameKey_OnPhi_theta_Ce_theta_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OnPhi_theta_Ce_theta_Cu_bx", + "Matching && Same SubSector && bx==0 && OnPhi ; Emulator #theta ; Unpacker #theta ", + 32, + 0, + 32., + 32, + 0, + 32.); + h2_Matching_SameKey_OnPhi_zone_Ce_zone_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OnPhi_zone_Ce_zone_Cu_bx", + "Matching && Same SubSector && bx==0 && OnPhi ;Emulator Zone ;Unpacker Zone ", + 15, + 0, + 15, + 15, + 0, + 15); + h2_Matching_SameKey_OnPhi_ID_Ce_ID_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OnPhi_ID_Ce_ID_Cu_bx", + "Matching && Same SubSector && bx==0 && OnPhi ; Emulator Chamber ID;Unpacker Chamber ID ", + 38, + 0, + 38, + 38, + 0, + 38); + h2_Matching_SameKey_OnPhi_ID_Ce_roll_Ce_bx = + ibooker.book2D("h2_Matching_SameKey_OnPhi_ID_Ce_roll_Ce_bx", + "Matching && Same SubSector && bx==0 && OnPhi ;Emulator Chamber ID ;Emulator Roll ", + 38, + 0, + 38, + 4, + 0, + 4); + + h2_Matching_SameKey_OffPhi_phi_Ce_phi_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OffPhi_phi_Ce_phi_Cu_bx", + "Matching && Same SubSector && OffPhi ; Emulator #phi ; Unpacker #phi", + 62, + 0.0, + 1240., + 62, + 0.0, + 1240.); + h2_Matching_SameKey_OffPhi_theta_Ce_theta_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OffPhi_theta_Ce_theta_Cu_bx", + "Matching && Same SubSector && bx==0 && OffPhi ; Emulator #theta ; Unpacker #theta ", + 32, + 0, + 32., + 32, + 0, + 32.); + h2_Matching_SameKey_OffPhi_zone_Ce_zone_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OffPhi_zone_Ce_zone_Cu_bx", + "Matching && Same SubSector && bx==0 && OffPhi ;Emulator Zone ;Unpacker Zone ", + 15, + 0, + 15, + 15, + 0, + 15); + h2_Matching_SameKey_OffPhi_ID_Ce_ID_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OffPhi_ID_Ce_ID_Cu_bx", + "Matching && Same SubSector && bx==0 && OffPhi ; Emulator Chamber ID;Unpacker Chamber ID ", + 38, + 0, + 38, + 38, + 0, + 38); + h2_Matching_SameKey_OffPhi_ID_Ce_roll_Ce_bx = + ibooker.book2D("h2_Matching_SameKey_OffPhi_ID_Ce_roll_Ce_bx", + "Matching && Same SubSector && bx==0 && OffPhi ;Emulator Chamber ID ;Emulator Roll ", + 38, + 0, + 38, + 4, + 0, + 4); + + h2_Matching_SameKey_OnTheta_phi_Ce_phi_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OnTheta_phi_Ce_phi_Cu_bx", + "Matching && Same SubSector && OnTheta ; Emulator #phi ; Unpacker #phi", + 62, + 0.0, + 1240., + 62, + 0.0, + 1240.); + h2_Matching_SameKey_OnTheta_theta_Ce_theta_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OnTheta_theta_Ce_theta_Cu_bx", + "Matching && Same SubSector && bx==0 && OnTheta ; Emulator #theta ; Unpacker #theta ", + 32, + 0, + 32., + 32, + 0, + 32.); + h2_Matching_SameKey_OnTheta_zone_Ce_zone_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OnTheta_zone_Ce_zone_Cu_bx", + "Matching && Same SubSector && bx==0 && OnTheta ;Emulator Zone ;Unpacker Zone ", + 15, + 0, + 15, + 15, + 0, + 15); + + h2_Matching_SameKey_OffTheta_phi_Ce_phi_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OffTheta_phi_Ce_phi_Cu_bx", + "Matching && Same SubSector && OffTheta ; Emulator #phi ; Unpacker #phi", + 62, + 0.0, + 1240., + 62, + 0.0, + 1240.); + h2_Matching_SameKey_OffTheta_theta_Ce_theta_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OffTheta_theta_Ce_theta_Cu_bx", + "Matching && Same SubSector && bx==0 && OffTheta ; Emulator #theta ; Unpacker #theta ", + 32, + 0, + 32., + 32, + 0, + 32.); + h2_Matching_SameKey_OffTheta_zone_Ce_zone_Cu_bx = + ibooker.book2D("h2_Matching_SameKey_OffTheta_zone_Ce_zone_Cu_bx", + "Matching && Same SubSector && bx==0 && OffTheta ;Emulator Zone ;Unpacker Zone ", + 15, + 0, + 15, + 15, + 0, + 15); } void L1TdeStage2CPPF::analyze(const edm::Event& e, const edm::EventSetup& c) { - - if (verbose) edm::LogInfo("L1TdeStage2CPPF") << "L1TdeStage2CPPF: analyze..." << std::endl; + if (verbose) + edm::LogInfo("L1TdeStage2CPPF") << "L1TdeStage2CPPF: analyze..." << std::endl; edm::Handle dataCPPFs; e.getByToken(dataToken, dataCPPFs); @@ -48,272 +172,293 @@ void L1TdeStage2CPPF::analyze(const edm::Event& e, const edm::EventSetup& c) { edm::Handle emulCPPFs; e.getByToken(emulToken, emulCPPFs); - - std::unordered_map _nHit_Ce; - std::unordered_map _nHit_Cu; - std::unordered_map> _phi_Ce; - std::unordered_map> _phi_Cu; - std::unordered_map> _phi_glob_Ce; - std::unordered_map> _phi_glob_Cu; - std::unordered_map> _theta_Ce; - std::unordered_map> _theta_Cu; - std::unordered_map> _theta_glob_Ce; - std::unordered_map> _theta_glob_Cu; - std::unordered_map> _roll_Ce; - std::unordered_map> _roll_Cu; - std::unordered_map> _zone_Ce; - std::unordered_map> _zone_Cu; - std::unordered_map> _ID_Ce; - std::unordered_map> _ID_Cu; - std::unordered_map> _emtfSubsector_Ce; - std::unordered_map> _emtfSubsector_Cu; - std::unordered_map> _emtfSector_Ce; - std::unordered_map> _emtfSector_Cu; - std::unordered_map> _bx_Ce; - std::unordered_map> _bx_Cu; - std::unordered_map> _cluster_size_Ce; - std::unordered_map> _cluster_size_Cu; - - for(auto& cppf_digis : *emulCPPFs){ - RPCDetId rpcIdCe = (int)cppf_digis.rpcId(); - int regionCe = (int)rpcIdCe.region(); - int stationCe = (int)rpcIdCe.station(); - int sectorCe = (int)rpcIdCe.sector(); - int subsectorCe = (int)rpcIdCe.subsector(); - int ringCe = (int)rpcIdCe.ring(); - int rollCe = (int)(rpcIdCe.roll()); - int phiIntCe = (int)cppf_digis.phi_int(); - int thetaIntCe = (int)cppf_digis.theta_int(); - int phiGlobalCe = (int)cppf_digis.phi_glob(); - int thetaGlobalCe = (int)cppf_digis.theta_glob(); - int cluster_sizeCe = (int)cppf_digis.cluster_size(); - int bxCe = cppf_digis.bx(); - int emtfSectorCe = (int)cppf_digis.emtf_sector(); - int emtfSubsectorCe = GetSubsector(emtfSectorCe, subsectorCe); - int fillOccupancyCe = occupancy_value(regionCe, stationCe, ringCe); - - int nsubCe = 6; - (ringCe == 1 && stationCe > 1) ? nsubCe = 3 : nsubCe = 6; - int chamberIDCe = subsectorCe + nsubCe * ( sectorCe - 1); - - std::ostringstream oss; - oss << regionCe << stationCe << ringCe << sectorCe << subsectorCe << emtfSectorCe << emtfSubsectorCe; - std::istringstream iss(oss.str()); - int unique_id; - iss >> unique_id; - - if ( _nHit_Ce.find(unique_id) == _nHit_Ce.end() ) { - _nHit_Ce.insert({unique_id, 1}); - _phi_Ce[unique_id].push_back(phiIntCe); - _phi_glob_Ce[unique_id].push_back(phiGlobalCe); - _theta_Ce[unique_id].push_back(thetaIntCe); - _theta_glob_Ce[unique_id].push_back(thetaGlobalCe); - _roll_Ce[unique_id].push_back(rollCe); - _ID_Ce[unique_id].push_back( chamberIDCe); - _zone_Ce[unique_id].push_back(fillOccupancyCe); - _emtfSubsector_Ce[unique_id].push_back(emtfSubsectorCe); - _emtfSector_Ce[unique_id].push_back(emtfSectorCe); - _bx_Ce[unique_id].push_back(bxCe); - _cluster_size_Ce[unique_id].push_back(cluster_sizeCe); - } - else { - _nHit_Ce.at(unique_id) += 1; - _phi_Ce[unique_id].push_back(phiIntCe); - _phi_glob_Ce[unique_id].push_back(phiGlobalCe); - _theta_Ce[unique_id].push_back(thetaIntCe); - _theta_glob_Ce[unique_id].push_back(thetaGlobalCe); - _roll_Ce[unique_id].push_back(rollCe); - _ID_Ce[unique_id].push_back( chamberIDCe); - _zone_Ce[unique_id].push_back(fillOccupancyCe); - _emtfSubsector_Ce[unique_id].push_back(emtfSubsectorCe); - _emtfSector_Ce[unique_id].push_back(emtfSectorCe); - _bx_Ce[unique_id].push_back(bxCe); - _cluster_size_Ce[unique_id].push_back(cluster_sizeCe); - } - - } // END :: for(auto& cppf_digis : *CppfDigis1) - - for(auto& cppf_digis2 : *dataCPPFs){ - RPCDetId rpcIdCu = cppf_digis2.rpcId(); - int regionCu = (int)rpcIdCu.region(); - int stationCu = (int)rpcIdCu.station(); - int sectorCu = (int)rpcIdCu.sector(); - int subsectorCu = (int)rpcIdCu.subsector(); - int ringCu = (int)rpcIdCu.ring(); - int rollCu = (int)(rpcIdCu.roll()); - int phiIntCu = (int)cppf_digis2.phi_int(); - int thetaIntCu = (int)cppf_digis2.theta_int(); - int phiGlobalCu = (int)cppf_digis2.phi_glob(); - int thetaGlobalCu = (int)cppf_digis2.theta_glob(); - int cluster_sizeCu = (int)cppf_digis2.cluster_size(); - int bxCu = (int)cppf_digis2.bx(); - int emtfSectorCu = (int)cppf_digis2.emtf_sector(); - int emtfSubsectorCu = GetSubsector(emtfSectorCu, subsectorCu); - int fillOccupancyCu = occupancy_value(regionCu, stationCu, ringCu); - - int nsubCu = 6; - (ringCu == 1 && stationCu > 1) ? nsubCu = 3 : nsubCu = 6; - int chamberIDCu = subsectorCu + nsubCu * ( sectorCu - 1); - - std::ostringstream oss2; - oss2 << regionCu << stationCu << ringCu << sectorCu << subsectorCu << emtfSectorCu << emtfSubsectorCu; - std::istringstream iss2(oss2.str()); - int unique_id; - iss2 >> unique_id; - - if ( _nHit_Cu.find(unique_id) == _nHit_Cu.end() ) { // chamber had no hit so far - _nHit_Cu.insert({unique_id, 1}); - _phi_Cu[unique_id].push_back(phiIntCu); - _theta_Cu[unique_id].push_back(thetaIntCu); - _phi_glob_Cu[unique_id].push_back(phiGlobalCu); - _theta_glob_Cu[unique_id].push_back(thetaGlobalCu); - _ID_Cu[unique_id].push_back( chamberIDCu); - _zone_Cu[unique_id].push_back(fillOccupancyCu); - _roll_Cu[unique_id].push_back(rollCu); - _emtfSubsector_Cu[unique_id].push_back(emtfSubsectorCu); - _emtfSector_Cu[unique_id].push_back(emtfSectorCu); - _bx_Cu[unique_id].push_back(bxCu); - _cluster_size_Cu[unique_id].push_back(cluster_sizeCu); - } else { - _nHit_Cu.at(unique_id) += 1; - _phi_Cu[unique_id].push_back(phiIntCu); - _theta_Cu[unique_id].push_back(thetaIntCu); - _phi_glob_Cu[unique_id].push_back(phiGlobalCu); - _theta_glob_Cu[unique_id].push_back(thetaGlobalCu); - _ID_Cu[unique_id].push_back( chamberIDCu); - _zone_Cu[unique_id].push_back(fillOccupancyCu); - _roll_Cu[unique_id].push_back(rollCu); - _emtfSubsector_Cu[unique_id].push_back(emtfSubsectorCu); - _emtfSector_Cu[unique_id].push_back(emtfSectorCu); - _bx_Cu[unique_id].push_back(bxCu); - _cluster_size_Cu[unique_id].push_back(cluster_sizeCu); - } - } // END: : for(auto& cppf_digis2 : *CppfDigis2) - - for (auto const& Ce : _nHit_Ce){ - int key_Ce = Ce.first; - int nHit_Ce = Ce.second; - - for (auto const& Cu : _nHit_Cu){ - int key_Cu = Cu.first; - int nHit_Cu = Cu.second; - - if (key_Ce != key_Cu) continue; - if (nHit_Ce != nHit_Cu) continue; - - for (int vecSize = 0; vecSize < nHit_Cu; ++vecSize){ - - if (_bx_Cu.at(key_Cu)[vecSize] != _bx_Ce.at(key_Ce)[vecSize]) continue; - - bool OnPhi_Matching = false; - int index_Ce = vecSize; - int index_Cu = vecSize; - for (int i = 0; i < nHit_Ce; ++i){ - if ( _phi_Ce.at(key_Ce)[i] == _phi_Cu.at(key_Cu)[vecSize] ){ - OnPhi_Matching = true; - index_Cu = vecSize; - index_Ce = i; - } - } - if (OnPhi_Matching){ - h2_Matching_SameKey_OnPhi_phi_Ce_phi_Cu_bx->Fill(_phi_Ce.at(key_Ce)[index_Ce], _phi_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OnPhi_theta_Ce_theta_Cu_bx->Fill(_theta_Ce.at(key_Ce)[index_Ce], _theta_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OnPhi_zone_Ce_zone_Cu_bx->Fill(_zone_Ce.at(key_Ce)[index_Ce], _zone_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OnPhi_ID_Ce_ID_Cu_bx->Fill(_ID_Ce.at(key_Ce)[index_Ce], _ID_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OnPhi_ID_Ce_roll_Ce_bx->Fill(_ID_Ce.at(key_Ce)[index_Ce], _roll_Ce.at(key_Ce)[index_Ce]); - } - else{ - h2_Matching_SameKey_OffPhi_phi_Ce_phi_Cu_bx->Fill(_phi_Ce.at(key_Ce)[index_Ce], _phi_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OffPhi_theta_Ce_theta_Cu_bx->Fill(_theta_Ce.at(key_Ce)[index_Ce], _theta_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OffPhi_zone_Ce_zone_Cu_bx->Fill(_zone_Ce.at(key_Ce)[index_Ce], _zone_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OffPhi_ID_Ce_ID_Cu_bx->Fill(_ID_Ce.at(key_Ce)[index_Ce], _ID_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OffPhi_ID_Ce_roll_Ce_bx->Fill(_ID_Ce.at(key_Ce)[index_Ce], _roll_Ce.at(key_Ce)[index_Ce]); - } - - bool OnTheta_Matching = false; - for (int i = 0; i < nHit_Ce; ++i){ - if (_theta_Ce.at(key_Ce)[i] == _theta_Cu.at(key_Cu)[index_Cu]){ - OnTheta_Matching = true; - index_Cu = vecSize; - index_Ce = i; - } - } - if ( OnTheta_Matching ){ - h2_Matching_SameKey_OnTheta_phi_Ce_phi_Cu_bx->Fill(_phi_Ce.at(key_Ce)[index_Ce], _phi_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OnTheta_theta_Ce_theta_Cu_bx->Fill(_theta_Ce.at(key_Ce)[index_Ce], _theta_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OnTheta_zone_Ce_zone_Cu_bx->Fill(_zone_Ce.at(key_Ce)[index_Ce], _zone_Cu.at(key_Cu)[index_Cu]); - } - else{ - h2_Matching_SameKey_OffTheta_phi_Ce_phi_Cu_bx->Fill(_phi_Ce.at(key_Ce)[index_Ce], _phi_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OffTheta_theta_Ce_theta_Cu_bx->Fill(_theta_Ce.at(key_Ce)[index_Ce], _theta_Cu.at(key_Cu)[index_Cu]); - h2_Matching_SameKey_OffTheta_zone_Ce_zone_Cu_bx->Fill(_zone_Ce.at(key_Ce)[index_Ce], _zone_Cu.at(key_Cu)[index_Cu]); - } - - } - } - } -} + std::unordered_map _nHit_Ce; + std::unordered_map _nHit_Cu; + std::unordered_map> _phi_Ce; + std::unordered_map> _phi_Cu; + std::unordered_map> _phi_glob_Ce; + std::unordered_map> _phi_glob_Cu; + std::unordered_map> _theta_Ce; + std::unordered_map> _theta_Cu; + std::unordered_map> _theta_glob_Ce; + std::unordered_map> _theta_glob_Cu; + std::unordered_map> _roll_Ce; + std::unordered_map> _roll_Cu; + std::unordered_map> _zone_Ce; + std::unordered_map> _zone_Cu; + std::unordered_map> _ID_Ce; + std::unordered_map> _ID_Cu; + std::unordered_map> _emtfSubsector_Ce; + std::unordered_map> _emtfSubsector_Cu; + std::unordered_map> _emtfSector_Ce; + std::unordered_map> _emtfSector_Cu; + std::unordered_map> _bx_Ce; + std::unordered_map> _bx_Cu; + std::unordered_map> _cluster_size_Ce; + std::unordered_map> _cluster_size_Cu; + + for (auto& cppf_digis : *emulCPPFs) { + RPCDetId rpcIdCe = (int)cppf_digis.rpcId(); + int regionCe = (int)rpcIdCe.region(); + int stationCe = (int)rpcIdCe.station(); + int sectorCe = (int)rpcIdCe.sector(); + int subsectorCe = (int)rpcIdCe.subsector(); + int ringCe = (int)rpcIdCe.ring(); + int rollCe = (int)(rpcIdCe.roll()); + int phiIntCe = (int)cppf_digis.phi_int(); + int thetaIntCe = (int)cppf_digis.theta_int(); + int phiGlobalCe = (int)cppf_digis.phi_glob(); + int thetaGlobalCe = (int)cppf_digis.theta_glob(); + int cluster_sizeCe = (int)cppf_digis.cluster_size(); + int bxCe = cppf_digis.bx(); + int emtfSectorCe = (int)cppf_digis.emtf_sector(); + int emtfSubsectorCe = GetSubsector(emtfSectorCe, subsectorCe); + int fillOccupancyCe = occupancy_value(regionCe, stationCe, ringCe); + + int nsubCe = 6; + (ringCe == 1 && stationCe > 1) ? nsubCe = 3 : nsubCe = 6; + int chamberIDCe = subsectorCe + nsubCe * (sectorCe - 1); + + std::ostringstream oss; + oss << regionCe << stationCe << ringCe << sectorCe << subsectorCe << emtfSectorCe << emtfSubsectorCe; + std::istringstream iss(oss.str()); + int unique_id; + iss >> unique_id; + + if (_nHit_Ce.find(unique_id) == _nHit_Ce.end()) { + _nHit_Ce.insert({unique_id, 1}); + _phi_Ce[unique_id].push_back(phiIntCe); + _phi_glob_Ce[unique_id].push_back(phiGlobalCe); + _theta_Ce[unique_id].push_back(thetaIntCe); + _theta_glob_Ce[unique_id].push_back(thetaGlobalCe); + _roll_Ce[unique_id].push_back(rollCe); + _ID_Ce[unique_id].push_back(chamberIDCe); + _zone_Ce[unique_id].push_back(fillOccupancyCe); + _emtfSubsector_Ce[unique_id].push_back(emtfSubsectorCe); + _emtfSector_Ce[unique_id].push_back(emtfSectorCe); + _bx_Ce[unique_id].push_back(bxCe); + _cluster_size_Ce[unique_id].push_back(cluster_sizeCe); + } else { + _nHit_Ce.at(unique_id) += 1; + _phi_Ce[unique_id].push_back(phiIntCe); + _phi_glob_Ce[unique_id].push_back(phiGlobalCe); + _theta_Ce[unique_id].push_back(thetaIntCe); + _theta_glob_Ce[unique_id].push_back(thetaGlobalCe); + _roll_Ce[unique_id].push_back(rollCe); + _ID_Ce[unique_id].push_back(chamberIDCe); + _zone_Ce[unique_id].push_back(fillOccupancyCe); + _emtfSubsector_Ce[unique_id].push_back(emtfSubsectorCe); + _emtfSector_Ce[unique_id].push_back(emtfSectorCe); + _bx_Ce[unique_id].push_back(bxCe); + _cluster_size_Ce[unique_id].push_back(cluster_sizeCe); + } + + } // END :: for(auto& cppf_digis : *CppfDigis1) + + for (auto& cppf_digis2 : *dataCPPFs) { + RPCDetId rpcIdCu = cppf_digis2.rpcId(); + int regionCu = (int)rpcIdCu.region(); + int stationCu = (int)rpcIdCu.station(); + int sectorCu = (int)rpcIdCu.sector(); + int subsectorCu = (int)rpcIdCu.subsector(); + int ringCu = (int)rpcIdCu.ring(); + int rollCu = (int)(rpcIdCu.roll()); + int phiIntCu = (int)cppf_digis2.phi_int(); + int thetaIntCu = (int)cppf_digis2.theta_int(); + int phiGlobalCu = (int)cppf_digis2.phi_glob(); + int thetaGlobalCu = (int)cppf_digis2.theta_glob(); + int cluster_sizeCu = (int)cppf_digis2.cluster_size(); + int bxCu = (int)cppf_digis2.bx(); + int emtfSectorCu = (int)cppf_digis2.emtf_sector(); + int emtfSubsectorCu = GetSubsector(emtfSectorCu, subsectorCu); + int fillOccupancyCu = occupancy_value(regionCu, stationCu, ringCu); + + int nsubCu = 6; + (ringCu == 1 && stationCu > 1) ? nsubCu = 3 : nsubCu = 6; + int chamberIDCu = subsectorCu + nsubCu * (sectorCu - 1); + std::ostringstream oss2; + oss2 << regionCu << stationCu << ringCu << sectorCu << subsectorCu << emtfSectorCu << emtfSubsectorCu; + std::istringstream iss2(oss2.str()); + int unique_id; + iss2 >> unique_id; + if (_nHit_Cu.find(unique_id) == _nHit_Cu.end()) { // chamber had no hit so far + _nHit_Cu.insert({unique_id, 1}); + _phi_Cu[unique_id].push_back(phiIntCu); + _theta_Cu[unique_id].push_back(thetaIntCu); + _phi_glob_Cu[unique_id].push_back(phiGlobalCu); + _theta_glob_Cu[unique_id].push_back(thetaGlobalCu); + _ID_Cu[unique_id].push_back(chamberIDCu); + _zone_Cu[unique_id].push_back(fillOccupancyCu); + _roll_Cu[unique_id].push_back(rollCu); + _emtfSubsector_Cu[unique_id].push_back(emtfSubsectorCu); + _emtfSector_Cu[unique_id].push_back(emtfSectorCu); + _bx_Cu[unique_id].push_back(bxCu); + _cluster_size_Cu[unique_id].push_back(cluster_sizeCu); + } else { + _nHit_Cu.at(unique_id) += 1; + _phi_Cu[unique_id].push_back(phiIntCu); + _theta_Cu[unique_id].push_back(thetaIntCu); + _phi_glob_Cu[unique_id].push_back(phiGlobalCu); + _theta_glob_Cu[unique_id].push_back(thetaGlobalCu); + _ID_Cu[unique_id].push_back(chamberIDCu); + _zone_Cu[unique_id].push_back(fillOccupancyCu); + _roll_Cu[unique_id].push_back(rollCu); + _emtfSubsector_Cu[unique_id].push_back(emtfSubsectorCu); + _emtfSector_Cu[unique_id].push_back(emtfSectorCu); + _bx_Cu[unique_id].push_back(bxCu); + _cluster_size_Cu[unique_id].push_back(cluster_sizeCu); + } + } // END: : for(auto& cppf_digis2 : *CppfDigis2) + + for (auto const& Ce : _nHit_Ce) { + int key_Ce = Ce.first; + int nHit_Ce = Ce.second; + + for (auto const& Cu : _nHit_Cu) { + int key_Cu = Cu.first; + int nHit_Cu = Cu.second; + + if (key_Ce != key_Cu) + continue; + if (nHit_Ce != nHit_Cu) + continue; + + for (int vecSize = 0; vecSize < nHit_Cu; ++vecSize) { + if (_bx_Cu.at(key_Cu)[vecSize] != _bx_Ce.at(key_Ce)[vecSize]) + continue; + + bool OnPhi_Matching = false; + int index_Ce = vecSize; + int index_Cu = vecSize; + for (int i = 0; i < nHit_Ce; ++i) { + if (_phi_Ce.at(key_Ce)[i] == _phi_Cu.at(key_Cu)[vecSize]) { + OnPhi_Matching = true; + index_Cu = vecSize; + index_Ce = i; + } + } + if (OnPhi_Matching) { + h2_Matching_SameKey_OnPhi_phi_Ce_phi_Cu_bx->Fill(_phi_Ce.at(key_Ce)[index_Ce], _phi_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OnPhi_theta_Ce_theta_Cu_bx->Fill(_theta_Ce.at(key_Ce)[index_Ce], + _theta_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OnPhi_zone_Ce_zone_Cu_bx->Fill(_zone_Ce.at(key_Ce)[index_Ce], + _zone_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OnPhi_ID_Ce_ID_Cu_bx->Fill(_ID_Ce.at(key_Ce)[index_Ce], _ID_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OnPhi_ID_Ce_roll_Ce_bx->Fill(_ID_Ce.at(key_Ce)[index_Ce], _roll_Ce.at(key_Ce)[index_Ce]); + } else { + h2_Matching_SameKey_OffPhi_phi_Ce_phi_Cu_bx->Fill(_phi_Ce.at(key_Ce)[index_Ce], _phi_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OffPhi_theta_Ce_theta_Cu_bx->Fill(_theta_Ce.at(key_Ce)[index_Ce], + _theta_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OffPhi_zone_Ce_zone_Cu_bx->Fill(_zone_Ce.at(key_Ce)[index_Ce], + _zone_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OffPhi_ID_Ce_ID_Cu_bx->Fill(_ID_Ce.at(key_Ce)[index_Ce], _ID_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OffPhi_ID_Ce_roll_Ce_bx->Fill(_ID_Ce.at(key_Ce)[index_Ce], _roll_Ce.at(key_Ce)[index_Ce]); + } + + bool OnTheta_Matching = false; + for (int i = 0; i < nHit_Ce; ++i) { + if (_theta_Ce.at(key_Ce)[i] == _theta_Cu.at(key_Cu)[index_Cu]) { + OnTheta_Matching = true; + index_Cu = vecSize; + index_Ce = i; + } + } + if (OnTheta_Matching) { + h2_Matching_SameKey_OnTheta_phi_Ce_phi_Cu_bx->Fill(_phi_Ce.at(key_Ce)[index_Ce], + _phi_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OnTheta_theta_Ce_theta_Cu_bx->Fill(_theta_Ce.at(key_Ce)[index_Ce], + _theta_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OnTheta_zone_Ce_zone_Cu_bx->Fill(_zone_Ce.at(key_Ce)[index_Ce], + _zone_Cu.at(key_Cu)[index_Cu]); + } else { + h2_Matching_SameKey_OffTheta_phi_Ce_phi_Cu_bx->Fill(_phi_Ce.at(key_Ce)[index_Ce], + _phi_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OffTheta_theta_Ce_theta_Cu_bx->Fill(_theta_Ce.at(key_Ce)[index_Ce], + _theta_Cu.at(key_Cu)[index_Cu]); + h2_Matching_SameKey_OffTheta_zone_Ce_zone_Cu_bx->Fill(_zone_Ce.at(key_Ce)[index_Ce], + _zone_Cu.at(key_Cu)[index_Cu]); + } + } + } + } +} int L1TdeStage2CPPF::GetSubsector(int emtfsector_, int lsubsector_) { - const int nsectors = 6; - int gsubsector = 0; - if ((emtfsector_ != -99) and (lsubsector_ != 0)) { - gsubsector = (emtfsector_ - 1)*nsectors + lsubsector_; - } - return gsubsector; + const int nsectors = 6; + int gsubsector = 0; + if ((emtfsector_ != -99) and (lsubsector_ != 0)) { + gsubsector = (emtfsector_ - 1) * nsectors + lsubsector_; + } + return gsubsector; } -int L1TdeStage2CPPF::occupancy_value(int region_, int station_, int ring_){ - +int L1TdeStage2CPPF::occupancy_value(int region_, int station_, int ring_) { int fill_val = 0; - if(region_ == -1){ - - if((station_ == 4) && (ring_ == 3)) fill_val = 1; - else if ((station_ == 4) && (ring_ == 2)) fill_val = 2; - else if ((station_ == 3) && (ring_ == 3)) fill_val = 3; - else if ((station_ == 3) && (ring_ == 2)) fill_val = 4; - else if ((station_ == 2) && (ring_ == 2)) fill_val = 5; - else if ((station_ == 1) && (ring_ == 2)) fill_val = 6; - - } - else if(region_ == +1){ - - if((station_ == 1) && (ring_ == 2)) fill_val = 7; - else if((station_ == 2) && (ring_ == 2)) fill_val = 8; - else if((station_ == 3) && (ring_ == 2)) fill_val = 9; - else if((station_ == 3) && (ring_ == 3)) fill_val = 10; - else if((station_ == 4) && (ring_ == 2)) fill_val = 11; - else if((station_ == 4) && (ring_ == 3)) fill_val = 12; - + if (region_ == -1) { + if ((station_ == 4) && (ring_ == 3)) + fill_val = 1; + else if ((station_ == 4) && (ring_ == 2)) + fill_val = 2; + else if ((station_ == 3) && (ring_ == 3)) + fill_val = 3; + else if ((station_ == 3) && (ring_ == 2)) + fill_val = 4; + else if ((station_ == 2) && (ring_ == 2)) + fill_val = 5; + else if ((station_ == 1) && (ring_ == 2)) + fill_val = 6; + + } else if (region_ == +1) { + if ((station_ == 1) && (ring_ == 2)) + fill_val = 7; + else if ((station_ == 2) && (ring_ == 2)) + fill_val = 8; + else if ((station_ == 3) && (ring_ == 2)) + fill_val = 9; + else if ((station_ == 3) && (ring_ == 3)) + fill_val = 10; + else if ((station_ == 4) && (ring_ == 2)) + fill_val = 11; + else if ((station_ == 4) && (ring_ == 3)) + fill_val = 12; } return fill_val; } -int L1TdeStage2CPPF::bx_value(int region_, int emtfsector_){ - +int L1TdeStage2CPPF::bx_value(int region_, int emtfsector_) { int fill_val = 0; - - if(region_ == -1){ - - if(emtfsector_ == 1) fill_val = 6; - else if(emtfsector_ == 2) fill_val = 5; - else if(emtfsector_ == 3) fill_val = 4; - else if(emtfsector_ == 4) fill_val = 3; - else if(emtfsector_ == 5) fill_val = 2; - else if(emtfsector_ == 6) fill_val = 1; - + + if (region_ == -1) { + if (emtfsector_ == 1) + fill_val = 6; + else if (emtfsector_ == 2) + fill_val = 5; + else if (emtfsector_ == 3) + fill_val = 4; + else if (emtfsector_ == 4) + fill_val = 3; + else if (emtfsector_ == 5) + fill_val = 2; + else if (emtfsector_ == 6) + fill_val = 1; + } - - else if(region_ == +1){ - - if(emtfsector_ == 1) fill_val = 7; - else if(emtfsector_ == 2) fill_val = 8; - else if(emtfsector_ == 3) fill_val = 9; - else if(emtfsector_ == 4) fill_val = 10; - else if(emtfsector_ == 5) fill_val = 11; - else if(emtfsector_ == 6) fill_val = 12; + + else if (region_ == +1) { + if (emtfsector_ == 1) + fill_val = 7; + else if (emtfsector_ == 2) + fill_val = 8; + else if (emtfsector_ == 3) + fill_val = 9; + else if (emtfsector_ == 4) + fill_val = 10; + else if (emtfsector_ == 5) + fill_val = 11; + else if (emtfsector_ == 6) + fill_val = 12; } return fill_val; } diff --git a/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.cc b/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.cc index 062fa0cc50cad..ab893d3c55783 100644 --- a/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.cc +++ b/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.cc @@ -257,14 +257,14 @@ void RPCCPPFUnpacker::processTXRecord(RPCAMCLink link, static int const station[6] = {1, 2, 3, 3, 4, 4}; int region(link.getAMCNumber() < 7 ? 1 : -1); unsigned int endcap_sector((35 + (link.getAMCNumber() - (region > 0 ? 3 : 7)) * 9 + (block >> 1)) % 36 + 1); - unsigned int emtf_link(((34+(link.getAMCNumber() - (region > 0 ? 3 : 7)) * 9 + (block >> 1))%36)%6 +1); - unsigned int emtf_sector(((34+(link.getAMCNumber() - (region > 0 ? 3 : 7)) * 9 + (block >> 1))%36)/6 + 1); + unsigned int emtf_link(((34 + (link.getAMCNumber() - (region > 0 ? 3 : 7)) * 9 + (block >> 1)) % 36) % 6 + 1); + unsigned int emtf_sector(((34 + (link.getAMCNumber() - (region > 0 ? 3 : 7)) * 9 + (block >> 1)) % 36) / 6 + 1); RPCDetId rpc_id(region, ring[word] // ring , station[word] // station , - ((endcap_sector-1) / 6) + 1 // sector + ((endcap_sector - 1) / 6) + 1 // sector , 1 // layer , @@ -273,10 +273,12 @@ void RPCCPPFUnpacker::processTXRecord(RPCAMCLink link, 0); // roll if (record.isValid(0)) { - rpc_cppf_digis.push_back(l1t::CPPFDigi(rpc_id, 0, record.getPhi(0), record.getTheta(0), 0, 0, 0, emtf_sector, emtf_link, 0, 0, 0, 0) ); + rpc_cppf_digis.push_back( + l1t::CPPFDigi(rpc_id, 0, record.getPhi(0), record.getTheta(0), 0, 0, 0, emtf_sector, emtf_link, 0, 0, 0, 0)); } if (record.isValid(1)) { - rpc_cppf_digis.push_back(l1t::CPPFDigi(rpc_id, 0, record.getPhi(1), record.getTheta(1), 1, 0, 0, emtf_sector, emtf_link, 0, 0, 0, 0) ); + rpc_cppf_digis.push_back( + l1t::CPPFDigi(rpc_id, 0, record.getPhi(1), record.getTheta(1), 1, 0, 0, emtf_sector, emtf_link, 0, 0, 0, 0)); } } diff --git a/L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc b/L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc index c525edac875f3..59f141d131c1c 100644 --- a/L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc +++ b/L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc @@ -17,7 +17,7 @@ EmulateCPPF::EmulateCPPF(const edm::ParameterSet &iConfig, edm::ConsumesCollecto recHitToken_(iConsumes.consumes(iConfig.getParameter("recHitLabel"))), rpcDigiSimLinkToken_(iConsumes.consumes >( iConfig.getParameter("rpcDigiSimLinkLabel"))), - rpcGeomToken_(iConsumes.esConsumes()), + rpcGeomToken_(iConsumes.esConsumes()), cppfSource_(CppfSource::EventSetup), MaxClusterSize_(0) { MaxClusterSize_ = iConfig.getParameter("MaxClusterSize"); @@ -56,12 +56,18 @@ EmulateCPPF::~EmulateCPPF() {} void EmulateCPPF::process(const edm::Event &iEvent, const edm::EventSetup &iSetup, l1t::CPPFDigiCollection &cppf_recHit) { - if (cppfSource_ == CppfSource::File) { // Using the look up table to fill the information cppf_recHit.clear(); for (auto &recHit_processor : recHit_processors_) { - recHit_processor.processLook( - iEvent, iSetup, recHitToken_, rpcDigiToken_, rpcDigiSimLinkToken_, rpcGeomToken_, CppfVec_1, cppf_recHit, MaxClusterSize_); + recHit_processor.processLook(iEvent, + iSetup, + recHitToken_, + rpcDigiToken_, + rpcDigiSimLinkToken_, + rpcGeomToken_, + CppfVec_1, + cppf_recHit, + MaxClusterSize_); } } else if (cppfSource_ == CppfSource::EventSetup) { // Clear output collections @@ -81,7 +87,8 @@ void EmulateCPPF::process(const edm::Event &iEvent, // cppf_rpcDigi ); // } for (auto &recHit_processor : recHit_processors_) { - recHit_processor.process(iEvent, iSetup, recHitToken_, rpcDigiToken_, rpcDigiSimLinkToken_, rpcGeomToken_, cppf_recHit); + recHit_processor.process( + iEvent, iSetup, recHitToken_, rpcDigiToken_, rpcDigiSimLinkToken_, rpcGeomToken_, cppf_recHit); } } } // End void EmulateCPPF::process() diff --git a/L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc b/L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc index 824585cc1652a..e14b99d883744 100644 --- a/L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc +++ b/L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc @@ -17,7 +17,7 @@ void RecHitProcessor::processLook(const edm::Event &iEvent, const edm::EDGetToken &recHitToken, const edm::EDGetToken &rpcDigiToken, const edm::EDGetToken &rpcDigiSimLinkToken, - const edm::ESGetToken &rpcGeomToken, + const edm::ESGetToken &rpcGeomToken, std::vector &CppfVec1, l1t::CPPFDigiCollection &cppfDigis, const int MaxClusterSize) const { @@ -30,8 +30,7 @@ void RecHitProcessor::processLook(const edm::Event &iEvent, edm::Handle> theSimlinkDigis; iEvent.getByToken(rpcDigiSimLinkToken, theSimlinkDigis); - const auto& rpcGeom = iSetup.getData(rpcGeomToken); - + const auto &rpcGeom = iSetup.getData(rpcGeomToken); for (const auto &&rpcdgIt : (*rpcDigis)) { const RPCDetId &rpcId = rpcdgIt.first; @@ -285,10 +284,10 @@ void RecHitProcessor::process(const edm::Event &iEvent, const edm::EDGetToken &recHitToken, const edm::EDGetToken &rpcDigiToken, const edm::EDGetToken &rpcDigiSimLinkToken, - const edm::ESGetToken &rpcGeomToken, + const edm::ESGetToken &rpcGeomToken, l1t::CPPFDigiCollection &cppfDigis) const { // Get the RPC Geometry - const auto& rpcGeom = iSetup.getData(rpcGeomToken); + const auto &rpcGeom = iSetup.getData(rpcGeomToken); edm::Handle rpcDigis; iEvent.getByToken(rpcDigiToken, rpcDigis);