File indexing completed on 2024-04-06 12:09:43
0001
0002
0003
0004
0005
0006
0007
0008 #include "FWCore/Framework/interface/MakerMacros.h"
0009
0010 #include "DataFormats/MuonReco/interface/MuonSegmentMatch.h"
0011 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0012
0013 #include "DQMOffline/MuonDPG/interface/BaseTnPEfficiencyTask.h"
0014
0015 class RPCTnPEfficiencyTask : public BaseTnPEfficiencyTask {
0016 public:
0017
0018 RPCTnPEfficiencyTask(const edm::ParameterSet& config);
0019
0020
0021 ~RPCTnPEfficiencyTask() override;
0022
0023 protected:
0024 std::string topFolder() const override;
0025
0026 void bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const& context) override;
0027
0028
0029 void bookWheelHistos(DQMStore::IBooker& iBooker, int wheel, std::string folder = "");
0030
0031
0032 void bookEndcapHistos(DQMStore::IBooker& iBooker, int stations, std::string folder = "");
0033
0034 int get_barrel_histo_ycoord(int ring, int station, int sector, int layer, int subsector, int roll);
0035
0036
0037 void analyze(const edm::Event& event, const edm::EventSetup& context) override;
0038 };
0039
0040 RPCTnPEfficiencyTask::RPCTnPEfficiencyTask(const edm::ParameterSet& config) : BaseTnPEfficiencyTask(config) {
0041 LogTrace("DQMOffline|MuonDPG|RPCTnPEfficiencyTask") << "[RPCTnPEfficiencyTask]: Constructor" << std::endl;
0042 }
0043
0044 RPCTnPEfficiencyTask::~RPCTnPEfficiencyTask() {
0045 LogTrace("DQMOffline|MuonDPG|RPCTnPEfficiencyTask")
0046 << "[RPCTnPEfficiencyTask]: analyzed " << m_nEvents << " events" << std::endl;
0047 }
0048
0049 void RPCTnPEfficiencyTask::bookHistograms(DQMStore::IBooker& iBooker,
0050 edm::Run const& run,
0051 edm::EventSetup const& context) {
0052 BaseTnPEfficiencyTask::bookHistograms(iBooker, run, context);
0053
0054 LogTrace("DQMOffline|MuonDPG|RPCTnPEfficiencyTask") << "[RPCTnPEfficiencyTask]: bookHistograms" << std::endl;
0055
0056 for (int wheel = -2; wheel <= 2; ++wheel) {
0057 bookWheelHistos(iBooker, wheel, "Task");
0058 }
0059
0060 for (int station = -4; station <= 4; ++station) {
0061 if (station == 0)
0062 continue;
0063 bookEndcapHistos(iBooker, station, "Task");
0064 }
0065
0066 auto baseDir = topFolder() + "Task/";
0067 iBooker.setCurrentFolder(baseDir);
0068
0069 MonitorElement* me_RPC_barrel_pass_allCh_1D =
0070 iBooker.book1D("RPC_nPassingProbe_Barrel_allCh_1D", "RPC_nPassingProbe_Barrel_allCh_1D", 20, 0.5, 20.5);
0071 MonitorElement* me_RPC_barrel_fail_allCh_1D =
0072 iBooker.book1D("RPC_nFailingProbe_Barrel_allCh_1D", "RPC_nFailingProbe_Barrel_allCh_1D", 20, 0.5, 20.5);
0073
0074 MonitorElement* me_RPC_endcap_pass_allCh_1D =
0075 iBooker.book1D("RPC_nPassingProbe_Endcap_allCh_1D", "RPC_nPassingProbe_Endcap_allCh_1D", 9, -4., 5.);
0076 MonitorElement* me_RPC_endcap_fail_allCh_1D =
0077 iBooker.book1D("RPC_nFailingProbe_Endcap_allCh_1D", "RPC_nFailingProbe_Endcap_allCh_1D", 9, -4., 5.);
0078
0079 me_RPC_barrel_pass_allCh_1D->setBinLabel(1, "RB1/YB-2", 1);
0080 me_RPC_barrel_pass_allCh_1D->setBinLabel(2, "RB2/YB-2", 1);
0081 me_RPC_barrel_pass_allCh_1D->setBinLabel(3, "RB3/YB-2", 1);
0082 me_RPC_barrel_pass_allCh_1D->setBinLabel(4, "RB4/YB-2", 1);
0083 me_RPC_barrel_pass_allCh_1D->setBinLabel(5, "RB1/YB-1", 1);
0084 me_RPC_barrel_pass_allCh_1D->setBinLabel(6, "RB2/YB-1", 1);
0085 me_RPC_barrel_pass_allCh_1D->setBinLabel(7, "RB3/YB-1", 1);
0086 me_RPC_barrel_pass_allCh_1D->setBinLabel(8, "RB4/YB-1", 1);
0087 me_RPC_barrel_pass_allCh_1D->setBinLabel(9, "RB1/YB0", 1);
0088 me_RPC_barrel_pass_allCh_1D->setBinLabel(10, "RB2/YB0", 1);
0089 me_RPC_barrel_pass_allCh_1D->setBinLabel(11, "RB3/YB0", 1);
0090 me_RPC_barrel_pass_allCh_1D->setBinLabel(12, "RB4/YB0", 1);
0091 me_RPC_barrel_pass_allCh_1D->setBinLabel(13, "RB1/YB1", 1);
0092 me_RPC_barrel_pass_allCh_1D->setBinLabel(14, "RB2/YB1", 1);
0093 me_RPC_barrel_pass_allCh_1D->setBinLabel(15, "RB3/YB1", 1);
0094 me_RPC_barrel_pass_allCh_1D->setBinLabel(16, "RB4/YB1", 1);
0095 me_RPC_barrel_pass_allCh_1D->setBinLabel(17, "RB1/YB2", 1);
0096 me_RPC_barrel_pass_allCh_1D->setBinLabel(18, "RB2/YB2", 1);
0097 me_RPC_barrel_pass_allCh_1D->setBinLabel(19, "RB3/YB2", 1);
0098 me_RPC_barrel_pass_allCh_1D->setBinLabel(20, "RB4/YB2", 1);
0099 me_RPC_barrel_pass_allCh_1D->setAxisTitle("Number of passing probes", 2);
0100
0101 me_RPC_barrel_fail_allCh_1D->setBinLabel(1, "RB1/YB-2", 1);
0102 me_RPC_barrel_fail_allCh_1D->setBinLabel(2, "RB2/YB-2", 1);
0103 me_RPC_barrel_fail_allCh_1D->setBinLabel(3, "RB3/YB-2", 1);
0104 me_RPC_barrel_fail_allCh_1D->setBinLabel(4, "RB4/YB-2", 1);
0105 me_RPC_barrel_fail_allCh_1D->setBinLabel(5, "RB1/YB-1", 1);
0106 me_RPC_barrel_fail_allCh_1D->setBinLabel(6, "RB2/YB-1", 1);
0107 me_RPC_barrel_fail_allCh_1D->setBinLabel(7, "RB3/YB-1", 1);
0108 me_RPC_barrel_fail_allCh_1D->setBinLabel(8, "RB4/YB-1", 1);
0109 me_RPC_barrel_fail_allCh_1D->setBinLabel(9, "RB1/YB0", 1);
0110 me_RPC_barrel_fail_allCh_1D->setBinLabel(10, "RB2/YB0", 1);
0111 me_RPC_barrel_fail_allCh_1D->setBinLabel(11, "RB3/YB0", 1);
0112 me_RPC_barrel_fail_allCh_1D->setBinLabel(12, "RB4/YB0", 1);
0113 me_RPC_barrel_fail_allCh_1D->setBinLabel(13, "RB1/YB1", 1);
0114 me_RPC_barrel_fail_allCh_1D->setBinLabel(14, "RB2/YB1", 1);
0115 me_RPC_barrel_fail_allCh_1D->setBinLabel(15, "RB3/YB1", 1);
0116 me_RPC_barrel_fail_allCh_1D->setBinLabel(16, "RB4/YB1", 1);
0117 me_RPC_barrel_fail_allCh_1D->setBinLabel(17, "RB1/YB2", 1);
0118 me_RPC_barrel_fail_allCh_1D->setBinLabel(18, "RB2/YB2", 1);
0119 me_RPC_barrel_fail_allCh_1D->setBinLabel(19, "RB3/YB2", 1);
0120 me_RPC_barrel_fail_allCh_1D->setBinLabel(20, "RB4/YB2", 1);
0121 me_RPC_barrel_fail_allCh_1D->setAxisTitle("Number of failing probes", 2);
0122
0123 me_RPC_endcap_pass_allCh_1D->setBinLabel(1, "RE-4", 1);
0124 me_RPC_endcap_pass_allCh_1D->setBinLabel(2, "RE-3", 1);
0125 me_RPC_endcap_pass_allCh_1D->setBinLabel(3, "RE-2", 1);
0126 me_RPC_endcap_pass_allCh_1D->setBinLabel(4, "RE-1", 1);
0127 me_RPC_endcap_pass_allCh_1D->setBinLabel(6, "RE1", 1);
0128 me_RPC_endcap_pass_allCh_1D->setBinLabel(7, "RE2", 1);
0129 me_RPC_endcap_pass_allCh_1D->setBinLabel(8, "RE3", 1);
0130 me_RPC_endcap_pass_allCh_1D->setBinLabel(9, "RE4", 1);
0131 me_RPC_endcap_pass_allCh_1D->setAxisTitle("Number of passing probes", 2);
0132
0133 me_RPC_endcap_fail_allCh_1D->setBinLabel(1, "RE-4", 1);
0134 me_RPC_endcap_fail_allCh_1D->setBinLabel(2, "RE-3", 1);
0135 me_RPC_endcap_fail_allCh_1D->setBinLabel(3, "RE-2", 1);
0136 me_RPC_endcap_fail_allCh_1D->setBinLabel(4, "RE-1", 1);
0137 me_RPC_endcap_fail_allCh_1D->setBinLabel(6, "RE1", 1);
0138 me_RPC_endcap_fail_allCh_1D->setBinLabel(7, "RE2", 1);
0139 me_RPC_endcap_fail_allCh_1D->setBinLabel(8, "RE3", 1);
0140 me_RPC_endcap_fail_allCh_1D->setBinLabel(9, "RE4", 1);
0141 me_RPC_endcap_fail_allCh_1D->setAxisTitle("Number of failing probes", 2);
0142
0143 m_histos["RPC_nPassingProbe_Barrel_allCh_1D"] = me_RPC_barrel_pass_allCh_1D;
0144 m_histos["RPC_nFailingProbe_Barrel_allCh_1D"] = me_RPC_barrel_fail_allCh_1D;
0145
0146 m_histos["RPC_nPassingProbe_Endcap_allCh_1D"] = me_RPC_endcap_pass_allCh_1D;
0147 m_histos["RPC_nFailingProbe_Endcap_allCh_1D"] = me_RPC_endcap_fail_allCh_1D;
0148 }
0149
0150 void RPCTnPEfficiencyTask::analyze(const edm::Event& event, const edm::EventSetup& context) {
0151 BaseTnPEfficiencyTask::analyze(event, context);
0152
0153 edm::Handle<reco::MuonCollection> muons;
0154 event.getByToken(m_muToken, muons);
0155
0156
0157 std::vector<std::vector<int>> probe_coll_RPC_region;
0158 std::vector<std::vector<int>> probe_coll_RPC_ring;
0159 std::vector<std::vector<int>> probe_coll_RPC_sta;
0160 std::vector<std::vector<int>> probe_coll_RPC_sec;
0161 std::vector<std::vector<int>> probe_coll_RPC_lay;
0162 std::vector<std::vector<int>> probe_coll_RPC_sub;
0163 std::vector<std::vector<int>> probe_coll_RPC_roll;
0164 std::vector<std::vector<float>> probe_coll_RPC_dx;
0165 std::vector<uint8_t> probe_coll_RPC_staMatch;
0166
0167 std::vector<unsigned> probe_indices;
0168 if (!m_probeIndices.empty())
0169 probe_indices = m_probeIndices.back();
0170
0171
0172 for (const auto i : probe_indices) {
0173
0174 std::vector<int> probe_RPC_region;
0175 std::vector<int> probe_RPC_ring;
0176 std::vector<int> probe_RPC_sta;
0177 std::vector<int> probe_RPC_sec;
0178 std::vector<int> probe_RPC_lay;
0179 std::vector<int> probe_RPC_sub;
0180 std::vector<int> probe_RPC_roll;
0181 std::vector<float> probe_RPC_dx;
0182 uint8_t RPC_stationMatching = 0;
0183
0184 float rpc_matched = false;
0185
0186 for (const auto& chambMatch : (*muons).at(i).matches()) {
0187
0188 if (chambMatch.detector() == MuonSubdetId::RPC) {
0189 if (chambMatch.edgeX < m_borderCut && chambMatch.edgeY < m_borderCut) {
0190 rpc_matched = true;
0191
0192 RPCDetId chId(chambMatch.id.rawId());
0193
0194 int region = chId.region();
0195 int ring = chId.ring();
0196 int station = chId.station();
0197 int sector = chId.sector();
0198 int subsector = chId.subsector();
0199 int layer = chId.layer();
0200 int roll = chId.roll();
0201
0202 reco::MuonRPCHitMatch closest_matchedRPCHit;
0203 double smallestDx = 999.;
0204 for (auto& seg : chambMatch.rpcMatches) {
0205 float dx = std::abs(chambMatch.x - seg.x);
0206
0207 if (dx < smallestDx) {
0208 smallestDx = dx;
0209 closest_matchedRPCHit = seg;
0210 }
0211 }
0212
0213 RPC_stationMatching = RPC_stationMatching | (1 << (station - 1));
0214
0215 probe_RPC_region.push_back(region);
0216 probe_RPC_ring.push_back(ring);
0217 probe_RPC_sta.push_back(station);
0218 probe_RPC_sec.push_back(sector);
0219 probe_RPC_lay.push_back(layer);
0220 probe_RPC_sub.push_back(subsector);
0221 probe_RPC_roll.push_back(roll);
0222 probe_RPC_dx.push_back(smallestDx);
0223 }
0224 } else
0225 continue;
0226 }
0227
0228
0229 if (m_detailedAnalysis && rpc_matched) {
0230 m_histos.find("probeEta")->second->Fill((*muons).at(i).eta());
0231 m_histos.find("probePhi")->second->Fill((*muons).at(i).phi());
0232 m_histos.find("probeNumberOfMatchedStations")->second->Fill((*muons).at(i).numberOfMatchedStations());
0233 m_histos.find("probePt")->second->Fill((*muons).at(i).pt());
0234 }
0235
0236
0237 probe_coll_RPC_region.push_back(probe_RPC_region);
0238 probe_coll_RPC_ring.push_back(probe_RPC_ring);
0239 probe_coll_RPC_sta.push_back(probe_RPC_sta);
0240 probe_coll_RPC_sec.push_back(probe_RPC_sec);
0241 probe_coll_RPC_lay.push_back(probe_RPC_lay);
0242 probe_coll_RPC_sub.push_back(probe_RPC_sub);
0243 probe_coll_RPC_roll.push_back(probe_RPC_roll);
0244 probe_coll_RPC_dx.push_back(probe_RPC_dx);
0245 probe_coll_RPC_staMatch.push_back(RPC_stationMatching);
0246 }
0247
0248
0249 for (unsigned i = 0; i < probe_indices.size(); ++i) {
0250 uint8_t RPC_matchPatt = probe_coll_RPC_staMatch.at(i);
0251
0252
0253 unsigned nRPC_matches = probe_coll_RPC_region.at(i).size();
0254 for (unsigned j = 0; j < nRPC_matches; ++j) {
0255
0256 int RPC_region = probe_coll_RPC_region.at(i).at(j);
0257 int RPC_ring = probe_coll_RPC_ring.at(i).at(j);
0258 int RPC_sta = probe_coll_RPC_sta.at(i).at(j);
0259 int RPC_sec = probe_coll_RPC_sec.at(i).at(j);
0260 int RPC_lay = probe_coll_RPC_lay.at(i).at(j);
0261 int RPC_subsec = probe_coll_RPC_sub.at(i).at(j);
0262 int RPC_roll = probe_coll_RPC_roll.at(i).at(j);
0263 float RPC_dx = probe_coll_RPC_dx.at(i).at(j);
0264
0265
0266 if ((RPC_matchPatt & (1 << (RPC_sta - 1))) != 0)
0267 {
0268 if (RPC_dx < m_dxCut) {
0269
0270 if (RPC_region == 0) {
0271 int barrel_histo_xcoord = RPC_sec;
0272 int barrel_histo_ycoord =
0273 get_barrel_histo_ycoord(RPC_ring, RPC_sta, RPC_sec, RPC_lay, RPC_subsec, RPC_roll);
0274
0275 std::string hName = std::string("RPC_nPassingProbePerRoll_Barrel_W") + std::to_string(RPC_ring);
0276 m_histos.find(hName)->second->Fill(barrel_histo_xcoord, barrel_histo_ycoord);
0277
0278 std::string hName_1D = std::string("RPC_nPassingProbePerRoll_Barrel_1D_W") + std::to_string(RPC_ring);
0279 m_histos.find(hName_1D)->second->Fill(barrel_histo_ycoord);
0280
0281 m_histos.find("RPC_nPassingProbe_Barrel_allCh_1D")->second->Fill((RPC_sta) + 4 * (RPC_ring + 2));
0282 }
0283
0284 else {
0285 int endcap_histo_xcoord = (6 * (RPC_sec - 1)) + RPC_subsec;
0286 int endcap_histo_ycoord = (3 * (RPC_ring - 2)) + RPC_roll;
0287
0288 std::string hName =
0289 std::string("RPC_nPassingProbePerRoll_Endcap_Sta") + std::to_string(RPC_sta * RPC_region);
0290 m_histos.find(hName)->second->Fill(endcap_histo_xcoord, endcap_histo_ycoord);
0291
0292 std::string hName_1D =
0293 std::string("RPC_nPassingProbePerRoll_Endcap_1D_Sta") + std::to_string(RPC_sta * RPC_region);
0294 m_histos.find(hName_1D)->second->Fill(endcap_histo_ycoord);
0295
0296 m_histos.find("RPC_nPassingProbe_Endcap_allCh_1D")->second->Fill(RPC_region * RPC_sta);
0297 }
0298 } else {
0299
0300 if (RPC_region == 0) {
0301 int barrel_histo_xcoord = RPC_sec;
0302 int barrel_histo_ycoord =
0303 get_barrel_histo_ycoord(RPC_ring, RPC_sta, RPC_sec, RPC_lay, RPC_subsec, RPC_roll);
0304
0305 std::string hName = std::string("RPC_nFailingProbePerRoll_Barrel_W") + std::to_string(RPC_ring);
0306 m_histos.find(hName)->second->Fill(barrel_histo_xcoord, barrel_histo_ycoord);
0307
0308 std::string hName_1D = std::string("RPC_nFailingProbePerRoll_Barrel_1D_W") + std::to_string(RPC_ring);
0309 m_histos.find(hName_1D)->second->Fill(barrel_histo_ycoord);
0310
0311 m_histos.find("RPC_nFailingProbe_Barrel_allCh_1D")->second->Fill((RPC_sta) + 4 * (RPC_ring + 2));
0312 }
0313
0314 else {
0315 int endcap_histo_xcoord = (6 * (RPC_sec - 1)) + RPC_subsec;
0316 int endcap_histo_ycoord = (3 * (RPC_ring - 2)) + RPC_roll;
0317
0318 std::string hName =
0319 std::string("RPC_nFailingProbePerRoll_Endcap_Sta") + std::to_string(RPC_sta * RPC_region);
0320 m_histos.find(hName)->second->Fill(endcap_histo_xcoord, endcap_histo_ycoord);
0321
0322 std::string hName_1D =
0323 std::string("RPC_nFailingProbePerRoll_Endcap_1D_Sta") + std::to_string(RPC_sta * RPC_region);
0324 m_histos.find(hName_1D)->second->Fill(endcap_histo_ycoord);
0325
0326 m_histos.find("RPC_nFailingProbe_Endcap_allCh_1D")->second->Fill(RPC_region * RPC_sta);
0327 }
0328 }
0329 }
0330 }
0331 }
0332 }
0333
0334 void RPCTnPEfficiencyTask::bookWheelHistos(DQMStore::IBooker& iBooker, int wheel, std::string folder) {
0335 auto baseDir = topFolder() + folder + "/";
0336 iBooker.setCurrentFolder(baseDir);
0337
0338 LogTrace("DQMOffline|MuonDPG|RPCTnPEfficiencyTask")
0339 << "[RPCTnPEfficiencyTask]: booking histos in " << baseDir << std::endl;
0340
0341 auto hName_RPC_pass = std::string("RPC_nPassingProbePerRoll_Barrel_W") + std::to_string(wheel);
0342 auto hName_RPC_fail = std::string("RPC_nFailingProbePerRoll_Barrel_W") + std::to_string(wheel);
0343
0344 auto hName_RPC_pass_1D = std::string("RPC_nPassingProbePerRoll_Barrel_1D_W") + std::to_string(wheel);
0345 auto hName_RPC_fail_1D = std::string("RPC_nFailingProbePerRoll_Barrel_1D_W") + std::to_string(wheel);
0346
0347 MonitorElement* me_RPC_pass =
0348 iBooker.book2D(hName_RPC_pass.c_str(), hName_RPC_pass.c_str(), 12, 0.5, 12.5, 21, 0., 21.5);
0349 MonitorElement* me_RPC_fail =
0350 iBooker.book2D(hName_RPC_fail.c_str(), hName_RPC_fail.c_str(), 12, 0.5, 12.5, 21, 0., 21.5);
0351
0352 MonitorElement* me_RPC_pass_1D = iBooker.book1D(hName_RPC_pass_1D.c_str(), hName_RPC_pass_1D.c_str(), 21, 0., 21.5);
0353 MonitorElement* me_RPC_fail_1D = iBooker.book1D(hName_RPC_fail_1D.c_str(), hName_RPC_fail_1D.c_str(), 21, 0., 21.5);
0354
0355 me_RPC_pass->setBinLabel(1, "RB1in B", 2);
0356 me_RPC_pass->setBinLabel(2, "RB1in F", 2);
0357 me_RPC_pass->setBinLabel(3, "RB1out B", 2);
0358 me_RPC_pass->setBinLabel(4, "RB1out F", 2);
0359 if (std::abs(wheel) < 2) {
0360 me_RPC_pass->setBinLabel(5, "RB2in B", 2);
0361 me_RPC_pass->setBinLabel(6, "RB2in M", 2);
0362 me_RPC_pass->setBinLabel(7, "RB2in F", 2);
0363 me_RPC_pass->setBinLabel(8, "RB2out B", 2);
0364 me_RPC_pass->setBinLabel(9, "RB2out F", 2);
0365 } else {
0366 me_RPC_pass->setBinLabel(5, "RB2in B", 2);
0367 me_RPC_pass->setBinLabel(6, "RB2in F", 2);
0368 me_RPC_pass->setBinLabel(7, "RB2out B", 2);
0369 me_RPC_pass->setBinLabel(8, "RB2out M", 2);
0370 me_RPC_pass->setBinLabel(9, "RB2out F", 2);
0371 }
0372 me_RPC_pass->setBinLabel(10, "RB3- B", 2);
0373 me_RPC_pass->setBinLabel(11, "RB3- F", 2);
0374 me_RPC_pass->setBinLabel(12, "RB3+ B", 2);
0375 me_RPC_pass->setBinLabel(13, "RB3+ F", 2);
0376 me_RPC_pass->setBinLabel(14, "RB4- B", 2);
0377 me_RPC_pass->setBinLabel(15, "RB4- F", 2);
0378 me_RPC_pass->setBinLabel(16, "RB4+ B", 2);
0379 me_RPC_pass->setBinLabel(17, "RB4+ F", 2);
0380 me_RPC_pass->setBinLabel(18, "RB4-- B", 2);
0381 me_RPC_pass->setBinLabel(19, "RB4-- F", 2);
0382 me_RPC_pass->setBinLabel(20, "RB4++ B", 2);
0383 me_RPC_pass->setBinLabel(21, "RB4++ F", 2);
0384 for (int i = 1; i < 13; ++i) {
0385 me_RPC_pass->setBinLabel(i, std::to_string(i), 1);
0386 }
0387 me_RPC_pass->setAxisTitle("Sector", 1);
0388 me_RPC_pass->setAxisTitle("Number of passing probes", 3);
0389
0390 me_RPC_fail->setBinLabel(1, "RB1in B", 2);
0391 me_RPC_fail->setBinLabel(2, "RB1in F", 2);
0392 me_RPC_fail->setBinLabel(3, "RB1out B", 2);
0393 me_RPC_fail->setBinLabel(4, "RB1out F", 2);
0394 if (std::abs(wheel) < 2) {
0395 me_RPC_fail->setBinLabel(5, "RB2in B", 2);
0396 me_RPC_fail->setBinLabel(6, "RB2in M", 2);
0397 me_RPC_fail->setBinLabel(7, "RB2in F", 2);
0398 me_RPC_fail->setBinLabel(8, "RB2out B", 2);
0399 me_RPC_fail->setBinLabel(9, "RB2out F", 2);
0400 } else {
0401 me_RPC_fail->setBinLabel(5, "RB2in B", 2);
0402 me_RPC_fail->setBinLabel(6, "RB2in F", 2);
0403 me_RPC_fail->setBinLabel(7, "RB2out B", 2);
0404 me_RPC_fail->setBinLabel(8, "RB2out M", 2);
0405 me_RPC_fail->setBinLabel(9, "RB2out F", 2);
0406 }
0407 me_RPC_fail->setBinLabel(10, "RB3- B", 2);
0408 me_RPC_fail->setBinLabel(11, "RB3- F", 2);
0409 me_RPC_fail->setBinLabel(12, "RB3+ B", 2);
0410 me_RPC_fail->setBinLabel(13, "RB3+ F", 2);
0411 me_RPC_fail->setBinLabel(14, "RB4- B", 2);
0412 me_RPC_fail->setBinLabel(15, "RB4- F", 2);
0413 me_RPC_fail->setBinLabel(16, "RB4+ B", 2);
0414 me_RPC_fail->setBinLabel(17, "RB4+ F", 2);
0415 me_RPC_fail->setBinLabel(18, "RB4-- B", 2);
0416 me_RPC_fail->setBinLabel(19, "RB4-- F", 2);
0417 me_RPC_fail->setBinLabel(20, "RB4++ B", 2);
0418 me_RPC_fail->setBinLabel(21, "RB4++ F", 2);
0419 for (int i = 1; i < 13; ++i) {
0420 me_RPC_fail->setBinLabel(i, std::to_string(i), 1);
0421 }
0422 me_RPC_fail->setAxisTitle("Sector", 1);
0423 me_RPC_fail->setAxisTitle("Number of failing probes", 3);
0424
0425 me_RPC_pass_1D->setBinLabel(1, "RB1in B", 1);
0426 me_RPC_pass_1D->setBinLabel(2, "RB1in F", 1);
0427 me_RPC_pass_1D->setBinLabel(3, "RB1out B", 1);
0428 me_RPC_pass_1D->setBinLabel(4, "RB1out F", 1);
0429 if (std::abs(wheel) < 2) {
0430 me_RPC_pass_1D->setBinLabel(5, "RB2in B", 1);
0431 me_RPC_pass_1D->setBinLabel(6, "RB2in M", 1);
0432 me_RPC_pass_1D->setBinLabel(7, "RB2in F", 1);
0433 me_RPC_pass_1D->setBinLabel(8, "RB2out B", 1);
0434 me_RPC_pass_1D->setBinLabel(9, "RB2out F", 1);
0435 } else {
0436 me_RPC_pass_1D->setBinLabel(5, "RB2in B", 1);
0437 me_RPC_pass_1D->setBinLabel(6, "RB2in F", 1);
0438 me_RPC_pass_1D->setBinLabel(7, "RB2out B", 1);
0439 me_RPC_pass_1D->setBinLabel(8, "RB2out M", 1);
0440 me_RPC_pass_1D->setBinLabel(9, "RB2out F", 1);
0441 }
0442 me_RPC_pass_1D->setBinLabel(10, "RB3- B", 1);
0443 me_RPC_pass_1D->setBinLabel(11, "RB3- F", 1);
0444 me_RPC_pass_1D->setBinLabel(12, "RB3+ B", 1);
0445 me_RPC_pass_1D->setBinLabel(13, "RB3+ F", 1);
0446 me_RPC_pass_1D->setBinLabel(14, "RB4- B", 1);
0447 me_RPC_pass_1D->setBinLabel(15, "RB4- F", 1);
0448 me_RPC_pass_1D->setBinLabel(16, "RB4+ B", 1);
0449 me_RPC_pass_1D->setBinLabel(17, "RB4+ F", 1);
0450 me_RPC_pass_1D->setBinLabel(18, "RB4-- B", 1);
0451 me_RPC_pass_1D->setBinLabel(19, "RB4-- F", 1);
0452 me_RPC_pass_1D->setBinLabel(20, "RB4++ B", 1);
0453 me_RPC_pass_1D->setBinLabel(21, "RB4++ F", 1);
0454 me_RPC_pass->setAxisTitle("Number of passing probes", 2);
0455
0456 me_RPC_fail_1D->setBinLabel(1, "RB1in B", 1);
0457 me_RPC_fail_1D->setBinLabel(2, "RB1in F", 1);
0458 me_RPC_fail_1D->setBinLabel(3, "RB1out B", 1);
0459 me_RPC_fail_1D->setBinLabel(4, "RB1out F", 1);
0460 if (std::abs(wheel) < 2) {
0461 me_RPC_fail_1D->setBinLabel(5, "RB2in B", 1);
0462 me_RPC_fail_1D->setBinLabel(6, "RB2in M", 1);
0463 me_RPC_fail_1D->setBinLabel(7, "RB2in F", 1);
0464 me_RPC_fail_1D->setBinLabel(8, "RB2out B", 1);
0465 me_RPC_fail_1D->setBinLabel(9, "RB2out F", 1);
0466 } else {
0467 me_RPC_fail_1D->setBinLabel(5, "RB2in B", 1);
0468 me_RPC_fail_1D->setBinLabel(6, "RB2in F", 1);
0469 me_RPC_fail_1D->setBinLabel(7, "RB2out B", 1);
0470 me_RPC_fail_1D->setBinLabel(8, "RB2out M", 1);
0471 me_RPC_fail_1D->setBinLabel(9, "RB2out F", 1);
0472 }
0473 me_RPC_fail_1D->setBinLabel(10, "RB3- B", 1);
0474 me_RPC_fail_1D->setBinLabel(11, "RB3- F", 1);
0475 me_RPC_fail_1D->setBinLabel(12, "RB3+ B", 1);
0476 me_RPC_fail_1D->setBinLabel(13, "RB3+ F", 1);
0477 me_RPC_fail_1D->setBinLabel(14, "RB4- B", 1);
0478 me_RPC_fail_1D->setBinLabel(15, "RB4- F", 1);
0479 me_RPC_fail_1D->setBinLabel(16, "RB4+ B", 1);
0480 me_RPC_fail_1D->setBinLabel(17, "RB4+ F", 1);
0481 me_RPC_fail_1D->setBinLabel(18, "RB4-- B", 1);
0482 me_RPC_fail_1D->setBinLabel(19, "RB4-- F", 1);
0483 me_RPC_fail_1D->setBinLabel(20, "RB4++ B", 1);
0484 me_RPC_fail_1D->setBinLabel(21, "RB4++ F", 1);
0485 me_RPC_fail_1D->setAxisTitle("Number of failing probes", 2);
0486
0487 m_histos[hName_RPC_pass] = me_RPC_pass;
0488 m_histos[hName_RPC_fail] = me_RPC_fail;
0489
0490 m_histos[hName_RPC_pass_1D] = me_RPC_pass_1D;
0491 m_histos[hName_RPC_fail_1D] = me_RPC_fail_1D;
0492 }
0493
0494 void RPCTnPEfficiencyTask::bookEndcapHistos(DQMStore::IBooker& iBooker, int station, std::string folder) {
0495 auto baseDir = topFolder() + folder + "/";
0496 iBooker.setCurrentFolder(baseDir);
0497
0498 LogTrace("DQMOffline|MuonDPG|RPCTnPEfficiencyTask")
0499 << "[RPCTnPEfficiencyTask]: booking histos in " << baseDir << std::endl;
0500
0501 auto hName_RPC_pass = std::string("RPC_nPassingProbePerRoll_Endcap_Sta") + std::to_string(station);
0502 auto hName_RPC_fail = std::string("RPC_nFailingProbePerRoll_Endcap_Sta") + std::to_string(station);
0503
0504 auto hName_RPC_pass_1D = std::string("RPC_nPassingProbePerRoll_Endcap_1D_Sta") + std::to_string(station);
0505 auto hName_RPC_fail_1D = std::string("RPC_nFailingProbePerRoll_Endcap_1D_Sta") + std::to_string(station);
0506
0507 MonitorElement* me_RPC_pass =
0508 iBooker.book2D(hName_RPC_pass.c_str(), hName_RPC_pass.c_str(), 36, 0.5, 36.5, 6, 0.5, 6.5);
0509 MonitorElement* me_RPC_fail =
0510 iBooker.book2D(hName_RPC_fail.c_str(), hName_RPC_fail.c_str(), 36, 0.5, 36.5, 6, 0.5, 6.5);
0511
0512 MonitorElement* me_RPC_pass_1D = iBooker.book1D(hName_RPC_pass_1D.c_str(), hName_RPC_pass_1D.c_str(), 6, 0.5, 6.5);
0513 MonitorElement* me_RPC_fail_1D = iBooker.book1D(hName_RPC_fail_1D.c_str(), hName_RPC_fail_1D.c_str(), 6, 0.5, 6.5);
0514
0515 me_RPC_pass->setBinLabel(1, "R2_A", 2);
0516 me_RPC_pass->setBinLabel(2, "R2_B", 2);
0517 me_RPC_pass->setBinLabel(3, "R2_C", 2);
0518 me_RPC_pass->setBinLabel(4, "R3_A", 2);
0519 me_RPC_pass->setBinLabel(5, "R3_B", 2);
0520 me_RPC_pass->setBinLabel(6, "R3_C", 2);
0521 for (int i = 1; i < 37; ++i) {
0522 me_RPC_pass->setBinLabel(i, std::to_string(i), 1);
0523 }
0524 me_RPC_pass->setAxisTitle("Sector", 1);
0525 me_RPC_pass->setAxisTitle("Number of passing probes", 3);
0526 me_RPC_pass->setTitle("RE" + std::to_string(station));
0527
0528 me_RPC_fail->setBinLabel(1, "R2_A", 2);
0529 me_RPC_fail->setBinLabel(2, "R2_B", 2);
0530 me_RPC_fail->setBinLabel(3, "R2_C", 2);
0531 me_RPC_fail->setBinLabel(4, "R3_A", 2);
0532 me_RPC_fail->setBinLabel(5, "R3_B", 2);
0533 me_RPC_fail->setBinLabel(6, "R3_C", 2);
0534 for (int i = 1; i < 37; ++i) {
0535 me_RPC_fail->setBinLabel(i, std::to_string(i), 1);
0536 }
0537 me_RPC_fail->setAxisTitle("Sector", 1);
0538 me_RPC_fail->setAxisTitle("Number of failing probes", 3);
0539 me_RPC_fail->setTitle("RE" + std::to_string(station));
0540
0541 me_RPC_pass_1D->setBinLabel(1, "R2_A", 1);
0542 me_RPC_pass_1D->setBinLabel(2, "R2_B", 1);
0543 me_RPC_pass_1D->setBinLabel(3, "R2_C", 1);
0544 me_RPC_pass_1D->setBinLabel(4, "R3_A", 1);
0545 me_RPC_pass_1D->setBinLabel(5, "R3_B", 1);
0546 me_RPC_pass_1D->setBinLabel(6, "R3_C", 1);
0547 me_RPC_pass_1D->setAxisTitle("Number of passing probes", 2);
0548 me_RPC_pass_1D->setTitle("RE" + std::to_string(station));
0549
0550 me_RPC_fail_1D->setBinLabel(1, "R2_A", 1);
0551 me_RPC_fail_1D->setBinLabel(2, "R2_B", 1);
0552 me_RPC_fail_1D->setBinLabel(3, "R2_C", 1);
0553 me_RPC_fail_1D->setBinLabel(4, "R3_A", 1);
0554 me_RPC_fail_1D->setBinLabel(5, "R3_B", 1);
0555 me_RPC_fail_1D->setBinLabel(6, "R3_C", 1);
0556 me_RPC_fail_1D->setAxisTitle("Number of failing probes", 2);
0557 me_RPC_fail_1D->setTitle("RE" + std::to_string(station));
0558
0559 m_histos[hName_RPC_pass] = me_RPC_pass;
0560 m_histos[hName_RPC_fail] = me_RPC_fail;
0561
0562 m_histos[hName_RPC_pass_1D] = me_RPC_pass_1D;
0563 m_histos[hName_RPC_fail_1D] = me_RPC_fail_1D;
0564 }
0565
0566 int RPCTnPEfficiencyTask::get_barrel_histo_ycoord(
0567 int ring, int station, int sector, int layer, int subsector, int roll) {
0568 int ycoord;
0569
0570 if (station < 3) {
0571
0572 bool three_rolls = station == 2 && ((std::abs(ring) > 1 && layer == 2) || (std::abs(ring) < 2 && layer == 1));
0573
0574 int layer_roll;
0575
0576 if (!three_rolls) {
0577 roll = roll > 1 ? 2 : 1;
0578 int a = station == 2 && std::abs(ring) < 2 && layer == 2 ? 3 : 2;
0579 layer_roll = (a * (layer - 1)) + roll;
0580 } else {
0581 layer_roll = (2 * (layer - 1)) + roll;
0582 }
0583
0584 ycoord = (4 * (station - 1)) + layer_roll;
0585 } else if (station == 3) {
0586 roll = roll > 1 ? 2 : 1;
0587 ycoord = 9 + (4 * (station - 3)) + (2 * (subsector - 1)) + roll;
0588 } else {
0589 int my_subsector = subsector;
0590
0591
0592
0593
0594
0595
0596
0597
0598 if (sector == 4) {
0599 switch (subsector) {
0600 case 1:
0601 my_subsector = 3;
0602 break;
0603 case 2:
0604 my_subsector = 1;
0605 break;
0606 case 3:
0607 my_subsector = 2;
0608 break;
0609 case 4:
0610 my_subsector = 4;
0611 break;
0612 }
0613 }
0614 roll = roll > 1 ? 2 : 1;
0615 ycoord = 9 + (4 * (station - 3)) + (2 * (my_subsector - 1)) + roll;
0616 }
0617
0618 return ycoord;
0619 }
0620
0621 std::string RPCTnPEfficiencyTask::topFolder() const { return "RPC/Segment_TnP/"; };
0622
0623 DEFINE_FWK_MODULE(RPCTnPEfficiencyTask);