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 #include "DQM/L1TMonitor/interface/L1TDTTF.h"
00178
00180 #include "FWCore/ServiceRegistry/interface/Service.h"
00181 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00182 #include "DQMServices/Core/interface/DQMStore.h"
00183 #include "DQMServices/Core/interface/MonitorElement.h"
00184
00186
00187
00188
00189
00190
00192 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTTrackContainer.h"
00193
00195 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
00196
00197
00199 #include "DataFormats/MuonReco/interface/Muon.h"
00200 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00201
00202
00203
00204
00205 L1TDTTF::L1TDTTF(const edm::ParameterSet& ps)
00206 : dttpgSource_( ps.getParameter< edm::InputTag >("dttpgSource") ),
00207 gmtSource_( ps.getParameter< edm::InputTag >("gmtSource") ),
00208 muonCollectionLabel_( ps.getParameter<edm::InputTag>("MuonCollection") ),
00209 l1tsubsystemfolder_( ps.getUntrackedParameter<std::string>("l1tSystemFolder",
00210 "L1T/L1TDTTF")),
00211 online_( ps.getUntrackedParameter<bool>("online", true) ),
00212 verbose_( ps.getUntrackedParameter<bool>("verbose", false) )
00213
00214 {
00215
00216 std::string trstring =
00217 dttpgSource_.label() + ":DATA:" + dttpgSource_.process();
00218 trackInputTag_ = edm::InputTag(trstring);
00219
00221 if ( verbose_ ) edm::LogInfo("L1TDTTF: constructor") << "Verbose enabled";
00222
00224 dbe_ = NULL;
00225 if ( ps.getUntrackedParameter<bool>("DQMStore", false) ) {
00226 dbe_ = edm::Service<DQMStore>().operator->();
00227 dbe_->setVerbose(0);
00228 dbe_->setCurrentFolder(l1tsubsystemfolder_);
00229 }
00230
00232 if ( ps.getUntrackedParameter<bool>("disableROOToutput", false) ) {
00233
00234 outputFile_ = "";
00235
00236 } else {
00237
00238 outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
00239 if ( ! outputFile_.empty() ) {
00240 edm::LogInfo("L1TDTTF: constructor")
00241 << "L1T Monitoring histograms will be saved to " << outputFile_;
00242 }
00243
00244 }
00245
00246 }
00247
00248
00249
00250
00251 L1TDTTF::~L1TDTTF()
00252 {
00254 }
00255
00256
00257
00258
00259 void L1TDTTF::beginJob(void)
00260 {
00262 nev_ = 0;
00263 nev_dttf_ = 0;
00264 nev_dttf_track2_ = 0;
00265
00266
00267
00268 if ( dbe_ ) {
00269
00270 std::string dttf_trk_folder = l1tsubsystemfolder_;
00271
00272 char hname[100];
00273 char htitle[100];
00274
00276 float start = 0;
00277 float stop = 0;
00278 int nbins = 0;
00280
00282 dbe_->setCurrentFolder(dttf_trk_folder);
00283
00284 std::string wheelpath[6] = { "/02-WHEEL_N2",
00285 "/03-WHEEL_N1",
00286 "/04-WHEEL_N0",
00287 "/05-WHEEL_P0",
00288 "/06-WHEEL_P1",
00289 "/07-WHEEL_P2" };
00290
00291
00292 char c_whn[6][3] = { "N2", "N1", "N0", "P0", "P1", "P2" };
00293
00294
00295
00296 for ( int iwh = 0; iwh < 6; ++iwh ) {
00297
00298 bookEta( iwh, nbins, start, stop );
00299
00303 std::string dttf_trk_folder_wheel = dttf_trk_folder + wheelpath[iwh];
00304 dbe_->setCurrentFolder(dttf_trk_folder_wheel);
00305
00307 sprintf(hname, "dttf_01_nTracksPerEvent_wh%s", c_whn[iwh]);
00308 sprintf(htitle, "Wheel %s - Number Tracks Per Event", c_whn[iwh]);
00309 dttf_nTracksPerEvent_wheel[iwh] = dbe_->book1D(hname, htitle,
00310 10, 0.5, 10.5);
00311 dttf_nTracksPerEvent_wheel[iwh]->setAxisTitle("# tracks/event", 1);
00312
00314 sprintf(hname, "dttf_07_phi_vs_etaFine_wh%s", c_whn[iwh]);
00315 sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (fine #eta only, unpacked values)", c_whn[iwh]);
00316 dttf_phi_eta_fine_wheel[iwh] = dbe_->book2D(hname, htitle,
00317 nbins, start-0.5, stop-0.5,
00318 144, -6, 138);
00319
00320
00321 dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#eta", 1);
00322 dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#phi", 2);
00323
00325 sprintf(hname, "dttf_08_phi_vs_etaCoarse_wh%s", c_whn[iwh]);
00326 sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (coarse #eta only, unpacked values)", c_whn[iwh]);
00327 dttf_phi_eta_coarse_wheel[iwh] = dbe_->book2D(hname, htitle,
00328 nbins, start-0.5, stop-0.5,
00329 144, -6, 138);
00330
00331 dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#eta", 1);
00332 dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#phi", 2);
00333
00336 std::string dttf_trk_folder_wheel_2ndtrack =
00337 dttf_trk_folder_wheel + "/2ND_TRACK_ONLY";
00338 dbe_->setCurrentFolder(dttf_trk_folder_wheel_2ndtrack);
00339
00340
00342 sprintf(hname, "dttf_04_quality_wh%s_2ndTrack", c_whn[iwh]);
00343 sprintf(htitle, "Wheel %s - 2nd Tracks Quality distribution", c_whn[iwh]);
00344 dttf_quality_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 7, 1, 8);
00345 setQualLabel( dttf_quality_wheel_2ndTrack[iwh], 1);
00346
00348 sprintf(hname, "dttf_05_quality_summary_wh%s_2ndTrack", c_whn[iwh]);
00349 sprintf(htitle, "Wheel %s - 2nd Tracks - Quality", c_whn[iwh]);
00350 dttf_quality_summary_wheel_2ndTrack[iwh] = dbe_->book2D(hname, htitle,
00351 12, 1, 13, 7, 1, 8 );
00352 dttf_quality_summary_wheel_2ndTrack[iwh]->setAxisTitle("Sector", 1);
00353 setQualLabel( dttf_quality_summary_wheel_2ndTrack[iwh], 2);
00354
00355
00357 sprintf(hname, "dttf_06_phi_vs_eta_wh%s_2ndTrack", c_whn[iwh]);
00358 sprintf(htitle, "Wheel %s - #eta-#phi Distribution of DTTF 2nd Tracks",
00359 c_whn[iwh]);
00360
00361 dttf_phi_eta_wheel_2ndTrack[iwh] = dbe_->book2D(hname, htitle,
00362 nbins, start-0.5,stop-0.5,
00363 144, -6, 138);
00364
00365 dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
00366 dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 2);
00367
00368
00369
00371 sprintf(hname, "dttf_07_eta_wh%s_2ndTrack", c_whn[iwh]);
00372 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks #eta distribution (Packed values)",
00373 c_whn[iwh]);
00374 dttf_eta_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 64, -0.5, 63.5);
00375 dttf_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
00376
00378 sprintf(hname, "dttf_08_phi_wh%s_2ndTrack", c_whn[iwh]);
00379 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Phi distribution (Packed values)",
00380 c_whn[iwh]);
00381 dttf_phi_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 144, -6, 138. );
00382 dttf_phi_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 1);
00383
00385 sprintf(hname, "dttf_09_pt_wh%s_2ndTrack", c_whn[iwh]);
00386 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks p_{T} distribution (Packed values)",
00387 c_whn[iwh]);
00388 dttf_pt_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 32, -0.5, 31.5);
00389 dttf_pt_wheel_2ndTrack[iwh]->setAxisTitle("p_{T}", 1);
00390
00392 sprintf(hname, "dttf_10_charge_wh%s_2ndTrack", c_whn[iwh]);
00393 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Charge distribution", c_whn[iwh]);
00394 dttf_q_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 2, -0.5, 1.5);
00395 dttf_q_wheel_2ndTrack[iwh]->setAxisTitle("Charge", 1);
00396
00397
00398
00399
00403
00405 std::string dttf_trk_folder_nTracksPerEvent = dttf_trk_folder_wheel + "/TracksPerEvent";
00406 dbe_->setCurrentFolder(dttf_trk_folder_nTracksPerEvent);
00407
00408 for(int ise = 0; ise < 12; ++ise) {
00409 sprintf(hname, "dttf_nTracksPerEvent_wh%s_se%d", c_whn[iwh], ise+1);
00410 sprintf(htitle, "Wheel %s Sector %d - Number of Tracks Per Event",
00411 c_whn[iwh], ise+1);
00412 dttf_nTracksPerEv[iwh][ise] = dbe_->book1D(hname, htitle, 2, 0.5, 2.5);
00413 dttf_nTracksPerEv[iwh][ise]->setAxisTitle("# tracks/event", 1);
00414 }
00415
00416
00418 std::string dttf_trk_folder_wh_bxsec_all =
00419 dttf_trk_folder_wheel + "/BX_BySector";
00420 dbe_->setCurrentFolder(dttf_trk_folder_wh_bxsec_all);
00421
00422 for(int ise = 0; ise < 12; ++ise ) {
00423 sprintf(hname, "dttf_bx_wh%s_se%d", c_whn[iwh], ise+1);
00424 sprintf(htitle, "Wheel %s Sector %d - BX Distribution",
00425 c_whn[iwh], ise+1);
00426 dttf_bx[iwh][ise] = dbe_->book1D(hname, htitle, 3, -1.5, 1.5);
00427 dttf_bx[iwh][ise]->setAxisTitle("BX", 1);
00428 }
00429
00430 std::string dttf_trk_folder_wh_bxsec_trk2 =
00431 dttf_trk_folder_wheel + "/BX_BySector/2ND_TRACK_ONLY";
00432 dbe_->setCurrentFolder(dttf_trk_folder_wh_bxsec_trk2);
00433
00434 for(int ise = 0; ise < 12; ++ise ) {
00435 sprintf(hname, "dttf_bx_2ndTrack_wh%s_se%d", c_whn[iwh], ise+1);
00436 sprintf(htitle, "Wheel %s Sector %d - BX 2nd Tracks only",
00437 c_whn[iwh], ise+1);
00438 dttf_bx_2ndTrack[iwh][ise] = dbe_->book1D(hname, htitle, 3, -1.5, 1.5);
00439 dttf_bx_2ndTrack[iwh][ise]->setAxisTitle("BX", 1);
00440 }
00441
00443 std::string dttf_trk_folder_charge = dttf_trk_folder_wheel + "/Charge";
00444 dbe_->setCurrentFolder(dttf_trk_folder_charge);
00445
00446 for(int ise = 0; ise < 12; ++ise) {
00447 sprintf(hname, "dttf_charge_wh%s_se%d", c_whn[iwh], ise+1);
00448 sprintf(htitle, "Wheel %s Sector %d - Packed Charge", c_whn[iwh], ise+1);
00449 dttf_q[iwh][ise] = dbe_->book1D(hname, htitle, 2, -0.5, 1.5);
00450 dttf_q[iwh][ise]->setAxisTitle("Charge", 1);
00451 }
00452
00454 std::string dttf_trk_folder_pt = dttf_trk_folder_wheel + "/PT";
00455 dbe_->setCurrentFolder(dttf_trk_folder_pt);
00456
00457 for(int ise = 0; ise < 12; ++ise ) {
00458 sprintf(hname, "dttf_pt_wh%s_se%d", c_whn[iwh], ise+1);
00459 sprintf(htitle, "Wheel %s Sector %d - Packed p_{T}",
00460 c_whn[iwh], ise + 1 );
00461 dttf_pt[iwh][ise]= dbe_->book1D(hname, htitle, 32, -0.5, 31.5);
00462 dttf_pt[iwh][ise]->setAxisTitle("p_{T}", 1);
00463 }
00464
00466 std::string dttf_trk_folder_phi = dttf_trk_folder_wheel + "/Phi";
00467 dbe_->setCurrentFolder(dttf_trk_folder_phi);
00468
00469 for(int ise = 0; ise < 12; ++ise ) {
00470 sprintf(hname, "dttf_phi_wh%s_se%d", c_whn[iwh], ise+1);
00471 sprintf(htitle, "Wheel %s Sector %d - Packed Phi", c_whn[iwh], ise+1);
00472 dttf_phi[iwh][ise] = dbe_->book1D(hname, htitle, 144, -6, 138);
00473 dttf_phi[iwh][ise]->setAxisTitle("#phi", 1);
00474
00475 }
00476
00478 std::string dttf_trk_folder_quality = dttf_trk_folder_wheel + "/Quality";
00479 dbe_->setCurrentFolder(dttf_trk_folder_quality);
00480
00481 for(int ise = 0; ise < 12; ++ise){
00482 sprintf(hname, "dttf_qual_wh%s_se%d", c_whn[iwh], ise+1);
00483 sprintf(htitle, "Wheel %s Sector %d - Packed Quality",
00484 c_whn[iwh], ise+1);
00485 dttf_qual[iwh][ise] = dbe_->book1D(hname, htitle, 7, 1, 8);
00486 dttf_qual[iwh][ise]->setAxisTitle("Quality", 1);
00487 setQualLabel( dttf_qual[iwh][ise], 1 );
00488 }
00489
00491 std::string dttf_trk_folder_eta = dttf_trk_folder_wheel + "/Eta";
00492 dbe_->setCurrentFolder(dttf_trk_folder_eta);
00493
00494 for (int ise = 0; ise < 12; ++ise ) {
00495
00496 sprintf(hname, "dttf_eta_wh%s_se%d", c_whn[iwh], ise+1);
00497 sprintf(htitle, "Wheel %s Sector %d - Packed #eta",
00498 c_whn[iwh], ise+1);
00499 dttf_eta[iwh][ise] = dbe_->book1D(hname, htitle, 64, -0.5, 63.5);
00500 dttf_eta[iwh][ise]->setAxisTitle("#eta", 1);
00501
00502 }
00503
00505 dttf_trk_folder_eta = dttf_trk_folder_wheel + "/EtaFineFraction";
00506 dbe_->setCurrentFolder(dttf_trk_folder_eta);
00507
00508 for (int ise = 0; ise < 12; ++ise ) {
00509
00510 sprintf(hname, "dttf_etaFine_fraction_wh%s_se%d", c_whn[iwh], ise+1);
00511 sprintf(htitle, "Wheel %s Sector %d - Eta Fine Fraction",
00512 c_whn[iwh], ise+1);
00513 dttf_eta_fine_fraction[iwh][ise] = dbe_->book1D(hname, htitle, 2, 0, 2);
00514 dttf_eta_fine_fraction[iwh][ise]->setAxisTitle("#eta", 1);
00515 dttf_eta_fine_fraction[iwh][ise]->setBinLabel(1, "fine", 1);
00516 dttf_eta_fine_fraction[iwh][ise]->setBinLabel(2, "coarse", 1);
00517
00518 }
00519
00520 }
00521
00525 std::string dttf_trk_folder_inclusive = dttf_trk_folder + "/01-INCLUSIVE";
00526 dbe_->setCurrentFolder(dttf_trk_folder_inclusive);
00527
00528
00529 sprintf(hname, "dttf_01_nTracksPerEvent_integ");
00530 sprintf(htitle, "Number of DTTF Tracks Per Event");
00531 dttf_nTracksPerEvent_integ = dbe_->book1D(hname, htitle, 20, 0.5, 20.5);
00532 dttf_nTracksPerEvent_integ->setAxisTitle("# tracks/event", 1);
00533
00535
00536
00537
00538
00539
00541 if ( online_ ) {
00542 sprintf(hname, "dttf_04_tracks_occupancy_by_lumi");
00543 sprintf(htitle, "DTTF Tracks in the last LumiSections");
00544 dttf_spare = dbe_->book2D(hname, htitle, 6, 0, 6, 12, 1, 13);
00545 setWheelLabel( dttf_spare );
00546 dttf_spare->setAxisTitle("Sector", 2);
00547 dttf_spare->getTH2F()->GetXaxis()->SetNdivisions(12);
00548 } else {
00549
00550 sprintf(hname, "dttf_04_global_muons_request");
00551 sprintf(htitle, "Tracks compatible with a Global Muon in the Barrel");
00552 dttf_spare = dbe_->book1D(hname, htitle, 4, -0.5, 3.5 );
00553 dttf_spare->setBinLabel(1, "No tracks", 1);
00554 dttf_spare->setBinLabel(2, "No tracks but GM", 1);
00555 dttf_spare->setBinLabel(3, "Tracks wo GM", 1);
00556 dttf_spare->setBinLabel(4, "Tracks w GM", 1);
00557
00558 }
00559
00560 std::string dttf_trk_folder_integrated_gmt =
00561 dttf_trk_folder + "/08-GMT_MATCH";
00562 dbe_->setCurrentFolder(dttf_trk_folder_integrated_gmt);
00563
00564 sprintf(hname, "dttf_tracks_with_gmt_match");
00565 sprintf(htitle, "DTTF Tracks With a Match in GMT");
00566 dttf_gmt_match = dbe_->book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
00567 setWheelLabel( dttf_gmt_match );
00568
00569 sprintf(hname, "dttf_tracks_without_gmt_match");
00570 sprintf(htitle, "DTTF Tracks Without a Match in GMT");
00571 dttf_gmt_missed = dbe_->book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
00572 setWheelLabel( dttf_gmt_missed );
00573
00574 sprintf(hname, "dttf_missing_tracks_in_gmt");
00575 sprintf(htitle, "GMT Tracks Without a Corresponding Track in DTTF");
00576 dttf_gmt_ghost = dbe_->book2D(hname, htitle, 5, -2, 3, 12, 1, 13.);
00577
00578 dttf_gmt_ghost->setBinLabel(1, "N2", 1);
00579 dttf_gmt_ghost->setBinLabel(2, "N1", 1);
00580 dttf_gmt_ghost->setBinLabel(3, "N0/P0", 1);
00581 dttf_gmt_ghost->setBinLabel(4, "P1", 1);
00582 dttf_gmt_ghost->setBinLabel(5, "P2", 1);
00583
00584
00585
00586
00587
00588
00589
00590 }
00591
00592 }
00593
00594
00595
00596
00597 void L1TDTTF::endJob(void)
00598 {
00599 if (verbose_) {
00600 edm::LogInfo("EndJob") << "L1TDTTF: end job....";
00601 edm::LogInfo("EndJob") << "analyzed " << nev_ << " events";
00602 edm::LogInfo("EndJob") << "containing at least one dttf track : "
00603 << nev_dttf_;
00604 edm::LogInfo("EndJob") << "containing two dttf tracks : "
00605 << nev_dttf_track2_;
00606 }
00607
00608 if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
00609
00610 }
00611
00612
00613
00614
00615 void L1TDTTF::analyze(const edm::Event& event,
00616 const edm::EventSetup& eventSetup)
00617 {
00618
00619
00620 if ( verbose_ )
00621 edm::LogInfo("L1TDTTF::Analyze::start") << "#################### START";
00622
00624 ++nev_;
00625 memset( numTracks, 0, 72 * sizeof(int) );
00626
00628 edm::Handle<L1MuDTTrackContainer > myL1MuDTTrackContainer;
00629 try {
00630 event.getByLabel(trackInputTag_, myL1MuDTTrackContainer);
00631 } catch (...) {
00632 edm::LogError("L1TDTTF::analyze::DataNotFound")
00633 << "can't getByLabel L1MuDTTrackContainer with label "
00634 << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
00635 return;
00636 }
00637
00638 if ( !myL1MuDTTrackContainer.isValid() ) {
00639 edm::LogError("L1TDTTF::analyze::DataNotFound")
00640 << "can't find L1MuDTTrackContainer with label "
00641 << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
00642 return;
00643 }
00644
00645 L1MuDTTrackContainer::TrackContainer * trackContainer =
00646 myL1MuDTTrackContainer->getContainer();
00647
00649 if ( trackContainer->size() > 0 ) {
00650 ++nev_dttf_;
00651 if( trackContainer->size() > 1 ) ++nev_dttf_track2_;
00652 }
00653
00657 bool accept = true;
00658 if ( ! online_ ) {
00659
00660 try {
00661
00662 edm::Handle<reco::MuonCollection> muons;
00663 event.getByLabel(muonCollectionLabel_, muons);
00664
00665 accept = false;
00666 if ( muons.isValid() ) {
00667 for (reco::MuonCollection::const_iterator recoMu = muons->begin();
00668 recoMu!=muons->end(); ++recoMu ) {
00669 if ( fabs( recoMu->eta() ) < 1.4 ) {
00670 if ( verbose_ ) {
00671 edm::LogInfo("L1TDTTFClient::Analyze:GM") << "Found a global muon!";
00672 }
00673 accept = true;
00674 break;
00675 }
00676
00677 }
00678
00680 if ( ! accept ) {
00681 dttf_spare->Fill( trackContainer->size() ? 1 : 0 );
00682
00683 if ( verbose_ ) {
00684 edm::LogInfo("L1TDTTFClient::Analyze:GM")
00685 << "No global muons in this event!";
00686 }
00687
00688 } else {
00689 dttf_spare->Fill( trackContainer->size() ? 2 : 3 );
00690 }
00691
00692 } else {
00694 accept = true;
00695 edm::LogWarning("L1TDTTFClient::Analyze:GM")
00696 << "Invalid MuonCollection with label "
00697 << muonCollectionLabel_.label();
00698 }
00699
00700
00701 } catch (...) {
00703 accept = true;
00704 edm::LogError("DataNotFound") << "Unable to getByLabel MuonCollection with label "
00705 << muonCollectionLabel_.label() ;
00706 }
00707
00708 }
00709
00710
00712 std::vector<L1MuRegionalCand> gmtBx0DttfCandidates;
00713
00714 try {
00715
00716 edm::Handle<L1MuGMTReadoutCollection> pCollection;
00717 event.getByLabel(gmtSource_, pCollection);
00718
00719 if ( !pCollection.isValid() ) {
00720 edm::LogError("DataNotFound") << "can't find L1MuGMTReadoutCollection with label "
00721 << gmtSource_.label() ;
00722 }
00723
00724
00725 L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
00726 std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
00727
00728 std::vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
00729
00730 for ( RRItr = gmt_records.begin(); RRItr != gmt_records.end(); ++RRItr ) {
00731
00732 std::vector<L1MuRegionalCand> dttfCands = RRItr->getDTBXCands();
00733 std::vector<L1MuRegionalCand>::iterator dttfCand;
00734
00735 for( dttfCand = dttfCands.begin(); dttfCand != dttfCands.end();
00736 ++dttfCand ) {
00737
00738 if(dttfCand->empty()) continue;
00740 if ( RRItr->getBxInEvent() ) continue;
00741
00742
00743
00744 gmtBx0DttfCandidates.push_back( *dttfCand );
00745
00746 }
00747 }
00748
00749 } catch (...) {
00750 edm::LogError("DataNotFound") << "Unable to getByLabel L1MuGMTReadoutCollection with label "
00751 << gmtSource_.label() ;
00752 }
00753
00754
00755
00756 if ( accept ) fillMEs( trackContainer, gmtBx0DttfCandidates );
00757
00759 std::vector<L1MuRegionalCand>::iterator dttfCand;
00760 for( dttfCand = gmtBx0DttfCandidates.begin();
00761 dttfCand != gmtBx0DttfCandidates.end(); ++dttfCand ) {
00762 if( dttfCand->empty() ) continue;
00763
00767 int phi= dttfCand->phi_packed();
00768 int sector = 1 + (phi + 6)/12;
00769 if (sector > 12 ) sector -= 12;
00770 double eta = dttfCand->etaValue();
00771
00772 int wheel = -3;
00773 if ( eta < -0.74 ) {
00774 wheel = -2;
00775 } else if ( eta < -0.3 ) {
00776 wheel = -1;
00777
00778 } else if ( eta < 0.3 ) {
00779 wheel = 0;
00780
00781 } else if ( eta < 0.74 ) {
00782 wheel = 1;
00783 } else {
00784 wheel = 2;
00785 }
00786
00787 dttf_gmt_ghost->Fill( wheel, sector );
00788
00789
00790 }
00791
00792
00794 int numTracksInt = 0;
00795
00796 for ( int w = 0; w < 6; ++w ) {
00797
00798 int numTracks_wh = 0;
00799 for ( int s = 0; s < 12; ++s ) {
00800
00801 dttf_nTracksPerEv[w][s]->Fill( numTracks[w][s] );
00802
00803 numTracks_wh += numTracks[w][s];
00804
00805 }
00806
00807 numTracksInt += numTracks_wh;
00808 dttf_nTracksPerEvent_wheel[w]->Fill( numTracks_wh );
00809
00810 }
00811
00812 dttf_nTracksPerEvent_integ->Fill( numTracksInt );
00813
00814
00815
00816 }
00817
00818
00819
00820
00821
00822 void L1TDTTF::fillMEs( std::vector<L1MuDTTrackCand> * trackContainer,
00823 std::vector<L1MuRegionalCand> & gmtDttfCands )
00824 {
00825
00826 L1MuDTTrackContainer::TrackContainer::const_iterator track
00827 = trackContainer->begin();
00828 L1MuDTTrackContainer::TrackContainer::const_iterator trackEnd
00829 = trackContainer->end();
00830
00831 for ( ; track != trackEnd; ++track ) {
00832
00833 if ( verbose_ ) {
00834 edm::LogInfo("L1TDTTF::Analyze") << "bx = " << track->bx();
00835 edm::LogInfo("L1TDTTF::Analyze") << "quality (packed) = "
00836 << track->quality_packed();
00837 edm::LogInfo("L1TDTTF::Analyze") << "pt (packed) = "
00838 << track->pt_packed()
00839 << " , pt (GeV) = " << track->ptValue();
00840 edm::LogInfo("L1TDTTF::Analyze") << "phi (packed) = "
00841 << track->phi_packed()
00842 << " , phi (rad) = " << track->phiValue();
00843 edm::LogInfo("L1TDTTF::Analyze") << "charge (packed) = "
00844 << track->charge_packed();
00845 }
00846
00847
00849 if ( ( track->whNum() == -1 ) && ! track->eta_packed() ) {
00850 edm::LogInfo("L1TDTTF::Analyze") << "Skipping N0 with zero eta value";
00851
00852 continue;
00853 }
00854
00855
00856 int bxindex = track->bx() + 1;
00857 int se = track->scNum();
00858 int sector = se + 1;
00859 int whindex = track->whNum();
00860
00861 whindex = ( whindex < 0 ) ? whindex + 3 : whindex + 2;
00862
00863 if ( whindex < 0 || whindex > 5 ) {
00864 edm::LogError("L1TDTTF::Analyze::WHEEL_ERROR") << track->whNum()
00865 << "(" << whindex << ")";
00866 continue;
00867 }
00868
00869 if ( se < 0 || se > 11 ) {
00870 edm::LogError("L1TDTTF::Analyze::SECTOR_ERROR") << se;
00871 continue;
00872 }
00873
00875
00877
00878
00879
00880
00881
00882
00883
00884
00886 int phi_global = track->phi_packed();
00887 phi_global = (phi_global > 15 ? phi_global - 32 : phi_global ) + se * 12;
00888 if ( phi_global < -6 ) phi_global += 144;
00889 if ( phi_global > 137 ) phi_global -= 144;
00890
00891
00892
00893
00894
00895
00899
00901 dttf_bx[whindex][se]->Fill(track->bx());
00902
00904 if( track->TrkTag() == 1 ) {
00905
00907 dttf_bx_2ndTrack[whindex][se]->Fill(track->bx());
00908
00909 }
00910
00914
00915
00916 if ( bxindex == 1 ) {
00917
00919 ++numTracks[whindex][se];
00920
00922 dttf_phi[whindex][se]->Fill(phi_global);
00923
00925 dttf_qual[whindex][se]->Fill(track->quality_packed());
00926
00928 dttf_pt[whindex][se]->Fill(track->pt_packed());
00929
00931 dttf_q[whindex][se]->Fill(track->charge_packed());
00932
00933
00935 dttf_eta[whindex][se]->Fill( track->eta_packed() );
00936
00937 if( track->isFineHalo() ) {
00938
00939 dttf_eta_fine_fraction[whindex][se]->Fill( 0 );
00940
00942 dttf_phi_eta_fine_wheel[whindex]->Fill( track->eta_packed(), phi_global );
00943
00944 } else {
00945
00946 dttf_eta_fine_fraction[whindex][se]->Fill( 1 );
00947
00949 dttf_phi_eta_coarse_wheel[whindex]->Fill( track->eta_packed(), phi_global );
00950 }
00951
00953 if ( online_ ) {
00954 dttf_spare->Fill( whindex, sector );
00955 }
00956
00958
00959
00961 if ( track->TrkTag() == 1 ) {
00962
00964 dttf_phi_wheel_2ndTrack[whindex]->Fill(phi_global);
00965
00967 dttf_pt_wheel_2ndTrack[whindex]->Fill(track->pt_packed());
00968
00970 dttf_eta_wheel_2ndTrack[whindex]->Fill(track->eta_packed());
00971
00973 dttf_quality_wheel_2ndTrack[whindex]->Fill(track->quality_packed());
00974
00976 dttf_q_wheel_2ndTrack[whindex]->Fill(track->charge_packed());
00977
00979 dttf_quality_summary_wheel_2ndTrack[whindex]->Fill( sector, track->quality_packed() );
00980
00982 dttf_phi_eta_wheel_2ndTrack[whindex]->Fill( track->eta_packed(), phi_global );
00983
00984 }
00985
00987 bool match = false;
00988 std::vector<L1MuRegionalCand>::iterator dttfCand;
00990 unsigned int gmt_phi = ( phi_global < 0 ? phi_global + 144 : phi_global );
00991
00992 for ( dttfCand = gmtDttfCands.begin(); dttfCand != gmtDttfCands.end();
00993 ++dttfCand ) {
00994
00996 if ( dttfCand->empty() ) continue;
00997 if ( ( dttfCand->phi_packed() == gmt_phi ) &&
00998 dttfCand->quality_packed() == track->quality_packed() ) {
00999 match = true;
01000 dttfCand->reset();
01001 break;
01002 }
01003
01004
01005 }
01006
01007 if ( match ) {
01008 dttf_gmt_match->Fill( whindex, sector );
01009 } else {
01010 dttf_gmt_missed->Fill( whindex, sector );
01011 }
01012
01013 }
01014
01015 }
01016
01017 }
01018
01019
01020
01021 void L1TDTTF::setQualLabel(MonitorElement *me, int axis)
01022 {
01023
01024 if( axis == 1 )
01025 me->setAxisTitle("Quality", axis);
01026 me->setBinLabel(1, "T34", axis);
01027 me->setBinLabel(2, "T23/24", axis);
01028 me->setBinLabel(3, "T12/13/14", axis);
01029 me->setBinLabel(4, "T234", axis);
01030 me->setBinLabel(5, "T134", axis);
01031 me->setBinLabel(6, "T123/124", axis);
01032 me->setBinLabel(7, "T1234", axis);
01033 }
01034
01035
01036 void L1TDTTF::setWheelLabel(MonitorElement *me)
01037 {
01038 me->setAxisTitle("Wheel", 1);
01039 me->setBinLabel(1, "N2", 1);
01040 me->setBinLabel(2, "N1", 1);
01041 me->setBinLabel(3, "N0", 1);
01042 me->setBinLabel(4, "P0", 1);
01043 me->setBinLabel(5, "P1", 1);
01044 me->setBinLabel(6, "P2", 1);
01045 }
01046
01047
01048
01049
01050 void L1TDTTF::bookEta( int wh, int & nbins, float & start, float & stop )
01051 {
01052
01053 switch ( wh ) {
01054 case 0 : start = 0; stop = 18; nbins = 18; break;
01055 case 1 : start = 8; stop = 28; nbins = 20; break;
01056 case 2 : start = 22; stop = 32; nbins = 10; break;
01057 case 3 : start = 22; stop = 42; nbins = 20; break;
01058 case 4 : start = 36; stop = 56; nbins = 20; break;
01059 case 5 : start = 46; stop = 64; nbins = 18; break;
01060 default : start = 0; stop = 0; nbins = 0; break;
01061 }
01062
01063 }
01064
01065
01066
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