CMS 3D CMS Logo

L1TDTTF.cc
Go to the documentation of this file.
1 /*
2  * \file L1TDTTF.cc
3  *
4  * \author J. Berryhill
5  *
6  *
7  * Revision 1.27 2010/11/01 11:27:53 gcodispo
8  * Cleaned up 2nd track sections
9  *
10  * Revision 1.26 2010/10/27 13:59:25 gcodispo
11  * Changed name to 2nd track quality (same convention as for all tracks)
12  *
13  * Revision 1.25 2010/10/27 13:37:08 gcodispo
14  * Changed name to 2nd track quality (same convention as for all tracks)
15  *
16  * Revision 1.24 2010/10/27 08:08:52 gcodispo
17  * Graphic improvements (names, titles, labels...)
18  *
19  * Revision 1.23 2010/10/19 12:14:56 gcodispo
20  * New DTTF DQM version
21  * - added L1TDTTFClient in order to use proper normalization
22  * - cleaned up most of the code, removed useless plots
23  * - reduced overall number of bins from 118325 to 104763 plus saved 1920 bins from wrongly called L1TDTTPGClient
24  * - added match with GMT inputremoved useless plots
25  * - added eta fine fraction plots
26  * - added quality distribution plots
27  *
28  * Revision 1.22 2009/11/19 15:09:18 puigh
29  * modify beginJob
30  *
31  * Revision 1.21 2009/10/12 10:16:42 nuno
32  * bug fix; letting the package compile again
33  *
34  * Revision 1.20 2009/08/03 21:11:22 lorenzo
35  * added dttf phi and theta
36  *
37  * Revision 1.19 2008/07/29 14:18:27 wteo
38  * updated and added more MEs
39  *
40  * Revision 1.15 2008/06/10 18:01:55 lorenzo
41  * reduced n histos
42  *
43  * Revision 1.14 2008/05/09 16:42:27 ameyer
44  * *** empty log message ***
45  *
46  * Revision 1.13 2008/04/30 08:44:21 lorenzo
47  * new dttf source, not based on gmt record
48  *
49  * Revision 1.20 2008/03/20 19:38:25 berryhil
50  *
51  *
52  * organized message logger
53  *
54  * Revision 1.19 2008/03/14 20:35:46 berryhil
55  *
56  *
57  * stripped out obsolete parameter settings
58  *
59  * rpc tpg restored with correct dn access and dbe handling
60  *
61  * Revision 1.18 2008/03/12 17:24:24 berryhil
62  *
63  *
64  * eliminated log files, truncated HCALTPGXana histo output
65  *
66  * Revision 1.17 2008/03/10 09:29:52 lorenzo
67  * added MEs
68  *
69  * Revision 1.16 2008/03/01 00:40:00 lat
70  * DQM core migration.
71  *
72  *
73  * Revision 1.27 2010/11/01 11:27:53 gcodispo
74  * Cleaned up 2nd track sections
75  *
76  * Revision 1.26 2010/10/27 13:59:25 gcodispo
77  * Changed name to 2nd track quality (same convention as for all tracks)
78  *
79  * Revision 1.25 2010/10/27 13:37:08 gcodispo
80  * Changed name to 2nd track quality (same convention as for all tracks)
81  *
82  * Revision 1.24 2010/10/27 08:08:52 gcodispo
83  * Graphic improvements (names, titles, labels...)
84  *
85  * Revision 1.23 2010/10/19 12:14:56 gcodispo
86  * New DTTF DQM version
87  * - added L1TDTTFClient in order to use proper normalization
88  * - cleaned up most of the code, removed useless plots
89  * - reduced overall number of bins from 118325 to 104763 plus saved 1920 bins from wrongly called L1TDTTPGClient
90  * - added match with GMT inputremoved useless plots
91  * - added eta fine fraction plots
92  * - added quality distribution plots
93  *
94  * Revision 1.22 2009/11/19 15:09:18 puigh
95  * modify beginJob
96  *
97  * Revision 1.21 2009/10/12 10:16:42 nuno
98  * bug fix; letting the package compile again
99  *
100  * Revision 1.20 2009/08/03 21:11:22 lorenzo
101  * added dttf phi and theta
102  *
103  * Revision 1.19 2008/07/29 14:18:27 wteo
104  * updated and added more MEs
105  *
106  * Revision 1.15 2008/06/10 18:01:55 lorenzo
107  * reduced n histos
108  *
109  * Revision 1.14 2008/05/09 16:42:27 ameyer
110  * *** empty log message ***
111  *
112  * Revision 1.13 2008/04/30 08:44:21 lorenzo
113  * new dttf source, not based on gmt record
114  *
115  * Revision 1.20 2008/03/20 19:38:25 berryhil
116  *
117  *
118  * organized message logger
119  *
120  * Revision 1.19 2008/03/14 20:35:46 berryhil
121  *
122  *
123  * stripped out obsolete parameter settings
124  *
125  * rpc tpg restored with correct dn access and dbe handling
126  *
127  * Revision 1.18 2008/03/12 17:24:24 berryhil
128  *
129  *
130  * eliminated log files, truncated HCALTPGXana histo output
131  *
132  * Revision 1.17 2008/03/10 09:29:52 lorenzo
133  * added MEs
134  *
135  * Revision 1.15 2008/01/22 18:56:01 muzaffar
136  * include cleanup. Only for cc/cpp files
137  *
138  * Revision 1.14 2007/12/21 17:41:20 berryhil
139  *
140  *
141  * try/catch removal
142  *
143  * Revision 1.13 2007/11/19 15:08:22 lorenzo
144  * changed top folder name
145  *
146  * Revision 1.12 2007/08/15 18:56:25 berryhil
147  *
148  *
149  * split histograms by bx; add Maiken's bx classifier plots
150  *
151  * Revision 1.11 2007/07/26 09:37:09 berryhil
152  *
153  *
154  * set verbose false for all modules
155  * set verbose fix for DTTPG tracks
156  *
157  * Revision 1.10 2007/07/25 09:03:58 berryhil
158  *
159  *
160  * conform to DTTFFEDReader input tag.... for now
161  *
162  * Revision 1.9 2007/07/12 16:06:18 wittich
163  * add simple phi output track histograms.
164  * note that the label of this class is different than others
165  * from the DTFFReader creates.
166  *
167  */
168 
170 
175 
177 // #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
178 // #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhDigi.h"
179 // #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
180 // #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThDigi.h"
181 
184 
187 
191 
192 //--------------------------------------------------------
194  : dttpgSource_(ps.getParameter<edm::InputTag>("dttpgSource")),
195  gmtSource_(ps.getParameter<edm::InputTag>("gmtSource")),
196  muonCollectionLabel_(ps.getParameter<edm::InputTag>("MuonCollection")),
197  l1tsubsystemfolder_(ps.getUntrackedParameter<std::string>("l1tSystemFolder", "L1T/L1TDTTF")),
198  online_(ps.getUntrackedParameter<bool>("online", true)),
199  verbose_(ps.getUntrackedParameter<bool>("verbose", false))
200 
201 {
202  std::string trstring = dttpgSource_.label() + ":DATA:" + dttpgSource_.process();
203  trackInputTag_ = edm::InputTag(trstring);
204 
206  if (verbose_)
207  edm::LogInfo("L1TDTTF: constructor") << "Verbose enabled";
208 
210  if (ps.getUntrackedParameter<bool>("disableROOToutput", false)) {
211  outputFile_ = "";
212 
213  } else {
214  outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
215  if (!outputFile_.empty()) {
216  edm::LogInfo("L1TDTTF: constructor") << "L1T Monitoring histograms will be saved to " << outputFile_;
217  }
218  }
219 
220  //set Token(-s)
221  trackInputToken_ = consumes<L1MuDTTrackContainer>(trackInputTag_);
222  muonCollectionToken_ = consumes<reco::MuonCollection>(ps.getParameter<edm::InputTag>("MuonCollection"));
223  gmtSourceToken_ = consumes<L1MuGMTReadoutCollection>(ps.getParameter<edm::InputTag>("gmtSource"));
224 }
225 
226 //--------------------------------------------------------
229 }
230 
231 //------------------------------------------------------
233  //empty
234 }
235 
236 //--------------------------------------------------------
239  nev_ = 0;
240  nev_dttf_ = 0;
241  nev_dttf_track2_ = 0;
242 
243  // get hold of back-end interface
244 
245  std::string dttf_trk_folder = l1tsubsystemfolder_;
246 
247  char hname[100];
248  char htitle[100];
249 
251  float start = 0;
252  float stop = 0;
253  int nbins = 0;
255 
257  ibooker.setCurrentFolder(dttf_trk_folder);
258 
259  std::string wheelpath[6] = {
260  "/02-WHEEL_N2", "/03-WHEEL_N1", "/04-WHEEL_N0", "/05-WHEEL_P0", "/06-WHEEL_P1", "/07-WHEEL_P2"};
261 
262  char c_whn[6][3] = {"N2", "N1", "N0", "P0", "P1", "P2"};
263  // char bxn [3][3] = { "N1", "0", "P1" };
264  // char bxn[3][25] = {"/BX_NONZERO_ONLY/BX_N1", "", "/BX_NONZERO_ONLY/BX_P1"};
265 
266  for (int iwh = 0; iwh < 6; ++iwh) {
267  bookEta(iwh, nbins, start, stop);
268 
272  std::string dttf_trk_folder_wheel = dttf_trk_folder + wheelpath[iwh];
273  ibooker.setCurrentFolder(dttf_trk_folder_wheel);
274 
276  sprintf(hname, "dttf_01_nTracksPerEvent_wh%s", c_whn[iwh]);
277  sprintf(htitle, "Wheel %s - Number Tracks Per Event", c_whn[iwh]);
278  dttf_nTracksPerEvent_wheel[iwh] = ibooker.book1D(hname, htitle, 10, 0.5, 10.5);
279  dttf_nTracksPerEvent_wheel[iwh]->setAxisTitle("# tracks/event", 1);
280 
282  sprintf(hname, "dttf_07_phi_vs_etaFine_wh%s", c_whn[iwh]);
283  sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (fine #eta only, unpacked values)", c_whn[iwh]);
284  dttf_phi_eta_fine_wheel[iwh] = ibooker.book2D(hname, htitle, nbins, start - 0.5, stop - 0.5, 144, -6, 138);
285  // 144, -0.5, 143.5);
286 
287  dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#eta", 1);
288  dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#phi", 2);
289 
291  sprintf(hname, "dttf_08_phi_vs_etaCoarse_wh%s", c_whn[iwh]);
292  sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (coarse #eta only, unpacked values)", c_whn[iwh]);
293  dttf_phi_eta_coarse_wheel[iwh] = ibooker.book2D(hname, htitle, nbins, start - 0.5, stop - 0.5, 144, -6, 138);
294  // 144, -0.5, 143.5);
295  dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#eta", 1);
296  dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#phi", 2);
297 
300  std::string dttf_trk_folder_wheel_2ndtrack = dttf_trk_folder_wheel + "/2ND_TRACK_ONLY";
301  ibooker.setCurrentFolder(dttf_trk_folder_wheel_2ndtrack);
302 
304  sprintf(hname, "dttf_04_quality_wh%s_2ndTrack", c_whn[iwh]);
305  sprintf(htitle, "Wheel %s - 2nd Tracks Quality distribution", c_whn[iwh]);
306  dttf_quality_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 7, 1, 8);
308 
310  sprintf(hname, "dttf_05_quality_summary_wh%s_2ndTrack", c_whn[iwh]);
311  sprintf(htitle, "Wheel %s - 2nd Tracks - Quality", c_whn[iwh]);
312  dttf_quality_summary_wheel_2ndTrack[iwh] = ibooker.book2D(hname, htitle, 12, 1, 13, 7, 1, 8);
315  // dttf_quality_summary_wheel_2ndTrack[iwh]->setAxisTitle("Quality", 2);
316 
318  sprintf(hname, "dttf_06_phi_vs_eta_wh%s_2ndTrack", c_whn[iwh]);
319  sprintf(htitle, "Wheel %s - #eta-#phi Distribution of DTTF 2nd Tracks", c_whn[iwh]);
320 
321  dttf_phi_eta_wheel_2ndTrack[iwh] = ibooker.book2D(hname, htitle, nbins, start - 0.5, stop - 0.5, 144, -6, 138);
322  // 144, -0.5, 143.5);
323  dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
324  dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 2);
325 
327  sprintf(hname, "dttf_07_eta_wh%s_2ndTrack", c_whn[iwh]);
328  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks #eta distribution (Packed values)", c_whn[iwh]);
329  dttf_eta_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 64, -0.5, 63.5);
330  dttf_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
331 
333  sprintf(hname, "dttf_08_phi_wh%s_2ndTrack", c_whn[iwh]);
334  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Phi distribution (Packed values)", c_whn[iwh]);
335  dttf_phi_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 144, -6, 138.);
336  dttf_phi_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 1);
337 
339  sprintf(hname, "dttf_09_pt_wh%s_2ndTrack", c_whn[iwh]);
340  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks p_{T} distribution (Packed values)", c_whn[iwh]);
341  dttf_pt_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 32, -0.5, 31.5);
342  dttf_pt_wheel_2ndTrack[iwh]->setAxisTitle("p_{T}", 1);
343 
345  sprintf(hname, "dttf_10_charge_wh%s_2ndTrack", c_whn[iwh]);
346  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Charge distribution", c_whn[iwh]);
347  dttf_q_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 2, -0.5, 1.5);
348  dttf_q_wheel_2ndTrack[iwh]->setAxisTitle("Charge", 1);
349 
353 
355  std::string dttf_trk_folder_nTracksPerEvent = dttf_trk_folder_wheel + "/TracksPerEvent";
356  ibooker.setCurrentFolder(dttf_trk_folder_nTracksPerEvent);
357 
358  for (int ise = 0; ise < 12; ++ise) {
359  sprintf(hname, "dttf_nTracksPerEvent_wh%s_se%d", c_whn[iwh], ise + 1);
360  sprintf(htitle, "Wheel %s Sector %d - Number of Tracks Per Event", c_whn[iwh], ise + 1);
361  dttf_nTracksPerEv[iwh][ise] = ibooker.book1D(hname, htitle, 2, 0.5, 2.5);
362  dttf_nTracksPerEv[iwh][ise]->setAxisTitle("# tracks/event", 1);
363  }
364 
366  std::string dttf_trk_folder_wh_bxsec_all = dttf_trk_folder_wheel + "/BX_BySector";
367  ibooker.setCurrentFolder(dttf_trk_folder_wh_bxsec_all);
368 
369  for (int ise = 0; ise < 12; ++ise) {
370  sprintf(hname, "dttf_bx_wh%s_se%d", c_whn[iwh], ise + 1);
371  sprintf(htitle, "Wheel %s Sector %d - BX Distribution", c_whn[iwh], ise + 1);
372  dttf_bx[iwh][ise] = ibooker.book1D(hname, htitle, 3, -1.5, 1.5);
373  dttf_bx[iwh][ise]->setAxisTitle("BX", 1);
374  }
375 
376  std::string dttf_trk_folder_wh_bxsec_trk2 = dttf_trk_folder_wheel + "/BX_BySector/2ND_TRACK_ONLY";
377  ibooker.setCurrentFolder(dttf_trk_folder_wh_bxsec_trk2);
378 
379  for (int ise = 0; ise < 12; ++ise) {
380  sprintf(hname, "dttf_bx_2ndTrack_wh%s_se%d", c_whn[iwh], ise + 1);
381  sprintf(htitle, "Wheel %s Sector %d - BX 2nd Tracks only", c_whn[iwh], ise + 1);
382  dttf_bx_2ndTrack[iwh][ise] = ibooker.book1D(hname, htitle, 3, -1.5, 1.5);
383  dttf_bx_2ndTrack[iwh][ise]->setAxisTitle("BX", 1);
384  }
385 
387  std::string dttf_trk_folder_charge = dttf_trk_folder_wheel + "/Charge";
388  ibooker.setCurrentFolder(dttf_trk_folder_charge);
389 
390  for (int ise = 0; ise < 12; ++ise) {
391  sprintf(hname, "dttf_charge_wh%s_se%d", c_whn[iwh], ise + 1);
392  sprintf(htitle, "Wheel %s Sector %d - Packed Charge", c_whn[iwh], ise + 1);
393  dttf_q[iwh][ise] = ibooker.book1D(hname, htitle, 2, -0.5, 1.5);
394  dttf_q[iwh][ise]->setAxisTitle("Charge", 1);
395  }
396 
398  std::string dttf_trk_folder_pt = dttf_trk_folder_wheel + "/PT";
399  ibooker.setCurrentFolder(dttf_trk_folder_pt);
400 
401  for (int ise = 0; ise < 12; ++ise) {
402  sprintf(hname, "dttf_pt_wh%s_se%d", c_whn[iwh], ise + 1);
403  sprintf(htitle, "Wheel %s Sector %d - Packed p_{T}", c_whn[iwh], ise + 1);
404  dttf_pt[iwh][ise] = ibooker.book1D(hname, htitle, 32, -0.5, 31.5);
405  dttf_pt[iwh][ise]->setAxisTitle("p_{T}", 1);
406  }
407 
409  std::string dttf_trk_folder_phi = dttf_trk_folder_wheel + "/Phi";
410  ibooker.setCurrentFolder(dttf_trk_folder_phi);
411 
412  for (int ise = 0; ise < 12; ++ise) {
413  sprintf(hname, "dttf_phi_wh%s_se%d", c_whn[iwh], ise + 1);
414  sprintf(htitle, "Wheel %s Sector %d - Packed Phi", c_whn[iwh], ise + 1);
415  dttf_phi[iwh][ise] = ibooker.book1D(hname, htitle, 144, -6, 138);
416  dttf_phi[iwh][ise]->setAxisTitle("#phi", 1);
417  //dttf_phi[iwh][ise] = dbe_->book1D(title,title, 32,-16.5, 15.5);
418  }
419 
421  std::string dttf_trk_folder_quality = dttf_trk_folder_wheel + "/Quality";
422  ibooker.setCurrentFolder(dttf_trk_folder_quality);
423 
424  for (int ise = 0; ise < 12; ++ise) {
425  sprintf(hname, "dttf_qual_wh%s_se%d", c_whn[iwh], ise + 1);
426  sprintf(htitle, "Wheel %s Sector %d - Packed Quality", c_whn[iwh], ise + 1);
427  dttf_qual[iwh][ise] = ibooker.book1D(hname, htitle, 7, 1, 8);
428  dttf_qual[iwh][ise]->setAxisTitle("Quality", 1);
429  setQualLabel(dttf_qual[iwh][ise], 1);
430  }
431 
433  std::string dttf_trk_folder_eta = dttf_trk_folder_wheel + "/Eta";
434  ibooker.setCurrentFolder(dttf_trk_folder_eta);
435 
436  for (int ise = 0; ise < 12; ++ise) {
437  sprintf(hname, "dttf_eta_wh%s_se%d", c_whn[iwh], ise + 1);
438  sprintf(htitle, "Wheel %s Sector %d - Packed #eta", c_whn[iwh], ise + 1);
439  dttf_eta[iwh][ise] = ibooker.book1D(hname, htitle, 64, -0.5, 63.5);
440  dttf_eta[iwh][ise]->setAxisTitle("#eta", 1);
441  }
442 
444  dttf_trk_folder_eta = dttf_trk_folder_wheel + "/EtaFineFraction";
445  ibooker.setCurrentFolder(dttf_trk_folder_eta);
446 
447  for (int ise = 0; ise < 12; ++ise) {
448  sprintf(hname, "dttf_etaFine_fraction_wh%s_se%d", c_whn[iwh], ise + 1);
449  sprintf(htitle, "Wheel %s Sector %d - Eta Fine Fraction", c_whn[iwh], ise + 1);
450  dttf_eta_fine_fraction[iwh][ise] = ibooker.book1D(hname, htitle, 2, 0, 2);
451  dttf_eta_fine_fraction[iwh][ise]->setAxisTitle("#eta", 1);
452  dttf_eta_fine_fraction[iwh][ise]->setBinLabel(1, "fine", 1);
453  dttf_eta_fine_fraction[iwh][ise]->setBinLabel(2, "coarse", 1);
454  }
455  }
456 
460  std::string dttf_trk_folder_inclusive = dttf_trk_folder + "/01-INCLUSIVE";
461  ibooker.setCurrentFolder(dttf_trk_folder_inclusive);
462 
463  sprintf(hname, "dttf_01_nTracksPerEvent_integ");
464  sprintf(htitle, "Number of DTTF Tracks Per Event");
465  dttf_nTracksPerEvent_integ = ibooker.book1D(hname, htitle, 20, 0.5, 20.5);
466  dttf_nTracksPerEvent_integ->setAxisTitle("# tracks/event", 1);
467 
469  // sprintf(hname, "dttf_10_qual_eta_distr");
470  // sprintf(htitle, "DTTF Tracks Quality vs Eta Distribution");
471  // dttf_qual_eta_integ = dbe_->book2D(hname, htitle, 64, 0, 64, 7, 1, 8);
472  // setQualLabel( dttf_qual_eta_integ, 2);
473 
475  if (online_) {
476  sprintf(hname, "dttf_04_tracks_occupancy_by_lumi");
477  sprintf(htitle, "DTTF Tracks in the last LumiSections");
478  dttf_spare = ibooker.book2D(hname, htitle, 6, 0, 6, 12, 1, 13);
480  dttf_spare->setAxisTitle("Sector", 2);
481  dttf_spare->getTH2F()->GetXaxis()->SetNdivisions(12);
482  } else {
483  sprintf(hname, "dttf_04_global_muons_request");
484  sprintf(htitle, "Tracks compatible with a Global Muon in the Barrel");
485  dttf_spare = ibooker.book1D(hname, htitle, 4, -0.5, 3.5);
486  dttf_spare->setBinLabel(1, "No tracks", 1);
487  dttf_spare->setBinLabel(2, "No tracks but GM", 1);
488  dttf_spare->setBinLabel(3, "Tracks wo GM", 1);
489  dttf_spare->setBinLabel(4, "Tracks w GM", 1);
490  }
491 
492  std::string dttf_trk_folder_integrated_gmt = dttf_trk_folder + "/08-GMT_MATCH";
493  ibooker.setCurrentFolder(dttf_trk_folder_integrated_gmt);
494 
495  sprintf(hname, "dttf_tracks_with_gmt_match");
496  sprintf(htitle, "DTTF Tracks With a Match in GMT");
497  dttf_gmt_match = ibooker.book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
499 
500  sprintf(hname, "dttf_tracks_without_gmt_match");
501  sprintf(htitle, "DTTF Tracks Without a Match in GMT");
502  dttf_gmt_missed = ibooker.book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
504 
505  sprintf(hname, "dttf_missing_tracks_in_gmt");
506  sprintf(htitle, "GMT Tracks Without a Corresponding Track in DTTF");
507  dttf_gmt_ghost = ibooker.book2D(hname, htitle, 5, -2, 3, 12, 1, 13.);
508 
509  dttf_gmt_ghost->setBinLabel(1, "N2", 1);
510  dttf_gmt_ghost->setBinLabel(2, "N1", 1);
511  dttf_gmt_ghost->setBinLabel(3, "N0/P0", 1);
512  dttf_gmt_ghost->setBinLabel(4, "P1", 1);
513  dttf_gmt_ghost->setBinLabel(5, "P2", 1);
514 
515  // sprintf(hname, "dttf_eta_phi_missing_tracks_in_gmt");
516  // sprintf(htitle, "GMT Tracks Without a Corresponding Track in DTTF");
517  // dttf_gmt_ghost_phys = dbe_->book2D(hname, htitle, 64, 0., 64., 144, 0., 144. );
518 }
519 
520 //--------------------------------------------------------
522  if (verbose_)
523  edm::LogInfo("L1TDTTF::Analyze::start") << "#################### START";
524 
526  ++nev_;
527  memset(numTracks, 0, 72 * sizeof(int));
528 
530  edm::Handle<L1MuDTTrackContainer> myL1MuDTTrackContainer;
531  try {
532  event.getByToken(trackInputToken_, myL1MuDTTrackContainer);
533  } catch (cms::Exception& iException) {
534  edm::LogError("L1TDTTF::analyze::DataNotFound") << "can't getByToken L1MuDTTrackContainer with label "
535  << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
536  return;
537  }
538 
539  if (!myL1MuDTTrackContainer.isValid()) {
540  edm::LogError("L1TDTTF::analyze::DataNotFound")
541  << "can't find L1MuDTTrackContainer with label " << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
542  return;
543  }
544 
545  L1MuDTTrackContainer::TrackContainer const* trackContainer = myL1MuDTTrackContainer->getContainer();
546 
548  if (!trackContainer->empty()) {
549  ++nev_dttf_;
550  if (trackContainer->size() > 1)
552  }
553 
557  bool accept = true;
558  if (!online_) {
559  try {
561  event.getByToken(muonCollectionToken_, muons);
562  accept = false;
563  if (muons.isValid()) {
564  for (reco::MuonCollection::const_iterator recoMu = muons->begin(); recoMu != muons->end(); ++recoMu) {
565  if (fabs(recoMu->eta()) < 1.4) {
566  if (verbose_) {
567  edm::LogInfo("L1TDTTFClient::Analyze:GM") << "Found a global muon!";
568  }
569  accept = true;
570  break;
571  }
572  }
573 
575  if (!accept) {
576  dttf_spare->Fill(!trackContainer->empty() ? 1 : 0);
577 
578  if (verbose_) {
579  edm::LogInfo("L1TDTTFClient::Analyze:GM") << "No global muons in this event!";
580  }
581 
582  } else {
583  dttf_spare->Fill(!trackContainer->empty() ? 2 : 3);
584  }
585 
586  } else {
588  accept = true;
589  edm::LogWarning("L1TDTTFClient::Analyze:GM")
590  << "Invalid MuonCollection with label " << muonCollectionLabel_.label();
591  }
592 
593  } catch (cms::Exception& iException) {
595  accept = true;
596  edm::LogError("DataNotFound") << "Unable to getByToken MuonCollection with label "
598  }
599  }
600 
602  std::vector<L1MuRegionalCand> gmtBx0DttfCandidates;
603 
604  try {
606  event.getByToken(gmtSourceToken_, pCollection);
607 
608  if (!pCollection.isValid()) {
609  edm::LogError("DataNotFound") << "can't find L1MuGMTReadoutCollection with label " << gmtSource_.label();
610  }
611 
612  // get GMT readout collection
613  L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
614  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
615 
616  std::vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
617 
618  for (RRItr = gmt_records.begin(); RRItr != gmt_records.end(); ++RRItr) {
619  std::vector<L1MuRegionalCand> dttfCands = RRItr->getDTBXCands();
620  std::vector<L1MuRegionalCand>::iterator dttfCand;
621 
622  for (dttfCand = dttfCands.begin(); dttfCand != dttfCands.end(); ++dttfCand) {
623  if (dttfCand->empty())
624  continue;
626  if (RRItr->getBxInEvent())
627  continue;
628 
629  // dttf_gmt_ghost_phys->Fill( dttfCand->eta_packed(),
630  // dttfCand->phi_packed() );
631  gmtBx0DttfCandidates.push_back(*dttfCand);
632  }
633  }
634 
635  } catch (cms::Exception& iException) {
636  edm::LogError("DataNotFound") << "Unable to getByToken L1MuGMTReadoutCollection with label " << gmtSource_.label();
637  }
638 
639  // fill MEs if all selections are passed
640  if (accept)
641  fillMEs(trackContainer, gmtBx0DttfCandidates);
642 
644  std::vector<L1MuRegionalCand>::iterator dttfCand;
645  for (dttfCand = gmtBx0DttfCandidates.begin(); dttfCand != gmtBx0DttfCandidates.end(); ++dttfCand) {
646  if (dttfCand->empty())
647  continue;
648 
652  int phi = dttfCand->phi_packed();
653  int sector = 1 + (phi + 6) / 12;
654  if (sector > 12)
655  sector -= 12;
656  double eta = dttfCand->etaValue();
657 
658  int wheel = -3;
659  if (eta < -0.74) {
660  wheel = -2;
661  } else if (eta < -0.3) {
662  wheel = -1;
663 
664  } else if (eta < 0.3) {
665  wheel = 0;
666 
667  } else if (eta < 0.74) {
668  wheel = 1;
669  } else {
670  wheel = 2;
671  }
672 
673  dttf_gmt_ghost->Fill(wheel, sector);
674  // dttf_gmt_ghost_phys->Fill( dttfCand->eta_packed(),
675  // dttfCand->phi_packed() );
676  }
677 
679  int numTracksInt = 0;
680 
681  for (int w = 0; w < 6; ++w) {
682  int numTracks_wh = 0;
683  for (int s = 0; s < 12; ++s) {
685 
686  numTracks_wh += numTracks[w][s];
687  }
688 
689  numTracksInt += numTracks_wh;
690  dttf_nTracksPerEvent_wheel[w]->Fill(numTracks_wh);
691  }
692 
693  dttf_nTracksPerEvent_integ->Fill(numTracksInt);
694 }
695 
696 //--------------------------------------------------------
697 void L1TDTTF::fillMEs(std::vector<L1MuDTTrackCand> const* trackContainer, std::vector<L1MuRegionalCand>& gmtDttfCands) {
698  L1MuDTTrackContainer::TrackContainer::const_iterator track = trackContainer->begin();
699  L1MuDTTrackContainer::TrackContainer::const_iterator trackEnd = trackContainer->end();
700 
701  for (; track != trackEnd; ++track) {
702  if (verbose_) {
703  edm::LogInfo("L1TDTTF::Analyze") << "bx = " << track->bx();
704  edm::LogInfo("L1TDTTF::Analyze") << "quality (packed) = " << track->quality_packed();
705  edm::LogInfo("L1TDTTF::Analyze") << "pt (packed) = " << track->pt_packed()
706  << " , pt (GeV) = " << track->ptValue();
707  edm::LogInfo("L1TDTTF::Analyze") << "phi (packed) = " << track->phi_packed()
708  << " , phi (rad) = " << track->phiValue();
709  edm::LogInfo("L1TDTTF::Analyze") << "charge (packed) = " << track->charge_packed();
710  }
711 
713  if ((track->whNum() == -1) && !track->eta_packed()) {
714  edm::LogInfo("L1TDTTF::Analyze") << "Skipping N0 with zero eta value";
715 
716  continue;
717  }
718 
719  int bxindex = track->bx() + 1;
720  int se = track->scNum();
721  int sector = se + 1;
722  int whindex = track->whNum();
723 
724  whindex = (whindex < 0) ? whindex + 3 : whindex + 2;
725 
726  if (whindex < 0 || whindex > 5) {
727  edm::LogError("L1TDTTF::Analyze::WHEEL_ERROR") << track->whNum() << "(" << whindex << ")";
728  continue;
729  }
730 
731  if (se < 0 || se > 11) {
732  edm::LogError("L1TDTTF::Analyze::SECTOR_ERROR") << se;
733  continue;
734  }
735 
737 
739  // int phi_local = track->phi_packed();//range: 0 < phi_local < 31
740  // if ( phi_local > 15 ) phi_local -= 32; //range: -16 < phi_local < 15
741 
742  // int phi_global = phi_local + se * 12; //range: -16 < phi_global < 147
743  // if(phi_global < 0) phi_global += 144; //range: 0 < phi_global < 147
744  // if(phi_global > 143) phi_global -= 144; //range: 0 < phi_global < 143
745  // // float phi_phys = phi_global * 2.5 + 1.25;
746 
748  int phi_global = track->phi_packed();
749  phi_global = (phi_global > 15 ? phi_global - 32 : phi_global) + se * 12;
750  if (phi_global < -6)
751  phi_global += 144; //range: 0 < phi_global < 147
752  if (phi_global > 137)
753  phi_global -= 144; //range: 0 < phi_global < 143
754 
755  // int eta_global = track->eta_packed();
756  // int eta_global = track->eta_packed() - 32;
757  // dttf_eta[bxindex][whindex][se]->Fill(eta_global);
758  // float eta_phys = eta_global / 2.4 ;
759 
763 
765  dttf_bx[whindex][se]->Fill(track->bx());
766 
768  if (track->TrkTag() == 1) {
770  dttf_bx_2ndTrack[whindex][se]->Fill(track->bx());
771  }
772 
776 
777  if (bxindex == 1) {
779  ++numTracks[whindex][se];
780 
782  dttf_phi[whindex][se]->Fill(phi_global);
783 
785  dttf_qual[whindex][se]->Fill(track->quality_packed());
786 
788  dttf_pt[whindex][se]->Fill(track->pt_packed());
789 
791  dttf_q[whindex][se]->Fill(track->charge_packed());
792 
794  dttf_eta[whindex][se]->Fill(track->eta_packed());
795 
796  if (track->isFineHalo()) {
797  dttf_eta_fine_fraction[whindex][se]->Fill(0);
798 
800  dttf_phi_eta_fine_wheel[whindex]->Fill(track->eta_packed(), phi_global);
801 
802  } else {
803  dttf_eta_fine_fraction[whindex][se]->Fill(1);
804 
806  dttf_phi_eta_coarse_wheel[whindex]->Fill(track->eta_packed(), phi_global);
807  }
808 
810  if (online_) {
811  dttf_spare->Fill(whindex, sector);
812  }
813 
815  // dttf_qual_eta_integ->Fill(track->eta_packed(), track->quality_packed());
816 
818  if (track->TrkTag() == 1) {
820  dttf_phi_wheel_2ndTrack[whindex]->Fill(phi_global);
821 
823  dttf_pt_wheel_2ndTrack[whindex]->Fill(track->pt_packed());
824 
826  dttf_eta_wheel_2ndTrack[whindex]->Fill(track->eta_packed());
827 
829  dttf_quality_wheel_2ndTrack[whindex]->Fill(track->quality_packed());
830 
832  dttf_q_wheel_2ndTrack[whindex]->Fill(track->charge_packed());
833 
835  dttf_quality_summary_wheel_2ndTrack[whindex]->Fill(sector, track->quality_packed());
836 
838  dttf_phi_eta_wheel_2ndTrack[whindex]->Fill(track->eta_packed(), phi_global);
839  }
840 
842  bool match = false;
843  std::vector<L1MuRegionalCand>::iterator dttfCand;
845  unsigned int gmt_phi = (phi_global < 0 ? phi_global + 144 : phi_global);
846 
847  for (dttfCand = gmtDttfCands.begin(); dttfCand != gmtDttfCands.end(); ++dttfCand) {
849  if (dttfCand->empty())
850  continue;
851  if ((dttfCand->phi_packed() == gmt_phi) && dttfCand->quality_packed() == track->quality_packed()) {
852  match = true;
853  dttfCand->reset();
854  break;
855  }
856  }
857 
858  if (match) {
859  dttf_gmt_match->Fill(whindex, sector);
860  } else {
861  dttf_gmt_missed->Fill(whindex, sector);
862  }
863  }
864  }
865 }
866 
867 //--------------------------------------------------------
869  if (axis == 1)
870  me->setAxisTitle("Quality", axis);
871  me->setBinLabel(1, "T34", axis);
872  me->setBinLabel(2, "T23/24", axis);
873  me->setBinLabel(3, "T12/13/14", axis);
874  me->setBinLabel(4, "T234", axis);
875  me->setBinLabel(5, "T134", axis);
876  me->setBinLabel(6, "T123/124", axis);
877  me->setBinLabel(7, "T1234", axis);
878 }
879 
880 //--------------------------------------------------------
882  me->setAxisTitle("Wheel", 1);
883  me->setBinLabel(1, "N2", 1);
884  me->setBinLabel(2, "N1", 1);
885  me->setBinLabel(3, "N0", 1);
886  me->setBinLabel(4, "P0", 1);
887  me->setBinLabel(5, "P1", 1);
888  me->setBinLabel(6, "P2", 1);
889 }
890 
891 //--------------------------------------------------------
892 void L1TDTTF::bookEta(int wh, int& nbins, float& start, float& stop) {
893  switch (wh) {
894  case 0:
895  start = 0;
896  stop = 18;
897  nbins = 18;
898  break; // N2
899  case 1:
900  start = 8;
901  stop = 28;
902  nbins = 20;
903  break; // N1
904  case 2:
905  start = 22;
906  stop = 32;
907  nbins = 10;
908  break; // N0
909  case 3:
910  start = 22;
911  stop = 42;
912  nbins = 20;
913  break; // P0
914  case 4:
915  start = 36;
916  stop = 56;
917  nbins = 20;
918  break; // P1
919  case 5:
920  start = 46;
921  stop = 64;
922  nbins = 18;
923  break; // P2
924  default:
925  start = 0;
926  stop = 0;
927  nbins = 0;
928  break; // BOH
929  }
930 }
Definition: start.py:1
std::string l1tsubsystemfolder_
Definition: L1TDTTF.h:56
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::InputTag trackInputTag_
Definition: L1TDTTF.h:60
MonitorElement * dttf_phi_eta_coarse_wheel[6]
Definition: L1TDTTF.h:66
edm::InputTag muonCollectionLabel_
Definition: L1TDTTF.h:55
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
void bookEta(int wh, int &nbins, float &start, float &stop)
Definition: L1TDTTF.cc:892
T w() const
MonitorElement * dttf_nTracksPerEvent_wheel[6]
Definition: L1TDTTF.h:62
MonitorElement * dttf_phi_eta_fine_wheel[6]
Definition: L1TDTTF.h:65
T const * product() const
Definition: Handle.h:70
void setWheelLabel(MonitorElement *me)
Definition: L1TDTTF.cc:881
std::string const & label() const
Definition: InputTag.h:36
MonitorElement * dttf_gmt_match
Definition: L1TDTTF.h:86
Log< level::Error, false > LogError
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
MonitorElement * dttf_phi_wheel_2ndTrack[6]
Definition: L1TDTTF.h:69
~L1TDTTF() override
Definition: L1TDTTF.cc:227
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
MonitorElement * dttf_nTracksPerEvent_integ
Definition: L1TDTTF.h:83
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TDTTF.cc:521
MonitorElement * dttf_pt_wheel_2ndTrack[6]
Definition: L1TDTTF.h:70
MonitorElement * dttf_eta_wheel_2ndTrack[6]
Definition: L1TDTTF.h:68
edm::InputTag gmtSource_
Definition: L1TDTTF.h:54
std::string outputFile_
Definition: L1TDTTF.h:59
edm::EDGetTokenT< L1MuGMTReadoutCollection > gmtSourceToken_
Definition: L1TDTTF.h:100
MonitorElement * dttf_qual[6][12]
Definition: L1TDTTF.h:76
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
Definition: L1TDTTF.cc:232
edm::InputTag dttpgSource_
Definition: L1TDTTF.h:53
MonitorElement * dttf_quality_wheel_2ndTrack[6]
Definition: L1TDTTF.h:63
std::vector< L1MuDTTrackCand > TrackContainer
MonitorElement * dttf_phi[6][12]
Definition: L1TDTTF.h:79
edm::EDGetTokenT< L1MuDTTrackContainer > trackInputToken_
Definition: L1TDTTF.h:98
TrackContainer const * getContainer() const
void fillMEs(std::vector< L1MuDTTrackCand > const *trackContainer, std::vector< L1MuRegionalCand > &gmtDttfCands)
Definition: L1TDTTF.cc:697
MonitorElement * dttf_gmt_missed
Definition: L1TDTTF.h:87
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)
MonitorElement * dttf_quality_summary_wheel_2ndTrack[6]
Definition: L1TDTTF.h:64
MonitorElement * dttf_eta_fine_fraction[6][12]
Definition: L1TDTTF.h:77
MonitorElement * dttf_bx[6][12]
Definition: L1TDTTF.h:74
Log< level::Info, false > LogInfo
int nev_dttf_track2_
Definition: L1TDTTF.h:94
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
int numTracks[6][12]
Definition: L1TDTTF.h:95
bool verbose_
Definition: L1TDTTF.h:58
MonitorElement * dttf_gmt_ghost
Definition: L1TDTTF.h:88
edm::EDGetTokenT< reco::MuonCollection > muonCollectionToken_
Definition: L1TDTTF.h:99
MonitorElement * dttf_bx_2ndTrack[6][12]
Definition: L1TDTTF.h:75
int nev_dttf_
Definition: L1TDTTF.h:93
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
bool isValid() const
Definition: HandleBase.h:70
MonitorElement * dttf_q_wheel_2ndTrack[6]
Definition: L1TDTTF.h:71
MonitorElement * dttf_eta[6][12]
Definition: L1TDTTF.h:78
HLT enums.
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Definition: L1TDTTF.cc:237
bool online_
Definition: L1TDTTF.h:57
MonitorElement * dttf_nTracksPerEv[6][12]
Definition: L1TDTTF.h:73
MonitorElement * dttf_pt[6][12]
Definition: L1TDTTF.h:80
MonitorElement * dttf_phi_eta_wheel_2ndTrack[6]
Definition: L1TDTTF.h:67
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
MonitorElement * dttf_spare
Definition: L1TDTTF.h:84
int nev_
Definition: L1TDTTF.h:92
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
std::string const & process() const
Definition: InputTag.h:40
MonitorElement * dttf_q[6][12]
Definition: L1TDTTF.h:81
void setQualLabel(MonitorElement *me, int axis)
Definition: L1TDTTF.cc:868
L1TDTTF(const edm::ParameterSet &ps)
base services
Definition: L1TDTTF.cc:193
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)