00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 #include "DQM/L1TMonitor/interface/L1TDTTF.h"
00184
00186 #include "FWCore/ServiceRegistry/interface/Service.h"
00187 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00188 #include "DQMServices/Core/interface/DQMStore.h"
00189 #include "DQMServices/Core/interface/MonitorElement.h"
00190
00192
00193
00194
00195
00196
00198 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTTrackContainer.h"
00199
00201 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
00202
00203
00205 #include "DataFormats/MuonReco/interface/Muon.h"
00206 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00207
00208
00209
00210
00211 L1TDTTF::L1TDTTF(const edm::ParameterSet& ps)
00212 : dttpgSource_( ps.getParameter< edm::InputTag >("dttpgSource") ),
00213 gmtSource_( ps.getParameter< edm::InputTag >("gmtSource") ),
00214 muonCollectionLabel_( ps.getParameter<edm::InputTag>("MuonCollection") ),
00215 l1tsubsystemfolder_( ps.getUntrackedParameter<std::string>("l1tSystemFolder",
00216 "L1T/L1TDTTF")),
00217 online_( ps.getUntrackedParameter<bool>("online", true) ),
00218 verbose_( ps.getUntrackedParameter<bool>("verbose", false) )
00219
00220 {
00221
00222 std::string trstring =
00223 dttpgSource_.label() + ":DATA:" + dttpgSource_.process();
00224 trackInputTag_ = edm::InputTag(trstring);
00225
00227 if ( verbose_ ) edm::LogInfo("L1TDTTF: constructor") << "Verbose enabled";
00228
00230 dbe_ = NULL;
00231 if ( ps.getUntrackedParameter<bool>("DQMStore", false) ) {
00232 dbe_ = edm::Service<DQMStore>().operator->();
00233 dbe_->setVerbose(0);
00234 dbe_->setCurrentFolder(l1tsubsystemfolder_);
00235 }
00236
00238 if ( ps.getUntrackedParameter<bool>("disableROOToutput", false) ) {
00239
00240 outputFile_ = "";
00241
00242 } else {
00243
00244 outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
00245 if ( ! outputFile_.empty() ) {
00246 edm::LogInfo("L1TDTTF: constructor")
00247 << "L1T Monitoring histograms will be saved to " << outputFile_;
00248 }
00249
00250 }
00251
00252 }
00253
00254
00255
00256
00257 L1TDTTF::~L1TDTTF()
00258 {
00260 }
00261
00262
00263
00264
00265 void L1TDTTF::beginJob(void)
00266 {
00268 nev_ = 0;
00269 nev_dttf_ = 0;
00270 nev_dttf_track2_ = 0;
00271
00272
00273
00274 if ( dbe_ ) {
00275
00276 std::string dttf_trk_folder = l1tsubsystemfolder_;
00277
00278 char hname[100];
00279 char htitle[100];
00280
00282 float start = 0;
00283 float stop = 0;
00284 int nbins = 0;
00286
00288 dbe_->setCurrentFolder(dttf_trk_folder);
00289
00290 std::string wheelpath[6] = { "/02-WHEEL_N2",
00291 "/03-WHEEL_N1",
00292 "/04-WHEEL_N0",
00293 "/05-WHEEL_P0",
00294 "/06-WHEEL_P1",
00295 "/07-WHEEL_P2" };
00296
00297
00298 char c_whn[6][3] = { "N2", "N1", "N0", "P0", "P1", "P2" };
00299
00300
00301
00302 for ( int iwh = 0; iwh < 6; ++iwh ) {
00303
00304 bookEta( iwh, nbins, start, stop );
00305
00309 std::string dttf_trk_folder_wheel = dttf_trk_folder + wheelpath[iwh];
00310 dbe_->setCurrentFolder(dttf_trk_folder_wheel);
00311
00313 sprintf(hname, "dttf_01_nTracksPerEvent_wh%s", c_whn[iwh]);
00314 sprintf(htitle, "Wheel %s - Number Tracks Per Event", c_whn[iwh]);
00315 dttf_nTracksPerEvent_wheel[iwh] = dbe_->book1D(hname, htitle,
00316 10, 0.5, 10.5);
00317 dttf_nTracksPerEvent_wheel[iwh]->setAxisTitle("# tracks/event", 1);
00318
00320 sprintf(hname, "dttf_07_phi_vs_etaFine_wh%s", c_whn[iwh]);
00321 sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (fine #eta only, unpacked values)", c_whn[iwh]);
00322 dttf_phi_eta_fine_wheel[iwh] = dbe_->book2D(hname, htitle,
00323 nbins, start-0.5, stop-0.5,
00324 144, -6, 138);
00325
00326
00327 dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#eta", 1);
00328 dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#phi", 2);
00329
00331 sprintf(hname, "dttf_08_phi_vs_etaCoarse_wh%s", c_whn[iwh]);
00332 sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (coarse #eta only, unpacked values)", c_whn[iwh]);
00333 dttf_phi_eta_coarse_wheel[iwh] = dbe_->book2D(hname, htitle,
00334 nbins, start-0.5, stop-0.5,
00335 144, -6, 138);
00336
00337 dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#eta", 1);
00338 dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#phi", 2);
00339
00342 std::string dttf_trk_folder_wheel_2ndtrack =
00343 dttf_trk_folder_wheel + "/2ND_TRACK_ONLY";
00344 dbe_->setCurrentFolder(dttf_trk_folder_wheel_2ndtrack);
00345
00346
00348 sprintf(hname, "dttf_04_quality_wh%s_2ndTrack", c_whn[iwh]);
00349 sprintf(htitle, "Wheel %s - 2nd Tracks Quality distribution", c_whn[iwh]);
00350 dttf_quality_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 7, 1, 8);
00351 setQualLabel( dttf_quality_wheel_2ndTrack[iwh], 1);
00352
00354 sprintf(hname, "dttf_05_quality_summary_wh%s_2ndTrack", c_whn[iwh]);
00355 sprintf(htitle, "Wheel %s - 2nd Tracks - Quality", c_whn[iwh]);
00356 dttf_quality_summary_wheel_2ndTrack[iwh] = dbe_->book2D(hname, htitle,
00357 12, 1, 13, 7, 1, 8 );
00358 dttf_quality_summary_wheel_2ndTrack[iwh]->setAxisTitle("Sector", 1);
00359 setQualLabel( dttf_quality_summary_wheel_2ndTrack[iwh], 2);
00360
00361
00363 sprintf(hname, "dttf_06_phi_vs_eta_wh%s_2ndTrack", c_whn[iwh]);
00364 sprintf(htitle, "Wheel %s - #eta-#phi Distribution of DTTF 2nd Tracks",
00365 c_whn[iwh]);
00366
00367 dttf_phi_eta_wheel_2ndTrack[iwh] = dbe_->book2D(hname, htitle,
00368 nbins, start-0.5,stop-0.5,
00369 144, -6, 138);
00370
00371 dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
00372 dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 2);
00373
00374
00375
00377 sprintf(hname, "dttf_07_eta_wh%s_2ndTrack", c_whn[iwh]);
00378 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks #eta distribution (Packed values)",
00379 c_whn[iwh]);
00380 dttf_eta_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 64, -0.5, 63.5);
00381 dttf_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
00382
00384 sprintf(hname, "dttf_08_phi_wh%s_2ndTrack", c_whn[iwh]);
00385 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Phi distribution (Packed values)",
00386 c_whn[iwh]);
00387 dttf_phi_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 144, -6, 138. );
00388 dttf_phi_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 1);
00389
00391 sprintf(hname, "dttf_09_pt_wh%s_2ndTrack", c_whn[iwh]);
00392 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks p_{T} distribution (Packed values)",
00393 c_whn[iwh]);
00394 dttf_pt_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 32, -0.5, 31.5);
00395 dttf_pt_wheel_2ndTrack[iwh]->setAxisTitle("p_{T}", 1);
00396
00398 sprintf(hname, "dttf_10_charge_wh%s_2ndTrack", c_whn[iwh]);
00399 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Charge distribution", c_whn[iwh]);
00400 dttf_q_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 2, -0.5, 1.5);
00401 dttf_q_wheel_2ndTrack[iwh]->setAxisTitle("Charge", 1);
00402
00403
00404
00405
00409
00411 std::string dttf_trk_folder_nTracksPerEvent = dttf_trk_folder_wheel + "/TracksPerEvent";
00412 dbe_->setCurrentFolder(dttf_trk_folder_nTracksPerEvent);
00413
00414 for(int ise = 0; ise < 12; ++ise) {
00415 sprintf(hname, "dttf_nTracksPerEvent_wh%s_se%d", c_whn[iwh], ise+1);
00416 sprintf(htitle, "Wheel %s Sector %d - Number of Tracks Per Event",
00417 c_whn[iwh], ise+1);
00418 dttf_nTracksPerEv[iwh][ise] = dbe_->book1D(hname, htitle, 2, 0.5, 2.5);
00419 dttf_nTracksPerEv[iwh][ise]->setAxisTitle("# tracks/event", 1);
00420 }
00421
00422
00424 std::string dttf_trk_folder_wh_bxsec_all =
00425 dttf_trk_folder_wheel + "/BX_BySector";
00426 dbe_->setCurrentFolder(dttf_trk_folder_wh_bxsec_all);
00427
00428 for(int ise = 0; ise < 12; ++ise ) {
00429 sprintf(hname, "dttf_bx_wh%s_se%d", c_whn[iwh], ise+1);
00430 sprintf(htitle, "Wheel %s Sector %d - BX Distribution",
00431 c_whn[iwh], ise+1);
00432 dttf_bx[iwh][ise] = dbe_->book1D(hname, htitle, 3, -1.5, 1.5);
00433 dttf_bx[iwh][ise]->setAxisTitle("BX", 1);
00434 }
00435
00436 std::string dttf_trk_folder_wh_bxsec_trk2 =
00437 dttf_trk_folder_wheel + "/BX_BySector/2ND_TRACK_ONLY";
00438 dbe_->setCurrentFolder(dttf_trk_folder_wh_bxsec_trk2);
00439
00440 for(int ise = 0; ise < 12; ++ise ) {
00441 sprintf(hname, "dttf_bx_2ndTrack_wh%s_se%d", c_whn[iwh], ise+1);
00442 sprintf(htitle, "Wheel %s Sector %d - BX 2nd Tracks only",
00443 c_whn[iwh], ise+1);
00444 dttf_bx_2ndTrack[iwh][ise] = dbe_->book1D(hname, htitle, 3, -1.5, 1.5);
00445 dttf_bx_2ndTrack[iwh][ise]->setAxisTitle("BX", 1);
00446 }
00447
00449 std::string dttf_trk_folder_charge = dttf_trk_folder_wheel + "/Charge";
00450 dbe_->setCurrentFolder(dttf_trk_folder_charge);
00451
00452 for(int ise = 0; ise < 12; ++ise) {
00453 sprintf(hname, "dttf_charge_wh%s_se%d", c_whn[iwh], ise+1);
00454 sprintf(htitle, "Wheel %s Sector %d - Packed Charge", c_whn[iwh], ise+1);
00455 dttf_q[iwh][ise] = dbe_->book1D(hname, htitle, 2, -0.5, 1.5);
00456 dttf_q[iwh][ise]->setAxisTitle("Charge", 1);
00457 }
00458
00460 std::string dttf_trk_folder_pt = dttf_trk_folder_wheel + "/PT";
00461 dbe_->setCurrentFolder(dttf_trk_folder_pt);
00462
00463 for(int ise = 0; ise < 12; ++ise ) {
00464 sprintf(hname, "dttf_pt_wh%s_se%d", c_whn[iwh], ise+1);
00465 sprintf(htitle, "Wheel %s Sector %d - Packed p_{T}",
00466 c_whn[iwh], ise + 1 );
00467 dttf_pt[iwh][ise]= dbe_->book1D(hname, htitle, 32, -0.5, 31.5);
00468 dttf_pt[iwh][ise]->setAxisTitle("p_{T}", 1);
00469 }
00470
00472 std::string dttf_trk_folder_phi = dttf_trk_folder_wheel + "/Phi";
00473 dbe_->setCurrentFolder(dttf_trk_folder_phi);
00474
00475 for(int ise = 0; ise < 12; ++ise ) {
00476 sprintf(hname, "dttf_phi_wh%s_se%d", c_whn[iwh], ise+1);
00477 sprintf(htitle, "Wheel %s Sector %d - Packed Phi", c_whn[iwh], ise+1);
00478 dttf_phi[iwh][ise] = dbe_->book1D(hname, htitle, 144, -6, 138);
00479 dttf_phi[iwh][ise]->setAxisTitle("#phi", 1);
00480
00481 }
00482
00484 std::string dttf_trk_folder_quality = dttf_trk_folder_wheel + "/Quality";
00485 dbe_->setCurrentFolder(dttf_trk_folder_quality);
00486
00487 for(int ise = 0; ise < 12; ++ise){
00488 sprintf(hname, "dttf_qual_wh%s_se%d", c_whn[iwh], ise+1);
00489 sprintf(htitle, "Wheel %s Sector %d - Packed Quality",
00490 c_whn[iwh], ise+1);
00491 dttf_qual[iwh][ise] = dbe_->book1D(hname, htitle, 7, 1, 8);
00492 dttf_qual[iwh][ise]->setAxisTitle("Quality", 1);
00493 setQualLabel( dttf_qual[iwh][ise], 1 );
00494 }
00495
00497 std::string dttf_trk_folder_eta = dttf_trk_folder_wheel + "/Eta";
00498 dbe_->setCurrentFolder(dttf_trk_folder_eta);
00499
00500 for (int ise = 0; ise < 12; ++ise ) {
00501
00502 sprintf(hname, "dttf_eta_wh%s_se%d", c_whn[iwh], ise+1);
00503 sprintf(htitle, "Wheel %s Sector %d - Packed #eta",
00504 c_whn[iwh], ise+1);
00505 dttf_eta[iwh][ise] = dbe_->book1D(hname, htitle, 64, -0.5, 63.5);
00506 dttf_eta[iwh][ise]->setAxisTitle("#eta", 1);
00507
00508 }
00509
00511 dttf_trk_folder_eta = dttf_trk_folder_wheel + "/EtaFineFraction";
00512 dbe_->setCurrentFolder(dttf_trk_folder_eta);
00513
00514 for (int ise = 0; ise < 12; ++ise ) {
00515
00516 sprintf(hname, "dttf_etaFine_fraction_wh%s_se%d", c_whn[iwh], ise+1);
00517 sprintf(htitle, "Wheel %s Sector %d - Eta Fine Fraction",
00518 c_whn[iwh], ise+1);
00519 dttf_eta_fine_fraction[iwh][ise] = dbe_->book1D(hname, htitle, 2, 0, 2);
00520 dttf_eta_fine_fraction[iwh][ise]->setAxisTitle("#eta", 1);
00521 dttf_eta_fine_fraction[iwh][ise]->setBinLabel(1, "fine", 1);
00522 dttf_eta_fine_fraction[iwh][ise]->setBinLabel(2, "coarse", 1);
00523
00524 }
00525
00526 }
00527
00531 std::string dttf_trk_folder_inclusive = dttf_trk_folder + "/01-INCLUSIVE";
00532 dbe_->setCurrentFolder(dttf_trk_folder_inclusive);
00533
00534
00535 sprintf(hname, "dttf_01_nTracksPerEvent_integ");
00536 sprintf(htitle, "Number of DTTF Tracks Per Event");
00537 dttf_nTracksPerEvent_integ = dbe_->book1D(hname, htitle, 20, 0.5, 20.5);
00538 dttf_nTracksPerEvent_integ->setAxisTitle("# tracks/event", 1);
00539
00541
00542
00543
00544
00545
00547 if ( online_ ) {
00548 sprintf(hname, "dttf_04_tracks_occupancy_by_lumi");
00549 sprintf(htitle, "DTTF Tracks in the last LumiSections");
00550 dttf_spare = dbe_->book2D(hname, htitle, 6, 0, 6, 12, 1, 13);
00551 setWheelLabel( dttf_spare );
00552 dttf_spare->setAxisTitle("Sector", 2);
00553 dttf_spare->getTH2F()->GetXaxis()->SetNdivisions(12);
00554 } else {
00555
00556 sprintf(hname, "dttf_04_global_muons_request");
00557 sprintf(htitle, "Tracks compatible with a Global Muon in the Barrel");
00558 dttf_spare = dbe_->book1D(hname, htitle, 4, -0.5, 3.5 );
00559 dttf_spare->setBinLabel(1, "No tracks", 1);
00560 dttf_spare->setBinLabel(2, "No tracks but GM", 1);
00561 dttf_spare->setBinLabel(3, "Tracks wo GM", 1);
00562 dttf_spare->setBinLabel(4, "Tracks w GM", 1);
00563
00564 }
00565
00566 std::string dttf_trk_folder_integrated_gmt =
00567 dttf_trk_folder + "/08-GMT_MATCH";
00568 dbe_->setCurrentFolder(dttf_trk_folder_integrated_gmt);
00569
00570 sprintf(hname, "dttf_tracks_with_gmt_match");
00571 sprintf(htitle, "DTTF Tracks With a Match in GMT");
00572 dttf_gmt_match = dbe_->book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
00573 setWheelLabel( dttf_gmt_match );
00574
00575 sprintf(hname, "dttf_tracks_without_gmt_match");
00576 sprintf(htitle, "DTTF Tracks Without a Match in GMT");
00577 dttf_gmt_missed = dbe_->book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
00578 setWheelLabel( dttf_gmt_missed );
00579
00580 sprintf(hname, "dttf_missing_tracks_in_gmt");
00581 sprintf(htitle, "GMT Tracks Without a Corresponding Track in DTTF");
00582 dttf_gmt_ghost = dbe_->book2D(hname, htitle, 5, -2, 3, 12, 1, 13.);
00583
00584 dttf_gmt_ghost->setBinLabel(1, "N2", 1);
00585 dttf_gmt_ghost->setBinLabel(2, "N1", 1);
00586 dttf_gmt_ghost->setBinLabel(3, "N0/P0", 1);
00587 dttf_gmt_ghost->setBinLabel(4, "P1", 1);
00588 dttf_gmt_ghost->setBinLabel(5, "P2", 1);
00589
00590
00591
00592
00593
00594
00595
00596 }
00597
00598 }
00599
00600
00601
00602
00603 void L1TDTTF::endJob(void)
00604 {
00605 if (verbose_) {
00606 edm::LogInfo("EndJob") << "L1TDTTF: end job....";
00607 edm::LogInfo("EndJob") << "analyzed " << nev_ << " events";
00608 edm::LogInfo("EndJob") << "containing at least one dttf track : "
00609 << nev_dttf_;
00610 edm::LogInfo("EndJob") << "containing two dttf tracks : "
00611 << nev_dttf_track2_;
00612 }
00613
00614 if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
00615
00616 }
00617
00618
00619
00620
00621 void L1TDTTF::analyze(const edm::Event& event,
00622 const edm::EventSetup& eventSetup)
00623 {
00624
00625
00626 if ( verbose_ )
00627 edm::LogInfo("L1TDTTF::Analyze::start") << "#################### START";
00628
00630 ++nev_;
00631 memset( numTracks, 0, 72 * sizeof(int) );
00632
00634 edm::Handle<L1MuDTTrackContainer > myL1MuDTTrackContainer;
00635 try {
00636 event.getByLabel(trackInputTag_, myL1MuDTTrackContainer);
00637 } catch (cms::Exception& iException) {
00638 edm::LogError("L1TDTTF::analyze::DataNotFound")
00639 << "can't getByLabel L1MuDTTrackContainer with label "
00640 << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
00641 return;
00642 }
00643
00644 if ( !myL1MuDTTrackContainer.isValid() ) {
00645 edm::LogError("L1TDTTF::analyze::DataNotFound")
00646 << "can't find L1MuDTTrackContainer with label "
00647 << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
00648 return;
00649 }
00650
00651 L1MuDTTrackContainer::TrackContainer * trackContainer =
00652 myL1MuDTTrackContainer->getContainer();
00653
00655 if ( trackContainer->size() > 0 ) {
00656 ++nev_dttf_;
00657 if( trackContainer->size() > 1 ) ++nev_dttf_track2_;
00658 }
00659
00663 bool accept = true;
00664 if ( ! online_ ) {
00665
00666 try {
00667
00668 edm::Handle<reco::MuonCollection> muons;
00669 event.getByLabel(muonCollectionLabel_, muons);
00670
00671 accept = false;
00672 if ( muons.isValid() ) {
00673 for (reco::MuonCollection::const_iterator recoMu = muons->begin();
00674 recoMu!=muons->end(); ++recoMu ) {
00675 if ( fabs( recoMu->eta() ) < 1.4 ) {
00676 if ( verbose_ ) {
00677 edm::LogInfo("L1TDTTFClient::Analyze:GM") << "Found a global muon!";
00678 }
00679 accept = true;
00680 break;
00681 }
00682
00683 }
00684
00686 if ( ! accept ) {
00687 dttf_spare->Fill( trackContainer->size() ? 1 : 0 );
00688
00689 if ( verbose_ ) {
00690 edm::LogInfo("L1TDTTFClient::Analyze:GM")
00691 << "No global muons in this event!";
00692 }
00693
00694 } else {
00695 dttf_spare->Fill( trackContainer->size() ? 2 : 3 );
00696 }
00697
00698 } else {
00700 accept = true;
00701 edm::LogWarning("L1TDTTFClient::Analyze:GM")
00702 << "Invalid MuonCollection with label "
00703 << muonCollectionLabel_.label();
00704 }
00705
00706
00707 } catch (cms::Exception& iException) {
00709 accept = true;
00710 edm::LogError("DataNotFound") << "Unable to getByLabel MuonCollection with label "
00711 << muonCollectionLabel_.label() ;
00712 }
00713
00714 }
00715
00716
00718 std::vector<L1MuRegionalCand> gmtBx0DttfCandidates;
00719
00720 try {
00721
00722 edm::Handle<L1MuGMTReadoutCollection> pCollection;
00723 event.getByLabel(gmtSource_, pCollection);
00724
00725 if ( !pCollection.isValid() ) {
00726 edm::LogError("DataNotFound") << "can't find L1MuGMTReadoutCollection with label "
00727 << gmtSource_.label() ;
00728 }
00729
00730
00731 L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
00732 std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
00733
00734 std::vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
00735
00736 for ( RRItr = gmt_records.begin(); RRItr != gmt_records.end(); ++RRItr ) {
00737
00738 std::vector<L1MuRegionalCand> dttfCands = RRItr->getDTBXCands();
00739 std::vector<L1MuRegionalCand>::iterator dttfCand;
00740
00741 for( dttfCand = dttfCands.begin(); dttfCand != dttfCands.end();
00742 ++dttfCand ) {
00743
00744 if(dttfCand->empty()) continue;
00746 if ( RRItr->getBxInEvent() ) continue;
00747
00748
00749
00750 gmtBx0DttfCandidates.push_back( *dttfCand );
00751
00752 }
00753 }
00754
00755 } catch (cms::Exception& iException) {
00756 edm::LogError("DataNotFound") << "Unable to getByLabel L1MuGMTReadoutCollection with label "
00757 << gmtSource_.label() ;
00758 }
00759
00760
00761
00762 if ( accept ) fillMEs( trackContainer, gmtBx0DttfCandidates );
00763
00765 std::vector<L1MuRegionalCand>::iterator dttfCand;
00766 for( dttfCand = gmtBx0DttfCandidates.begin();
00767 dttfCand != gmtBx0DttfCandidates.end(); ++dttfCand ) {
00768 if( dttfCand->empty() ) continue;
00769
00773 int phi= dttfCand->phi_packed();
00774 int sector = 1 + (phi + 6)/12;
00775 if (sector > 12 ) sector -= 12;
00776 double eta = dttfCand->etaValue();
00777
00778 int wheel = -3;
00779 if ( eta < -0.74 ) {
00780 wheel = -2;
00781 } else if ( eta < -0.3 ) {
00782 wheel = -1;
00783
00784 } else if ( eta < 0.3 ) {
00785 wheel = 0;
00786
00787 } else if ( eta < 0.74 ) {
00788 wheel = 1;
00789 } else {
00790 wheel = 2;
00791 }
00792
00793 dttf_gmt_ghost->Fill( wheel, sector );
00794
00795
00796 }
00797
00798
00800 int numTracksInt = 0;
00801
00802 for ( int w = 0; w < 6; ++w ) {
00803
00804 int numTracks_wh = 0;
00805 for ( int s = 0; s < 12; ++s ) {
00806
00807 dttf_nTracksPerEv[w][s]->Fill( numTracks[w][s] );
00808
00809 numTracks_wh += numTracks[w][s];
00810
00811 }
00812
00813 numTracksInt += numTracks_wh;
00814 dttf_nTracksPerEvent_wheel[w]->Fill( numTracks_wh );
00815
00816 }
00817
00818 dttf_nTracksPerEvent_integ->Fill( numTracksInt );
00819
00820
00821
00822 }
00823
00824
00825
00826
00827
00828 void L1TDTTF::fillMEs( std::vector<L1MuDTTrackCand> * trackContainer,
00829 std::vector<L1MuRegionalCand> & gmtDttfCands )
00830 {
00831
00832 L1MuDTTrackContainer::TrackContainer::const_iterator track
00833 = trackContainer->begin();
00834 L1MuDTTrackContainer::TrackContainer::const_iterator trackEnd
00835 = trackContainer->end();
00836
00837 for ( ; track != trackEnd; ++track ) {
00838
00839 if ( verbose_ ) {
00840 edm::LogInfo("L1TDTTF::Analyze") << "bx = " << track->bx();
00841 edm::LogInfo("L1TDTTF::Analyze") << "quality (packed) = "
00842 << track->quality_packed();
00843 edm::LogInfo("L1TDTTF::Analyze") << "pt (packed) = "
00844 << track->pt_packed()
00845 << " , pt (GeV) = " << track->ptValue();
00846 edm::LogInfo("L1TDTTF::Analyze") << "phi (packed) = "
00847 << track->phi_packed()
00848 << " , phi (rad) = " << track->phiValue();
00849 edm::LogInfo("L1TDTTF::Analyze") << "charge (packed) = "
00850 << track->charge_packed();
00851 }
00852
00853
00855 if ( ( track->whNum() == -1 ) && ! track->eta_packed() ) {
00856 edm::LogInfo("L1TDTTF::Analyze") << "Skipping N0 with zero eta value";
00857
00858 continue;
00859 }
00860
00861
00862 int bxindex = track->bx() + 1;
00863 int se = track->scNum();
00864 int sector = se + 1;
00865 int whindex = track->whNum();
00866
00867 whindex = ( whindex < 0 ) ? whindex + 3 : whindex + 2;
00868
00869 if ( whindex < 0 || whindex > 5 ) {
00870 edm::LogError("L1TDTTF::Analyze::WHEEL_ERROR") << track->whNum()
00871 << "(" << whindex << ")";
00872 continue;
00873 }
00874
00875 if ( se < 0 || se > 11 ) {
00876 edm::LogError("L1TDTTF::Analyze::SECTOR_ERROR") << se;
00877 continue;
00878 }
00879
00881
00883
00884
00885
00886
00887
00888
00889
00890
00892 int phi_global = track->phi_packed();
00893 phi_global = (phi_global > 15 ? phi_global - 32 : phi_global ) + se * 12;
00894 if ( phi_global < -6 ) phi_global += 144;
00895 if ( phi_global > 137 ) phi_global -= 144;
00896
00897
00898
00899
00900
00901
00905
00907 dttf_bx[whindex][se]->Fill(track->bx());
00908
00910 if( track->TrkTag() == 1 ) {
00911
00913 dttf_bx_2ndTrack[whindex][se]->Fill(track->bx());
00914
00915 }
00916
00920
00921
00922 if ( bxindex == 1 ) {
00923
00925 ++numTracks[whindex][se];
00926
00928 dttf_phi[whindex][se]->Fill(phi_global);
00929
00931 dttf_qual[whindex][se]->Fill(track->quality_packed());
00932
00934 dttf_pt[whindex][se]->Fill(track->pt_packed());
00935
00937 dttf_q[whindex][se]->Fill(track->charge_packed());
00938
00939
00941 dttf_eta[whindex][se]->Fill( track->eta_packed() );
00942
00943 if( track->isFineHalo() ) {
00944
00945 dttf_eta_fine_fraction[whindex][se]->Fill( 0 );
00946
00948 dttf_phi_eta_fine_wheel[whindex]->Fill( track->eta_packed(), phi_global );
00949
00950 } else {
00951
00952 dttf_eta_fine_fraction[whindex][se]->Fill( 1 );
00953
00955 dttf_phi_eta_coarse_wheel[whindex]->Fill( track->eta_packed(), phi_global );
00956 }
00957
00959 if ( online_ ) {
00960 dttf_spare->Fill( whindex, sector );
00961 }
00962
00964
00965
00967 if ( track->TrkTag() == 1 ) {
00968
00970 dttf_phi_wheel_2ndTrack[whindex]->Fill(phi_global);
00971
00973 dttf_pt_wheel_2ndTrack[whindex]->Fill(track->pt_packed());
00974
00976 dttf_eta_wheel_2ndTrack[whindex]->Fill(track->eta_packed());
00977
00979 dttf_quality_wheel_2ndTrack[whindex]->Fill(track->quality_packed());
00980
00982 dttf_q_wheel_2ndTrack[whindex]->Fill(track->charge_packed());
00983
00985 dttf_quality_summary_wheel_2ndTrack[whindex]->Fill( sector, track->quality_packed() );
00986
00988 dttf_phi_eta_wheel_2ndTrack[whindex]->Fill( track->eta_packed(), phi_global );
00989
00990 }
00991
00993 bool match = false;
00994 std::vector<L1MuRegionalCand>::iterator dttfCand;
00996 unsigned int gmt_phi = ( phi_global < 0 ? phi_global + 144 : phi_global );
00997
00998 for ( dttfCand = gmtDttfCands.begin(); dttfCand != gmtDttfCands.end();
00999 ++dttfCand ) {
01000
01002 if ( dttfCand->empty() ) continue;
01003 if ( ( dttfCand->phi_packed() == gmt_phi ) &&
01004 dttfCand->quality_packed() == track->quality_packed() ) {
01005 match = true;
01006 dttfCand->reset();
01007 break;
01008 }
01009
01010
01011 }
01012
01013 if ( match ) {
01014 dttf_gmt_match->Fill( whindex, sector );
01015 } else {
01016 dttf_gmt_missed->Fill( whindex, sector );
01017 }
01018
01019 }
01020
01021 }
01022
01023 }
01024
01025
01026
01027 void L1TDTTF::setQualLabel(MonitorElement *me, int axis)
01028 {
01029
01030 if( axis == 1 )
01031 me->setAxisTitle("Quality", axis);
01032 me->setBinLabel(1, "T34", axis);
01033 me->setBinLabel(2, "T23/24", axis);
01034 me->setBinLabel(3, "T12/13/14", axis);
01035 me->setBinLabel(4, "T234", axis);
01036 me->setBinLabel(5, "T134", axis);
01037 me->setBinLabel(6, "T123/124", axis);
01038 me->setBinLabel(7, "T1234", axis);
01039 }
01040
01041
01042 void L1TDTTF::setWheelLabel(MonitorElement *me)
01043 {
01044 me->setAxisTitle("Wheel", 1);
01045 me->setBinLabel(1, "N2", 1);
01046 me->setBinLabel(2, "N1", 1);
01047 me->setBinLabel(3, "N0", 1);
01048 me->setBinLabel(4, "P0", 1);
01049 me->setBinLabel(5, "P1", 1);
01050 me->setBinLabel(6, "P2", 1);
01051 }
01052
01053
01054
01055
01056 void L1TDTTF::bookEta( int wh, int & nbins, float & start, float & stop )
01057 {
01058
01059 switch ( wh ) {
01060 case 0 : start = 0; stop = 18; nbins = 18; break;
01061 case 1 : start = 8; stop = 28; nbins = 20; break;
01062 case 2 : start = 22; stop = 32; nbins = 10; break;
01063 case 3 : start = 22; stop = 42; nbins = 20; break;
01064 case 4 : start = 36; stop = 56; nbins = 20; break;
01065 case 5 : start = 46; stop = 64; nbins = 18; break;
01066 default : start = 0; stop = 0; nbins = 0; break;
01067 }
01068
01069 }
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182