CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
250  //empty
251 }
252 
253 //--------------------------------------------------------
255 {
257  runId_=ibooker.bookInt("iRun");
258  lumisecId_=ibooker.bookInt("iLumi");
259  nev_ = 0;
260  nev_dttf_ = 0;
261  nev_dttf_track2_ = 0;
262 
263  // get hold of back-end interface
264 
265  std::string dttf_trk_folder = l1tsubsystemfolder_;
266 
267  char hname[100];
268  char htitle[100];
269 
271  float start = 0;
272  float stop = 0;
273  int nbins = 0;
275 
277  ibooker.setCurrentFolder(dttf_trk_folder);
278 
279  std::string wheelpath[6] = { "/02-WHEEL_N2",
280  "/03-WHEEL_N1",
281  "/04-WHEEL_N0",
282  "/05-WHEEL_P0",
283  "/06-WHEEL_P1",
284  "/07-WHEEL_P2" };
285 
286 
287  char c_whn[6][3] = { "N2", "N1", "N0", "P0", "P1", "P2" };
288  // char bxn [3][3] = { "N1", "0", "P1" };
289  // char bxn[3][25] = {"/BX_NONZERO_ONLY/BX_N1", "", "/BX_NONZERO_ONLY/BX_P1"};
290 
291  for ( int iwh = 0; iwh < 6; ++iwh ) {
292 
293  bookEta( iwh, nbins, start, stop );
294 
298  std::string dttf_trk_folder_wheel = dttf_trk_folder + wheelpath[iwh];
299  ibooker.setCurrentFolder(dttf_trk_folder_wheel);
300 
302  sprintf(hname, "dttf_01_nTracksPerEvent_wh%s", c_whn[iwh]);
303  sprintf(htitle, "Wheel %s - Number Tracks Per Event", c_whn[iwh]);
304  dttf_nTracksPerEvent_wheel[iwh] = ibooker.book1D(hname, htitle,
305  10, 0.5, 10.5);
306  dttf_nTracksPerEvent_wheel[iwh]->setAxisTitle("# tracks/event", 1);
307 
309  sprintf(hname, "dttf_07_phi_vs_etaFine_wh%s", c_whn[iwh]);
310  sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (fine #eta only, unpacked values)", c_whn[iwh]);
311  dttf_phi_eta_fine_wheel[iwh] = ibooker.book2D(hname, htitle,
312  nbins, start-0.5, stop-0.5,
313  144, -6, 138);
314  // 144, -0.5, 143.5);
315 
316  dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#eta", 1);
317  dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#phi", 2);
318 
320  sprintf(hname, "dttf_08_phi_vs_etaCoarse_wh%s", c_whn[iwh]);
321  sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (coarse #eta only, unpacked values)", c_whn[iwh]);
322  dttf_phi_eta_coarse_wheel[iwh] = ibooker.book2D(hname, htitle,
323  nbins, start-0.5, stop-0.5,
324  144, -6, 138);
325  // 144, -0.5, 143.5);
326  dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#eta", 1);
327  dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#phi", 2);
328 
331  std::string dttf_trk_folder_wheel_2ndtrack =
332  dttf_trk_folder_wheel + "/2ND_TRACK_ONLY";
333  ibooker.setCurrentFolder(dttf_trk_folder_wheel_2ndtrack);
334 
335 
337  sprintf(hname, "dttf_04_quality_wh%s_2ndTrack", c_whn[iwh]);
338  sprintf(htitle, "Wheel %s - 2nd Tracks Quality distribution", c_whn[iwh]);
339  dttf_quality_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 7, 1, 8);
341 
343  sprintf(hname, "dttf_05_quality_summary_wh%s_2ndTrack", c_whn[iwh]);
344  sprintf(htitle, "Wheel %s - 2nd Tracks - Quality", c_whn[iwh]);
345  dttf_quality_summary_wheel_2ndTrack[iwh] = ibooker.book2D(hname, htitle,
346  12, 1, 13, 7, 1, 8 );
349  // dttf_quality_summary_wheel_2ndTrack[iwh]->setAxisTitle("Quality", 2);
350 
352  sprintf(hname, "dttf_06_phi_vs_eta_wh%s_2ndTrack", c_whn[iwh]);
353  sprintf(htitle, "Wheel %s - #eta-#phi Distribution of DTTF 2nd Tracks",
354  c_whn[iwh]);
355 
356  dttf_phi_eta_wheel_2ndTrack[iwh] = ibooker.book2D(hname, htitle,
357  nbins, start-0.5,stop-0.5,
358  144, -6, 138);
359  // 144, -0.5, 143.5);
360  dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
361  dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 2);
362 
363 
364 
366  sprintf(hname, "dttf_07_eta_wh%s_2ndTrack", c_whn[iwh]);
367  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks #eta distribution (Packed values)",
368  c_whn[iwh]);
369  dttf_eta_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 64, -0.5, 63.5);
370  dttf_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
371 
373  sprintf(hname, "dttf_08_phi_wh%s_2ndTrack", c_whn[iwh]);
374  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Phi distribution (Packed values)",
375  c_whn[iwh]);
376  dttf_phi_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 144, -6, 138. );
377  dttf_phi_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 1);
378 
380  sprintf(hname, "dttf_09_pt_wh%s_2ndTrack", c_whn[iwh]);
381  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks p_{T} distribution (Packed values)",
382  c_whn[iwh]);
383  dttf_pt_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 32, -0.5, 31.5);
384  dttf_pt_wheel_2ndTrack[iwh]->setAxisTitle("p_{T}", 1);
385 
387  sprintf(hname, "dttf_10_charge_wh%s_2ndTrack", c_whn[iwh]);
388  sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Charge distribution", c_whn[iwh]);
389  dttf_q_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 2, -0.5, 1.5);
390  dttf_q_wheel_2ndTrack[iwh]->setAxisTitle("Charge", 1);
391 
392 
393 
394 
398 
400  std::string dttf_trk_folder_nTracksPerEvent = dttf_trk_folder_wheel + "/TracksPerEvent";
401  ibooker.setCurrentFolder(dttf_trk_folder_nTracksPerEvent);
402 
403  for(int ise = 0; ise < 12; ++ise) {
404  sprintf(hname, "dttf_nTracksPerEvent_wh%s_se%d", c_whn[iwh], ise+1);
405  sprintf(htitle, "Wheel %s Sector %d - Number of Tracks Per Event",
406  c_whn[iwh], ise+1);
407  dttf_nTracksPerEv[iwh][ise] = ibooker.book1D(hname, htitle, 2, 0.5, 2.5);
408  dttf_nTracksPerEv[iwh][ise]->setAxisTitle("# tracks/event", 1);
409  }
410 
411 
413  std::string dttf_trk_folder_wh_bxsec_all =
414  dttf_trk_folder_wheel + "/BX_BySector";
415  ibooker.setCurrentFolder(dttf_trk_folder_wh_bxsec_all);
416 
417  for(int ise = 0; ise < 12; ++ise ) {
418  sprintf(hname, "dttf_bx_wh%s_se%d", c_whn[iwh], ise+1);
419  sprintf(htitle, "Wheel %s Sector %d - BX Distribution",
420  c_whn[iwh], ise+1);
421  dttf_bx[iwh][ise] = ibooker.book1D(hname, htitle, 3, -1.5, 1.5);
422  dttf_bx[iwh][ise]->setAxisTitle("BX", 1);
423  }
424 
425  std::string dttf_trk_folder_wh_bxsec_trk2 =
426  dttf_trk_folder_wheel + "/BX_BySector/2ND_TRACK_ONLY";
427  ibooker.setCurrentFolder(dttf_trk_folder_wh_bxsec_trk2);
428 
429  for(int ise = 0; ise < 12; ++ise ) {
430  sprintf(hname, "dttf_bx_2ndTrack_wh%s_se%d", c_whn[iwh], ise+1);
431  sprintf(htitle, "Wheel %s Sector %d - BX 2nd Tracks only",
432  c_whn[iwh], ise+1);
433  dttf_bx_2ndTrack[iwh][ise] = ibooker.book1D(hname, htitle, 3, -1.5, 1.5);
434  dttf_bx_2ndTrack[iwh][ise]->setAxisTitle("BX", 1);
435  }
436 
438  std::string dttf_trk_folder_charge = dttf_trk_folder_wheel + "/Charge";
439  ibooker.setCurrentFolder(dttf_trk_folder_charge);
440 
441  for(int ise = 0; ise < 12; ++ise) {
442  sprintf(hname, "dttf_charge_wh%s_se%d", c_whn[iwh], ise+1);
443  sprintf(htitle, "Wheel %s Sector %d - Packed Charge", c_whn[iwh], ise+1);
444  dttf_q[iwh][ise] = ibooker.book1D(hname, htitle, 2, -0.5, 1.5);
445  dttf_q[iwh][ise]->setAxisTitle("Charge", 1);
446  }
447 
449  std::string dttf_trk_folder_pt = dttf_trk_folder_wheel + "/PT";
450  ibooker.setCurrentFolder(dttf_trk_folder_pt);
451 
452  for(int ise = 0; ise < 12; ++ise ) {
453  sprintf(hname, "dttf_pt_wh%s_se%d", c_whn[iwh], ise+1);
454  sprintf(htitle, "Wheel %s Sector %d - Packed p_{T}",
455  c_whn[iwh], ise + 1 );
456  dttf_pt[iwh][ise]= ibooker.book1D(hname, htitle, 32, -0.5, 31.5);
457  dttf_pt[iwh][ise]->setAxisTitle("p_{T}", 1);
458  }
459 
461  std::string dttf_trk_folder_phi = dttf_trk_folder_wheel + "/Phi";
462  ibooker.setCurrentFolder(dttf_trk_folder_phi);
463 
464  for(int ise = 0; ise < 12; ++ise ) {
465  sprintf(hname, "dttf_phi_wh%s_se%d", c_whn[iwh], ise+1);
466  sprintf(htitle, "Wheel %s Sector %d - Packed Phi", c_whn[iwh], ise+1);
467  dttf_phi[iwh][ise] = ibooker.book1D(hname, htitle, 144, -6, 138);
468  dttf_phi[iwh][ise]->setAxisTitle("#phi", 1);
469  //dttf_phi[iwh][ise] = dbe_->book1D(title,title, 32,-16.5, 15.5);
470  }
471 
473  std::string dttf_trk_folder_quality = dttf_trk_folder_wheel + "/Quality";
474  ibooker.setCurrentFolder(dttf_trk_folder_quality);
475 
476  for(int ise = 0; ise < 12; ++ise){
477  sprintf(hname, "dttf_qual_wh%s_se%d", c_whn[iwh], ise+1);
478  sprintf(htitle, "Wheel %s Sector %d - Packed Quality",
479  c_whn[iwh], ise+1);
480  dttf_qual[iwh][ise] = ibooker.book1D(hname, htitle, 7, 1, 8);
481  dttf_qual[iwh][ise]->setAxisTitle("Quality", 1);
482  setQualLabel( dttf_qual[iwh][ise], 1 );
483  }
484 
486  std::string dttf_trk_folder_eta = dttf_trk_folder_wheel + "/Eta";
487  ibooker.setCurrentFolder(dttf_trk_folder_eta);
488 
489  for (int ise = 0; ise < 12; ++ise ) {
490 
491  sprintf(hname, "dttf_eta_wh%s_se%d", c_whn[iwh], ise+1);
492  sprintf(htitle, "Wheel %s Sector %d - Packed #eta",
493  c_whn[iwh], ise+1);
494  dttf_eta[iwh][ise] = ibooker.book1D(hname, htitle, 64, -0.5, 63.5);
495  dttf_eta[iwh][ise]->setAxisTitle("#eta", 1);
496 
497  }
498 
500  dttf_trk_folder_eta = dttf_trk_folder_wheel + "/EtaFineFraction";
501  ibooker.setCurrentFolder(dttf_trk_folder_eta);
502 
503  for (int ise = 0; ise < 12; ++ise ) {
504 
505  sprintf(hname, "dttf_etaFine_fraction_wh%s_se%d", c_whn[iwh], ise+1);
506  sprintf(htitle, "Wheel %s Sector %d - Eta Fine Fraction",
507  c_whn[iwh], ise+1);
508  dttf_eta_fine_fraction[iwh][ise] = ibooker.book1D(hname, htitle, 2, 0, 2);
509  dttf_eta_fine_fraction[iwh][ise]->setAxisTitle("#eta", 1);
510  dttf_eta_fine_fraction[iwh][ise]->setBinLabel(1, "fine", 1);
511  dttf_eta_fine_fraction[iwh][ise]->setBinLabel(2, "coarse", 1);
512  }
513 
514  }
515 
519  std::string dttf_trk_folder_inclusive = dttf_trk_folder + "/01-INCLUSIVE";
520  ibooker.setCurrentFolder(dttf_trk_folder_inclusive);
521 
522 
523  sprintf(hname, "dttf_01_nTracksPerEvent_integ");
524  sprintf(htitle, "Number of DTTF Tracks Per Event");
525  dttf_nTracksPerEvent_integ = ibooker.book1D(hname, htitle, 20, 0.5, 20.5);
526  dttf_nTracksPerEvent_integ->setAxisTitle("# tracks/event", 1);
527 
529  // sprintf(hname, "dttf_10_qual_eta_distr");
530  // sprintf(htitle, "DTTF Tracks Quality vs Eta Distribution");
531  // dttf_qual_eta_integ = dbe_->book2D(hname, htitle, 64, 0, 64, 7, 1, 8);
532  // setQualLabel( dttf_qual_eta_integ, 2);
533 
535  if ( online_ ) {
536  sprintf(hname, "dttf_04_tracks_occupancy_by_lumi");
537  sprintf(htitle, "DTTF Tracks in the last LumiSections");
538  dttf_spare = ibooker.book2D(hname, htitle, 6, 0, 6, 12, 1, 13);
540  dttf_spare->setAxisTitle("Sector", 2);
541  dttf_spare->getTH2F()->GetXaxis()->SetNdivisions(12);
542  } else {
543 
544  sprintf(hname, "dttf_04_global_muons_request");
545  sprintf(htitle, "Tracks compatible with a Global Muon in the Barrel");
546  dttf_spare = ibooker.book1D(hname, htitle, 4, -0.5, 3.5 );
547  dttf_spare->setBinLabel(1, "No tracks", 1);
548  dttf_spare->setBinLabel(2, "No tracks but GM", 1);
549  dttf_spare->setBinLabel(3, "Tracks wo GM", 1);
550  dttf_spare->setBinLabel(4, "Tracks w GM", 1);
551 
552  }
553 
554  std::string dttf_trk_folder_integrated_gmt =
555  dttf_trk_folder + "/08-GMT_MATCH";
556  ibooker.setCurrentFolder(dttf_trk_folder_integrated_gmt);
557 
558  sprintf(hname, "dttf_tracks_with_gmt_match");
559  sprintf(htitle, "DTTF Tracks With a Match in GMT");
560  dttf_gmt_match = ibooker.book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
562 
563  sprintf(hname, "dttf_tracks_without_gmt_match");
564  sprintf(htitle, "DTTF Tracks Without a Match in GMT");
565  dttf_gmt_missed = ibooker.book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
567 
568  sprintf(hname, "dttf_missing_tracks_in_gmt");
569  sprintf(htitle, "GMT Tracks Without a Corresponding Track in DTTF");
570  dttf_gmt_ghost = ibooker.book2D(hname, htitle, 5, -2, 3, 12, 1, 13.);
571 
572  dttf_gmt_ghost->setBinLabel(1, "N2", 1);
573  dttf_gmt_ghost->setBinLabel(2, "N1", 1);
574  dttf_gmt_ghost->setBinLabel(3, "N0/P0", 1);
575  dttf_gmt_ghost->setBinLabel(4, "P1", 1);
576  dttf_gmt_ghost->setBinLabel(5, "P2", 1);
577 
578 
579  // sprintf(hname, "dttf_eta_phi_missing_tracks_in_gmt");
580  // sprintf(htitle, "GMT Tracks Without a Corresponding Track in DTTF");
581  // dttf_gmt_ghost_phys = dbe_->book2D(hname, htitle, 64, 0., 64., 144, 0., 144. );
582 
583 }
584 
585 //--------------------------------------------------------
587  const edm::EventSetup& eventSetup)
588 {
589 
590 
591  if ( verbose_ )
592  edm::LogInfo("L1TDTTF::Analyze::start") << "#################### START";
593 
595  ++nev_;
596  memset( numTracks, 0, 72 * sizeof(int) );
597 
599  edm::Handle<L1MuDTTrackContainer > myL1MuDTTrackContainer;
600  try {
601  event.getByToken(trackInputToken_, myL1MuDTTrackContainer);
602  } catch (cms::Exception& iException) {
603  edm::LogError("L1TDTTF::analyze::DataNotFound")
604  << "can't getByToken L1MuDTTrackContainer with label "
605  << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
606  return;
607  }
608 
609  if ( !myL1MuDTTrackContainer.isValid() ) {
610  edm::LogError("L1TDTTF::analyze::DataNotFound")
611  << "can't find L1MuDTTrackContainer with label "
612  << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
613  return;
614  }
615 
616  L1MuDTTrackContainer::TrackContainer const * trackContainer =
617  myL1MuDTTrackContainer->getContainer();
618 
620  if ( trackContainer->size() > 0 ) {
621  ++nev_dttf_;
622  if( trackContainer->size() > 1 ) ++nev_dttf_track2_;
623  }
624 
628  bool accept = true;
629  if ( ! online_ ) {
630 
631  try {
632 
634  event.getByToken(muonCollectionToken_, muons);
635  accept = false;
636  if ( muons.isValid() ) {
637  for (reco::MuonCollection::const_iterator recoMu = muons->begin();
638  recoMu!=muons->end(); ++recoMu ) {
639  if ( fabs( recoMu->eta() ) < 1.4 ) {
640  if ( verbose_ ) {
641  edm::LogInfo("L1TDTTFClient::Analyze:GM") << "Found a global muon!";
642  }
643  accept = true;
644  break;
645  }
646 
647  }
648 
650  if ( ! accept ) {
651  dttf_spare->Fill( trackContainer->size() ? 1 : 0 );
652 
653  if ( verbose_ ) {
654  edm::LogInfo("L1TDTTFClient::Analyze:GM")
655  << "No global muons in this event!";
656  }
657 
658  } else {
659  dttf_spare->Fill( trackContainer->size() ? 2 : 3 );
660  }
661 
662  } else {
664  accept = true;
665  edm::LogWarning("L1TDTTFClient::Analyze:GM")
666  << "Invalid MuonCollection with label "
668  }
669 
670 
671  } catch (cms::Exception& iException) {
673  accept = true;
674  edm::LogError("DataNotFound") << "Unable to getByToken MuonCollection with label "
676  }
677 
678  }
679 
680 
682  std::vector<L1MuRegionalCand> gmtBx0DttfCandidates;
683 
684  try {
685 
687  event.getByToken(gmtSourceToken_, pCollection);
688 
689  if ( !pCollection.isValid() ) {
690  edm::LogError("DataNotFound") << "can't find L1MuGMTReadoutCollection with label "
691  << gmtSource_.label() ;
692  }
693 
694  // get GMT readout collection
695  L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
696  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
697 
698  std::vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
699 
700  for ( RRItr = gmt_records.begin(); RRItr != gmt_records.end(); ++RRItr ) {
701 
702  std::vector<L1MuRegionalCand> dttfCands = RRItr->getDTBXCands();
703  std::vector<L1MuRegionalCand>::iterator dttfCand;
704 
705  for( dttfCand = dttfCands.begin(); dttfCand != dttfCands.end();
706  ++dttfCand ) {
707 
708  if(dttfCand->empty()) continue;
710  if ( RRItr->getBxInEvent() ) continue;
711 
712  // dttf_gmt_ghost_phys->Fill( dttfCand->eta_packed(),
713  // dttfCand->phi_packed() );
714  gmtBx0DttfCandidates.push_back( *dttfCand );
715 
716  }
717  }
718 
719  } catch (cms::Exception& iException) {
720  edm::LogError("DataNotFound") << "Unable to getByToken L1MuGMTReadoutCollection with label "
721  << gmtSource_.label() ;
722  }
723 
724 
725  // fill MEs if all selections are passed
726  if ( accept ) fillMEs( trackContainer, gmtBx0DttfCandidates );
727 
729  std::vector<L1MuRegionalCand>::iterator dttfCand;
730  for( dttfCand = gmtBx0DttfCandidates.begin();
731  dttfCand != gmtBx0DttfCandidates.end(); ++dttfCand ) {
732  if( dttfCand->empty() ) continue;
733 
737  int phi= dttfCand->phi_packed();
738  int sector = 1 + (phi + 6)/12;
739  if (sector > 12 ) sector -= 12;
740  double eta = dttfCand->etaValue();
741 
742  int wheel = -3;
743  if ( eta < -0.74 ) {
744  wheel = -2;
745  } else if ( eta < -0.3 ) {
746  wheel = -1;
747 
748  } else if ( eta < 0.3 ) {
749  wheel = 0;
750 
751  } else if ( eta < 0.74 ) {
752  wheel = 1;
753  } else {
754  wheel = 2;
755  }
756 
757  dttf_gmt_ghost->Fill( wheel, sector );
758  // dttf_gmt_ghost_phys->Fill( dttfCand->eta_packed(),
759  // dttfCand->phi_packed() );
760  }
761 
762 
764  int numTracksInt = 0;
765 
766  for ( int w = 0; w < 6; ++w ) {
767 
768  int numTracks_wh = 0;
769  for ( int s = 0; s < 12; ++s ) {
770 
772 
773  numTracks_wh += numTracks[w][s];
774 
775  }
776 
777  numTracksInt += numTracks_wh;
778  dttf_nTracksPerEvent_wheel[w]->Fill( numTracks_wh );
779 
780  }
781 
782  dttf_nTracksPerEvent_integ->Fill( numTracksInt );
783 
784 
785 
786 }
787 
788 
789 
790 
791 //--------------------------------------------------------
792 void L1TDTTF::fillMEs( std::vector<L1MuDTTrackCand> const* trackContainer,
793  std::vector<L1MuRegionalCand>& gmtDttfCands )
794 {
795 
796  L1MuDTTrackContainer::TrackContainer::const_iterator track
797  = trackContainer->begin();
798  L1MuDTTrackContainer::TrackContainer::const_iterator trackEnd
799  = trackContainer->end();
800 
801  for ( ; track != trackEnd; ++track ) {
802 
803  if ( verbose_ ) {
804  edm::LogInfo("L1TDTTF::Analyze") << "bx = " << track->bx();
805  edm::LogInfo("L1TDTTF::Analyze") << "quality (packed) = "
806  << track->quality_packed();
807  edm::LogInfo("L1TDTTF::Analyze") << "pt (packed) = "
808  << track->pt_packed()
809  << " , pt (GeV) = " << track->ptValue();
810  edm::LogInfo("L1TDTTF::Analyze") << "phi (packed) = "
811  << track->phi_packed()
812  << " , phi (rad) = " << track->phiValue();
813  edm::LogInfo("L1TDTTF::Analyze") << "charge (packed) = "
814  << track->charge_packed();
815  }
816 
817 
819  if ( ( track->whNum() == -1 ) && ! track->eta_packed() ) {
820  edm::LogInfo("L1TDTTF::Analyze") << "Skipping N0 with zero eta value";
821 
822  continue;
823  }
824 
825 
826  int bxindex = track->bx() + 1;
827  int se = track->scNum();
828  int sector = se + 1;
829  int whindex = track->whNum();
830 
831  whindex = ( whindex < 0 ) ? whindex + 3 : whindex + 2;
832 
833  if ( whindex < 0 || whindex > 5 ) {
834  edm::LogError("L1TDTTF::Analyze::WHEEL_ERROR") << track->whNum()
835  << "(" << whindex << ")";
836  continue;
837  }
838 
839  if ( se < 0 || se > 11 ) {
840  edm::LogError("L1TDTTF::Analyze::SECTOR_ERROR") << se;
841  continue;
842  }
843 
845 
847  // int phi_local = track->phi_packed();//range: 0 < phi_local < 31
848  // if ( phi_local > 15 ) phi_local -= 32; //range: -16 < phi_local < 15
849 
850  // int phi_global = phi_local + se * 12; //range: -16 < phi_global < 147
851  // if(phi_global < 0) phi_global += 144; //range: 0 < phi_global < 147
852  // if(phi_global > 143) phi_global -= 144; //range: 0 < phi_global < 143
853  // // float phi_phys = phi_global * 2.5 + 1.25;
854 
856  int phi_global = track->phi_packed();
857  phi_global = (phi_global > 15 ? phi_global - 32 : phi_global ) + se * 12;
858  if ( phi_global < -6 ) phi_global += 144; //range: 0 < phi_global < 147
859  if ( phi_global > 137 ) phi_global -= 144; //range: 0 < phi_global < 143
860 
861  // int eta_global = track->eta_packed();
862  // int eta_global = track->eta_packed() - 32;
863  // dttf_eta[bxindex][whindex][se]->Fill(eta_global);
864  // float eta_phys = eta_global / 2.4 ;
865 
869 
871  dttf_bx[whindex][se]->Fill(track->bx());
872 
874  if( track->TrkTag() == 1 ) {
875 
877  dttf_bx_2ndTrack[whindex][se]->Fill(track->bx());
878 
879  }
880 
884 
885 
886  if ( bxindex == 1 ) {
887 
889  ++numTracks[whindex][se];
890 
892  dttf_phi[whindex][se]->Fill(phi_global);
893 
895  dttf_qual[whindex][se]->Fill(track->quality_packed());
896 
898  dttf_pt[whindex][se]->Fill(track->pt_packed());
899 
901  dttf_q[whindex][se]->Fill(track->charge_packed());
902 
903 
905  dttf_eta[whindex][se]->Fill( track->eta_packed() );
906 
907  if( track->isFineHalo() ) {
908 
909  dttf_eta_fine_fraction[whindex][se]->Fill( 0 );
910 
912  dttf_phi_eta_fine_wheel[whindex]->Fill( track->eta_packed(), phi_global );
913 
914  } else {
915 
916  dttf_eta_fine_fraction[whindex][se]->Fill( 1 );
917 
919  dttf_phi_eta_coarse_wheel[whindex]->Fill( track->eta_packed(), phi_global );
920  }
921 
923  if ( online_ ) {
924  dttf_spare->Fill( whindex, sector );
925  }
926 
928  // dttf_qual_eta_integ->Fill(track->eta_packed(), track->quality_packed());
929 
931  if ( track->TrkTag() == 1 ) {
932 
934  dttf_phi_wheel_2ndTrack[whindex]->Fill(phi_global);
935 
937  dttf_pt_wheel_2ndTrack[whindex]->Fill(track->pt_packed());
938 
940  dttf_eta_wheel_2ndTrack[whindex]->Fill(track->eta_packed());
941 
943  dttf_quality_wheel_2ndTrack[whindex]->Fill(track->quality_packed());
944 
946  dttf_q_wheel_2ndTrack[whindex]->Fill(track->charge_packed());
947 
949  dttf_quality_summary_wheel_2ndTrack[whindex]->Fill( sector, track->quality_packed() );
950 
952  dttf_phi_eta_wheel_2ndTrack[whindex]->Fill( track->eta_packed(), phi_global );
953 
954  }
955 
957  bool match = false;
958  std::vector<L1MuRegionalCand>::iterator dttfCand;
960  unsigned int gmt_phi = ( phi_global < 0 ? phi_global + 144 : phi_global );
961 
962  for ( dttfCand = gmtDttfCands.begin(); dttfCand != gmtDttfCands.end();
963  ++dttfCand ) {
964 
966  if ( dttfCand->empty() ) continue;
967  if ( ( dttfCand->phi_packed() == gmt_phi ) &&
968  dttfCand->quality_packed() == track->quality_packed() ) {
969  match = true;
970  dttfCand->reset();
971  break;
972  }
973 
974 
975  }
976 
977  if ( match ) {
978  dttf_gmt_match->Fill( whindex, sector );
979  } else {
980  dttf_gmt_missed->Fill( whindex, sector );
981  }
982 
983  }
984 
985  }
986 
987 }
988 
989 
990 //--------------------------------------------------------
992 {
993 
994  if( axis == 1 )
995  me->setAxisTitle("Quality", axis);
996  me->setBinLabel(1, "T34", axis);
997  me->setBinLabel(2, "T23/24", axis);
998  me->setBinLabel(3, "T12/13/14", axis);
999  me->setBinLabel(4, "T234", axis);
1000  me->setBinLabel(5, "T134", axis);
1001  me->setBinLabel(6, "T123/124", axis);
1002  me->setBinLabel(7, "T1234", axis);
1003 }
1004 
1005 //--------------------------------------------------------
1007 {
1008  me->setAxisTitle("Wheel", 1);
1009  me->setBinLabel(1, "N2", 1);
1010  me->setBinLabel(2, "N1", 1);
1011  me->setBinLabel(3, "N0", 1);
1012  me->setBinLabel(4, "P0", 1);
1013  me->setBinLabel(5, "P1", 1);
1014  me->setBinLabel(6, "P2", 1);
1015 }
1016 
1017 
1018 
1019 //--------------------------------------------------------
1020 void L1TDTTF::bookEta( int wh, int & nbins, float & start, float & stop )
1021 {
1022 
1023  switch ( wh ) {
1024  case 0 : start = 0; stop = 18; nbins = 18; break; // N2
1025  case 1 : start = 8; stop = 28; nbins = 20; break; // N1
1026  case 2 : start = 22; stop = 32; nbins = 10; break; // N0
1027  case 3 : start = 22; stop = 42; nbins = 20; break; // P0
1028  case 4 : start = 36; stop = 56; nbins = 20; break; // P1
1029  case 5 : start = 46; stop = 64; nbins = 18; break; // P2
1030  default : start = 0; stop = 0; nbins = 0; break; // BOH
1031  }
1032 
1033 }
1034 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string l1tsubsystemfolder_
Definition: L1TDTTF.h:61
edm::InputTag trackInputTag_
Definition: L1TDTTF.h:65
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
MonitorElement * dttf_phi_eta_coarse_wheel[6]
Definition: L1TDTTF.h:71
const double w
Definition: UKUtility.cc:23
edm::InputTag muonCollectionLabel_
Definition: L1TDTTF.h:60
virtual ~L1TDTTF()
Definition: L1TDTTF.cc:239
void bookEta(int wh, int &nbins, float &start, float &stop)
Definition: L1TDTTF.cc:1020
MonitorElement * dttf_nTracksPerEvent_wheel[6]
Definition: L1TDTTF.h:67
MonitorElement * dttf_phi_eta_fine_wheel[6]
Definition: L1TDTTF.h:70
MonitorElement * bookInt(Args &&...args)
Definition: DQMStore.h:103
MonitorElement * lumisecId_
Definition: L1TDTTF.h:95
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:1006
MonitorElement * dttf_gmt_match
Definition: L1TDTTF.h:91
T eta() const
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:25
MonitorElement * dttf_phi_wheel_2ndTrack[6]
Definition: L1TDTTF.h:74
void Fill(long long x)
MonitorElement * dttf_nTracksPerEvent_integ
Definition: L1TDTTF.h:88
MonitorElement * dttf_pt_wheel_2ndTrack[6]
Definition: L1TDTTF.h:75
MonitorElement * dttf_eta_wheel_2ndTrack[6]
Definition: L1TDTTF.h:73
edm::InputTag gmtSource_
Definition: L1TDTTF.h:59
std::string outputFile_
Definition: L1TDTTF.h:64
edm::EDGetTokenT< L1MuGMTReadoutCollection > gmtSourceToken_
Definition: L1TDTTF.h:106
MonitorElement * dttf_qual[6][12]
Definition: L1TDTTF.h:81
edm::InputTag dttpgSource_
Definition: L1TDTTF.h:58
MonitorElement * dttf_quality_wheel_2ndTrack[6]
Definition: L1TDTTF.h:68
std::vector< L1MuDTTrackCand > TrackContainer
MonitorElement * dttf_phi[6][12]
Definition: L1TDTTF.h:84
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
edm::EDGetTokenT< L1MuDTTrackContainer > trackInputToken_
Definition: L1TDTTF.h:104
MonitorElement * runId_
Definition: L1TDTTF.h:94
void fillMEs(std::vector< L1MuDTTrackCand > const *trackContainer, std::vector< L1MuRegionalCand > &gmtDttfCands)
Definition: L1TDTTF.cc:792
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
MonitorElement * dttf_gmt_missed
Definition: L1TDTTF.h:92
bool isValid() const
Definition: HandleBase.h:75
MonitorElement * dttf_quality_summary_wheel_2ndTrack[6]
Definition: L1TDTTF.h:69
MonitorElement * dttf_eta_fine_fraction[6][12]
Definition: L1TDTTF.h:82
MonitorElement * dttf_bx[6][12]
Definition: L1TDTTF.h:79
int nev_dttf_track2_
Definition: L1TDTTF.h:100
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
int numTracks[6][12]
Definition: L1TDTTF.h:101
T const * product() const
Definition: Handle.h:81
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
bool verbose_
Definition: L1TDTTF.h:63
MonitorElement * dttf_gmt_ghost
Definition: L1TDTTF.h:93
edm::EDGetTokenT< reco::MuonCollection > muonCollectionToken_
Definition: L1TDTTF.h:105
MonitorElement * dttf_bx_2ndTrack[6][12]
Definition: L1TDTTF.h:80
int nev_dttf_
Definition: L1TDTTF.h:99
virtual void dqmBeginRun(edm::Run const &, edm::EventSetup const &)
Definition: L1TDTTF.cc:245
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: L1TDTTF.cc:249
MonitorElement * dttf_q_wheel_2ndTrack[6]
Definition: L1TDTTF.h:76
std::string const & label() const
Definition: InputTag.h:42
std::string const & process() const
Definition: InputTag.h:46
MonitorElement * dttf_eta[6][12]
Definition: L1TDTTF.h:83
tuple muons
Definition: patZpeak.py:38
virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Definition: L1TDTTF.cc:254
bool online_
Definition: L1TDTTF.h:62
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
MonitorElement * dttf_nTracksPerEv[6][12]
Definition: L1TDTTF.h:78
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: L1TDTTF.cc:586
MonitorElement * dttf_pt[6][12]
Definition: L1TDTTF.h:85
MonitorElement * dttf_phi_eta_wheel_2ndTrack[6]
Definition: L1TDTTF.h:72
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:89
volatile std::atomic< bool > shutdown_flag false
int nev_
Definition: L1TDTTF.h:98
TH2F * getTH2F(void) const
MonitorElement * dttf_q[6][12]
Definition: L1TDTTF.h:86
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:991
L1TDTTF(const edm::ParameterSet &ps)
base services
Definition: L1TDTTF.cc:197
Definition: Run.h:41
Definition: DDAxes.h:10