CMS 3D CMS Logo

GEMTnPEfficiencyTask.cc
Go to the documentation of this file.
1 /*
2  * \file GEMTnPEfficiencyTask.cc
3  * \author Qianying
4  *
5  * \interited from the TnP framework of
6  * \author L. Lunerti - INFN Bologna
7  *
8  */
9 
11 
14 
16 
18 public:
21 
23  ~GEMTnPEfficiencyTask() override;
24 
25 protected:
26  std::string topFolder() const override;
27 
28  void bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const& context) override;
29 
31  void analyze(const edm::Event& event, const edm::EventSetup& context) override;
32 };
33 
35  LogTrace("DQMOffline|MuonDPG|GEMTnPEfficiencyTask") << "[GEMTnPEfficiencyTask]: Constructor" << std::endl;
36 }
37 
39  LogTrace("DQMOffline|MuonDPG|GEMTnPEfficiencyTask")
40  << "[GEMTnPEfficiencyTask]: analyzed " << m_nEvents << " events" << std::endl;
41 }
42 
44  edm::Run const& run,
45  edm::EventSetup const& context) {
47 
48  LogTrace("DQMOffline|MuonDPG|GEMTnPEfficiencyTask") << "[GEMTnPEfficiencyTask]: bookHistograms" << std::endl;
49 
50  auto baseDir = topFolder() + "Task/";
51  iBooker.setCurrentFolder(baseDir);
52 
53  MonitorElement* me_GEM_pass_Ch_region =
54  iBooker.book2D("GEM_nPassingProbe_Ch_region", "GEM_nPassingProbe_Ch_region", 2, -1.5, 1.5, 36, 1, 37);
55  MonitorElement* me_GEM_fail_Ch_region =
56  iBooker.book2D("GEM_nFailingProbe_Ch_region", "GEM_nFailingProbe_Ch_region", 2, -1.5, 1.5, 36, 1, 37);
57  MonitorElement* me_GEM_pass_Ch_region_GE1 =
58  iBooker.book2D("GEM_nPassingProbe_Ch_region_GE1", "GEM_nPassingProbe_Ch_region_GE1", 4, 0, 4, 36, 1, 37);
59  MonitorElement* me_GEM_fail_Ch_region_GE1 =
60  iBooker.book2D("GEM_nFailingProbe_Ch_region_GE1", "GEM_nFailingProbe_Ch_region_GE1", 4, 0, 4, 36, 1, 37);
61  MonitorElement* me_GEM_pass_Ch_region_GE1_NoL =
62  iBooker.book2D("GEM_nPassingProbe_Ch_region_GE1_NoL", "GEM_nPassingProbe_Ch_region_GE1_NoL", 2, 0, 2, 36, 1, 37);
63  MonitorElement* me_GEM_fail_Ch_region_GE1_NoL =
64  iBooker.book2D("GEM_nFailingProbe_Ch_region_GE1_NoL", "GEM_nFailingProbe_Ch_region_GE1_NoL", 2, 0, 2, 36, 1, 37);
65  MonitorElement* me_GEM_pass_Ch_eta =
66  iBooker.book2D("GEM_nPassingProbe_Ch_eta", "GEM_nPassingProbe_Ch_eta", 24, 0, 2.4, 36, 1, 37);
67  MonitorElement* me_GEM_fail_Ch_eta =
68  iBooker.book2D("GEM_nFailingProbe_Ch_eta", "GEM_nFailingProbe_Ch_eta", 24, 0, 2.4, 36, 1, 37);
69  MonitorElement* me_GEM_pass_Ch_phi =
70  iBooker.book2D("GEM_nPassingProbe_Ch_phi", "GEM_nPassingProbe_Ch_phi", 20, -TMath::Pi(), TMath::Pi(), 36, 1, 37);
71  MonitorElement* me_GEM_fail_Ch_phi =
72  iBooker.book2D("GEM_nFailingProbe_Ch_phi", "GEM_nFailingProbe_Ch_phi", 20, -TMath::Pi(), TMath::Pi(), 36, 1, 37);
73  MonitorElement* me_GEM_pass_allCh_1D =
74  iBooker.book1D("GEM_nPassingProbe_allCh_1D", "GEM_nPassingProbe_allCh_1D", 2, -1.5, 1.5);
75  MonitorElement* me_GEM_fail_allCh_1D =
76  iBooker.book1D("GEM_nFailingProbe_allCh_1D", "GEM_nFailingProbe_allCh_1D", 2, -1.5, 1.5);
77  MonitorElement* me_GEM_pass_chamber_1D =
78  iBooker.book1D("GEM_nPassingProbe_chamber_1D", "GEM_nPassingProbe_chamber_1D", 36, 1, 37);
79  MonitorElement* me_GEM_fail_chamber_1D =
80  iBooker.book1D("GEM_nFailingProbe_chamber_1D", "GEM_nFailingProbe_chamber_1D", 36, 1, 37);
81  MonitorElement* me_GEM_pass_chamber_p1_1D =
82  iBooker.book1D("GEM_nPassingProbe_chamber_p1_1D", "GEM_nPassingProbe_chamber_p1_1D", 36, 1, 37);
83  MonitorElement* me_GEM_fail_chamber_p1_1D =
84  iBooker.book1D("GEM_nFailingProbe_chamber_p1_1D", "GEM_nFailingProbe_chamber_p1_1D", 36, 1, 37);
85  MonitorElement* me_GEM_pass_chamber_p2_1D =
86  iBooker.book1D("GEM_nPassingProbe_chamber_p2_1D", "GEM_nPassingProbe_chamber_p2_1D", 36, 1, 37);
87  MonitorElement* me_GEM_fail_chamber_p2_1D =
88  iBooker.book1D("GEM_nFailingProbe_chamber_p2_1D", "GEM_nFailingProbe_chamber_p2_1D", 36, 1, 37);
89  MonitorElement* me_GEM_pass_chamber_n1_1D =
90  iBooker.book1D("GEM_nPassingProbe_chamber_n1_1D", "GEM_nPassingProbe_chamber_n1_1D", 36, 1, 37);
91  MonitorElement* me_GEM_fail_chamber_n1_1D =
92  iBooker.book1D("GEM_nFailingProbe_chamber_n1_1D", "GEM_nFailingProbe_chamber_n1_1D", 36, 1, 37);
93  MonitorElement* me_GEM_pass_chamber_n2_1D =
94  iBooker.book1D("GEM_nPassingProbe_chamber_n2_1D", "GEM_nPassingProbe_chamber_n2_1D", 36, 1, 37);
95  MonitorElement* me_GEM_fail_chamber_n2_1D =
96  iBooker.book1D("GEM_nFailingProbe_chamber_n2_1D", "GEM_nFailingProbe_chamber_n2_1D", 36, 1, 37);
97  //
98  MonitorElement* me_GEM_pass_pt_1D = iBooker.book1D("GEM_nPassingProbe_pt_1D", "GEM_nPassingProbe_pt_1D", 20, 0, 100);
99  MonitorElement* me_GEM_fail_pt_1D = iBooker.book1D("GEM_nFailingProbe_pt_1D", "GEM_nFailingProbe_pt_1D", 20, 0, 100);
100  MonitorElement* me_GEM_pass_eta_1D =
101  iBooker.book1D("GEM_nPassingProbe_eta_1D", "GEM_nPassingProbe_eta_1D", 24, 0, 2.4);
102  MonitorElement* me_GEM_fail_eta_1D =
103  iBooker.book1D("GEM_nFailingProbe_eta_1D", "GEM_nFailingProbe_eta_1D", 24, 0, 2.4);
104  MonitorElement* me_GEM_pass_phi_1D =
105  iBooker.book1D("GEM_nPassingProbe_phi_1D", "GEM_nPassingProbe_phi_1D", 20, -TMath::Pi(), TMath::Pi());
106  MonitorElement* me_GEM_fail_phi_1D =
107  iBooker.book1D("GEM_nFailingProbe_phi_1D", "GEM_nFailingProbe_phi_1D", 20, -TMath::Pi(), TMath::Pi());
109  MonitorElement* me_GEM_pass_pt_p1_1D =
110  iBooker.book1D("GEM_nPassingProbe_pt_p1_1D", "GEM_nPassingProbe_pt_p1_1D", 20, 0, 100);
111  MonitorElement* me_GEM_fail_pt_p1_1D =
112  iBooker.book1D("GEM_nFailingProbe_pt_p1_1D", "GEM_nFailingProbe_pt_p1_1D", 20, 0, 100);
113  MonitorElement* me_GEM_pass_eta_p1_1D =
114  iBooker.book1D("GEM_nPassingProbe_eta_p1_1D", "GEM_nPassingProbe_eta_p1_1D", 24, 0, 2.4);
115  MonitorElement* me_GEM_fail_eta_p1_1D =
116  iBooker.book1D("GEM_nFailingProbe_eta_p1_1D", "GEM_nFailingProbe_eta_p1_1D", 24, 0, 2.4);
117  MonitorElement* me_GEM_pass_phi_p1_1D =
118  iBooker.book1D("GEM_nPassingProbe_phi_p1_1D", "GEM_nPassingProbe_phi_p1_1D", 20, -TMath::Pi(), TMath::Pi());
119  MonitorElement* me_GEM_fail_phi_p1_1D =
120  iBooker.book1D("GEM_nFailingProbe_phi_p1_1D", "GEM_nFailingProbe_phi_p1_1D", 20, -TMath::Pi(), TMath::Pi());
121  MonitorElement* me_GEM_pass_pt_p2_1D =
122  iBooker.book1D("GEM_nPassingProbe_pt_p2_1D", "GEM_nPassingProbe_pt_p2_1D", 20, 0, 100);
123  MonitorElement* me_GEM_fail_pt_p2_1D =
124  iBooker.book1D("GEM_nFailingProbe_pt_p2_1D", "GEM_nFailingProbe_pt_p2_1D", 20, 0, 100);
125  MonitorElement* me_GEM_pass_eta_p2_1D =
126  iBooker.book1D("GEM_nPassingProbe_eta_p2_1D", "GEM_nPassingProbe_eta_p2_1D", 24, 0, 2.4);
127  MonitorElement* me_GEM_fail_eta_p2_1D =
128  iBooker.book1D("GEM_nFailingProbe_eta_p2_1D", "GEM_nFailingProbe_eta_p2_1D", 24, 0, 2.4);
129  MonitorElement* me_GEM_pass_phi_p2_1D =
130  iBooker.book1D("GEM_nPassingProbe_phi_p2_1D", "GEM_nPassingProbe_phi_p2_1D", 20, -TMath::Pi(), TMath::Pi());
131  MonitorElement* me_GEM_fail_phi_p2_1D =
132  iBooker.book1D("GEM_nFailingProbe_phi_p2_1D", "GEM_nFailingProbe_phi_p2_1D", 20, -TMath::Pi(), TMath::Pi());
133  MonitorElement* me_GEM_pass_pt_n1_1D =
134  iBooker.book1D("GEM_nPassingProbe_pt_n1_1D", "GEM_nPassingProbe_pt_n1_1D", 20, 0, 100);
135  MonitorElement* me_GEM_fail_pt_n1_1D =
136  iBooker.book1D("GEM_nFailingProbe_pt_n1_1D", "GEM_nFailingProbe_pt_n1_1D", 20, 0, 100);
137  MonitorElement* me_GEM_pass_eta_n1_1D =
138  iBooker.book1D("GEM_nPassingProbe_eta_n1_1D", "GEM_nPassingProbe_eta_n1_1D", 24, 0, 2.4);
139  MonitorElement* me_GEM_fail_eta_n1_1D =
140  iBooker.book1D("GEM_nFailingProbe_eta_n1_1D", "GEM_nFailingProbe_eta_n1_1D", 24, 0, 2.4);
141  MonitorElement* me_GEM_pass_phi_n1_1D =
142  iBooker.book1D("GEM_nPassingProbe_phi_n1_1D", "GEM_nPassingProbe_phi_n1_1D", 20, -TMath::Pi(), TMath::Pi());
143  MonitorElement* me_GEM_fail_phi_n1_1D =
144  iBooker.book1D("GEM_nFailingProbe_phi_n1_1D", "GEM_nFailingProbe_phi_n1_1D", 20, -TMath::Pi(), TMath::Pi());
145  MonitorElement* me_GEM_pass_pt_n2_1D =
146  iBooker.book1D("GEM_nPassingProbe_pt_n2_1D", "GEM_nPassingProbe_pt_n2_1D", 20, 0, 100);
147  MonitorElement* me_GEM_fail_pt_n2_1D =
148  iBooker.book1D("GEM_nFailingProbe_pt_n2_1D", "GEM_nFailingProbe_pt_n2_1D", 20, 0, 100);
149  MonitorElement* me_GEM_pass_eta_n2_1D =
150  iBooker.book1D("GEM_nPassingProbe_eta_n2_1D", "GEM_nPassingProbe_eta_n2_1D", 24, 0, 2.4);
151  MonitorElement* me_GEM_fail_eta_n2_1D =
152  iBooker.book1D("GEM_nFailingProbe_eta_n2_1D", "GEM_nFailingProbe_eta_n2_1D", 24, 0, 2.4);
153  MonitorElement* me_GEM_pass_phi_n2_1D =
154  iBooker.book1D("GEM_nPassingProbe_phi_n2_1D", "GEM_nPassingProbe_phi_n2_1D", 20, -TMath::Pi(), TMath::Pi());
155  MonitorElement* me_GEM_fail_phi_n2_1D =
156  iBooker.book1D("GEM_nFailingProbe_phi_n2_1D", "GEM_nFailingProbe_phi_n2_1D", 20, -TMath::Pi(), TMath::Pi());
158  MonitorElement* me_ME0_pass_chamber_1D =
159  iBooker.book1D("ME0_nPassingProbe_chamber_1D", "ME0_nPassingProbe_chamber_1D", 18, 1, 19);
160  MonitorElement* me_ME0_fail_chamber_1D =
161  iBooker.book1D("ME0_nFailingProbe_chamber_1D", "ME0_nFailingProbe_chamber_1D", 18, 1, 19);
162  MonitorElement* me_GEM_pass_Ch_region_layer_phase2 = iBooker.book2D(
163  "GEM_nPassingProbe_Ch_region_layer_phase2", "GEM_nPassingProbe_Ch_region_layer_phase2", 10, 0, 10, 36, 1, 37);
164  MonitorElement* me_GEM_fail_Ch_region_layer_phase2 = iBooker.book2D(
165  "GEM_nFailingProbe_Ch_region_layer_phase2", "GEM_nFailingProbe_Ch_region_layer_phase2", 10, 0, 10, 36, 1, 37);
166 
167  me_GEM_pass_allCh_1D->setBinLabel(1, "GE-11", 1);
168  me_GEM_pass_allCh_1D->setBinLabel(2, "GE11", 1);
169  me_GEM_pass_allCh_1D->setAxisTitle("Number of passing probes", 2);
170 
171  me_GEM_fail_allCh_1D->setBinLabel(1, "GE-11", 1);
172  me_GEM_fail_allCh_1D->setBinLabel(2, "GE11", 1);
173  me_GEM_fail_allCh_1D->setAxisTitle("Number of failing probes", 2);
174 
175  me_GEM_pass_chamber_1D->setAxisTitle("Chamber", 1);
176  me_GEM_pass_chamber_1D->setAxisTitle("Number of passing probes", 2);
177  me_GEM_fail_chamber_1D->setAxisTitle("Chamber", 1);
178  me_GEM_fail_chamber_1D->setAxisTitle("Number of failing probes", 2);
179 
180  me_GEM_pass_chamber_p1_1D->setAxisTitle("Chamber", 1);
181  me_GEM_pass_chamber_p1_1D->setAxisTitle("Number of passing probes", 2);
182  me_GEM_fail_chamber_p1_1D->setAxisTitle("Chamber", 1);
183  me_GEM_fail_chamber_p1_1D->setAxisTitle("Number of failing probes", 2);
184 
185  me_GEM_pass_chamber_p2_1D->setAxisTitle("Chamber", 1);
186  me_GEM_pass_chamber_p2_1D->setAxisTitle("Number of passing probes", 2);
187  me_GEM_fail_chamber_p2_1D->setAxisTitle("Chamber", 1);
188  me_GEM_fail_chamber_p2_1D->setAxisTitle("Number of failing probes", 2);
189 
190  me_GEM_pass_chamber_n1_1D->setAxisTitle("Chamber", 1);
191  me_GEM_pass_chamber_n1_1D->setAxisTitle("Number of passing probes", 2);
192  me_GEM_fail_chamber_n1_1D->setAxisTitle("Chamber", 1);
193  me_GEM_fail_chamber_n1_1D->setAxisTitle("Number of failing probes", 2);
194 
195  me_GEM_pass_chamber_n2_1D->setAxisTitle("Chamber", 1);
196  me_GEM_pass_chamber_n2_1D->setAxisTitle("Number of passing probes", 2);
197  me_GEM_fail_chamber_n2_1D->setAxisTitle("Chamber", 1);
198  me_GEM_fail_chamber_n2_1D->setAxisTitle("Number of failing probes", 2);
199 
200  me_GEM_pass_pt_1D->setAxisTitle("P_{T}", 1);
201  me_GEM_pass_pt_1D->setAxisTitle("Number of passing probes", 2);
202  me_GEM_fail_pt_1D->setAxisTitle("P_{T}", 1);
203  me_GEM_fail_pt_1D->setAxisTitle("Number of failing probes", 2);
204 
205  me_GEM_pass_eta_1D->setAxisTitle("#eta", 1);
206  me_GEM_pass_eta_1D->setAxisTitle("Number of passing probes", 2);
207  me_GEM_fail_eta_1D->setAxisTitle("#eta", 1);
208  me_GEM_fail_eta_1D->setAxisTitle("Number of failing probes", 2);
209 
210  me_GEM_pass_phi_1D->setAxisTitle("#phi", 1);
211  me_GEM_pass_phi_1D->setAxisTitle("Number of passing probes", 2);
212  me_GEM_fail_phi_1D->setAxisTitle("#phi", 1);
213  me_GEM_fail_phi_1D->setAxisTitle("Number of failing probes", 2);
214 
215  me_GEM_pass_pt_p1_1D->setAxisTitle("P_{T}", 1);
216  me_GEM_pass_pt_p1_1D->setAxisTitle("Number of passing probes", 2);
217  me_GEM_fail_pt_p1_1D->setAxisTitle("P_{T}", 1);
218  me_GEM_fail_pt_p1_1D->setAxisTitle("Number of failing probes", 2);
219 
220  me_GEM_pass_eta_p1_1D->setAxisTitle("#eta", 1);
221  me_GEM_pass_eta_p1_1D->setAxisTitle("Number of passing probes", 2);
222  me_GEM_fail_eta_p1_1D->setAxisTitle("#eta", 1);
223  me_GEM_fail_eta_p1_1D->setAxisTitle("Number of failing probes", 2);
224 
225  me_GEM_pass_phi_p1_1D->setAxisTitle("#phi", 1);
226  me_GEM_pass_phi_p1_1D->setAxisTitle("Number of passing probes", 2);
227  me_GEM_fail_phi_p1_1D->setAxisTitle("#phi", 1);
228  me_GEM_fail_phi_p1_1D->setAxisTitle("Number of failing probes", 2);
229 
230  me_GEM_pass_pt_p2_1D->setAxisTitle("P_{T}", 1);
231  me_GEM_pass_pt_p2_1D->setAxisTitle("Number of passing probes", 2);
232  me_GEM_fail_pt_p2_1D->setAxisTitle("P_{T}", 1);
233  me_GEM_fail_pt_p2_1D->setAxisTitle("Number of failing probes", 2);
234 
235  me_GEM_pass_eta_p2_1D->setAxisTitle("#eta", 1);
236  me_GEM_pass_eta_p2_1D->setAxisTitle("Number of passing probes", 2);
237  me_GEM_fail_eta_p2_1D->setAxisTitle("#eta", 1);
238  me_GEM_fail_eta_p2_1D->setAxisTitle("Number of failing probes", 2);
239 
240  me_GEM_pass_phi_p2_1D->setAxisTitle("#phi", 1);
241  me_GEM_pass_phi_p2_1D->setAxisTitle("Number of passing probes", 2);
242  me_GEM_fail_phi_p2_1D->setAxisTitle("#phi", 1);
243  me_GEM_fail_phi_p2_1D->setAxisTitle("Number of failing probes", 2);
244 
245  me_GEM_pass_pt_n1_1D->setAxisTitle("P_{T}", 1);
246  me_GEM_pass_pt_n1_1D->setAxisTitle("Number of passing probes", 2);
247  me_GEM_fail_pt_n1_1D->setAxisTitle("P_{T}", 1);
248  me_GEM_fail_pt_n1_1D->setAxisTitle("Number of failing probes", 2);
249 
250  me_GEM_pass_eta_n1_1D->setAxisTitle("#eta", 1);
251  me_GEM_pass_eta_n1_1D->setAxisTitle("Number of passing probes", 2);
252  me_GEM_fail_eta_n1_1D->setAxisTitle("#eta", 1);
253  me_GEM_fail_eta_n1_1D->setAxisTitle("Number of failing probes", 2);
254 
255  me_GEM_pass_phi_n1_1D->setAxisTitle("#phi", 1);
256  me_GEM_pass_phi_n1_1D->setAxisTitle("Number of passing probes", 2);
257  me_GEM_fail_phi_n1_1D->setAxisTitle("#phi", 1);
258  me_GEM_fail_phi_n1_1D->setAxisTitle("Number of failing probes", 2);
259 
260  me_GEM_pass_pt_n2_1D->setAxisTitle("P_{T}", 1);
261  me_GEM_pass_pt_n2_1D->setAxisTitle("Number of passing probes", 2);
262  me_GEM_fail_pt_n2_1D->setAxisTitle("P_{T}", 1);
263  me_GEM_fail_pt_n2_1D->setAxisTitle("Number of failing probes", 2);
264 
265  me_GEM_pass_eta_n2_1D->setAxisTitle("#eta", 1);
266  me_GEM_pass_eta_n2_1D->setAxisTitle("Number of passing probes", 2);
267  me_GEM_fail_eta_n2_1D->setAxisTitle("#eta", 1);
268  me_GEM_fail_eta_n2_1D->setAxisTitle("Number of failing probes", 2);
269 
270  me_GEM_pass_phi_n2_1D->setAxisTitle("#phi", 1);
271  me_GEM_pass_phi_n2_1D->setAxisTitle("Number of passing probes", 2);
272  me_GEM_fail_phi_n2_1D->setAxisTitle("#phi", 1);
273  me_GEM_fail_phi_n2_1D->setAxisTitle("Number of failing probes", 2);
274 
275  me_GEM_fail_Ch_region->setBinLabel(1, "GE-11", 1);
276  me_GEM_fail_Ch_region->setBinLabel(2, "GE11", 1);
277  for (int i = 1; i < 37; ++i) {
278  me_GEM_fail_Ch_region->setBinLabel(i, std::to_string(i), 2);
279  }
280  me_GEM_fail_Ch_region->setAxisTitle("Chamber", 2);
281  me_GEM_fail_Ch_region->setAxisTitle("Number of failing probes", 3);
282 
283  me_GEM_pass_Ch_region->setBinLabel(1, "GE-11", 1);
284  me_GEM_pass_Ch_region->setBinLabel(2, "GE11", 1);
285  for (int i = 1; i < 37; ++i) {
286  me_GEM_pass_Ch_region->setBinLabel(i, std::to_string(i), 2);
287  }
288  me_GEM_pass_Ch_region->setAxisTitle("Chamber", 2);
289  me_GEM_pass_Ch_region->setAxisTitle("Number of passing probes", 3);
290 
291  me_GEM_fail_Ch_region_GE1->setBinLabel(1, "GE-1/1_L2", 1);
292  me_GEM_fail_Ch_region_GE1->setBinLabel(2, "GE-1/1_L1", 1);
293  me_GEM_fail_Ch_region_GE1->setBinLabel(3, "GE1/1_L1", 1);
294  me_GEM_fail_Ch_region_GE1->setBinLabel(4, "GE1/1_L2", 1);
295  for (int i = 1; i < 37; ++i) {
296  me_GEM_fail_Ch_region_GE1->setBinLabel(i, std::to_string(i), 2);
297  }
298  me_GEM_fail_Ch_region_GE1->setAxisTitle("Chamber", 2);
299  me_GEM_fail_Ch_region_GE1->setAxisTitle("Number of passing probes", 3);
300 
301  me_GEM_pass_Ch_region_GE1->setBinLabel(1, "GE-1/1_L2", 1);
302  me_GEM_pass_Ch_region_GE1->setBinLabel(2, "GE-1/1_L1", 1);
303  me_GEM_pass_Ch_region_GE1->setBinLabel(3, "GE1/1_L1", 1);
304  me_GEM_pass_Ch_region_GE1->setBinLabel(4, "GE1/1_L2", 1);
305  for (int i = 1; i < 37; ++i) {
306  me_GEM_pass_Ch_region_GE1->setBinLabel(i, std::to_string(i), 2);
307  }
308  me_GEM_pass_Ch_region_GE1->setAxisTitle("Chamber", 2);
309  me_GEM_pass_Ch_region_GE1->setAxisTitle("Number of passing probes", 3);
310 
311  me_GEM_fail_Ch_region_GE1_NoL->setBinLabel(1, "GE-1", 1);
312  me_GEM_fail_Ch_region_GE1_NoL->setBinLabel(2, "GE+1", 1);
313  for (int i = 1; i < 37; ++i) {
314  me_GEM_fail_Ch_region_GE1_NoL->setBinLabel(i, std::to_string(i), 2);
315  }
316  me_GEM_fail_Ch_region_GE1_NoL->setAxisTitle("Chamber", 2);
317  me_GEM_fail_Ch_region_GE1_NoL->setAxisTitle("Number of passing probes", 3);
318 
319  me_GEM_pass_Ch_region_GE1_NoL->setBinLabel(1, "GE-1", 1);
320  me_GEM_pass_Ch_region_GE1_NoL->setBinLabel(2, "GE+1", 1);
321  for (int i = 1; i < 37; ++i) {
322  me_GEM_pass_Ch_region_GE1_NoL->setBinLabel(i, std::to_string(i), 2);
323  }
324  me_GEM_pass_Ch_region_GE1_NoL->setAxisTitle("Chamber", 2);
325  me_GEM_pass_Ch_region_GE1_NoL->setAxisTitle("Number of passing probes", 3);
326 
327  for (int i = 1; i < 37; ++i) {
328  me_GEM_fail_Ch_eta->setBinLabel(i, std::to_string(i), 2);
329  }
330  me_GEM_fail_Ch_eta->setAxisTitle("#eta", 1);
331  me_GEM_fail_Ch_eta->setAxisTitle("Chamber", 2);
332  me_GEM_fail_Ch_eta->setAxisTitle("Number of failing probes", 3);
333 
334  for (int i = 1; i < 37; ++i) {
335  me_GEM_pass_Ch_eta->setBinLabel(i, std::to_string(i), 2);
336  }
337  me_GEM_pass_Ch_eta->setAxisTitle("#eta", 1);
338  me_GEM_pass_Ch_eta->setAxisTitle("Chamber", 2);
339  me_GEM_pass_Ch_eta->setAxisTitle("Number of passing probes", 3);
340 
341  for (int i = 1; i < 37; ++i) {
342  me_GEM_fail_Ch_phi->setBinLabel(i, std::to_string(i), 2);
343  }
344  me_GEM_fail_Ch_phi->setAxisTitle("#phi", 1);
345  me_GEM_fail_Ch_phi->setAxisTitle("Chamber", 2);
346  me_GEM_fail_Ch_phi->setAxisTitle("Number of failing probes", 3);
347 
348  for (int i = 1; i < 37; ++i) {
349  me_GEM_pass_Ch_phi->setBinLabel(i, std::to_string(i), 2);
350  }
351  me_GEM_pass_Ch_phi->setAxisTitle("#phi", 1);
352  me_GEM_pass_Ch_phi->setAxisTitle("Chamber", 2);
353  me_GEM_pass_Ch_phi->setAxisTitle("Number of passing probes", 3);
354 
355  for (int i = 1; i < 19; ++i) {
356  me_ME0_pass_chamber_1D->setBinLabel(i, std::to_string(i), 1);
357  }
358  me_ME0_pass_chamber_1D->setAxisTitle("Chamber", 1);
359  me_ME0_pass_chamber_1D->setAxisTitle("Number of passing probes", 2);
360  for (int i = 1; i < 19; ++i) {
361  me_ME0_fail_chamber_1D->setBinLabel(i, std::to_string(i), 1);
362  }
363  me_ME0_fail_chamber_1D->setAxisTitle("Chamber", 1);
364  me_ME0_fail_chamber_1D->setAxisTitle("Number of failing probes", 2);
365 
366  me_GEM_fail_Ch_region_layer_phase2->setBinLabel(1, "GE-2/1_L2", 1);
367  me_GEM_fail_Ch_region_layer_phase2->setBinLabel(2, "GE-2/1_L1", 1);
368  me_GEM_fail_Ch_region_layer_phase2->setBinLabel(3, "GE-1/1_L2", 1);
369  me_GEM_fail_Ch_region_layer_phase2->setBinLabel(4, "GE-1/1_L1", 1);
370  me_GEM_fail_Ch_region_layer_phase2->setBinLabel(5, "GE0-1", 1);
371  me_GEM_fail_Ch_region_layer_phase2->setBinLabel(6, "GE0+1", 1);
372  me_GEM_fail_Ch_region_layer_phase2->setBinLabel(7, "GE1/1_L1", 1);
373  me_GEM_fail_Ch_region_layer_phase2->setBinLabel(8, "GE1/1_L2", 1);
374  me_GEM_fail_Ch_region_layer_phase2->setBinLabel(9, "GE2/1_L1", 1);
375  me_GEM_fail_Ch_region_layer_phase2->setBinLabel(10, "GE2/1_L2", 1);
376  for (int i = 1; i < 37; ++i) {
377  me_GEM_fail_Ch_region_layer_phase2->setBinLabel(i, std::to_string(i), 2);
378  }
379  me_GEM_fail_Ch_region_layer_phase2->setAxisTitle("Chamber", 2);
380  me_GEM_fail_Ch_region_layer_phase2->setAxisTitle("Number of passing probes", 3);
381 
382  me_GEM_pass_Ch_region_layer_phase2->setBinLabel(1, "GE-2/1_L2", 1);
383  me_GEM_pass_Ch_region_layer_phase2->setBinLabel(2, "GE-2/1_L1", 1);
384  me_GEM_pass_Ch_region_layer_phase2->setBinLabel(3, "GE-1/1_L2", 1);
385  me_GEM_pass_Ch_region_layer_phase2->setBinLabel(4, "GE-1/1_L1", 1);
386  me_GEM_pass_Ch_region_layer_phase2->setBinLabel(5, "GE0-1", 1);
387  me_GEM_pass_Ch_region_layer_phase2->setBinLabel(6, "GE0+1", 1);
388  me_GEM_pass_Ch_region_layer_phase2->setBinLabel(7, "GE1/1_L1", 1);
389  me_GEM_pass_Ch_region_layer_phase2->setBinLabel(8, "GE1/1_L2", 1);
390  me_GEM_pass_Ch_region_layer_phase2->setBinLabel(9, "GE2/1_L1", 1);
391  me_GEM_pass_Ch_region_layer_phase2->setBinLabel(10, "GE2/1_L2", 1);
392 
393  for (int i = 1; i < 37; ++i) {
394  me_GEM_pass_Ch_region_layer_phase2->setBinLabel(i, std::to_string(i), 2);
395  }
396  me_GEM_pass_Ch_region_layer_phase2->setAxisTitle("Chamber", 2);
397  me_GEM_pass_Ch_region_layer_phase2->setAxisTitle("Number of passing probes", 3);
398 
399  m_histos["GEM_nPassingProbe_Ch_region"] = me_GEM_pass_Ch_region;
400  m_histos["GEM_nFailingProbe_Ch_region"] = me_GEM_fail_Ch_region;
401  m_histos["GEM_nPassingProbe_Ch_region_GE1"] = me_GEM_pass_Ch_region_GE1;
402  m_histos["GEM_nFailingProbe_Ch_region_GE1"] = me_GEM_fail_Ch_region_GE1;
403  m_histos["GEM_nPassingProbe_Ch_region_GE1_NoL"] = me_GEM_pass_Ch_region_GE1_NoL;
404  m_histos["GEM_nFailingProbe_Ch_region_GE1_NoL"] = me_GEM_fail_Ch_region_GE1_NoL;
405  m_histos["GEM_nPassingProbe_Ch_eta"] = me_GEM_pass_Ch_eta;
406  m_histos["GEM_nFailingProbe_Ch_eta"] = me_GEM_fail_Ch_eta;
407  m_histos["GEM_nPassingProbe_Ch_phi"] = me_GEM_pass_Ch_phi;
408  m_histos["GEM_nFailingProbe_Ch_phi"] = me_GEM_fail_Ch_phi;
409  m_histos["GEM_nPassingProbe_allCh_1D"] = me_GEM_pass_allCh_1D;
410  m_histos["GEM_nFailingProbe_allCh_1D"] = me_GEM_fail_allCh_1D;
411  m_histos["GEM_nPassingProbe_chamber_1D"] = me_GEM_pass_chamber_1D;
412  m_histos["GEM_nFailingProbe_chamber_1D"] = me_GEM_fail_chamber_1D;
413  m_histos["GEM_nPassingProbe_chamber_p1_1D"] = me_GEM_pass_chamber_p1_1D;
414  m_histos["GEM_nFailingProbe_chamber_p1_1D"] = me_GEM_fail_chamber_p1_1D;
415  m_histos["GEM_nPassingProbe_chamber_p2_1D"] = me_GEM_pass_chamber_p2_1D;
416  m_histos["GEM_nFailingProbe_chamber_p2_1D"] = me_GEM_fail_chamber_p2_1D;
417  m_histos["GEM_nPassingProbe_chamber_n1_1D"] = me_GEM_pass_chamber_n1_1D;
418  m_histos["GEM_nFailingProbe_chamber_n1_1D"] = me_GEM_fail_chamber_n1_1D;
419  m_histos["GEM_nPassingProbe_chamber_n2_1D"] = me_GEM_pass_chamber_n2_1D;
420  m_histos["GEM_nFailingProbe_chamber_n2_1D"] = me_GEM_fail_chamber_n2_1D;
421  m_histos["GEM_nPassingProbe_pt_1D"] = me_GEM_pass_pt_1D;
422  m_histos["GEM_nFailingProbe_pt_1D"] = me_GEM_fail_pt_1D;
423  m_histos["GEM_nPassingProbe_eta_1D"] = me_GEM_pass_eta_1D;
424  m_histos["GEM_nFailingProbe_eta_1D"] = me_GEM_fail_eta_1D;
425  m_histos["GEM_nPassingProbe_phi_1D"] = me_GEM_pass_phi_1D;
426  m_histos["GEM_nFailingProbe_phi_1D"] = me_GEM_fail_phi_1D;
427  m_histos["GEM_nPassingProbe_pt_p1_1D"] = me_GEM_pass_pt_p1_1D;
428  m_histos["GEM_nFailingProbe_pt_p1_1D"] = me_GEM_fail_pt_p1_1D;
429  m_histos["GEM_nPassingProbe_eta_p1_1D"] = me_GEM_pass_eta_p1_1D;
430  m_histos["GEM_nFailingProbe_eta_p1_1D"] = me_GEM_fail_eta_p1_1D;
431  m_histos["GEM_nPassingProbe_phi_p1_1D"] = me_GEM_pass_phi_p1_1D;
432  m_histos["GEM_nFailingProbe_phi_p1_1D"] = me_GEM_fail_phi_p1_1D;
433  m_histos["GEM_nPassingProbe_pt_p2_1D"] = me_GEM_pass_pt_p2_1D;
434  m_histos["GEM_nFailingProbe_pt_p2_1D"] = me_GEM_fail_pt_p2_1D;
435  m_histos["GEM_nPassingProbe_eta_p2_1D"] = me_GEM_pass_eta_p2_1D;
436  m_histos["GEM_nFailingProbe_eta_p2_1D"] = me_GEM_fail_eta_p2_1D;
437  m_histos["GEM_nPassingProbe_phi_p2_1D"] = me_GEM_pass_phi_p2_1D;
438  m_histos["GEM_nFailingProbe_phi_p2_1D"] = me_GEM_fail_phi_p2_1D;
439  m_histos["GEM_nPassingProbe_pt_n1_1D"] = me_GEM_pass_pt_n1_1D;
440  m_histos["GEM_nFailingProbe_pt_n1_1D"] = me_GEM_fail_pt_n1_1D;
441  m_histos["GEM_nPassingProbe_eta_n1_1D"] = me_GEM_pass_eta_n1_1D;
442  m_histos["GEM_nFailingProbe_eta_n1_1D"] = me_GEM_fail_eta_n1_1D;
443  m_histos["GEM_nPassingProbe_phi_n1_1D"] = me_GEM_pass_phi_n1_1D;
444  m_histos["GEM_nFailingProbe_phi_n1_1D"] = me_GEM_fail_phi_n1_1D;
445  m_histos["GEM_nPassingProbe_pt_n2_1D"] = me_GEM_pass_pt_n2_1D;
446  m_histos["GEM_nFailingProbe_pt_n2_1D"] = me_GEM_fail_pt_n2_1D;
447  m_histos["GEM_nPassingProbe_eta_n2_1D"] = me_GEM_pass_eta_n2_1D;
448  m_histos["GEM_nFailingProbe_eta_n2_1D"] = me_GEM_fail_eta_n2_1D;
449  m_histos["GEM_nPassingProbe_phi_n2_1D"] = me_GEM_pass_phi_n2_1D;
450  m_histos["GEM_nFailingProbe_phi_n2_1D"] = me_GEM_fail_phi_n2_1D;
451  m_histos["ME0_nPassingProbe_chamber_1D"] = me_ME0_pass_chamber_1D;
452  m_histos["ME0_nFailingProbe_chamber_1D"] = me_ME0_fail_chamber_1D;
453  m_histos["GEM_nPassingProbe_Ch_region_layer_phase2"] = me_GEM_pass_Ch_region_layer_phase2;
454  m_histos["GEM_nFailingProbe_Ch_region_layer_phase2"] = me_GEM_fail_Ch_region_layer_phase2;
455 
456  std::string baseDir_ = topFolder() + "/detailed/";
457  iBooker.setCurrentFolder(baseDir_);
458  m_histos["GEMhit_dx"] = iBooker.book1D("GEMhit_dx", "GEMhit_dx;probe dx [cm];Events", 100, 0., 10.);
459  m_histos["GEMseg_dx"] = iBooker.book1D("GEMseg_dx", "GEMseg_dx;probe dx [cm];Events", 100, 0., 20.);
460 
461  m_histos["GEMhit_x"] = iBooker.book1D("GEMhit_x", "GEMhit_x;probe x [cm];Events", 100, -10., 10.);
462  m_histos["GEMhit_x_GE2"] = iBooker.book1D("GEMhit_x_GE2", "GEMhit_x;probe x [cm];Events", 100, -10., 10.);
463  m_histos["Cham_x"] = iBooker.book1D("Cham_x", "Cham_x;probe x [cm];Events", 100, -10., 10.);
464  m_histos["Cham_x_GE2"] = iBooker.book1D("Cham_x_GE2", "Cham_x;probe x [cm];Events", 100, -10., 10.);
465 
466  m_histos["GEMhit_dx_GE2"] = iBooker.book1D("GEMhit_dx_GE2", "GEMhit_dx;probe dx [cm];Events", 100, 0., 10.);
467 }
468 
471 
473  event.getByToken(m_muToken, muons);
474 
475  //GEM variables
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;
485 
486  //ME0 variables
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;
497 
498  std::vector<unsigned> probe_indices;
499  if (!m_probeIndices.empty())
500  probe_indices = m_probeIndices.back();
501 
502  //Fill probe dx + subdetector coordinates
503  for (const auto i : probe_indices) {
504  //GEM variables
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;
513  //std::vector<float> probe_GEM_dx_seg;
514  uint8_t GEM_stationMatching = 0;
515  //ME0 variables
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;
526 
527  bool gem_matched = false; // fill detailed plots only for probes matching GEM
528 
529  for (const auto& chambMatch : (*muons).at(i).matches()) {
530  // look in GEMs
531  if (chambMatch.detector() == MuonSubdetId::GEM) {
532  if (chambMatch.edgeX < m_borderCut && chambMatch.edgeY < m_borderCut) {
533  gem_matched = true; //fill detailed plots if at least one GEM match
534 
535  GEMDetId chId(chambMatch.id.rawId());
536 
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();
545 
546  reco::MuonGEMHitMatch closest_matchedHit;
547  double smallestDx = 99999.;
548  double matched_GEMHit_x = 99999.;
549 
550  for (auto& gemHit : chambMatch.gemHitMatches) {
551  float dx = std::abs(chambMatch.x - gemHit.x);
552  if (dx < smallestDx) {
553  smallestDx = dx;
554  closest_matchedHit = gemHit;
555  matched_GEMHit_x = gemHit.x;
556  }
557  }
558 
559  reco::MuonSegmentMatch closest_matchedSegment;
560  double smallestDx_seg = 99999.;
561 
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;
567  }
568  }
569  if (m_detailedAnalysis && gem_matched) {
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);
574  if (station == 2) {
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);
578  }
579  }
580 
581  GEM_stationMatching = GEM_stationMatching | (1 << (station - 1));
582 
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);
591  //probe_GEM_dx.push_back(smallestDx_seg);
592  //probe_GEM_dx_seg.push_back(smallestDx_seg);
593 
594  if (station == 0) {
595  reco::MuonSegmentMatch closest_matchedSegment_ME0;
596  double smallestDx_ME0 = 99999.;
597  for (auto& seg : chambMatch.gemMatches) {
598  float dx = std::abs(chambMatch.x - seg.x);
599  if (dx < smallestDx_ME0) {
600  smallestDx_ME0 = dx;
601  closest_matchedSegment_ME0 = seg;
602  }
603  }
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);
614  }
615  }
616  } else
617  continue;
618  } //loop over chamber matches
619 
620  //Fill detailed plots
621  if (m_detailedAnalysis && gem_matched) {
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());
626  //for(int ii=0; i<probe_GEM_dx.size(); ii++)
627  //{
628  // m_histos.find("GEMhit_dx")->second->Fill(probe_GEM_dx[ii]);
629  // m_histos.find("GEMseg_dx")->second->Fill(probe_GEM_dx_seg[ii]);
630  //}
631  }
632 
633  //Fill GEM variables
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);
643 
644  //Fill ME0 variables
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);
655 
656  } //loop over probe collection
657 
658  //Loop over probes
659  for (unsigned i = 0; i < probe_indices.size(); ++i) {
660  uint8_t GEM_matchPatt = probe_coll_GEM_staMatch.at(i);
661  //uint8_t ME0_matchPatt = probe_coll_ME0_staMatch.at(i);
662 
663  //Loop over ME0 matches
664  unsigned nME0_matches = probe_coll_ME0_region.at(i).size();
665  for (unsigned j = 0; j < nME0_matches; ++j) {
666  //ME0 variables
667  int ME0_region = probe_coll_ME0_region.at(i).at(j);
668  //int ME0_roll = probe_coll_ME0_roll.at(i).at(j);
669  int ME0_sta = probe_coll_ME0_sta.at(i).at(j);
670  //int ME0_lay = probe_coll_ME0_lay.at(i).at(j);
671  int ME0_chamber = probe_coll_ME0_chamber.at(i).at(j);
672  //float ME0_pt = probe_coll_ME0_pt.at(i).at(j);
673  float ME0_dx = probe_coll_ME0_dx.at(i).at(j);
674  //float ME0_eta = probe_coll_ME0_eta.at(i).at(j);
675  //float ME0_phi = probe_coll_ME0_phi.at(i).at(j);
676 
677  if (ME0_sta == 0) {
678  if (ME0_dx < m_dxCut) {
679  m_histos.find("ME0_nPassingProbe_chamber_1D")->second->Fill(ME0_chamber);
680  if (ME0_region < 0)
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);
684  } else {
685  m_histos.find("ME0_nFailingProbe_chamber_1D")->second->Fill(ME0_chamber);
686  if (ME0_region < 0)
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);
690  }
691  }
692  }
693  //
694 
695  //Loop over GEM matches
696  unsigned nGEM_matches = probe_coll_GEM_region.at(i).size();
697  for (unsigned j = 0; j < nGEM_matches; ++j) {
698  //GEM variables
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);
707 
708  //Fill GEM plots
709  if (((GEM_matchPatt & (1 << (GEM_sta - 1))) != 0) && GEM_sta != 0) //avoids 0 station matching
710  {
711  if (GEM_dx < m_dxCut) {
712  if (GEM_region == 1 && GEM_lay == 0 && GEM_sta == 2 && GEM_chamber == 16)
713  continue; //exclude GE2 ch16 of Run3
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);
728  }
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);
738  }
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);
743  }
744 
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);
769  }
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);
773  } else {
774  if (GEM_region == 1 && GEM_lay == 0 && GEM_sta == 2 && GEM_chamber == 16)
775  continue;
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);
790  }
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);
800  }
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);
805  }
806  //
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);
831  }
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);
835  }
836  }
837  }
838  }
839 }
840 
841 std::string GEMTnPEfficiencyTask::topFolder() const { return "GEM/Segment_TnP/"; };
842 
const double Pi
static constexpr int GEM
Definition: MuonSubdetId.h:14
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
~GEMTnPEfficiencyTask() override
Destructor.
const edm::EDGetTokenT< reco::MuonCollection > m_muToken
Definition: config.py:1
static std::string to_string(const XMLCh *ch)
#define LogTrace(id)
std::vector< std::vector< unsigned > > m_probeIndices
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::map< std::string, MonitorElement * > m_histos
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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 analyze(const edm::Event &event, const edm::EventSetup &context) override
Analyze.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
GEMTnPEfficiencyTask(const edm::ParameterSet &config)
Constructor.
std::string topFolder() const override
Return the top folder.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
Definition: event.py:1
Definition: Run.h:45
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)