41 LogTrace(
"DQMOffline|MuonDPG|RPCTnPEfficiencyTask") <<
"[RPCTnPEfficiencyTask]: Constructor" << std::endl;
45 LogTrace(
"DQMOffline|MuonDPG|RPCTnPEfficiencyTask")
46 <<
"[RPCTnPEfficiencyTask]: analyzed " <<
m_nEvents <<
" events" << std::endl;
54 LogTrace(
"DQMOffline|MuonDPG|RPCTnPEfficiencyTask") <<
"[RPCTnPEfficiencyTask]: bookHistograms" << std::endl;
70 iBooker.
book1D(
"RPC_nPassingProbe_Barrel_allCh_1D",
"RPC_nPassingProbe_Barrel_allCh_1D", 20, 0.5, 20.5);
72 iBooker.
book1D(
"RPC_nFailingProbe_Barrel_allCh_1D",
"RPC_nFailingProbe_Barrel_allCh_1D", 20, 0.5, 20.5);
75 iBooker.
book1D(
"RPC_nPassingProbe_Endcap_allCh_1D",
"RPC_nPassingProbe_Endcap_allCh_1D", 9, -4., 5.);
77 iBooker.
book1D(
"RPC_nFailingProbe_Endcap_allCh_1D",
"RPC_nFailingProbe_Endcap_allCh_1D", 9, -4., 5.);
79 me_RPC_barrel_pass_allCh_1D->
setBinLabel(1,
"RB1/YB-2", 1);
80 me_RPC_barrel_pass_allCh_1D->
setBinLabel(2,
"RB2/YB-2", 1);
81 me_RPC_barrel_pass_allCh_1D->
setBinLabel(3,
"RB3/YB-2", 1);
82 me_RPC_barrel_pass_allCh_1D->
setBinLabel(4,
"RB4/YB-2", 1);
83 me_RPC_barrel_pass_allCh_1D->
setBinLabel(5,
"RB1/YB-1", 1);
84 me_RPC_barrel_pass_allCh_1D->
setBinLabel(6,
"RB2/YB-1", 1);
85 me_RPC_barrel_pass_allCh_1D->
setBinLabel(7,
"RB3/YB-1", 1);
86 me_RPC_barrel_pass_allCh_1D->
setBinLabel(8,
"RB4/YB-1", 1);
87 me_RPC_barrel_pass_allCh_1D->
setBinLabel(9,
"RB1/YB0", 1);
88 me_RPC_barrel_pass_allCh_1D->
setBinLabel(10,
"RB2/YB0", 1);
89 me_RPC_barrel_pass_allCh_1D->
setBinLabel(11,
"RB3/YB0", 1);
90 me_RPC_barrel_pass_allCh_1D->
setBinLabel(12,
"RB4/YB0", 1);
91 me_RPC_barrel_pass_allCh_1D->
setBinLabel(13,
"RB1/YB1", 1);
92 me_RPC_barrel_pass_allCh_1D->
setBinLabel(14,
"RB2/YB1", 1);
93 me_RPC_barrel_pass_allCh_1D->
setBinLabel(15,
"RB3/YB1", 1);
94 me_RPC_barrel_pass_allCh_1D->
setBinLabel(16,
"RB4/YB1", 1);
95 me_RPC_barrel_pass_allCh_1D->
setBinLabel(17,
"RB1/YB2", 1);
96 me_RPC_barrel_pass_allCh_1D->
setBinLabel(18,
"RB2/YB2", 1);
97 me_RPC_barrel_pass_allCh_1D->
setBinLabel(19,
"RB3/YB2", 1);
98 me_RPC_barrel_pass_allCh_1D->
setBinLabel(20,
"RB4/YB2", 1);
99 me_RPC_barrel_pass_allCh_1D->
setAxisTitle(
"Number of passing probes", 2);
101 me_RPC_barrel_fail_allCh_1D->
setBinLabel(1,
"RB1/YB-2", 1);
102 me_RPC_barrel_fail_allCh_1D->
setBinLabel(2,
"RB2/YB-2", 1);
103 me_RPC_barrel_fail_allCh_1D->
setBinLabel(3,
"RB3/YB-2", 1);
104 me_RPC_barrel_fail_allCh_1D->
setBinLabel(4,
"RB4/YB-2", 1);
105 me_RPC_barrel_fail_allCh_1D->
setBinLabel(5,
"RB1/YB-1", 1);
106 me_RPC_barrel_fail_allCh_1D->
setBinLabel(6,
"RB2/YB-1", 1);
107 me_RPC_barrel_fail_allCh_1D->
setBinLabel(7,
"RB3/YB-1", 1);
108 me_RPC_barrel_fail_allCh_1D->
setBinLabel(8,
"RB4/YB-1", 1);
109 me_RPC_barrel_fail_allCh_1D->
setBinLabel(9,
"RB1/YB0", 1);
110 me_RPC_barrel_fail_allCh_1D->
setBinLabel(10,
"RB2/YB0", 1);
111 me_RPC_barrel_fail_allCh_1D->
setBinLabel(11,
"RB3/YB0", 1);
112 me_RPC_barrel_fail_allCh_1D->
setBinLabel(12,
"RB4/YB0", 1);
113 me_RPC_barrel_fail_allCh_1D->
setBinLabel(13,
"RB1/YB1", 1);
114 me_RPC_barrel_fail_allCh_1D->
setBinLabel(14,
"RB2/YB1", 1);
115 me_RPC_barrel_fail_allCh_1D->
setBinLabel(15,
"RB3/YB1", 1);
116 me_RPC_barrel_fail_allCh_1D->
setBinLabel(16,
"RB4/YB1", 1);
117 me_RPC_barrel_fail_allCh_1D->
setBinLabel(17,
"RB1/YB2", 1);
118 me_RPC_barrel_fail_allCh_1D->
setBinLabel(18,
"RB2/YB2", 1);
119 me_RPC_barrel_fail_allCh_1D->
setBinLabel(19,
"RB3/YB2", 1);
120 me_RPC_barrel_fail_allCh_1D->
setBinLabel(20,
"RB4/YB2", 1);
121 me_RPC_barrel_fail_allCh_1D->
setAxisTitle(
"Number of failing probes", 2);
123 me_RPC_endcap_pass_allCh_1D->
setBinLabel(1,
"RE-4", 1);
124 me_RPC_endcap_pass_allCh_1D->
setBinLabel(2,
"RE-3", 1);
125 me_RPC_endcap_pass_allCh_1D->
setBinLabel(3,
"RE-2", 1);
126 me_RPC_endcap_pass_allCh_1D->
setBinLabel(4,
"RE-1", 1);
127 me_RPC_endcap_pass_allCh_1D->
setBinLabel(6,
"RE1", 1);
128 me_RPC_endcap_pass_allCh_1D->
setBinLabel(7,
"RE2", 1);
129 me_RPC_endcap_pass_allCh_1D->
setBinLabel(8,
"RE3", 1);
130 me_RPC_endcap_pass_allCh_1D->
setBinLabel(9,
"RE4", 1);
131 me_RPC_endcap_pass_allCh_1D->
setAxisTitle(
"Number of passing probes", 2);
133 me_RPC_endcap_fail_allCh_1D->
setBinLabel(1,
"RE-4", 1);
134 me_RPC_endcap_fail_allCh_1D->
setBinLabel(2,
"RE-3", 1);
135 me_RPC_endcap_fail_allCh_1D->
setBinLabel(3,
"RE-2", 1);
136 me_RPC_endcap_fail_allCh_1D->
setBinLabel(4,
"RE-1", 1);
137 me_RPC_endcap_fail_allCh_1D->
setBinLabel(6,
"RE1", 1);
138 me_RPC_endcap_fail_allCh_1D->
setBinLabel(7,
"RE2", 1);
139 me_RPC_endcap_fail_allCh_1D->
setBinLabel(8,
"RE3", 1);
140 me_RPC_endcap_fail_allCh_1D->
setBinLabel(9,
"RE4", 1);
141 me_RPC_endcap_fail_allCh_1D->
setAxisTitle(
"Number of failing probes", 2);
143 m_histos[
"RPC_nPassingProbe_Barrel_allCh_1D"] = me_RPC_barrel_pass_allCh_1D;
144 m_histos[
"RPC_nFailingProbe_Barrel_allCh_1D"] = me_RPC_barrel_fail_allCh_1D;
146 m_histos[
"RPC_nPassingProbe_Endcap_allCh_1D"] = me_RPC_endcap_pass_allCh_1D;
147 m_histos[
"RPC_nFailingProbe_Endcap_allCh_1D"] = me_RPC_endcap_fail_allCh_1D;
157 std::vector<std::vector<int>> probe_coll_RPC_region;
158 std::vector<std::vector<int>> probe_coll_RPC_ring;
159 std::vector<std::vector<int>> probe_coll_RPC_sta;
160 std::vector<std::vector<int>> probe_coll_RPC_sec;
161 std::vector<std::vector<int>> probe_coll_RPC_lay;
162 std::vector<std::vector<int>> probe_coll_RPC_sub;
163 std::vector<std::vector<int>> probe_coll_RPC_roll;
164 std::vector<std::vector<float>> probe_coll_RPC_dx;
165 std::vector<uint8_t> probe_coll_RPC_staMatch;
167 std::vector<unsigned> probe_indices;
172 for (
const auto i : probe_indices) {
174 std::vector<int> probe_RPC_region;
175 std::vector<int> probe_RPC_ring;
176 std::vector<int> probe_RPC_sta;
177 std::vector<int> probe_RPC_sec;
178 std::vector<int> probe_RPC_lay;
179 std::vector<int> probe_RPC_sub;
180 std::vector<int> probe_RPC_roll;
181 std::vector<float> probe_RPC_dx;
182 uint8_t RPC_stationMatching = 0;
184 float rpc_matched =
false;
186 for (
const auto& chambMatch : (*muons).at(
i).matches()) {
192 RPCDetId chId(chambMatch.id.rawId());
194 int region = chId.region();
195 int ring = chId.ring();
197 int sector = chId.sector();
198 int subsector = chId.subsector();
199 int layer = chId.layer();
200 int roll = chId.roll();
203 double smallestDx = 999.;
204 for (
auto& seg : chambMatch.rpcMatches) {
207 if (
dx < smallestDx) {
209 closest_matchedRPCHit = seg;
213 RPC_stationMatching = RPC_stationMatching | (1 << (
station - 1));
215 probe_RPC_region.push_back(
region);
216 probe_RPC_ring.push_back(
ring);
217 probe_RPC_sta.push_back(
station);
218 probe_RPC_sec.push_back(sector);
219 probe_RPC_lay.push_back(
layer);
220 probe_RPC_sub.push_back(subsector);
221 probe_RPC_roll.push_back(roll);
222 probe_RPC_dx.push_back(smallestDx);
230 m_histos.find(
"probeEta")->second->Fill((*muons).at(
i).eta());
231 m_histos.find(
"probePhi")->second->Fill((*muons).at(
i).phi());
232 m_histos.find(
"probeNumberOfMatchedStations")->second->Fill((*muons).at(
i).numberOfMatchedStations());
233 m_histos.find(
"probePt")->second->Fill((*muons).at(
i).pt());
237 probe_coll_RPC_region.push_back(probe_RPC_region);
238 probe_coll_RPC_ring.push_back(probe_RPC_ring);
239 probe_coll_RPC_sta.push_back(probe_RPC_sta);
240 probe_coll_RPC_sec.push_back(probe_RPC_sec);
241 probe_coll_RPC_lay.push_back(probe_RPC_lay);
242 probe_coll_RPC_sub.push_back(probe_RPC_sub);
243 probe_coll_RPC_roll.push_back(probe_RPC_roll);
244 probe_coll_RPC_dx.push_back(probe_RPC_dx);
245 probe_coll_RPC_staMatch.push_back(RPC_stationMatching);
249 for (
unsigned i = 0;
i < probe_indices.size(); ++
i) {
250 uint8_t RPC_matchPatt = probe_coll_RPC_staMatch.at(
i);
253 unsigned nRPC_matches = probe_coll_RPC_region.at(
i).size();
254 for (
unsigned j = 0;
j < nRPC_matches; ++
j) {
256 int RPC_region = probe_coll_RPC_region.at(
i).at(
j);
257 int RPC_ring = probe_coll_RPC_ring.at(
i).at(
j);
258 int RPC_sta = probe_coll_RPC_sta.at(
i).at(
j);
259 int RPC_sec = probe_coll_RPC_sec.at(
i).at(
j);
260 int RPC_lay = probe_coll_RPC_lay.at(
i).at(
j);
261 int RPC_subsec = probe_coll_RPC_sub.at(
i).at(
j);
262 int RPC_roll = probe_coll_RPC_roll.at(
i).at(
j);
263 float RPC_dx = probe_coll_RPC_dx.at(
i).at(
j);
266 if ((RPC_matchPatt & (1 << (RPC_sta - 1))) != 0)
270 if (RPC_region == 0) {
271 int barrel_histo_xcoord = RPC_sec;
272 int barrel_histo_ycoord =
276 m_histos.find(hName)->second->Fill(barrel_histo_xcoord, barrel_histo_ycoord);
279 m_histos.find(hName_1D)->second->Fill(barrel_histo_ycoord);
281 m_histos.find(
"RPC_nPassingProbe_Barrel_allCh_1D")->second->Fill((RPC_sta) + 4 * (RPC_ring + 2));
285 int endcap_histo_xcoord = (6 * (RPC_sec - 1)) + RPC_subsec;
286 int endcap_histo_ycoord = (3 * (RPC_ring - 2)) + RPC_roll;
290 m_histos.find(hName)->second->Fill(endcap_histo_xcoord, endcap_histo_ycoord);
294 m_histos.find(hName_1D)->second->Fill(endcap_histo_ycoord);
296 m_histos.find(
"RPC_nPassingProbe_Endcap_allCh_1D")->second->Fill(RPC_region * RPC_sta);
300 if (RPC_region == 0) {
301 int barrel_histo_xcoord = RPC_sec;
302 int barrel_histo_ycoord =
306 m_histos.find(hName)->second->Fill(barrel_histo_xcoord, barrel_histo_ycoord);
309 m_histos.find(hName_1D)->second->Fill(barrel_histo_ycoord);
311 m_histos.find(
"RPC_nFailingProbe_Barrel_allCh_1D")->second->Fill((RPC_sta) + 4 * (RPC_ring + 2));
315 int endcap_histo_xcoord = (6 * (RPC_sec - 1)) + RPC_subsec;
316 int endcap_histo_ycoord = (3 * (RPC_ring - 2)) + RPC_roll;
320 m_histos.find(hName)->second->Fill(endcap_histo_xcoord, endcap_histo_ycoord);
324 m_histos.find(hName_1D)->second->Fill(endcap_histo_ycoord);
326 m_histos.find(
"RPC_nFailingProbe_Endcap_allCh_1D")->second->Fill(RPC_region * RPC_sta);
338 LogTrace(
"DQMOffline|MuonDPG|RPCTnPEfficiencyTask")
339 <<
"[RPCTnPEfficiencyTask]: booking histos in " <<
baseDir << std::endl;
348 iBooker.
book2D(hName_RPC_pass.c_str(), hName_RPC_pass.c_str(), 12, 0.5, 12.5, 21, 0., 21.5);
350 iBooker.
book2D(hName_RPC_fail.c_str(), hName_RPC_fail.c_str(), 12, 0.5, 12.5, 21, 0., 21.5);
352 MonitorElement* me_RPC_pass_1D = iBooker.
book1D(hName_RPC_pass_1D.c_str(), hName_RPC_pass_1D.c_str(), 21, 0., 21.5);
353 MonitorElement* me_RPC_fail_1D = iBooker.
book1D(hName_RPC_fail_1D.c_str(), hName_RPC_fail_1D.c_str(), 21, 0., 21.5);
384 for (
int i = 1;
i < 13; ++
i) {
388 me_RPC_pass->
setAxisTitle(
"Number of passing probes", 3);
419 for (
int i = 1;
i < 13; ++
i) {
423 me_RPC_fail->
setAxisTitle(
"Number of failing probes", 3);
454 me_RPC_pass->
setAxisTitle(
"Number of passing probes", 2);
485 me_RPC_fail_1D->
setAxisTitle(
"Number of failing probes", 2);
487 m_histos[hName_RPC_pass] = me_RPC_pass;
488 m_histos[hName_RPC_fail] = me_RPC_fail;
490 m_histos[hName_RPC_pass_1D] = me_RPC_pass_1D;
491 m_histos[hName_RPC_fail_1D] = me_RPC_fail_1D;
498 LogTrace(
"DQMOffline|MuonDPG|RPCTnPEfficiencyTask")
499 <<
"[RPCTnPEfficiencyTask]: booking histos in " <<
baseDir << std::endl;
508 iBooker.
book2D(hName_RPC_pass.c_str(), hName_RPC_pass.c_str(), 36, 0.5, 36.5, 6, 0.5, 6.5);
510 iBooker.
book2D(hName_RPC_fail.c_str(), hName_RPC_fail.c_str(), 36, 0.5, 36.5, 6, 0.5, 6.5);
512 MonitorElement* me_RPC_pass_1D = iBooker.
book1D(hName_RPC_pass_1D.c_str(), hName_RPC_pass_1D.c_str(), 6, 0.5, 6.5);
513 MonitorElement* me_RPC_fail_1D = iBooker.
book1D(hName_RPC_fail_1D.c_str(), hName_RPC_fail_1D.c_str(), 6, 0.5, 6.5);
521 for (
int i = 1;
i < 37; ++
i) {
525 me_RPC_pass->
setAxisTitle(
"Number of passing probes", 3);
534 for (
int i = 1;
i < 37; ++
i) {
538 me_RPC_fail->
setAxisTitle(
"Number of failing probes", 3);
547 me_RPC_pass_1D->
setAxisTitle(
"Number of passing probes", 2);
556 me_RPC_fail_1D->
setAxisTitle(
"Number of failing probes", 2);
559 m_histos[hName_RPC_pass] = me_RPC_pass;
560 m_histos[hName_RPC_fail] = me_RPC_fail;
562 m_histos[hName_RPC_pass_1D] = me_RPC_pass_1D;
563 m_histos[hName_RPC_fail_1D] = me_RPC_fail_1D;
577 roll = roll > 1 ? 2 : 1;
579 layer_roll = (
a * (
layer - 1)) + roll;
581 layer_roll = (2 * (
layer - 1)) + roll;
584 ycoord = (4 * (
station - 1)) + layer_roll;
586 roll = roll > 1 ? 2 : 1;
587 ycoord = 9 + (4 * (
station - 3)) + (2 * (subsector - 1)) + roll;
589 int my_subsector = subsector;
614 roll = roll > 1 ? 2 : 1;
615 ycoord = 9 + (4 * (
station - 3)) + (2 * (my_subsector - 1)) + roll;
virtual void setTitle(const std::string &title)
set (ie. change) histogram/profile title
virtual void setCurrentFolder(std::string const &fullpath)
RPCTnPEfficiencyTask(const edm::ParameterSet &config)
Constructor.
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< reco::MuonCollection > m_muToken
int get_barrel_histo_ycoord(int ring, int station, int sector, int layer, int subsector, int roll)
void analyze(const edm::Event &event, const edm::EventSetup &context) override
Analyze.
std::string to_string(const V &value)
constexpr std::array< uint8_t, layerIndexSize > layer
void bookEndcapHistos(DQMStore::IBooker &iBooker, int stations, std::string folder="")
Book endcap histograms.
std::vector< std::vector< unsigned > > m_probeIndices
const bool m_detailedAnalysis
std::string topFolder() const override
Return the top folder.
~RPCTnPEfficiencyTask() override
Destructor.
Abs< T >::type abs(const T &t)
std::map< std::string, MonitorElement * > m_histos
void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &context) override
void analyze(const edm::Event &event, const edm::EventSetup &context) override
Analyze.
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &context) override
void bookWheelHistos(DQMStore::IBooker &iBooker, int wheel, std::string folder="")
Book wheel granularity histograms.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)