File indexing completed on 2024-04-06 12:07:51
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169 #include "DQM/L1TMonitor/interface/L1TDTTF.h"
0170
0171
0172 #include "FWCore/ServiceRegistry/interface/Service.h"
0173 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0174 #include "DQMServices/Core/interface/DQMStore.h"
0175
0176
0177
0178
0179
0180
0181
0182
0183 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTTrackContainer.h"
0184
0185
0186 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
0187
0188
0189 #include "DataFormats/MuonReco/interface/Muon.h"
0190 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0191
0192
0193 L1TDTTF::L1TDTTF(const edm::ParameterSet& ps)
0194 : dttpgSource_(ps.getParameter<edm::InputTag>("dttpgSource")),
0195 gmtSource_(ps.getParameter<edm::InputTag>("gmtSource")),
0196 muonCollectionLabel_(ps.getParameter<edm::InputTag>("MuonCollection")),
0197 l1tsubsystemfolder_(ps.getUntrackedParameter<std::string>("l1tSystemFolder", "L1T/L1TDTTF")),
0198 online_(ps.getUntrackedParameter<bool>("online", true)),
0199 verbose_(ps.getUntrackedParameter<bool>("verbose", false))
0200
0201 {
0202 std::string trstring = dttpgSource_.label() + ":DATA:" + dttpgSource_.process();
0203 trackInputTag_ = edm::InputTag(trstring);
0204
0205
0206 if (verbose_)
0207 edm::LogInfo("L1TDTTF: constructor") << "Verbose enabled";
0208
0209
0210 if (ps.getUntrackedParameter<bool>("disableROOToutput", false)) {
0211 outputFile_ = "";
0212
0213 } else {
0214 outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
0215 if (!outputFile_.empty()) {
0216 edm::LogInfo("L1TDTTF: constructor") << "L1T Monitoring histograms will be saved to " << outputFile_;
0217 }
0218 }
0219
0220
0221 trackInputToken_ = consumes<L1MuDTTrackContainer>(trackInputTag_);
0222 muonCollectionToken_ = consumes<reco::MuonCollection>(ps.getParameter<edm::InputTag>("MuonCollection"));
0223 gmtSourceToken_ = consumes<L1MuGMTReadoutCollection>(ps.getParameter<edm::InputTag>("gmtSource"));
0224 }
0225
0226
0227 L1TDTTF::~L1TDTTF() {
0228
0229 }
0230
0231
0232 void L1TDTTF::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) {
0233
0234 }
0235
0236
0237 void L1TDTTF::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) {
0238
0239 nev_ = 0;
0240 nev_dttf_ = 0;
0241 nev_dttf_track2_ = 0;
0242
0243
0244
0245 std::string dttf_trk_folder = l1tsubsystemfolder_;
0246
0247 char hname[100];
0248 char htitle[100];
0249
0250
0251 float start = 0;
0252 float stop = 0;
0253 int nbins = 0;
0254
0255
0256
0257 ibooker.setCurrentFolder(dttf_trk_folder);
0258
0259 std::string wheelpath[6] = {
0260 "/02-WHEEL_N2", "/03-WHEEL_N1", "/04-WHEEL_N0", "/05-WHEEL_P0", "/06-WHEEL_P1", "/07-WHEEL_P2"};
0261
0262 char c_whn[6][3] = {"N2", "N1", "N0", "P0", "P1", "P2"};
0263
0264
0265
0266 for (int iwh = 0; iwh < 6; ++iwh) {
0267 bookEta(iwh, nbins, start, stop);
0268
0269
0270
0271
0272 std::string dttf_trk_folder_wheel = dttf_trk_folder + wheelpath[iwh];
0273 ibooker.setCurrentFolder(dttf_trk_folder_wheel);
0274
0275
0276 sprintf(hname, "dttf_01_nTracksPerEvent_wh%s", c_whn[iwh]);
0277 sprintf(htitle, "Wheel %s - Number Tracks Per Event", c_whn[iwh]);
0278 dttf_nTracksPerEvent_wheel[iwh] = ibooker.book1D(hname, htitle, 10, 0.5, 10.5);
0279 dttf_nTracksPerEvent_wheel[iwh]->setAxisTitle("# tracks/event", 1);
0280
0281
0282 sprintf(hname, "dttf_07_phi_vs_etaFine_wh%s", c_whn[iwh]);
0283 sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (fine #eta only, unpacked values)", c_whn[iwh]);
0284 dttf_phi_eta_fine_wheel[iwh] = ibooker.book2D(hname, htitle, nbins, start - 0.5, stop - 0.5, 144, -6, 138);
0285
0286
0287 dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#eta", 1);
0288 dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#phi", 2);
0289
0290
0291 sprintf(hname, "dttf_08_phi_vs_etaCoarse_wh%s", c_whn[iwh]);
0292 sprintf(htitle, "Wheel %s - #eta-#phi DTTF Tracks occupancy (coarse #eta only, unpacked values)", c_whn[iwh]);
0293 dttf_phi_eta_coarse_wheel[iwh] = ibooker.book2D(hname, htitle, nbins, start - 0.5, stop - 0.5, 144, -6, 138);
0294
0295 dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#eta", 1);
0296 dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#phi", 2);
0297
0298
0299
0300 std::string dttf_trk_folder_wheel_2ndtrack = dttf_trk_folder_wheel + "/2ND_TRACK_ONLY";
0301 ibooker.setCurrentFolder(dttf_trk_folder_wheel_2ndtrack);
0302
0303
0304 sprintf(hname, "dttf_04_quality_wh%s_2ndTrack", c_whn[iwh]);
0305 sprintf(htitle, "Wheel %s - 2nd Tracks Quality distribution", c_whn[iwh]);
0306 dttf_quality_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 7, 1, 8);
0307 setQualLabel(dttf_quality_wheel_2ndTrack[iwh], 1);
0308
0309
0310 sprintf(hname, "dttf_05_quality_summary_wh%s_2ndTrack", c_whn[iwh]);
0311 sprintf(htitle, "Wheel %s - 2nd Tracks - Quality", c_whn[iwh]);
0312 dttf_quality_summary_wheel_2ndTrack[iwh] = ibooker.book2D(hname, htitle, 12, 1, 13, 7, 1, 8);
0313 dttf_quality_summary_wheel_2ndTrack[iwh]->setAxisTitle("Sector", 1);
0314 setQualLabel(dttf_quality_summary_wheel_2ndTrack[iwh], 2);
0315
0316
0317
0318 sprintf(hname, "dttf_06_phi_vs_eta_wh%s_2ndTrack", c_whn[iwh]);
0319 sprintf(htitle, "Wheel %s - #eta-#phi Distribution of DTTF 2nd Tracks", c_whn[iwh]);
0320
0321 dttf_phi_eta_wheel_2ndTrack[iwh] = ibooker.book2D(hname, htitle, nbins, start - 0.5, stop - 0.5, 144, -6, 138);
0322
0323 dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
0324 dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 2);
0325
0326
0327 sprintf(hname, "dttf_07_eta_wh%s_2ndTrack", c_whn[iwh]);
0328 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks #eta distribution (Packed values)", c_whn[iwh]);
0329 dttf_eta_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 64, -0.5, 63.5);
0330 dttf_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
0331
0332
0333 sprintf(hname, "dttf_08_phi_wh%s_2ndTrack", c_whn[iwh]);
0334 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Phi distribution (Packed values)", c_whn[iwh]);
0335 dttf_phi_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 144, -6, 138.);
0336 dttf_phi_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 1);
0337
0338
0339 sprintf(hname, "dttf_09_pt_wh%s_2ndTrack", c_whn[iwh]);
0340 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks p_{T} distribution (Packed values)", c_whn[iwh]);
0341 dttf_pt_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 32, -0.5, 31.5);
0342 dttf_pt_wheel_2ndTrack[iwh]->setAxisTitle("p_{T}", 1);
0343
0344
0345 sprintf(hname, "dttf_10_charge_wh%s_2ndTrack", c_whn[iwh]);
0346 sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Charge distribution", c_whn[iwh]);
0347 dttf_q_wheel_2ndTrack[iwh] = ibooker.book1D(hname, htitle, 2, -0.5, 1.5);
0348 dttf_q_wheel_2ndTrack[iwh]->setAxisTitle("Charge", 1);
0349
0350
0351
0352
0353
0354
0355 std::string dttf_trk_folder_nTracksPerEvent = dttf_trk_folder_wheel + "/TracksPerEvent";
0356 ibooker.setCurrentFolder(dttf_trk_folder_nTracksPerEvent);
0357
0358 for (int ise = 0; ise < 12; ++ise) {
0359 sprintf(hname, "dttf_nTracksPerEvent_wh%s_se%d", c_whn[iwh], ise + 1);
0360 sprintf(htitle, "Wheel %s Sector %d - Number of Tracks Per Event", c_whn[iwh], ise + 1);
0361 dttf_nTracksPerEv[iwh][ise] = ibooker.book1D(hname, htitle, 2, 0.5, 2.5);
0362 dttf_nTracksPerEv[iwh][ise]->setAxisTitle("# tracks/event", 1);
0363 }
0364
0365
0366 std::string dttf_trk_folder_wh_bxsec_all = dttf_trk_folder_wheel + "/BX_BySector";
0367 ibooker.setCurrentFolder(dttf_trk_folder_wh_bxsec_all);
0368
0369 for (int ise = 0; ise < 12; ++ise) {
0370 sprintf(hname, "dttf_bx_wh%s_se%d", c_whn[iwh], ise + 1);
0371 sprintf(htitle, "Wheel %s Sector %d - BX Distribution", c_whn[iwh], ise + 1);
0372 dttf_bx[iwh][ise] = ibooker.book1D(hname, htitle, 3, -1.5, 1.5);
0373 dttf_bx[iwh][ise]->setAxisTitle("BX", 1);
0374 }
0375
0376 std::string dttf_trk_folder_wh_bxsec_trk2 = dttf_trk_folder_wheel + "/BX_BySector/2ND_TRACK_ONLY";
0377 ibooker.setCurrentFolder(dttf_trk_folder_wh_bxsec_trk2);
0378
0379 for (int ise = 0; ise < 12; ++ise) {
0380 sprintf(hname, "dttf_bx_2ndTrack_wh%s_se%d", c_whn[iwh], ise + 1);
0381 sprintf(htitle, "Wheel %s Sector %d - BX 2nd Tracks only", c_whn[iwh], ise + 1);
0382 dttf_bx_2ndTrack[iwh][ise] = ibooker.book1D(hname, htitle, 3, -1.5, 1.5);
0383 dttf_bx_2ndTrack[iwh][ise]->setAxisTitle("BX", 1);
0384 }
0385
0386
0387 std::string dttf_trk_folder_charge = dttf_trk_folder_wheel + "/Charge";
0388 ibooker.setCurrentFolder(dttf_trk_folder_charge);
0389
0390 for (int ise = 0; ise < 12; ++ise) {
0391 sprintf(hname, "dttf_charge_wh%s_se%d", c_whn[iwh], ise + 1);
0392 sprintf(htitle, "Wheel %s Sector %d - Packed Charge", c_whn[iwh], ise + 1);
0393 dttf_q[iwh][ise] = ibooker.book1D(hname, htitle, 2, -0.5, 1.5);
0394 dttf_q[iwh][ise]->setAxisTitle("Charge", 1);
0395 }
0396
0397
0398 std::string dttf_trk_folder_pt = dttf_trk_folder_wheel + "/PT";
0399 ibooker.setCurrentFolder(dttf_trk_folder_pt);
0400
0401 for (int ise = 0; ise < 12; ++ise) {
0402 sprintf(hname, "dttf_pt_wh%s_se%d", c_whn[iwh], ise + 1);
0403 sprintf(htitle, "Wheel %s Sector %d - Packed p_{T}", c_whn[iwh], ise + 1);
0404 dttf_pt[iwh][ise] = ibooker.book1D(hname, htitle, 32, -0.5, 31.5);
0405 dttf_pt[iwh][ise]->setAxisTitle("p_{T}", 1);
0406 }
0407
0408
0409 std::string dttf_trk_folder_phi = dttf_trk_folder_wheel + "/Phi";
0410 ibooker.setCurrentFolder(dttf_trk_folder_phi);
0411
0412 for (int ise = 0; ise < 12; ++ise) {
0413 sprintf(hname, "dttf_phi_wh%s_se%d", c_whn[iwh], ise + 1);
0414 sprintf(htitle, "Wheel %s Sector %d - Packed Phi", c_whn[iwh], ise + 1);
0415 dttf_phi[iwh][ise] = ibooker.book1D(hname, htitle, 144, -6, 138);
0416 dttf_phi[iwh][ise]->setAxisTitle("#phi", 1);
0417
0418 }
0419
0420
0421 std::string dttf_trk_folder_quality = dttf_trk_folder_wheel + "/Quality";
0422 ibooker.setCurrentFolder(dttf_trk_folder_quality);
0423
0424 for (int ise = 0; ise < 12; ++ise) {
0425 sprintf(hname, "dttf_qual_wh%s_se%d", c_whn[iwh], ise + 1);
0426 sprintf(htitle, "Wheel %s Sector %d - Packed Quality", c_whn[iwh], ise + 1);
0427 dttf_qual[iwh][ise] = ibooker.book1D(hname, htitle, 7, 1, 8);
0428 dttf_qual[iwh][ise]->setAxisTitle("Quality", 1);
0429 setQualLabel(dttf_qual[iwh][ise], 1);
0430 }
0431
0432
0433 std::string dttf_trk_folder_eta = dttf_trk_folder_wheel + "/Eta";
0434 ibooker.setCurrentFolder(dttf_trk_folder_eta);
0435
0436 for (int ise = 0; ise < 12; ++ise) {
0437 sprintf(hname, "dttf_eta_wh%s_se%d", c_whn[iwh], ise + 1);
0438 sprintf(htitle, "Wheel %s Sector %d - Packed #eta", c_whn[iwh], ise + 1);
0439 dttf_eta[iwh][ise] = ibooker.book1D(hname, htitle, 64, -0.5, 63.5);
0440 dttf_eta[iwh][ise]->setAxisTitle("#eta", 1);
0441 }
0442
0443
0444 dttf_trk_folder_eta = dttf_trk_folder_wheel + "/EtaFineFraction";
0445 ibooker.setCurrentFolder(dttf_trk_folder_eta);
0446
0447 for (int ise = 0; ise < 12; ++ise) {
0448 sprintf(hname, "dttf_etaFine_fraction_wh%s_se%d", c_whn[iwh], ise + 1);
0449 sprintf(htitle, "Wheel %s Sector %d - Eta Fine Fraction", c_whn[iwh], ise + 1);
0450 dttf_eta_fine_fraction[iwh][ise] = ibooker.book1D(hname, htitle, 2, 0, 2);
0451 dttf_eta_fine_fraction[iwh][ise]->setAxisTitle("#eta", 1);
0452 dttf_eta_fine_fraction[iwh][ise]->setBinLabel(1, "fine", 1);
0453 dttf_eta_fine_fraction[iwh][ise]->setBinLabel(2, "coarse", 1);
0454 }
0455 }
0456
0457
0458
0459
0460 std::string dttf_trk_folder_inclusive = dttf_trk_folder + "/01-INCLUSIVE";
0461 ibooker.setCurrentFolder(dttf_trk_folder_inclusive);
0462
0463 sprintf(hname, "dttf_01_nTracksPerEvent_integ");
0464 sprintf(htitle, "Number of DTTF Tracks Per Event");
0465 dttf_nTracksPerEvent_integ = ibooker.book1D(hname, htitle, 20, 0.5, 20.5);
0466 dttf_nTracksPerEvent_integ->setAxisTitle("# tracks/event", 1);
0467
0468
0469
0470
0471
0472
0473
0474
0475 if (online_) {
0476 sprintf(hname, "dttf_04_tracks_occupancy_by_lumi");
0477 sprintf(htitle, "DTTF Tracks in the last LumiSections");
0478 dttf_spare = ibooker.book2D(hname, htitle, 6, 0, 6, 12, 1, 13);
0479 setWheelLabel(dttf_spare);
0480 dttf_spare->setAxisTitle("Sector", 2);
0481 dttf_spare->getTH2F()->GetXaxis()->SetNdivisions(12);
0482 } else {
0483 sprintf(hname, "dttf_04_global_muons_request");
0484 sprintf(htitle, "Tracks compatible with a Global Muon in the Barrel");
0485 dttf_spare = ibooker.book1D(hname, htitle, 4, -0.5, 3.5);
0486 dttf_spare->setBinLabel(1, "No tracks", 1);
0487 dttf_spare->setBinLabel(2, "No tracks but GM", 1);
0488 dttf_spare->setBinLabel(3, "Tracks wo GM", 1);
0489 dttf_spare->setBinLabel(4, "Tracks w GM", 1);
0490 }
0491
0492 std::string dttf_trk_folder_integrated_gmt = dttf_trk_folder + "/08-GMT_MATCH";
0493 ibooker.setCurrentFolder(dttf_trk_folder_integrated_gmt);
0494
0495 sprintf(hname, "dttf_tracks_with_gmt_match");
0496 sprintf(htitle, "DTTF Tracks With a Match in GMT");
0497 dttf_gmt_match = ibooker.book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
0498 setWheelLabel(dttf_gmt_match);
0499
0500 sprintf(hname, "dttf_tracks_without_gmt_match");
0501 sprintf(htitle, "DTTF Tracks Without a Match in GMT");
0502 dttf_gmt_missed = ibooker.book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
0503 setWheelLabel(dttf_gmt_missed);
0504
0505 sprintf(hname, "dttf_missing_tracks_in_gmt");
0506 sprintf(htitle, "GMT Tracks Without a Corresponding Track in DTTF");
0507 dttf_gmt_ghost = ibooker.book2D(hname, htitle, 5, -2, 3, 12, 1, 13.);
0508
0509 dttf_gmt_ghost->setBinLabel(1, "N2", 1);
0510 dttf_gmt_ghost->setBinLabel(2, "N1", 1);
0511 dttf_gmt_ghost->setBinLabel(3, "N0/P0", 1);
0512 dttf_gmt_ghost->setBinLabel(4, "P1", 1);
0513 dttf_gmt_ghost->setBinLabel(5, "P2", 1);
0514
0515
0516
0517
0518 }
0519
0520
0521 void L1TDTTF::analyze(const edm::Event& event, const edm::EventSetup& eventSetup) {
0522 if (verbose_)
0523 edm::LogInfo("L1TDTTF::Analyze::start") << "#################### START";
0524
0525
0526 ++nev_;
0527 memset(numTracks, 0, 72 * sizeof(int));
0528
0529
0530 edm::Handle<L1MuDTTrackContainer> myL1MuDTTrackContainer;
0531 try {
0532 event.getByToken(trackInputToken_, myL1MuDTTrackContainer);
0533 } catch (cms::Exception& iException) {
0534 edm::LogError("L1TDTTF::analyze::DataNotFound") << "can't getByToken L1MuDTTrackContainer with label "
0535 << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
0536 return;
0537 }
0538
0539 if (!myL1MuDTTrackContainer.isValid()) {
0540 edm::LogError("L1TDTTF::analyze::DataNotFound")
0541 << "can't find L1MuDTTrackContainer with label " << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
0542 return;
0543 }
0544
0545 L1MuDTTrackContainer::TrackContainer const* trackContainer = myL1MuDTTrackContainer->getContainer();
0546
0547
0548 if (!trackContainer->empty()) {
0549 ++nev_dttf_;
0550 if (trackContainer->size() > 1)
0551 ++nev_dttf_track2_;
0552 }
0553
0554
0555
0556
0557 bool accept = true;
0558 if (!online_) {
0559 try {
0560 edm::Handle<reco::MuonCollection> muons;
0561 event.getByToken(muonCollectionToken_, muons);
0562 accept = false;
0563 if (muons.isValid()) {
0564 for (reco::MuonCollection::const_iterator recoMu = muons->begin(); recoMu != muons->end(); ++recoMu) {
0565 if (fabs(recoMu->eta()) < 1.4) {
0566 if (verbose_) {
0567 edm::LogInfo("L1TDTTFClient::Analyze:GM") << "Found a global muon!";
0568 }
0569 accept = true;
0570 break;
0571 }
0572 }
0573
0574
0575 if (!accept) {
0576 dttf_spare->Fill(!trackContainer->empty() ? 1 : 0);
0577
0578 if (verbose_) {
0579 edm::LogInfo("L1TDTTFClient::Analyze:GM") << "No global muons in this event!";
0580 }
0581
0582 } else {
0583 dttf_spare->Fill(!trackContainer->empty() ? 2 : 3);
0584 }
0585
0586 } else {
0587
0588 accept = true;
0589 edm::LogWarning("L1TDTTFClient::Analyze:GM")
0590 << "Invalid MuonCollection with label " << muonCollectionLabel_.label();
0591 }
0592
0593 } catch (cms::Exception& iException) {
0594
0595 accept = true;
0596 edm::LogError("DataNotFound") << "Unable to getByToken MuonCollection with label "
0597 << muonCollectionLabel_.label();
0598 }
0599 }
0600
0601
0602 std::vector<L1MuRegionalCand> gmtBx0DttfCandidates;
0603
0604 try {
0605 edm::Handle<L1MuGMTReadoutCollection> pCollection;
0606 event.getByToken(gmtSourceToken_, pCollection);
0607
0608 if (!pCollection.isValid()) {
0609 edm::LogError("DataNotFound") << "can't find L1MuGMTReadoutCollection with label " << gmtSource_.label();
0610 }
0611
0612
0613 L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
0614 std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
0615
0616 std::vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
0617
0618 for (RRItr = gmt_records.begin(); RRItr != gmt_records.end(); ++RRItr) {
0619 std::vector<L1MuRegionalCand> dttfCands = RRItr->getDTBXCands();
0620 std::vector<L1MuRegionalCand>::iterator dttfCand;
0621
0622 for (dttfCand = dttfCands.begin(); dttfCand != dttfCands.end(); ++dttfCand) {
0623 if (dttfCand->empty())
0624 continue;
0625
0626 if (RRItr->getBxInEvent())
0627 continue;
0628
0629
0630
0631 gmtBx0DttfCandidates.push_back(*dttfCand);
0632 }
0633 }
0634
0635 } catch (cms::Exception& iException) {
0636 edm::LogError("DataNotFound") << "Unable to getByToken L1MuGMTReadoutCollection with label " << gmtSource_.label();
0637 }
0638
0639
0640 if (accept)
0641 fillMEs(trackContainer, gmtBx0DttfCandidates);
0642
0643
0644 std::vector<L1MuRegionalCand>::iterator dttfCand;
0645 for (dttfCand = gmtBx0DttfCandidates.begin(); dttfCand != gmtBx0DttfCandidates.end(); ++dttfCand) {
0646 if (dttfCand->empty())
0647 continue;
0648
0649
0650
0651
0652 int phi = dttfCand->phi_packed();
0653 int sector = 1 + (phi + 6) / 12;
0654 if (sector > 12)
0655 sector -= 12;
0656 double eta = dttfCand->etaValue();
0657
0658 int wheel = -3;
0659 if (eta < -0.74) {
0660 wheel = -2;
0661 } else if (eta < -0.3) {
0662 wheel = -1;
0663
0664 } else if (eta < 0.3) {
0665 wheel = 0;
0666
0667 } else if (eta < 0.74) {
0668 wheel = 1;
0669 } else {
0670 wheel = 2;
0671 }
0672
0673 dttf_gmt_ghost->Fill(wheel, sector);
0674
0675
0676 }
0677
0678
0679 int numTracksInt = 0;
0680
0681 for (int w = 0; w < 6; ++w) {
0682 int numTracks_wh = 0;
0683 for (int s = 0; s < 12; ++s) {
0684 dttf_nTracksPerEv[w][s]->Fill(numTracks[w][s]);
0685
0686 numTracks_wh += numTracks[w][s];
0687 }
0688
0689 numTracksInt += numTracks_wh;
0690 dttf_nTracksPerEvent_wheel[w]->Fill(numTracks_wh);
0691 }
0692
0693 dttf_nTracksPerEvent_integ->Fill(numTracksInt);
0694 }
0695
0696
0697 void L1TDTTF::fillMEs(std::vector<L1MuDTTrackCand> const* trackContainer, std::vector<L1MuRegionalCand>& gmtDttfCands) {
0698 L1MuDTTrackContainer::TrackContainer::const_iterator track = trackContainer->begin();
0699 L1MuDTTrackContainer::TrackContainer::const_iterator trackEnd = trackContainer->end();
0700
0701 for (; track != trackEnd; ++track) {
0702 if (verbose_) {
0703 edm::LogInfo("L1TDTTF::Analyze") << "bx = " << track->bx();
0704 edm::LogInfo("L1TDTTF::Analyze") << "quality (packed) = " << track->quality_packed();
0705 edm::LogInfo("L1TDTTF::Analyze") << "pt (packed) = " << track->pt_packed()
0706 << " , pt (GeV) = " << track->ptValue();
0707 edm::LogInfo("L1TDTTF::Analyze") << "phi (packed) = " << track->phi_packed()
0708 << " , phi (rad) = " << track->phiValue();
0709 edm::LogInfo("L1TDTTF::Analyze") << "charge (packed) = " << track->charge_packed();
0710 }
0711
0712
0713 if ((track->whNum() == -1) && !track->eta_packed()) {
0714 edm::LogInfo("L1TDTTF::Analyze") << "Skipping N0 with zero eta value";
0715
0716 continue;
0717 }
0718
0719 int bxindex = track->bx() + 1;
0720 int se = track->scNum();
0721 int sector = se + 1;
0722 int whindex = track->whNum();
0723
0724 whindex = (whindex < 0) ? whindex + 3 : whindex + 2;
0725
0726 if (whindex < 0 || whindex > 5) {
0727 edm::LogError("L1TDTTF::Analyze::WHEEL_ERROR") << track->whNum() << "(" << whindex << ")";
0728 continue;
0729 }
0730
0731 if (se < 0 || se > 11) {
0732 edm::LogError("L1TDTTF::Analyze::SECTOR_ERROR") << se;
0733 continue;
0734 }
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748 int phi_global = track->phi_packed();
0749 phi_global = (phi_global > 15 ? phi_global - 32 : phi_global) + se * 12;
0750 if (phi_global < -6)
0751 phi_global += 144;
0752 if (phi_global > 137)
0753 phi_global -= 144;
0754
0755
0756
0757
0758
0759
0760
0761
0762
0763
0764
0765 dttf_bx[whindex][se]->Fill(track->bx());
0766
0767
0768 if (track->TrkTag() == 1) {
0769
0770 dttf_bx_2ndTrack[whindex][se]->Fill(track->bx());
0771 }
0772
0773
0774
0775
0776
0777 if (bxindex == 1) {
0778
0779 ++numTracks[whindex][se];
0780
0781
0782 dttf_phi[whindex][se]->Fill(phi_global);
0783
0784
0785 dttf_qual[whindex][se]->Fill(track->quality_packed());
0786
0787
0788 dttf_pt[whindex][se]->Fill(track->pt_packed());
0789
0790
0791 dttf_q[whindex][se]->Fill(track->charge_packed());
0792
0793
0794 dttf_eta[whindex][se]->Fill(track->eta_packed());
0795
0796 if (track->isFineHalo()) {
0797 dttf_eta_fine_fraction[whindex][se]->Fill(0);
0798
0799
0800 dttf_phi_eta_fine_wheel[whindex]->Fill(track->eta_packed(), phi_global);
0801
0802 } else {
0803 dttf_eta_fine_fraction[whindex][se]->Fill(1);
0804
0805
0806 dttf_phi_eta_coarse_wheel[whindex]->Fill(track->eta_packed(), phi_global);
0807 }
0808
0809
0810 if (online_) {
0811 dttf_spare->Fill(whindex, sector);
0812 }
0813
0814
0815
0816
0817
0818 if (track->TrkTag() == 1) {
0819
0820 dttf_phi_wheel_2ndTrack[whindex]->Fill(phi_global);
0821
0822
0823 dttf_pt_wheel_2ndTrack[whindex]->Fill(track->pt_packed());
0824
0825
0826 dttf_eta_wheel_2ndTrack[whindex]->Fill(track->eta_packed());
0827
0828
0829 dttf_quality_wheel_2ndTrack[whindex]->Fill(track->quality_packed());
0830
0831
0832 dttf_q_wheel_2ndTrack[whindex]->Fill(track->charge_packed());
0833
0834
0835 dttf_quality_summary_wheel_2ndTrack[whindex]->Fill(sector, track->quality_packed());
0836
0837
0838 dttf_phi_eta_wheel_2ndTrack[whindex]->Fill(track->eta_packed(), phi_global);
0839 }
0840
0841
0842 bool match = false;
0843 std::vector<L1MuRegionalCand>::iterator dttfCand;
0844
0845 unsigned int gmt_phi = (phi_global < 0 ? phi_global + 144 : phi_global);
0846
0847 for (dttfCand = gmtDttfCands.begin(); dttfCand != gmtDttfCands.end(); ++dttfCand) {
0848
0849 if (dttfCand->empty())
0850 continue;
0851 if ((dttfCand->phi_packed() == gmt_phi) && dttfCand->quality_packed() == track->quality_packed()) {
0852 match = true;
0853 dttfCand->reset();
0854 break;
0855 }
0856 }
0857
0858 if (match) {
0859 dttf_gmt_match->Fill(whindex, sector);
0860 } else {
0861 dttf_gmt_missed->Fill(whindex, sector);
0862 }
0863 }
0864 }
0865 }
0866
0867
0868 void L1TDTTF::setQualLabel(MonitorElement* me, int axis) {
0869 if (axis == 1)
0870 me->setAxisTitle("Quality", axis);
0871 me->setBinLabel(1, "T34", axis);
0872 me->setBinLabel(2, "T23/24", axis);
0873 me->setBinLabel(3, "T12/13/14", axis);
0874 me->setBinLabel(4, "T234", axis);
0875 me->setBinLabel(5, "T134", axis);
0876 me->setBinLabel(6, "T123/124", axis);
0877 me->setBinLabel(7, "T1234", axis);
0878 }
0879
0880
0881 void L1TDTTF::setWheelLabel(MonitorElement* me) {
0882 me->setAxisTitle("Wheel", 1);
0883 me->setBinLabel(1, "N2", 1);
0884 me->setBinLabel(2, "N1", 1);
0885 me->setBinLabel(3, "N0", 1);
0886 me->setBinLabel(4, "P0", 1);
0887 me->setBinLabel(5, "P1", 1);
0888 me->setBinLabel(6, "P2", 1);
0889 }
0890
0891
0892 void L1TDTTF::bookEta(int wh, int& nbins, float& start, float& stop) {
0893 switch (wh) {
0894 case 0:
0895 start = 0;
0896 stop = 18;
0897 nbins = 18;
0898 break;
0899 case 1:
0900 start = 8;
0901 stop = 28;
0902 nbins = 20;
0903 break;
0904 case 2:
0905 start = 22;
0906 stop = 32;
0907 nbins = 10;
0908 break;
0909 case 3:
0910 start = 22;
0911 stop = 42;
0912 nbins = 20;
0913 break;
0914 case 4:
0915 start = 36;
0916 stop = 56;
0917 nbins = 20;
0918 break;
0919 case 5:
0920 start = 46;
0921 stop = 64;
0922 nbins = 18;
0923 break;
0924 default:
0925 start = 0;
0926 stop = 0;
0927 nbins = 0;
0928 break;
0929 }
0930 }