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 
176 
178 // #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
179 // #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhDigi.h"
180 // #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
181 // #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThDigi.h"
182 
185 
188 
189 
193 
194 
195 
196 //--------------------------------------------------------
198  : dttpgSource_( ps.getParameter< edm::InputTag >("dttpgSource") ),
199  gmtSource_( ps.getParameter< edm::InputTag >("gmtSource") ),
200  muonCollectionLabel_( ps.getParameter<edm::InputTag>("MuonCollection") ),
201  l1tsubsystemfolder_( ps.getUntrackedParameter<std::string>("l1tSystemFolder",
202  "L1T/L1TDTTF")),
203  online_( ps.getUntrackedParameter<bool>("online", true) ),
204  verbose_( ps.getUntrackedParameter<bool>("verbose", false) )
205 
206 {
207 
208  std::string trstring =
209  dttpgSource_.label() + ":DATA:" + dttpgSource_.process();
210  trackInputTag_ = edm::InputTag(trstring);
211 
213  if ( verbose_ ) edm::LogInfo("L1TDTTF: constructor") << "Verbose enabled";
214 
216  if ( ps.getUntrackedParameter<bool>("disableROOToutput", false) ) {
217 
218  outputFile_ = "";
219 
220  } else {
221 
222  outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
223  if ( ! outputFile_.empty() ) {
224  edm::LogInfo("L1TDTTF: constructor")
225  << "L1T Monitoring histograms will be saved to " << outputFile_;
226  }
227 
228  }
229 
230  //set Token(-s)
231  trackInputToken_ = consumes<L1MuDTTrackContainer>(trackInputTag_);
232  muonCollectionToken_ = consumes<reco::MuonCollection>(ps.getParameter<edm::InputTag>("MuonCollection"));
233  gmtSourceToken_ = consumes<L1MuGMTReadoutCollection>(ps.getParameter< edm::InputTag >("gmtSource"));
234 }
235 
236 
237 
238 //--------------------------------------------------------
240 {
242 }
243 
244 //------------------------------------------------------
246  //empty
247 }
248 
249 
250 //--------------------------------------------------------
252 {
254  nev_ = 0;
255  nev_dttf_ = 0;
256  nev_dttf_track2_ = 0;
257 
258  // get hold of back-end interface
259 
260  std::string dttf_trk_folder = l1tsubsystemfolder_;
261 
262  char hname[100];
263  char htitle[100];
264 
266  float start = 0;
267  float stop = 0;
268  int nbins = 0;
270 
272  ibooker.setCurrentFolder(dttf_trk_folder);
273 
274  std::string wheelpath[6] = { "/02-WHEEL_N2",
275  "/03-WHEEL_N1",
276  "/04-WHEEL_N0",
277  "/05-WHEEL_P0",
278  "/06-WHEEL_P1",
279  "/07-WHEEL_P2" };
280 
281 
282  char c_whn[6][3] = { "N2", "N1", "N0", "P0", "P1", "P2" };
283  // char bxn [3][3] = { "N1", "0", "P1" };
284  // char bxn[3][25] = {"/BX_NONZERO_ONLY/BX_N1", "", "/BX_NONZERO_ONLY/BX_P1"};
285 
286  for ( int iwh = 0; iwh < 6; ++iwh ) {
287 
288  bookEta( iwh, nbins, start, stop );
289 
293  std::string dttf_trk_folder_wheel = dttf_trk_folder + wheelpath[iwh];
294  ibooker.setCurrentFolder(dttf_trk_folder_wheel);
295 
297  sprintf(hname, "dttf_01_nTracksPerEvent_wh%s", c_whn[iwh]);
298  sprintf(htitle, "Wheel %s - Number Tracks Per Event", c_whn[iwh]);
299  dttf_nTracksPerEvent_wheel[iwh] = ibooker.book1D(hname, htitle,
300  10, 0.5, 10.5);
301  dttf_nTracksPerEvent_wheel[iwh]->setAxisTitle("# tracks/event", 1);
302 
304  sprintf(hname, "dttf_07_phi_vs_etaFine_wh%s", c_whn[iwh]);
305  sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (fine #eta only, unpacked values)", c_whn[iwh]);
306  dttf_phi_eta_fine_wheel[iwh] = ibooker.book2D(hname, htitle,
307  nbins, start-0.5, stop-0.5,
308  144, -6, 138);
309  // 144, -0.5, 143.5);
310 
311  dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#eta", 1);
312  dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#phi", 2);
313 
315  sprintf(hname, "dttf_08_phi_vs_etaCoarse_wh%s", c_whn[iwh]);
316  sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (coarse #eta only, unpacked values)", c_whn[iwh]);
317  dttf_phi_eta_coarse_wheel[iwh] = ibooker.book2D(hname, htitle,
318  nbins, start-0.5, stop-0.5,
319  144, -6, 138);
320  // 144, -0.5, 143.5);
321  dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#eta", 1);
322  dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#phi", 2);
323 
326  std::string dttf_trk_folder_wheel_2ndtrack =
327  dttf_trk_folder_wheel + "/2ND_TRACK_ONLY";
328  ibooker.setCurrentFolder(dttf_trk_folder_wheel_2ndtrack);
329 
330 
332  sprintf(hname, "dttf_04_quality_wh%s_2ndTrack", c_whn[iwh]);
333  sprintf(htitle, "Wheel %s - 2nd Tracks Quality distribution", c_whn[iwh]);
334  dttf_quality_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 7, 1, 8);
336 
338  sprintf(hname, "dttf_05_quality_summary_wh%s_2ndTrack", c_whn[iwh]);
339  sprintf(htitle, "Wheel %s - 2nd Tracks - Quality", c_whn[iwh]);
340  dttf_quality_summary_wheel_2ndTrack[iwh] = ibooker.book2D(hname, htitle,
341  12, 1, 13, 7, 1, 8 );
344  // dttf_quality_summary_wheel_2ndTrack[iwh]->setAxisTitle("Quality", 2);
345 
347  sprintf(hname, "dttf_06_phi_vs_eta_wh%s_2ndTrack", c_whn[iwh]);
348  sprintf(htitle, "Wheel %s - #eta-#phi Distribution of DTTF 2nd Tracks",
349  c_whn[iwh]);
350 
351  dttf_phi_eta_wheel_2ndTrack[iwh] = ibooker.book2D(hname, htitle,
352  nbins, start-0.5,stop-0.5,
353  144, -6, 138);
354  // 144, -0.5, 143.5);
355  dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
356  dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 2);
357 
358 
359 
361  sprintf(hname, "dttf_07_eta_wh%s_2ndTrack", c_whn[iwh]);
362  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks #eta distribution (Packed values)",
363  c_whn[iwh]);
364  dttf_eta_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 64, -0.5, 63.5);
365  dttf_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
366 
368  sprintf(hname, "dttf_08_phi_wh%s_2ndTrack", c_whn[iwh]);
369  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Phi distribution (Packed values)",
370  c_whn[iwh]);
371  dttf_phi_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 144, -6, 138. );
372  dttf_phi_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 1);
373 
375  sprintf(hname, "dttf_09_pt_wh%s_2ndTrack", c_whn[iwh]);
376  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks p_{T} distribution (Packed values)",
377  c_whn[iwh]);
378  dttf_pt_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 32, -0.5, 31.5);
379  dttf_pt_wheel_2ndTrack[iwh]->setAxisTitle("p_{T}", 1);
380 
382  sprintf(hname, "dttf_10_charge_wh%s_2ndTrack", c_whn[iwh]);
383  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Charge distribution", c_whn[iwh]);
384  dttf_q_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 2, -0.5, 1.5);
385  dttf_q_wheel_2ndTrack[iwh]->setAxisTitle("Charge", 1);
386 
387 
388 
389 
393 
395  std::string dttf_trk_folder_nTracksPerEvent = dttf_trk_folder_wheel + "/TracksPerEvent";
396  ibooker.setCurrentFolder(dttf_trk_folder_nTracksPerEvent);
397 
398  for(int ise = 0; ise < 12; ++ise) {
399  sprintf(hname, "dttf_nTracksPerEvent_wh%s_se%d", c_whn[iwh], ise+1);
400  sprintf(htitle, "Wheel %s Sector %d - Number of Tracks Per Event",
401  c_whn[iwh], ise+1);
402  dttf_nTracksPerEv[iwh][ise] = ibooker.book1D(hname, htitle, 2, 0.5, 2.5);
403  dttf_nTracksPerEv[iwh][ise]->setAxisTitle("# tracks/event", 1);
404  }
405 
406 
408  std::string dttf_trk_folder_wh_bxsec_all =
409  dttf_trk_folder_wheel + "/BX_BySector";
410  ibooker.setCurrentFolder(dttf_trk_folder_wh_bxsec_all);
411 
412  for(int ise = 0; ise < 12; ++ise ) {
413  sprintf(hname, "dttf_bx_wh%s_se%d", c_whn[iwh], ise+1);
414  sprintf(htitle, "Wheel %s Sector %d - BX Distribution",
415  c_whn[iwh], ise+1);
416  dttf_bx[iwh][ise] = ibooker.book1D(hname, htitle, 3, -1.5, 1.5);
417  dttf_bx[iwh][ise]->setAxisTitle("BX", 1);
418  }
419 
420  std::string dttf_trk_folder_wh_bxsec_trk2 =
421  dttf_trk_folder_wheel + "/BX_BySector/2ND_TRACK_ONLY";
422  ibooker.setCurrentFolder(dttf_trk_folder_wh_bxsec_trk2);
423 
424  for(int ise = 0; ise < 12; ++ise ) {
425  sprintf(hname, "dttf_bx_2ndTrack_wh%s_se%d", c_whn[iwh], ise+1);
426  sprintf(htitle, "Wheel %s Sector %d - BX 2nd Tracks only",
427  c_whn[iwh], ise+1);
428  dttf_bx_2ndTrack[iwh][ise] = ibooker.book1D(hname, htitle, 3, -1.5, 1.5);
429  dttf_bx_2ndTrack[iwh][ise]->setAxisTitle("BX", 1);
430  }
431 
433  std::string dttf_trk_folder_charge = dttf_trk_folder_wheel + "/Charge";
434  ibooker.setCurrentFolder(dttf_trk_folder_charge);
435 
436  for(int ise = 0; ise < 12; ++ise) {
437  sprintf(hname, "dttf_charge_wh%s_se%d", c_whn[iwh], ise+1);
438  sprintf(htitle, "Wheel %s Sector %d - Packed Charge", c_whn[iwh], ise+1);
439  dttf_q[iwh][ise] = ibooker.book1D(hname, htitle, 2, -0.5, 1.5);
440  dttf_q[iwh][ise]->setAxisTitle("Charge", 1);
441  }
442 
444  std::string dttf_trk_folder_pt = dttf_trk_folder_wheel + "/PT";
445  ibooker.setCurrentFolder(dttf_trk_folder_pt);
446 
447  for(int ise = 0; ise < 12; ++ise ) {
448  sprintf(hname, "dttf_pt_wh%s_se%d", c_whn[iwh], ise+1);
449  sprintf(htitle, "Wheel %s Sector %d - Packed p_{T}",
450  c_whn[iwh], ise + 1 );
451  dttf_pt[iwh][ise]= ibooker.book1D(hname, htitle, 32, -0.5, 31.5);
452  dttf_pt[iwh][ise]->setAxisTitle("p_{T}", 1);
453  }
454 
456  std::string dttf_trk_folder_phi = dttf_trk_folder_wheel + "/Phi";
457  ibooker.setCurrentFolder(dttf_trk_folder_phi);
458 
459  for(int ise = 0; ise < 12; ++ise ) {
460  sprintf(hname, "dttf_phi_wh%s_se%d", c_whn[iwh], ise+1);
461  sprintf(htitle, "Wheel %s Sector %d - Packed Phi", c_whn[iwh], ise+1);
462  dttf_phi[iwh][ise] = ibooker.book1D(hname, htitle, 144, -6, 138);
463  dttf_phi[iwh][ise]->setAxisTitle("#phi", 1);
464  //dttf_phi[iwh][ise] = dbe_->book1D(title,title, 32,-16.5, 15.5);
465  }
466 
468  std::string dttf_trk_folder_quality = dttf_trk_folder_wheel + "/Quality";
469  ibooker.setCurrentFolder(dttf_trk_folder_quality);
470 
471  for(int ise = 0; ise < 12; ++ise){
472  sprintf(hname, "dttf_qual_wh%s_se%d", c_whn[iwh], ise+1);
473  sprintf(htitle, "Wheel %s Sector %d - Packed Quality",
474  c_whn[iwh], ise+1);
475  dttf_qual[iwh][ise] = ibooker.book1D(hname, htitle, 7, 1, 8);
476  dttf_qual[iwh][ise]->setAxisTitle("Quality", 1);
477  setQualLabel( dttf_qual[iwh][ise], 1 );
478  }
479 
481  std::string dttf_trk_folder_eta = dttf_trk_folder_wheel + "/Eta";
482  ibooker.setCurrentFolder(dttf_trk_folder_eta);
483 
484  for (int ise = 0; ise < 12; ++ise ) {
485 
486  sprintf(hname, "dttf_eta_wh%s_se%d", c_whn[iwh], ise+1);
487  sprintf(htitle, "Wheel %s Sector %d - Packed #eta",
488  c_whn[iwh], ise+1);
489  dttf_eta[iwh][ise] = ibooker.book1D(hname, htitle, 64, -0.5, 63.5);
490  dttf_eta[iwh][ise]->setAxisTitle("#eta", 1);
491 
492  }
493 
495  dttf_trk_folder_eta = dttf_trk_folder_wheel + "/EtaFineFraction";
496  ibooker.setCurrentFolder(dttf_trk_folder_eta);
497 
498  for (int ise = 0; ise < 12; ++ise ) {
499 
500  sprintf(hname, "dttf_etaFine_fraction_wh%s_se%d", c_whn[iwh], ise+1);
501  sprintf(htitle, "Wheel %s Sector %d - Eta Fine Fraction",
502  c_whn[iwh], ise+1);
503  dttf_eta_fine_fraction[iwh][ise] = ibooker.book1D(hname, htitle, 2, 0, 2);
504  dttf_eta_fine_fraction[iwh][ise]->setAxisTitle("#eta", 1);
505  dttf_eta_fine_fraction[iwh][ise]->setBinLabel(1, "fine", 1);
506  dttf_eta_fine_fraction[iwh][ise]->setBinLabel(2, "coarse", 1);
507  }
508 
509  }
510 
514  std::string dttf_trk_folder_inclusive = dttf_trk_folder + "/01-INCLUSIVE";
515  ibooker.setCurrentFolder(dttf_trk_folder_inclusive);
516 
517 
518  sprintf(hname, "dttf_01_nTracksPerEvent_integ");
519  sprintf(htitle, "Number of DTTF Tracks Per Event");
520  dttf_nTracksPerEvent_integ = ibooker.book1D(hname, htitle, 20, 0.5, 20.5);
521  dttf_nTracksPerEvent_integ->setAxisTitle("# tracks/event", 1);
522 
524  // sprintf(hname, "dttf_10_qual_eta_distr");
525  // sprintf(htitle, "DTTF Tracks Quality vs Eta Distribution");
526  // dttf_qual_eta_integ = dbe_->book2D(hname, htitle, 64, 0, 64, 7, 1, 8);
527  // setQualLabel( dttf_qual_eta_integ, 2);
528 
530  if ( online_ ) {
531  sprintf(hname, "dttf_04_tracks_occupancy_by_lumi");
532  sprintf(htitle, "DTTF Tracks in the last LumiSections");
533  dttf_spare = ibooker.book2D(hname, htitle, 6, 0, 6, 12, 1, 13);
535  dttf_spare->setAxisTitle("Sector", 2);
536  dttf_spare->getTH2F()->GetXaxis()->SetNdivisions(12);
537  } else {
538 
539  sprintf(hname, "dttf_04_global_muons_request");
540  sprintf(htitle, "Tracks compatible with a Global Muon in the Barrel");
541  dttf_spare = ibooker.book1D(hname, htitle, 4, -0.5, 3.5 );
542  dttf_spare->setBinLabel(1, "No tracks", 1);
543  dttf_spare->setBinLabel(2, "No tracks but GM", 1);
544  dttf_spare->setBinLabel(3, "Tracks wo GM", 1);
545  dttf_spare->setBinLabel(4, "Tracks w GM", 1);
546 
547  }
548 
549  std::string dttf_trk_folder_integrated_gmt =
550  dttf_trk_folder + "/08-GMT_MATCH";
551  ibooker.setCurrentFolder(dttf_trk_folder_integrated_gmt);
552 
553  sprintf(hname, "dttf_tracks_with_gmt_match");
554  sprintf(htitle, "DTTF Tracks With a Match in GMT");
555  dttf_gmt_match = ibooker.book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
557 
558  sprintf(hname, "dttf_tracks_without_gmt_match");
559  sprintf(htitle, "DTTF Tracks Without a Match in GMT");
560  dttf_gmt_missed = ibooker.book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
562 
563  sprintf(hname, "dttf_missing_tracks_in_gmt");
564  sprintf(htitle, "GMT Tracks Without a Corresponding Track in DTTF");
565  dttf_gmt_ghost = ibooker.book2D(hname, htitle, 5, -2, 3, 12, 1, 13.);
566 
567  dttf_gmt_ghost->setBinLabel(1, "N2", 1);
568  dttf_gmt_ghost->setBinLabel(2, "N1", 1);
569  dttf_gmt_ghost->setBinLabel(3, "N0/P0", 1);
570  dttf_gmt_ghost->setBinLabel(4, "P1", 1);
571  dttf_gmt_ghost->setBinLabel(5, "P2", 1);
572 
573 
574  // sprintf(hname, "dttf_eta_phi_missing_tracks_in_gmt");
575  // sprintf(htitle, "GMT Tracks Without a Corresponding Track in DTTF");
576  // dttf_gmt_ghost_phys = dbe_->book2D(hname, htitle, 64, 0., 64., 144, 0., 144. );
577 
578 }
579 
580 //--------------------------------------------------------
582  const edm::EventSetup& eventSetup)
583 {
584 
585 
586  if ( verbose_ )
587  edm::LogInfo("L1TDTTF::Analyze::start") << "#################### START";
588 
590  ++nev_;
591  memset( numTracks, 0, 72 * sizeof(int) );
592 
594  edm::Handle<L1MuDTTrackContainer > myL1MuDTTrackContainer;
595  try {
596  event.getByToken(trackInputToken_, myL1MuDTTrackContainer);
597  } catch (cms::Exception& iException) {
598  edm::LogError("L1TDTTF::analyze::DataNotFound")
599  << "can't getByToken L1MuDTTrackContainer with label "
600  << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
601  return;
602  }
603 
604  if ( !myL1MuDTTrackContainer.isValid() ) {
605  edm::LogError("L1TDTTF::analyze::DataNotFound")
606  << "can't find L1MuDTTrackContainer with label "
607  << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
608  return;
609  }
610 
611  L1MuDTTrackContainer::TrackContainer const * trackContainer =
612  myL1MuDTTrackContainer->getContainer();
613 
615  if ( !trackContainer->empty() ) {
616  ++nev_dttf_;
617  if( trackContainer->size() > 1 ) ++nev_dttf_track2_;
618  }
619 
623  bool accept = true;
624  if ( ! online_ ) {
625 
626  try {
627 
629  event.getByToken(muonCollectionToken_, muons);
630  accept = false;
631  if ( muons.isValid() ) {
632  for (reco::MuonCollection::const_iterator recoMu = muons->begin();
633  recoMu!=muons->end(); ++recoMu ) {
634  if ( fabs( recoMu->eta() ) < 1.4 ) {
635  if ( verbose_ ) {
636  edm::LogInfo("L1TDTTFClient::Analyze:GM") << "Found a global muon!";
637  }
638  accept = true;
639  break;
640  }
641 
642  }
643 
645  if ( ! accept ) {
646  dttf_spare->Fill( !trackContainer->empty() ? 1 : 0 );
647 
648  if ( verbose_ ) {
649  edm::LogInfo("L1TDTTFClient::Analyze:GM")
650  << "No global muons in this event!";
651  }
652 
653  } else {
654  dttf_spare->Fill( !trackContainer->empty() ? 2 : 3 );
655  }
656 
657  } else {
659  accept = true;
660  edm::LogWarning("L1TDTTFClient::Analyze:GM")
661  << "Invalid MuonCollection with label "
663  }
664 
665 
666  } catch (cms::Exception& iException) {
668  accept = true;
669  edm::LogError("DataNotFound") << "Unable to getByToken MuonCollection with label "
671  }
672 
673  }
674 
675 
677  std::vector<L1MuRegionalCand> gmtBx0DttfCandidates;
678 
679  try {
680 
682  event.getByToken(gmtSourceToken_, pCollection);
683 
684  if ( !pCollection.isValid() ) {
685  edm::LogError("DataNotFound") << "can't find L1MuGMTReadoutCollection with label "
686  << gmtSource_.label() ;
687  }
688 
689  // get GMT readout collection
690  L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
691  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
692 
693  std::vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
694 
695  for ( RRItr = gmt_records.begin(); RRItr != gmt_records.end(); ++RRItr ) {
696 
697  std::vector<L1MuRegionalCand> dttfCands = RRItr->getDTBXCands();
698  std::vector<L1MuRegionalCand>::iterator dttfCand;
699 
700  for( dttfCand = dttfCands.begin(); dttfCand != dttfCands.end();
701  ++dttfCand ) {
702 
703  if(dttfCand->empty()) continue;
705  if ( RRItr->getBxInEvent() ) continue;
706 
707  // dttf_gmt_ghost_phys->Fill( dttfCand->eta_packed(),
708  // dttfCand->phi_packed() );
709  gmtBx0DttfCandidates.push_back( *dttfCand );
710 
711  }
712  }
713 
714  } catch (cms::Exception& iException) {
715  edm::LogError("DataNotFound") << "Unable to getByToken L1MuGMTReadoutCollection with label "
716  << gmtSource_.label() ;
717  }
718 
719 
720  // fill MEs if all selections are passed
721  if ( accept ) fillMEs( trackContainer, gmtBx0DttfCandidates );
722 
724  std::vector<L1MuRegionalCand>::iterator dttfCand;
725  for( dttfCand = gmtBx0DttfCandidates.begin();
726  dttfCand != gmtBx0DttfCandidates.end(); ++dttfCand ) {
727  if( dttfCand->empty() ) continue;
728 
732  int phi= dttfCand->phi_packed();
733  int sector = 1 + (phi + 6)/12;
734  if (sector > 12 ) sector -= 12;
735  double eta = dttfCand->etaValue();
736 
737  int wheel = -3;
738  if ( eta < -0.74 ) {
739  wheel = -2;
740  } else if ( eta < -0.3 ) {
741  wheel = -1;
742 
743  } else if ( eta < 0.3 ) {
744  wheel = 0;
745 
746  } else if ( eta < 0.74 ) {
747  wheel = 1;
748  } else {
749  wheel = 2;
750  }
751 
752  dttf_gmt_ghost->Fill( wheel, sector );
753  // dttf_gmt_ghost_phys->Fill( dttfCand->eta_packed(),
754  // dttfCand->phi_packed() );
755  }
756 
757 
759  int numTracksInt = 0;
760 
761  for ( int w = 0; w < 6; ++w ) {
762 
763  int numTracks_wh = 0;
764  for ( int s = 0; s < 12; ++s ) {
765 
767 
768  numTracks_wh += numTracks[w][s];
769 
770  }
771 
772  numTracksInt += numTracks_wh;
773  dttf_nTracksPerEvent_wheel[w]->Fill( numTracks_wh );
774 
775  }
776 
777  dttf_nTracksPerEvent_integ->Fill( numTracksInt );
778 
779 
780 
781 }
782 
783 
784 
785 
786 //--------------------------------------------------------
787 void L1TDTTF::fillMEs( std::vector<L1MuDTTrackCand> const* trackContainer,
788  std::vector<L1MuRegionalCand>& gmtDttfCands )
789 {
790 
791  L1MuDTTrackContainer::TrackContainer::const_iterator track
792  = trackContainer->begin();
793  L1MuDTTrackContainer::TrackContainer::const_iterator trackEnd
794  = trackContainer->end();
795 
796  for ( ; track != trackEnd; ++track ) {
797 
798  if ( verbose_ ) {
799  edm::LogInfo("L1TDTTF::Analyze") << "bx = " << track->bx();
800  edm::LogInfo("L1TDTTF::Analyze") << "quality (packed) = "
801  << track->quality_packed();
802  edm::LogInfo("L1TDTTF::Analyze") << "pt (packed) = "
803  << track->pt_packed()
804  << " , pt (GeV) = " << track->ptValue();
805  edm::LogInfo("L1TDTTF::Analyze") << "phi (packed) = "
806  << track->phi_packed()
807  << " , phi (rad) = " << track->phiValue();
808  edm::LogInfo("L1TDTTF::Analyze") << "charge (packed) = "
809  << track->charge_packed();
810  }
811 
812 
814  if ( ( track->whNum() == -1 ) && ! track->eta_packed() ) {
815  edm::LogInfo("L1TDTTF::Analyze") << "Skipping N0 with zero eta value";
816 
817  continue;
818  }
819 
820 
821  int bxindex = track->bx() + 1;
822  int se = track->scNum();
823  int sector = se + 1;
824  int whindex = track->whNum();
825 
826  whindex = ( whindex < 0 ) ? whindex + 3 : whindex + 2;
827 
828  if ( whindex < 0 || whindex > 5 ) {
829  edm::LogError("L1TDTTF::Analyze::WHEEL_ERROR") << track->whNum()
830  << "(" << whindex << ")";
831  continue;
832  }
833 
834  if ( se < 0 || se > 11 ) {
835  edm::LogError("L1TDTTF::Analyze::SECTOR_ERROR") << se;
836  continue;
837  }
838 
840 
842  // int phi_local = track->phi_packed();//range: 0 < phi_local < 31
843  // if ( phi_local > 15 ) phi_local -= 32; //range: -16 < phi_local < 15
844 
845  // int phi_global = phi_local + se * 12; //range: -16 < phi_global < 147
846  // if(phi_global < 0) phi_global += 144; //range: 0 < phi_global < 147
847  // if(phi_global > 143) phi_global -= 144; //range: 0 < phi_global < 143
848  // // float phi_phys = phi_global * 2.5 + 1.25;
849 
851  int phi_global = track->phi_packed();
852  phi_global = (phi_global > 15 ? phi_global - 32 : phi_global ) + se * 12;
853  if ( phi_global < -6 ) phi_global += 144; //range: 0 < phi_global < 147
854  if ( phi_global > 137 ) phi_global -= 144; //range: 0 < phi_global < 143
855 
856  // int eta_global = track->eta_packed();
857  // int eta_global = track->eta_packed() - 32;
858  // dttf_eta[bxindex][whindex][se]->Fill(eta_global);
859  // float eta_phys = eta_global / 2.4 ;
860 
864 
866  dttf_bx[whindex][se]->Fill(track->bx());
867 
869  if( track->TrkTag() == 1 ) {
870 
872  dttf_bx_2ndTrack[whindex][se]->Fill(track->bx());
873 
874  }
875 
879 
880 
881  if ( bxindex == 1 ) {
882 
884  ++numTracks[whindex][se];
885 
887  dttf_phi[whindex][se]->Fill(phi_global);
888 
890  dttf_qual[whindex][se]->Fill(track->quality_packed());
891 
893  dttf_pt[whindex][se]->Fill(track->pt_packed());
894 
896  dttf_q[whindex][se]->Fill(track->charge_packed());
897 
898 
900  dttf_eta[whindex][se]->Fill( track->eta_packed() );
901 
902  if( track->isFineHalo() ) {
903 
904  dttf_eta_fine_fraction[whindex][se]->Fill( 0 );
905 
907  dttf_phi_eta_fine_wheel[whindex]->Fill( track->eta_packed(), phi_global );
908 
909  } else {
910 
911  dttf_eta_fine_fraction[whindex][se]->Fill( 1 );
912 
914  dttf_phi_eta_coarse_wheel[whindex]->Fill( track->eta_packed(), phi_global );
915  }
916 
918  if ( online_ ) {
919  dttf_spare->Fill( whindex, sector );
920  }
921 
923  // dttf_qual_eta_integ->Fill(track->eta_packed(), track->quality_packed());
924 
926  if ( track->TrkTag() == 1 ) {
927 
929  dttf_phi_wheel_2ndTrack[whindex]->Fill(phi_global);
930 
932  dttf_pt_wheel_2ndTrack[whindex]->Fill(track->pt_packed());
933 
935  dttf_eta_wheel_2ndTrack[whindex]->Fill(track->eta_packed());
936 
938  dttf_quality_wheel_2ndTrack[whindex]->Fill(track->quality_packed());
939 
941  dttf_q_wheel_2ndTrack[whindex]->Fill(track->charge_packed());
942 
944  dttf_quality_summary_wheel_2ndTrack[whindex]->Fill( sector, track->quality_packed() );
945 
947  dttf_phi_eta_wheel_2ndTrack[whindex]->Fill( track->eta_packed(), phi_global );
948 
949  }
950 
952  bool match = false;
953  std::vector<L1MuRegionalCand>::iterator dttfCand;
955  unsigned int gmt_phi = ( phi_global < 0 ? phi_global + 144 : phi_global );
956 
957  for ( dttfCand = gmtDttfCands.begin(); dttfCand != gmtDttfCands.end();
958  ++dttfCand ) {
959 
961  if ( dttfCand->empty() ) continue;
962  if ( ( dttfCand->phi_packed() == gmt_phi ) &&
963  dttfCand->quality_packed() == track->quality_packed() ) {
964  match = true;
965  dttfCand->reset();
966  break;
967  }
968 
969 
970  }
971 
972  if ( match ) {
973  dttf_gmt_match->Fill( whindex, sector );
974  } else {
975  dttf_gmt_missed->Fill( whindex, sector );
976  }
977 
978  }
979 
980  }
981 
982 }
983 
984 
985 //--------------------------------------------------------
987 {
988 
989  if( axis == 1 )
990  me->setAxisTitle("Quality", axis);
991  me->setBinLabel(1, "T34", axis);
992  me->setBinLabel(2, "T23/24", axis);
993  me->setBinLabel(3, "T12/13/14", axis);
994  me->setBinLabel(4, "T234", axis);
995  me->setBinLabel(5, "T134", axis);
996  me->setBinLabel(6, "T123/124", axis);
997  me->setBinLabel(7, "T1234", axis);
998 }
999 
1000 //--------------------------------------------------------
1002 {
1003  me->setAxisTitle("Wheel", 1);
1004  me->setBinLabel(1, "N2", 1);
1005  me->setBinLabel(2, "N1", 1);
1006  me->setBinLabel(3, "N0", 1);
1007  me->setBinLabel(4, "P0", 1);
1008  me->setBinLabel(5, "P1", 1);
1009  me->setBinLabel(6, "P2", 1);
1010 }
1011 
1012 
1013 
1014 //--------------------------------------------------------
1015 void L1TDTTF::bookEta( int wh, int & nbins, float & start, float & stop )
1016 {
1017 
1018  switch ( wh ) {
1019  case 0 : start = 0; stop = 18; nbins = 18; break; // N2
1020  case 1 : start = 8; stop = 28; nbins = 20; break; // N1
1021  case 2 : start = 22; stop = 32; nbins = 10; break; // N0
1022  case 3 : start = 22; stop = 42; nbins = 20; break; // P0
1023  case 4 : start = 36; stop = 56; nbins = 20; break; // P1
1024  case 5 : start = 46; stop = 64; nbins = 18; break; // P2
1025  default : start = 0; stop = 0; nbins = 0; break; // BOH
1026  }
1027 
1028 }
1029 
Definition: start.py:1
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string l1tsubsystemfolder_
Definition: L1TDTTF.h:60
edm::InputTag trackInputTag_
Definition: L1TDTTF.h:64
MonitorElement * dttf_phi_eta_coarse_wheel[6]
Definition: L1TDTTF.h:70
const double w
Definition: UKUtility.cc:23
edm::InputTag muonCollectionLabel_
Definition: L1TDTTF.h:59
void bookEta(int wh, int &nbins, float &start, float &stop)
Definition: L1TDTTF.cc:1015
MonitorElement * dttf_nTracksPerEvent_wheel[6]
Definition: L1TDTTF.h:66
MonitorElement * dttf_phi_eta_fine_wheel[6]
Definition: L1TDTTF.h:69
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 setWheelLabel(MonitorElement *me)
Definition: L1TDTTF.cc:1001
MonitorElement * dttf_gmt_match
Definition: L1TDTTF.h:90
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
MonitorElement * dttf_phi_wheel_2ndTrack[6]
Definition: L1TDTTF.h:73
void Fill(long long x)
~L1TDTTF() override
Definition: L1TDTTF.cc:239
MonitorElement * dttf_nTracksPerEvent_integ
Definition: L1TDTTF.h:87
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TDTTF.cc:581
MonitorElement * dttf_pt_wheel_2ndTrack[6]
Definition: L1TDTTF.h:74
MonitorElement * dttf_eta_wheel_2ndTrack[6]
Definition: L1TDTTF.h:72
edm::InputTag gmtSource_
Definition: L1TDTTF.h:58
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::string outputFile_
Definition: L1TDTTF.h:63
edm::EDGetTokenT< L1MuGMTReadoutCollection > gmtSourceToken_
Definition: L1TDTTF.h:104
MonitorElement * dttf_qual[6][12]
Definition: L1TDTTF.h:80
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
Definition: L1TDTTF.cc:245
edm::InputTag dttpgSource_
Definition: L1TDTTF.h:57
MonitorElement * dttf_quality_wheel_2ndTrack[6]
Definition: L1TDTTF.h:67
std::vector< L1MuDTTrackCand > TrackContainer
MonitorElement * dttf_phi[6][12]
Definition: L1TDTTF.h:83
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
edm::EDGetTokenT< L1MuDTTrackContainer > trackInputToken_
Definition: L1TDTTF.h:102
void fillMEs(std::vector< L1MuDTTrackCand > const *trackContainer, std::vector< L1MuRegionalCand > &gmtDttfCands)
Definition: L1TDTTF.cc:787
MonitorElement * dttf_gmt_missed
Definition: L1TDTTF.h:91
bool isValid() const
Definition: HandleBase.h:74
MonitorElement * dttf_quality_summary_wheel_2ndTrack[6]
Definition: L1TDTTF.h:68
MonitorElement * dttf_eta_fine_fraction[6][12]
Definition: L1TDTTF.h:81
TH2F * getTH2F() const
MonitorElement * dttf_bx[6][12]
Definition: L1TDTTF.h:78
int nev_dttf_track2_
Definition: L1TDTTF.h:98
int numTracks[6][12]
Definition: L1TDTTF.h:99
T const * product() const
Definition: Handle.h:81
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
bool verbose_
Definition: L1TDTTF.h:62
MonitorElement * dttf_gmt_ghost
Definition: L1TDTTF.h:92
edm::EDGetTokenT< reco::MuonCollection > muonCollectionToken_
Definition: L1TDTTF.h:103
MonitorElement * dttf_bx_2ndTrack[6][12]
Definition: L1TDTTF.h:79
int nev_dttf_
Definition: L1TDTTF.h:97
MonitorElement * dttf_q_wheel_2ndTrack[6]
Definition: L1TDTTF.h:75
std::string const & label() const
Definition: InputTag.h:36
std::string const & process() const
Definition: InputTag.h:40
MonitorElement * dttf_eta[6][12]
Definition: L1TDTTF.h:82
HLT enums.
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Definition: L1TDTTF.cc:251
bool online_
Definition: L1TDTTF.h:61
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
MonitorElement * dttf_nTracksPerEv[6][12]
Definition: L1TDTTF.h:77
MonitorElement * dttf_pt[6][12]
Definition: L1TDTTF.h:84
MonitorElement * dttf_phi_eta_wheel_2ndTrack[6]
Definition: L1TDTTF.h:71
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:88
int nev_
Definition: L1TDTTF.h:96
MonitorElement * dttf_q[6][12]
Definition: L1TDTTF.h:85
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setQualLabel(MonitorElement *me, int axis)
Definition: L1TDTTF.cc:986
TrackContainer const * getContainer() const
L1TDTTF(const edm::ParameterSet &ps)
base services
Definition: L1TDTTF.cc:197
Definition: event.py:1
Definition: Run.h:44