Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:56

0001 #include "DQM/L1TMonitor/interface/L1TStage2uGMT.h"
0002 
0003 L1TStage2uGMT::L1TStage2uGMT(const edm::ParameterSet& ps)
0004     : ugmtMuonToken_(consumes<l1t::MuonBxCollection>(ps.getParameter<edm::InputTag>("muonProducer"))),
0005       ugmtMuonShowerToken_(consumes<l1t::MuonShowerBxCollection>(ps.getParameter<edm::InputTag>("muonShowerProducer"))),
0006       monitorDir_(ps.getUntrackedParameter<std::string>("monitorDir")),
0007       emul_(ps.getUntrackedParameter<bool>("emulator")),
0008       verbose_(ps.getUntrackedParameter<bool>("verbose")),
0009       displacedQuantities_(ps.getUntrackedParameter<bool>("displacedQuantities")),
0010       hadronicShowers_(ps.getUntrackedParameter<bool>("hadronicShowers")),
0011       etaScale_(0.010875),  // eta scale (CMS DN-2015/017)
0012       phiScale_(0.010908)   // phi scale (2*pi/576 HW values)
0013 {
0014   if (!emul_) {
0015     ugmtBMTFToken_ = consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("bmtfProducer"));
0016     ugmtOMTFToken_ = consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("omtfProducer"));
0017     ugmtEMTFToken_ = consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("emtfProducer"));
0018     ugmtEMTFShowerToken_ =
0019         consumes<l1t::RegionalMuonShowerBxCollection>(ps.getParameter<edm::InputTag>("emtfShowerProducer"));
0020   }
0021 }
0022 
0023 L1TStage2uGMT::~L1TStage2uGMT() {}
0024 
0025 void L1TStage2uGMT::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0026   edm::ParameterSetDescription desc;
0027   desc.add<edm::InputTag>("muonProducer")->setComment("uGMT output muons.");
0028 
0029   desc.add<edm::InputTag>("bmtfProducer")->setComment("RegionalMuonCands from BMTF.");
0030   desc.add<edm::InputTag>("omtfProducer")->setComment("RegionalMuonCands from OMTF.");
0031   desc.add<edm::InputTag>("emtfProducer")->setComment("RegionalMuonCands from EMTF.");
0032   desc.add<edm::InputTag>("muonShowerProducer")->setComment("uGMT output showers.");
0033   desc.add<edm::InputTag>("emtfShowerProducer")->setComment("RegionalMuonShowers from EMTF.");
0034   desc.addUntracked<std::string>("monitorDir", "")
0035       ->setComment("Target directory in the DQM file. Will be created if not existing.");
0036   desc.addUntracked<bool>("emulator", false)
0037       ->setComment("Create histograms for muonProducer input only. xmtfProducer inputs are ignored.");
0038   desc.addUntracked<bool>("verbose", false);
0039   desc.addUntracked<bool>("displacedQuantities", false);
0040   desc.addUntracked<bool>("hadronicShowers", false);
0041   descriptions.add("l1tStage2uGMT", desc);
0042 }
0043 
0044 void L1TStage2uGMT::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) {
0045   if (!emul_) {
0046     // BMTF Input
0047     ibooker.setCurrentFolder(monitorDir_ + "/BMTFInput");
0048 
0049     ugmtBMTFnMuons = ibooker.book1D("ugmtBMTFnMuons", "uGMT BMTF Input Muon Multiplicity", 37, -0.5, 36.5);
0050     ugmtBMTFnMuons->setAxisTitle("Muon Multiplicity (BX == 0)", 1);
0051 
0052     ugmtBMTFhwPt = ibooker.book1D("ugmtBMTFhwPt", "uGMT BMTF Input HW p_{T}", 512, -0.5, 511.5);
0053     ugmtBMTFhwPt->setAxisTitle("Hardware p_{T}", 1);
0054 
0055     if (displacedQuantities_) {
0056       ugmtBMTFhwPtUnconstrained =
0057           ibooker.book1D("ugmtBMTFhwPtUnconstrained", "uGMT BMTF Input HW p_{T} unconstrained", 256, -0.5, 255.5);
0058       ugmtBMTFhwPtUnconstrained->setAxisTitle("Hardware p_{T} unconstrained", 1);
0059 
0060       ugmtBMTFhwDXY = ibooker.book1D("ugmtBMTFhwDXY", "uGMT BMTF Input HW impact parameter", 4, -0.5, 3.5);
0061       ugmtBMTFhwDXY->setAxisTitle("Hardware dXY", 1);
0062     }
0063 
0064     ugmtBMTFhwEta = ibooker.book1D("ugmtBMTFhwEta", "uGMT BMTF Input HW #eta", 201, -100.5, 100.5);
0065     ugmtBMTFhwEta->setAxisTitle("Hardware #eta", 1);
0066 
0067     ugmtBMTFhwPhi = ibooker.book1D("ugmtBMTFhwPhi", "uGMT BMTF Input HW #phi", 71, -10.5, 60.5);
0068     ugmtBMTFhwPhi->setAxisTitle("Hardware #phi", 1);
0069 
0070     ugmtBMTFglbPhi = ibooker.book1D("ugmtBMTFglbhwPhi", "uGMT BMTF Input HW #phi", 577, -1.5, 575.5);
0071     ugmtBMTFglbPhi->setAxisTitle("Global Hardware #phi", 1);
0072 
0073     ugmtBMTFProcvshwPhi =
0074         ibooker.book2D("ugmtBMTFProcvshwPhi", "uGMT BMTF Processor vs HW #phi", 71, -10.5, 60.5, 12, 0, 12);
0075     ugmtBMTFProcvshwPhi->setAxisTitle("Hardware #phi", 1);
0076     ugmtBMTFProcvshwPhi->setAxisTitle("Wedge", 2);
0077     for (int bin = 1; bin <= 12; ++bin) {
0078       ugmtBMTFProcvshwPhi->setBinLabel(bin, std::to_string(bin), 2);
0079     }
0080 
0081     ugmtBMTFhwSign = ibooker.book1D("ugmtBMTFhwSign", "uGMT BMTF Input HW Sign", 4, -1.5, 2.5);
0082     ugmtBMTFhwSign->setAxisTitle("Hardware Sign", 1);
0083 
0084     ugmtBMTFhwSignValid = ibooker.book1D("ugmtBMTFhwSignValid", "uGMT BMTF Input SignValid", 2, -0.5, 1.5);
0085     ugmtBMTFhwSignValid->setAxisTitle("SignValid", 1);
0086 
0087     ugmtBMTFhwQual = ibooker.book1D("ugmtBMTFhwQual", "uGMT BMTF Input Quality", 16, -0.5, 15.5);
0088     ugmtBMTFhwQual->setAxisTitle("Quality", 1);
0089 
0090     ugmtBMTFlink = ibooker.book1D("ugmtBMTFlink", "uGMT BMTF Input Link", 12, 47.5, 59.5);
0091     ugmtBMTFlink->setAxisTitle("Link", 1);
0092 
0093     ugmtBMTFMuMuDEta =
0094         ibooker.book1D("ugmtBMTFMuMuDEta", "uGMT BMTF input muons #Delta#eta between wedges", 100, -0.5, 0.5);
0095     ugmtBMTFMuMuDEta->setAxisTitle("#Delta#eta", 1);
0096 
0097     ugmtBMTFMuMuDPhi =
0098         ibooker.book1D("ugmtBMTFMuMuDPhi", "uGMT BMTF input muons #Delta#phi between wedges", 100, -0.5, 0.5);
0099     ugmtBMTFMuMuDPhi->setAxisTitle("#Delta#phi", 1);
0100 
0101     ugmtBMTFMuMuDR = ibooker.book1D("ugmtBMTFMuMuDR", "uGMT BMTF input muons #DeltaR between wedges", 50, 0., 0.5);
0102     ugmtBMTFMuMuDR->setAxisTitle("#DeltaR", 1);
0103 
0104     // OMTF Input
0105     ibooker.setCurrentFolder(monitorDir_ + "/OMTFInput");
0106 
0107     ugmtOMTFnMuons = ibooker.book1D("ugmtOMTFnMuons", "uGMT OMTF Input Muon Multiplicity", 37, -0.5, 36.5);
0108     ugmtOMTFnMuons->setAxisTitle("Muon Multiplicity (BX == 0)", 1);
0109 
0110     ugmtOMTFhwPt = ibooker.book1D("ugmtOMTFhwPt", "uGMT OMTF Input HW p_{T}", 512, -0.5, 511.5);
0111     ugmtOMTFhwPt->setAxisTitle("Hardware p_{T}", 1);
0112 
0113     ugmtOMTFhwEta = ibooker.book1D("ugmtOMTFhwEta", "uGMT OMTF Input HW #eta", 231, -115.5, 115.5);
0114     ugmtOMTFhwEta->setAxisTitle("Hardware #eta", 1);
0115 
0116     ugmtOMTFhwPhiPos = ibooker.book1D("ugmtOMTFhwPhiPos", "uGMT OMTF Input HW #phi, Positive Side", 122, -16.5, 105.5);
0117     ugmtOMTFhwPhiPos->setAxisTitle("Hardware #phi", 1);
0118 
0119     ugmtOMTFhwPhiNeg = ibooker.book1D("ugmtOMTFhwPhiNeg", "uGMT OMTF Input HW #phi, Negative Side", 122, -16.5, 105.5);
0120     ugmtOMTFhwPhiNeg->setAxisTitle("Hardware #phi", 1);
0121 
0122     ugmtOMTFglbPhiPos =
0123         ibooker.book1D("ugmtOMTFglbhwPhiPos", "uGMT OMTF Input HW #phi, Positive Side", 577, -1.5, 575.5);
0124     ugmtOMTFglbPhiPos->setAxisTitle("Global Hardware #phi", 1);
0125 
0126     ugmtOMTFglbPhiNeg =
0127         ibooker.book1D("ugmtOMTFglbhwPhiNeg", "uGMT OMTF Input HW #phi, Negative Side", 577, -1.5, 575.5);
0128     ugmtOMTFglbPhiNeg->setAxisTitle("Global Hardware #phi", 1);
0129 
0130     ugmtOMTFProcvshwPhiPos =
0131         ibooker.book2D("ugmtOMTFProcvshwPhiPos", "uGMT OMTF Processor vs HW #phi", 122, -16.5, 105.5, 6, 0, 6);
0132     ugmtOMTFProcvshwPhiPos->setAxisTitle("Hardware #phi", 1);
0133     ugmtOMTFProcvshwPhiPos->setAxisTitle("Sector (Positive Side)", 2);
0134 
0135     ugmtOMTFProcvshwPhiNeg =
0136         ibooker.book2D("ugmtOMTFProcvshwPhiNeg", "uGMT OMTF Processor vs HW #phi", 122, -16.5, 105.5, 6, 0, 6);
0137     ugmtOMTFProcvshwPhiNeg->setAxisTitle("Hardware #phi", 1);
0138     ugmtOMTFProcvshwPhiNeg->setAxisTitle("Sector (Negative Side)", 2);
0139 
0140     for (int bin = 1; bin <= 6; ++bin) {
0141       ugmtOMTFProcvshwPhiPos->setBinLabel(bin, std::to_string(bin), 2);
0142       ugmtOMTFProcvshwPhiNeg->setBinLabel(bin, std::to_string(bin), 2);
0143     }
0144 
0145     ugmtOMTFhwSign = ibooker.book1D("ugmtOMTFhwSign", "uGMT OMTF Input HW Sign", 4, -1.5, 2.5);
0146     ugmtOMTFhwSign->setAxisTitle("Hardware Sign", 1);
0147 
0148     ugmtOMTFhwSignValid = ibooker.book1D("ugmtOMTFhwSignValid", "uGMT OMTF Input SignValid", 2, -0.5, 1.5);
0149     ugmtOMTFhwSignValid->setAxisTitle("SignValid", 1);
0150 
0151     ugmtOMTFhwQual = ibooker.book1D("ugmtOMTFhwQual", "uGMT OMTF Input Quality", 16, -0.5, 15.5);
0152     ugmtOMTFhwQual->setAxisTitle("Quality", 1);
0153 
0154     ugmtOMTFlink = ibooker.book1D("ugmtOMTFlink", "uGMT OMTF Input Link", 24, 41.5, 65.5);
0155     ugmtOMTFlink->setAxisTitle("Link", 1);
0156 
0157     ugmtOMTFMuMuDEta =
0158         ibooker.book1D("ugmtOMTFMuMuDEta", "uGMT OMTF input muons #Delta#eta between sectors", 100, -0.5, 0.5);
0159     ugmtOMTFMuMuDEta->setAxisTitle("#Delta#eta", 1);
0160 
0161     ugmtOMTFMuMuDPhi =
0162         ibooker.book1D("ugmtOMTFMuMuDPhi", "uGMT OMTF input muons #Delta#phi between sectors", 100, -0.5, 0.5);
0163     ugmtOMTFMuMuDPhi->setAxisTitle("#Delta#phi", 1);
0164 
0165     ugmtOMTFMuMuDR = ibooker.book1D("ugmtOMTFMuMuDR", "uGMT OMTF input muons #DeltaR between sectors", 50, 0., 0.5);
0166     ugmtOMTFMuMuDR->setAxisTitle("#DeltaR", 1);
0167 
0168     // EMTF Input
0169     ibooker.setCurrentFolder(monitorDir_ + "/EMTFInput");
0170 
0171     ugmtEMTFnMuons = ibooker.book1D("ugmtEMTFnMuons", "uGMT EMTF Input Muon Multiplicity", 37, -0.5, 36.5);
0172     ugmtEMTFnMuons->setAxisTitle("Muon Multiplicity (BX == 0)", 1);
0173 
0174     ugmtEMTFhwPt = ibooker.book1D("ugmtEMTFhwPt", "uGMT EMTF HW p_{T}", 512, -0.5, 511.5);
0175     ugmtEMTFhwPt->setAxisTitle("Hardware p_{T}", 1);
0176 
0177     if (displacedQuantities_) {
0178       ugmtEMTFhwPtUnconstrained =
0179           ibooker.book1D("ugmtEMTFhwPtUnconstrained", "uGMT EMTF Input HW p_{T} unconstrained", 256, -0.5, 255.5);
0180       ugmtEMTFhwPtUnconstrained->setAxisTitle("Hardware p_{T} unconstrained", 1);
0181 
0182       ugmtEMTFhwDXY = ibooker.book1D("ugmtEMTFhwDXY", "uGMT EMTF Input HW impact parameter", 4, -0.5, 3.5);
0183       ugmtEMTFhwDXY->setAxisTitle("Hardware dXY", 1);
0184     }
0185 
0186     ugmtEMTFhwEta = ibooker.book1D("ugmtEMTFhwEta", "uGMT EMTF HW #eta", 461, -230.5, 230.5);
0187     ugmtEMTFhwEta->setAxisTitle("Hardware #eta", 1);
0188 
0189     ugmtEMTFhwPhiPos = ibooker.book1D("ugmtEMTFhwPhiPos", "uGMT EMTF HW #phi, Positive Side", 146, -40.5, 105.5);
0190     ugmtEMTFhwPhiPos->setAxisTitle("Hardware #phi", 1);
0191 
0192     ugmtEMTFhwPhiNeg = ibooker.book1D("ugmtEMTFhwPhiNeg", "uGMT EMTF HW #phi, Negative Side", 146, -40.5, 105.5);
0193     ugmtEMTFhwPhiNeg->setAxisTitle("Hardware #phi", 1);
0194 
0195     ugmtEMTFglbPhiPos =
0196         ibooker.book1D("ugmtEMTFglbhwPhiPos", "uGMT EMTF Input Global HW #phi, Positive Side", 577, -1.5, 575.5);
0197     ugmtEMTFglbPhiPos->setAxisTitle("Global Hardware #phi", 1);
0198 
0199     ugmtEMTFglbPhiNeg =
0200         ibooker.book1D("ugmtEMTFglbhwPhiNeg", "uGMT EMTF Input Global HW #phi, Negative Side", 577, -1.5, 575.5);
0201     ugmtEMTFglbPhiNeg->setAxisTitle("Global Hardware #phi", 1);
0202 
0203     ugmtEMTFProcvshwPhiPos =
0204         ibooker.book2D("ugmtEMTFProcvshwPhiPos", "uGMT EMTF Processor vs HW #phi", 146, -40.5, 105.5, 6, 0, 6);
0205     ugmtEMTFProcvshwPhiPos->setAxisTitle("Hardware #phi", 1);
0206     ugmtEMTFProcvshwPhiPos->setAxisTitle("Sector (Positive Side)", 2);
0207 
0208     ugmtEMTFProcvshwPhiNeg =
0209         ibooker.book2D("ugmtEMTFProcvshwPhiNeg", "uGMT EMTF Processor vs HW #phi", 146, -40.5, 105.5, 6, 0, 6);
0210     ugmtEMTFProcvshwPhiNeg->setAxisTitle("Hardware #phi", 1);
0211     ugmtEMTFProcvshwPhiNeg->setAxisTitle("Sector (Negative Side)", 2);
0212 
0213     for (int bin = 1; bin <= 6; ++bin) {
0214       ugmtEMTFProcvshwPhiPos->setBinLabel(bin, std::to_string(bin), 2);
0215       ugmtEMTFProcvshwPhiNeg->setBinLabel(bin, std::to_string(bin), 2);
0216     }
0217 
0218     ugmtEMTFhwSign = ibooker.book1D("ugmtEMTFhwSign", "uGMT EMTF HW Sign", 4, -1.5, 2.5);
0219     ugmtEMTFhwSign->setAxisTitle("Hardware Sign", 1);
0220 
0221     ugmtEMTFhwSignValid = ibooker.book1D("ugmtEMTFhwSignValid", "uGMT EMTF SignValid", 2, -0.5, 1.5);
0222     ugmtEMTFhwSignValid->setAxisTitle("SignValid", 1);
0223 
0224     ugmtEMTFhwQual = ibooker.book1D("ugmtEMTFhwQual", "uGMT EMTF Quality", 16, -0.5, 15.5);
0225     ugmtEMTFhwQual->setAxisTitle("Quality", 1);
0226 
0227     ugmtEMTFlink = ibooker.book1D("ugmtEMTFlink", "uGMT EMTF Link", 36, 35.5, 71.5);
0228     ugmtEMTFlink->setAxisTitle("Link", 1);
0229 
0230     ugmtEMTFMuMuDEta =
0231         ibooker.book1D("ugmtEMTFMuMuDEta", "uGMT EMTF input muons #Delta#eta between sectors", 100, -0.5, 0.5);
0232     ugmtEMTFMuMuDEta->setAxisTitle("#Delta#eta", 1);
0233 
0234     ugmtEMTFMuMuDPhi =
0235         ibooker.book1D("ugmtEMTFMuMuDPhi", "uGMT EMTF input muons #Delta#phi between sectors", 100, -0.5, 0.5);
0236     ugmtEMTFMuMuDPhi->setAxisTitle("#Delta#phi", 1);
0237 
0238     ugmtEMTFMuMuDR = ibooker.book1D("ugmtEMTFMuMuDR", "uGMT EMTF input muons #DeltaR between sectors", 50, 0., 0.5);
0239     ugmtEMTFMuMuDR->setAxisTitle("#DeltaR", 1);
0240 
0241     // EMTF muon showers
0242     if (hadronicShowers_) {
0243       ibooker.setCurrentFolder(monitorDir_ + "/EMTFInput/Muon showers");
0244 
0245       ugmtEMTFShowerTypeOccupancyPerSector = ibooker.book2D(
0246           "ugmtEMTFShowerTypeOccupancyPerSector", "Shower type occupancy per sector", 12, 1, 13, 3, 1, 4);
0247       ugmtEMTFShowerTypeOccupancyPerSector->setAxisTitle("Processor", 1);
0248       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(12, "+6", 1);
0249       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(11, "+5", 1);
0250       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(10, "+4", 1);
0251       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(9, "+3", 1);
0252       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(8, "+2", 1);
0253       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(7, "+1", 1);
0254       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(6, "-6", 1);
0255       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(5, "-5", 1);
0256       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(4, "-4", 1);
0257       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(3, "-3", 1);
0258       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(2, "-2", 1);
0259       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(1, "-1", 1);
0260       ugmtEMTFShowerTypeOccupancyPerSector->setAxisTitle("Shower type", 2);
0261       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(IDX_LOOSE_SHOWER, "OneLoose", 2);
0262       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(IDX_TIGHT_SHOWER, "OneTight", 2);
0263       ugmtEMTFShowerTypeOccupancyPerSector->setBinLabel(IDX_NOMINAL_SHOWER, "OneNominal", 2);
0264     }
0265 
0266     // inter-TF muon correlations
0267     ibooker.setCurrentFolder(monitorDir_ + "/muon_correlations");
0268 
0269     ugmtBOMTFposMuMuDEta =
0270         ibooker.book1D("ugmtBOMTFposMuMuDEta", "uGMT input muons #Delta#eta between BMTF and OMTF+", 100, -0.5, 0.5);
0271     ugmtBOMTFposMuMuDEta->setAxisTitle("#Delta#eta", 1);
0272 
0273     ugmtBOMTFposMuMuDPhi =
0274         ibooker.book1D("ugmtBOMTFposMuMuDPhi", "uGMT input muons #Delta#phi between BMTF and OMTF+", 100, -0.5, 0.5);
0275     ugmtBOMTFposMuMuDPhi->setAxisTitle("#Delta#phi", 1);
0276 
0277     ugmtBOMTFposMuMuDR =
0278         ibooker.book1D("ugmtBOMTFposMuMuDR", "uGMT input muons #DeltaR between BMTF and OMTF+", 50, 0., 0.5);
0279     ugmtBOMTFposMuMuDR->setAxisTitle("#DeltaR", 1);
0280 
0281     ugmtBOMTFnegMuMuDEta =
0282         ibooker.book1D("ugmtBOMTFnegMuMuDEta", "uGMT input muons #Delta#eta between BMTF and OMTF-", 100, -0.5, 0.5);
0283     ugmtBOMTFnegMuMuDEta->setAxisTitle("#Delta#eta", 1);
0284 
0285     ugmtBOMTFnegMuMuDPhi =
0286         ibooker.book1D("ugmtBOMTFnegMuMuDPhi", "uGMT input muons #Delta#phi between BMTF and OMTF-", 100, -0.5, 0.5);
0287     ugmtBOMTFnegMuMuDPhi->setAxisTitle("#Delta#phi", 1);
0288 
0289     ugmtBOMTFnegMuMuDR =
0290         ibooker.book1D("ugmtBOMTFnegMuMuDR", "uGMT input muons #DeltaR between BMTF and OMTF-", 50, 0., 0.5);
0291     ugmtBOMTFnegMuMuDR->setAxisTitle("#DeltaR", 1);
0292 
0293     ugmtEOMTFposMuMuDEta =
0294         ibooker.book1D("ugmtEOMTFposMuMuDEta", "uGMT input muons #Delta#eta between EMTF+ and OMTF+", 100, -0.5, 0.5);
0295     ugmtEOMTFposMuMuDEta->setAxisTitle("#Delta#eta", 1);
0296 
0297     ugmtEOMTFposMuMuDPhi =
0298         ibooker.book1D("ugmtEOMTFposMuMuDPhi", "uGMT input muons #Delta#phi between EMTF+ and OMTF+", 100, -0.5, 0.5);
0299     ugmtEOMTFposMuMuDPhi->setAxisTitle("#Delta#phi", 1);
0300 
0301     ugmtEOMTFposMuMuDR =
0302         ibooker.book1D("ugmtEOMTFposMuMuDR", "uGMT input muons #DeltaR between EMTF+ and OMTF+", 50, 0., 0.5);
0303     ugmtEOMTFposMuMuDR->setAxisTitle("#DeltaR", 1);
0304 
0305     ugmtEOMTFnegMuMuDEta =
0306         ibooker.book1D("ugmtEOMTFnegMuMuDEta", "uGMT input muons #Delta#eta between EMTF- and OMTF-", 100, -0.5, 0.5);
0307     ugmtEOMTFnegMuMuDEta->setAxisTitle("#Delta#eta", 1);
0308 
0309     ugmtEOMTFnegMuMuDPhi =
0310         ibooker.book1D("ugmtEOMTFnegMuMuDPhi", "uGMT input muons #Delta#phi between EMTF- and OMTF-", 100, -0.5, 0.5);
0311     ugmtEOMTFnegMuMuDPhi->setAxisTitle("#Delta#phi", 1);
0312 
0313     ugmtEOMTFnegMuMuDR =
0314         ibooker.book1D("ugmtEOMTFnegMuMuDR", "uGMT input muons #DeltaR between EMTF- and OMTF-", 50, 0., 0.5);
0315     ugmtEOMTFnegMuMuDR->setAxisTitle("#DeltaR", 1);
0316   }
0317 
0318   // Subsystem Monitoring and Muon Output
0319   ibooker.setCurrentFolder(monitorDir_);
0320 
0321   ugmtMuonBX = ibooker.book1D("ugmtMuonBX", "uGMT output muon BX", 7, -3.5, 3.5);
0322   ugmtMuonBX->setAxisTitle("BX", 1);
0323 
0324   ugmtnMuons = ibooker.book1D("ugmtnMuons", "uGMT output muon Multiplicity", 9, -0.5, 8.5);
0325   ugmtnMuons->setAxisTitle("Muon Multiplicity (BX == 0)", 1);
0326 
0327   ugmtMuonIndex = ibooker.book1D("ugmtMuonIndex", "uGMT Input Muon Index", 108, -0.5, 107.5);
0328   ugmtMuonIndex->setAxisTitle("Index", 1);
0329 
0330   ugmtMuonhwPt = ibooker.book1D("ugmtMuonhwPt", "uGMT output muon HW p_{T}", 512, -0.5, 511.5);
0331   ugmtMuonhwPt->setAxisTitle("Hardware p_{T}", 1);
0332 
0333   if (displacedQuantities_) {
0334     ugmtMuonhwPtUnconstrained =
0335         ibooker.book1D("ugmtMuonhwPtUnconstrained", "uGMT output muon HW p_{T} unconstrained", 256, -0.5, 255.5);
0336     ugmtMuonhwPtUnconstrained->setAxisTitle("Hardware p_{T} unconstrained", 1);
0337 
0338     ugmtMuonhwDXY = ibooker.book1D("ugmtMuonhwDXY", "uGMT output muon HW impact parameter", 4, -0.5, 3.5);
0339     ugmtMuonhwDXY->setAxisTitle("Hardware dXY", 1);
0340   }
0341 
0342   ugmtMuonhwEta = ibooker.book1D("ugmtMuonhwEta", "uGMT output muon HW #eta", 461, -230.5, 230.5);
0343   ugmtMuonhwEta->setAxisTitle("Hardware Eta", 1);
0344 
0345   ugmtMuonhwPhi = ibooker.book1D("ugmtMuonhwPhi", "uGMT output muon HW #phi", 577, -1.5, 575.5);
0346   ugmtMuonhwPhi->setAxisTitle("Hardware Phi", 1);
0347 
0348   ugmtMuonhwEtaAtVtx = ibooker.book1D("ugmtMuonhwEtaAtVtx", "uGMT output muon HW #eta at vertex", 461, -230.5, 230.5);
0349   ugmtMuonhwEtaAtVtx->setAxisTitle("Hardware Eta at Vertex", 1);
0350 
0351   ugmtMuonhwPhiAtVtx = ibooker.book1D("ugmtMuonhwPhiAtVtx", "uGMT output muon HW #phi at vertex", 577, -1.5, 575.5);
0352   ugmtMuonhwPhiAtVtx->setAxisTitle("Hardware Phi at Vertex", 1);
0353 
0354   ugmtMuonhwCharge = ibooker.book1D("ugmtMuonhwCharge", "uGMT output muon HW Charge", 4, -1.5, 2.5);
0355   ugmtMuonhwCharge->setAxisTitle("Hardware Charge", 1);
0356 
0357   ugmtMuonhwChargeValid = ibooker.book1D("ugmtMuonhwChargeValid", "uGMT output muon ChargeValid", 2, -0.5, 1.5);
0358   ugmtMuonhwChargeValid->setAxisTitle("ChargeValid", 1);
0359 
0360   ugmtMuonhwQual = ibooker.book1D("ugmtMuonhwQual", "uGMT output muon Quality", 16, -0.5, 15.5);
0361   ugmtMuonhwQual->setAxisTitle("Quality", 1);
0362 
0363   ugmtMuonhwIso = ibooker.book1D("ugmtMuonhwIso", "uGMT output muon Isolation", 4, -0.5, 3.5);
0364   ugmtMuonhwIso->setAxisTitle("Isolation", 1);
0365 
0366   ugmtMuonPt = ibooker.book1D("ugmtMuonPt", "uGMT output muon p_{T}", 128, -0.5, 255.5);
0367   ugmtMuonPt->setAxisTitle("p_{T} [GeV]", 1);
0368 
0369   if (displacedQuantities_) {
0370     ugmtMuonPtUnconstrained =
0371         ibooker.book1D("ugmtMuonPtUnconstrained", "uGMT output muon p_{T} unconstrained", 128, -0.5, 255.5);
0372     ugmtMuonPtUnconstrained->setAxisTitle("p_{T} unconstrained [GeV]", 1);
0373   }
0374 
0375   ugmtMuonEta = ibooker.book1D("ugmtMuonEta", "uGMT output muon #eta", 52, -2.6, 2.6);
0376   ugmtMuonEta->setAxisTitle("#eta", 1);
0377 
0378   ugmtMuonPhi = ibooker.book1D("ugmtMuonPhi", "uGMT output muon #phi", 66, -3.3, 3.3);
0379   ugmtMuonPhi->setAxisTitle("#phi", 1);
0380 
0381   ugmtMuonEtaAtVtx = ibooker.book1D("ugmtMuonEtaAtVtx", "uGMT output muon #eta at vertex", 52, -2.6, 2.6);
0382   ugmtMuonEtaAtVtx->setAxisTitle("#eta at vertex", 1);
0383 
0384   ugmtMuonPhiAtVtx = ibooker.book1D("ugmtMuonPhiAtVtx", "uGMT output muon #phi at vertex", 66, -3.3, 3.3);
0385   ugmtMuonPhiAtVtx->setAxisTitle("#phi at vertex", 1);
0386 
0387   ugmtMuonCharge = ibooker.book1D("ugmtMuonCharge", "uGMT output muon Charge", 3, -1.5, 1.5);
0388   ugmtMuonCharge->setAxisTitle("Charge", 1);
0389 
0390   ugmtMuonPhiBmtf = ibooker.book1D("ugmtMuonPhiBmtf", "uGMT output muon #phi for BMTF Inputs", 66, -3.3, 3.3);
0391   ugmtMuonPhiBmtf->setAxisTitle("#phi", 1);
0392 
0393   ugmtMuonPhiOmtf = ibooker.book1D("ugmtMuonPhiOmtf", "uGMT output muon #phi for OMTF Inputs", 66, -3.3, 3.3);
0394   ugmtMuonPhiOmtf->setAxisTitle("#phi", 1);
0395 
0396   ugmtMuonPhiEmtf = ibooker.book1D("ugmtMuonPhiEmtf", "uGMT output muon #phi for EMTF Inputs", 66, -3.3, 3.3);
0397   ugmtMuonPhiEmtf->setAxisTitle("#phi", 1);
0398 
0399   const float dPhiScale = 4 * phiScale_;
0400   const float dEtaScale = etaScale_;
0401   ugmtMuonDEtavsPtBmtf = ibooker.book2D("ugmtMuonDEtavsPtBmtf",
0402                                         "uGMT output muon from BMTF #eta_{at vertex} - #eta_{at muon system} vs p_{T}",
0403                                         32,
0404                                         0,
0405                                         64,
0406                                         31,
0407                                         -15.5 * dEtaScale,
0408                                         15.5 * dEtaScale);
0409   ugmtMuonDEtavsPtBmtf->setAxisTitle("p_{T} [GeV]", 1);
0410   ugmtMuonDEtavsPtBmtf->setAxisTitle("#eta_{at vertex} - #eta", 2);
0411 
0412   ugmtMuonDPhivsPtBmtf = ibooker.book2D("ugmtMuonDPhivsPtBmtf",
0413                                         "uGMT output muon from BMTF #phi_{at vertex} - #phi_{at muon system} vs p_{T}",
0414                                         32,
0415                                         0,
0416                                         64,
0417                                         31,
0418                                         -15.5 * dPhiScale,
0419                                         15.5 * dPhiScale);
0420   ugmtMuonDPhivsPtBmtf->setAxisTitle("p_{T} [GeV]", 1);
0421   ugmtMuonDPhivsPtBmtf->setAxisTitle("#phi_{at vertex} - #phi", 2);
0422 
0423   ugmtMuonDEtavsPtOmtf = ibooker.book2D("ugmtMuonDEtavsPtOmtf",
0424                                         "uGMT output muon from OMTF #eta_{at vertex} - #eta_{at muon system} vs p_{T}",
0425                                         32,
0426                                         0,
0427                                         64,
0428                                         31,
0429                                         -15.5 * dEtaScale,
0430                                         15.5 * dEtaScale);
0431   ugmtMuonDEtavsPtOmtf->setAxisTitle("p_{T} [GeV]", 1);
0432   ugmtMuonDEtavsPtOmtf->setAxisTitle("#eta_{at vertex} - #eta", 2);
0433 
0434   ugmtMuonDPhivsPtOmtf = ibooker.book2D("ugmtMuonDPhivsPtOmtf",
0435                                         "uGMT output muon from OMTF #phi_{at vertex} - #phi_{at muon system} vs p_{T}",
0436                                         32,
0437                                         0,
0438                                         64,
0439                                         31,
0440                                         -15.5 * dPhiScale,
0441                                         15.5 * dPhiScale);
0442   ugmtMuonDPhivsPtOmtf->setAxisTitle("p_{T} [GeV]", 1);
0443   ugmtMuonDPhivsPtOmtf->setAxisTitle("#phi_{at vertex} - #phi", 2);
0444 
0445   ugmtMuonDEtavsPtEmtf = ibooker.book2D("ugmtMuonDEtavsPtEmtf",
0446                                         "uGMT output muon from EMTF #eta_{at vertex} - #eta_{at muon system} vs p_{T}",
0447                                         32,
0448                                         0,
0449                                         64,
0450                                         31,
0451                                         -15.5 * dEtaScale,
0452                                         15.5 * dEtaScale);
0453   ugmtMuonDEtavsPtEmtf->setAxisTitle("p_{T} [GeV]", 1);
0454   ugmtMuonDEtavsPtEmtf->setAxisTitle("#eta_{at vertex} - #eta", 2);
0455 
0456   ugmtMuonDPhivsPtEmtf = ibooker.book2D("ugmtMuonDPhivsPtEmtf",
0457                                         "uGMT output muon from EMTF #phi_{at vertex} - #phi_{at muon system} vs p_{T}",
0458                                         32,
0459                                         0,
0460                                         64,
0461                                         31,
0462                                         -15.5 * dPhiScale,
0463                                         15.5 * dPhiScale);
0464   ugmtMuonDPhivsPtEmtf->setAxisTitle("p_{T} [GeV]", 1);
0465   ugmtMuonDPhivsPtEmtf->setAxisTitle("#phi_{at vertex} - #phi", 2);
0466 
0467   ugmtMuonPtvsEta =
0468       ibooker.book2D("ugmtMuonPtvsEta", "uGMT output muon p_{T} vs #eta", 100, -2.5, 2.5, 128, -0.5, 255.5);
0469   ugmtMuonPtvsEta->setAxisTitle("#eta", 1);
0470   ugmtMuonPtvsEta->setAxisTitle("p_{T} [GeV]", 2);
0471 
0472   ugmtMuonPtvsPhi =
0473       ibooker.book2D("ugmtMuonPtvsPhi", "uGMT output muon p_{T} vs #phi", 64, -3.2, 3.2, 128, -0.5, 255.5);
0474   ugmtMuonPtvsPhi->setAxisTitle("#phi", 1);
0475   ugmtMuonPtvsPhi->setAxisTitle("p_{T} [GeV]", 2);
0476 
0477   ugmtMuonPhivsEta = ibooker.book2D("ugmtMuonPhivsEta", "uGMT output muon #phi vs #eta", 100, -2.5, 2.5, 64, -3.2, 3.2);
0478   ugmtMuonPhivsEta->setAxisTitle("#eta", 1);
0479   ugmtMuonPhivsEta->setAxisTitle("#phi", 2);
0480 
0481   ugmtMuonPhiAtVtxvsEtaAtVtx = ibooker.book2D(
0482       "ugmtMuonPhiAtVtxvsEtaAtVtx", "uGMT output muon #phi at vertex vs #eta at vertex", 100, -2.5, 2.5, 64, -3.2, 3.2);
0483   ugmtMuonPhiAtVtxvsEtaAtVtx->setAxisTitle("#eta at vertex", 1);
0484   ugmtMuonPhiAtVtxvsEtaAtVtx->setAxisTitle("#phi at vertex", 2);
0485 
0486   ugmtMuonBXvsLink =
0487       ibooker.book2D("ugmtMuonBXvsLink", "uGMT output muon BX vs Input Links", 36, 35.5, 71.5, 5, -2.5, 2.5);
0488   ugmtMuonBXvsLink->setAxisTitle("Muon Input Links", 1);
0489   for (int bin = 1; bin <= 6; ++bin) {
0490     ugmtMuonBXvsLink->setBinLabel(bin, Form("E+%d", bin), 1);
0491     ugmtMuonBXvsLink->setBinLabel(bin + 6, Form("O+%d", bin), 1);
0492     ugmtMuonBXvsLink->setBinLabel(bin + 12, Form("B%d", bin), 1);
0493     ugmtMuonBXvsLink->setBinLabel(bin + 18, Form("B%d", bin + 6), 1);
0494     ugmtMuonBXvsLink->setBinLabel(bin + 24, Form("O-%d", bin), 1);
0495     ugmtMuonBXvsLink->setBinLabel(bin + 30, Form("E-%d", bin), 1);
0496   }
0497   ugmtMuonBXvsLink->setAxisTitle("BX", 2);
0498 
0499   ugmtMuonChargevsLink =
0500       ibooker.book2D("ugmtMuonChargevsLink", "uGMT output muon Charge vs Input Links", 36, 35.5, 71.5, 3, -1.5, 1.5);
0501   ugmtMuonChargevsLink->setAxisTitle("Muon Input Links", 1);
0502   for (int bin = 1; bin <= 6; ++bin) {
0503     ugmtMuonChargevsLink->setBinLabel(bin, Form("E+%d", bin), 1);
0504     ugmtMuonChargevsLink->setBinLabel(bin + 6, Form("O+%d", bin), 1);
0505     ugmtMuonChargevsLink->setBinLabel(bin + 12, Form("B%d", bin), 1);
0506     ugmtMuonChargevsLink->setBinLabel(bin + 18, Form("B%d", bin + 6), 1);
0507     ugmtMuonChargevsLink->setBinLabel(bin + 24, Form("O-%d", bin), 1);
0508     ugmtMuonChargevsLink->setBinLabel(bin + 30, Form("E-%d", bin), 1);
0509   }
0510   ugmtMuonChargevsLink->setAxisTitle("Charge", 2);
0511 
0512   if (hadronicShowers_) {
0513     ugmtMuonShowerTypeOccupancyPerBx =
0514         ibooker.book2D("ugmtMuonShowerTypeOccupancyPerBx", "Shower type occupancy per BX", 7, -3.5, 3.5, 3, 1, 4);
0515     ugmtMuonShowerTypeOccupancyPerBx->setAxisTitle("BX", 1);
0516     ugmtMuonShowerTypeOccupancyPerBx->setAxisTitle("Shower type", 2);
0517     ugmtMuonShowerTypeOccupancyPerBx->setBinLabel(IDX_LOOSE_SHOWER, "TwoLoose", 2);
0518     ugmtMuonShowerTypeOccupancyPerBx->setBinLabel(IDX_TIGHT_SHOWER, "OneTight", 2);
0519     ugmtMuonShowerTypeOccupancyPerBx->setBinLabel(IDX_NOMINAL_SHOWER, "OneNominal", 2);
0520   }
0521 
0522   ugmtMuonBXvshwPt =
0523       ibooker.book2D("ugmtMuonBXvshwPt", "uGMT output muon BX vs HW p_{T}", 128, -0.5, 511.5, 5, -2.5, 2.5);
0524   ugmtMuonBXvshwPt->setAxisTitle("Hardware p_{T}", 1);
0525   ugmtMuonBXvshwPt->setAxisTitle("BX", 2);
0526 
0527   ugmtMuonBXvshwEta =
0528       ibooker.book2D("ugmtMuonBXvshwEta", "uGMT output muon BX vs HW #eta", 93, -232.5, 232.5, 5, -2.5, 2.5);
0529   ugmtMuonBXvshwEta->setAxisTitle("Hardware #eta", 1);
0530   ugmtMuonBXvshwEta->setAxisTitle("BX", 2);
0531 
0532   ugmtMuonBXvshwPhi =
0533       ibooker.book2D("ugmtMuonBXvshwPhi", "uGMT output muon BX vs HW #phi", 116, -2.5, 577.5, 5, -2.5, 2.5);
0534   ugmtMuonBXvshwPhi->setAxisTitle("Hardware #phi", 1);
0535   ugmtMuonBXvshwPhi->setAxisTitle("BX", 2);
0536 
0537   ugmtMuonBXvshwCharge =
0538       ibooker.book2D("ugmtMuonBXvshwCharge", "uGMT output muon BX vs HW Charge", 2, -0.5, 1.5, 5, -2.5, 2.5);
0539   ugmtMuonBXvshwCharge->setAxisTitle("Hardware Charge", 1);
0540   ugmtMuonBXvshwCharge->setAxisTitle("BX", 2);
0541 
0542   ugmtMuonBXvshwChargeValid =
0543       ibooker.book2D("ugmtMuonBXvshwChargeValid", "uGMT output muon BX vs ChargeValid", 2, -0.5, 1.5, 5, -2.5, 2.5);
0544   ugmtMuonBXvshwChargeValid->setAxisTitle("ChargeValid", 1);
0545   ugmtMuonBXvshwChargeValid->setAxisTitle("BX", 2);
0546 
0547   ugmtMuonBXvshwQual =
0548       ibooker.book2D("ugmtMuonBXvshwQual", "uGMT output muon BX vs Quality", 16, -0.5, 15.5, 5, -2.5, 2.5);
0549   ugmtMuonBXvshwQual->setAxisTitle("Quality", 1);
0550   ugmtMuonBXvshwQual->setAxisTitle("BX", 2);
0551 
0552   ugmtMuonBXvshwIso =
0553       ibooker.book2D("ugmtMuonBXvshwIso", "uGMT output muon BX vs Isolation", 4, -0.5, 3.5, 5, -2.5, 2.5);
0554   ugmtMuonBXvshwIso->setAxisTitle("Isolation", 1);
0555   ugmtMuonBXvshwIso->setAxisTitle("BX", 2);
0556 
0557   // muon correlations
0558   ibooker.setCurrentFolder(monitorDir_ + "/muon_correlations");
0559 
0560   ugmtMuMuInvMass = ibooker.book1D("ugmtMuMuInvMass", "uGMT dimuon invariant mass", 200, 0., 200.);
0561   ugmtMuMuInvMass->setAxisTitle("m(#mu#mu) [GeV]", 1);
0562 
0563   ugmtMuMuInvMassAtVtx =
0564       ibooker.book1D("ugmtMuMuInvMassAtVtx", "uGMT dimuon invariant mass with coordinates at vertex", 200, 0., 200.);
0565   ugmtMuMuInvMassAtVtx->setAxisTitle("m(#mu#mu) [GeV]", 1);
0566 
0567   ugmtMuMuDEta = ibooker.book1D("ugmtMuMuDEta", "uGMT output muons #Delta#eta", 100, -1., 1.);
0568   ugmtMuMuDEta->setAxisTitle("#Delta#eta", 1);
0569 
0570   ugmtMuMuDPhi = ibooker.book1D("ugmtMuMuDPhi", "uGMT output muons #Delta#phi", 100, -1., 1.);
0571   ugmtMuMuDPhi->setAxisTitle("#Delta#phi", 1);
0572 
0573   ugmtMuMuDR = ibooker.book1D("ugmtMuMuDR", "uGMT output muons #DeltaR", 50, 0., 1.);
0574   ugmtMuMuDR->setAxisTitle("#DeltaR", 1);
0575 
0576   // barrel - overlap
0577   ugmtMuMuDEtaBOpos =
0578       ibooker.book1D("ugmtMuMuDEtaBOpos", "uGMT output muons #Delta#eta barrel-overlap positive side", 100, -1., 1.);
0579   ugmtMuMuDEtaBOpos->setAxisTitle("#Delta#eta", 1);
0580 
0581   ugmtMuMuDPhiBOpos =
0582       ibooker.book1D("ugmtMuMuDPhiBOpos", "uGMT output muons #Delta#phi barrel-overlap positive side", 100, -1., 1.);
0583   ugmtMuMuDPhiBOpos->setAxisTitle("#Delta#phi", 1);
0584 
0585   ugmtMuMuDRBOpos =
0586       ibooker.book1D("ugmtMuMuDRBOpos", "uGMT output muons #DeltaR barrel-overlap positive side", 50, 0., 1.);
0587   ugmtMuMuDRBOpos->setAxisTitle("#DeltaR", 1);
0588 
0589   ugmtMuMuDEtaBOneg =
0590       ibooker.book1D("ugmtMuMuDEtaBOneg", "uGMT output muons #Delta#eta barrel-overlap negative side", 100, -1., 1.);
0591   ugmtMuMuDEtaBOneg->setAxisTitle("#Delta#eta", 1);
0592 
0593   ugmtMuMuDPhiBOneg =
0594       ibooker.book1D("ugmtMuMuDPhiBOneg", "uGMT output muons #Delta#phi barrel-overlap negative side", 100, -1., 1.);
0595   ugmtMuMuDPhiBOneg->setAxisTitle("#Delta#phi", 1);
0596 
0597   ugmtMuMuDRBOneg =
0598       ibooker.book1D("ugmtMuMuDRBOneg", "uGMT output muons #DeltaR barrel-overlap negative side", 50, 0., 1.);
0599   ugmtMuMuDRBOneg->setAxisTitle("#DeltaR", 1);
0600 
0601   // endcap - overlap
0602   ugmtMuMuDEtaEOpos =
0603       ibooker.book1D("ugmtMuMuDEtaEOpos", "uGMT output muons #Delta#eta endcap-overlap positive side", 100, -1., 1.);
0604   ugmtMuMuDEtaEOpos->setAxisTitle("#Delta#eta", 1);
0605 
0606   ugmtMuMuDPhiEOpos =
0607       ibooker.book1D("ugmtMuMuDPhiEOpos", "uGMT output muons #Delta#phi endcap-overlap positive side", 100, -1., 1.);
0608   ugmtMuMuDPhiEOpos->setAxisTitle("#Delta#phi", 1);
0609 
0610   ugmtMuMuDREOpos =
0611       ibooker.book1D("ugmtMuMuDREOpos", "uGMT output muons #DeltaR endcap-overlap positive side", 50, 0., 1.);
0612   ugmtMuMuDREOpos->setAxisTitle("#DeltaR", 1);
0613 
0614   ugmtMuMuDEtaEOneg =
0615       ibooker.book1D("ugmtMuMuDEtaEOneg", "uGMT output muons #Delta#eta endcap-overlap negative side", 100, -1., 1.);
0616   ugmtMuMuDEtaEOneg->setAxisTitle("#Delta#eta", 1);
0617 
0618   ugmtMuMuDPhiEOneg =
0619       ibooker.book1D("ugmtMuMuDPhiEOneg", "uGMT output muons #Delta#phi endcap-overlap negative side", 100, -1., 1.);
0620   ugmtMuMuDPhiEOneg->setAxisTitle("#Delta#phi", 1);
0621 
0622   ugmtMuMuDREOneg =
0623       ibooker.book1D("ugmtMuMuDREOneg", "uGMT output muons #DeltaR endcap-overlap negative side", 50, 0., 1.);
0624   ugmtMuMuDREOneg->setAxisTitle("#DeltaR", 1);
0625 
0626   // barrel wedges
0627   ugmtMuMuDEtaB = ibooker.book1D("ugmtMuMuDEtaB", "uGMT output muons #Delta#eta between barrel wedges", 100, -1., 1.);
0628   ugmtMuMuDEtaB->setAxisTitle("#Delta#eta", 1);
0629 
0630   ugmtMuMuDPhiB = ibooker.book1D("ugmtMuMuDPhiB", "uGMT output muons #Delta#phi between barrel wedges", 100, -1., 1.);
0631   ugmtMuMuDPhiB->setAxisTitle("#Delta#phi", 1);
0632 
0633   ugmtMuMuDRB = ibooker.book1D("ugmtMuMuDRB", "uGMT output muons #DeltaR between barrel wedges", 50, 0., 1.);
0634   ugmtMuMuDRB->setAxisTitle("#DeltaR", 1);
0635 
0636   // overlap sectors
0637   ugmtMuMuDEtaOpos = ibooker.book1D(
0638       "ugmtMuMuDEtaOpos", "uGMT output muons #Delta#eta between overlap positive side sectors", 100, -1., 1.);
0639   ugmtMuMuDEtaOpos->setAxisTitle("#Delta#eta", 1);
0640 
0641   ugmtMuMuDPhiOpos = ibooker.book1D(
0642       "ugmtMuMuDPhiOpos", "uGMT output muons #Delta#phi between overlap positive side sectors", 100, -1., 1.);
0643   ugmtMuMuDPhiOpos->setAxisTitle("#Delta#phi", 1);
0644 
0645   ugmtMuMuDROpos =
0646       ibooker.book1D("ugmtMuMuDROpos", "uGMT output muons #DeltaR between overlap positive side sectors", 50, 0., 1.);
0647   ugmtMuMuDROpos->setAxisTitle("#DeltaR", 1);
0648 
0649   ugmtMuMuDEtaOneg = ibooker.book1D(
0650       "ugmtMuMuDEtaOneg", "uGMT output muons #Delta#eta between overlap negative side sectors", 100, -1., 1.);
0651   ugmtMuMuDEtaOneg->setAxisTitle("#Delta#eta", 1);
0652 
0653   ugmtMuMuDPhiOneg = ibooker.book1D(
0654       "ugmtMuMuDPhiOneg", "uGMT output muons #Delta#phi between overlap negative side sectors", 100, -1., 1.);
0655   ugmtMuMuDPhiOneg->setAxisTitle("#Delta#phi", 1);
0656 
0657   ugmtMuMuDROneg =
0658       ibooker.book1D("ugmtMuMuDROneg", "uGMT output muons #DeltaR between overlap negative side sectors", 50, 0., 1.);
0659   ugmtMuMuDROneg->setAxisTitle("#DeltaR", 1);
0660 
0661   // endcap sectors
0662   ugmtMuMuDEtaEpos = ibooker.book1D(
0663       "ugmtMuMuDEtaEpos", "uGMT output muons #Delta#eta between endcap positive side sectors", 100, -1., 1.);
0664   ugmtMuMuDEtaEpos->setAxisTitle("#Delta#eta", 1);
0665 
0666   ugmtMuMuDPhiEpos = ibooker.book1D(
0667       "ugmtMuMuDPhiEpos", "uGMT output muons #Delta#phi between endcap positive side sectors", 100, -1., 1.);
0668   ugmtMuMuDPhiEpos->setAxisTitle("#Delta#phi", 1);
0669 
0670   ugmtMuMuDREpos =
0671       ibooker.book1D("ugmtMuMuDREpos", "uGMT output muons #DeltaR between endcap positive side sectors", 50, 0., 1.);
0672   ugmtMuMuDREpos->setAxisTitle("#DeltaR", 1);
0673 
0674   ugmtMuMuDEtaEneg = ibooker.book1D(
0675       "ugmtMuMuDEtaEneg", "uGMT output muons #Delta#eta between endcap negative side sectors", 100, -1., 1.);
0676   ugmtMuMuDEtaEneg->setAxisTitle("#Delta#eta", 1);
0677 
0678   ugmtMuMuDPhiEneg = ibooker.book1D(
0679       "ugmtMuMuDPhiEneg", "uGMT output muons #Delta#phi between endcap negative side sectors", 100, -1., 1.);
0680   ugmtMuMuDPhiEneg->setAxisTitle("#Delta#phi", 1);
0681 
0682   ugmtMuMuDREneg =
0683       ibooker.book1D("ugmtMuMuDREneg", "uGMT output muons #DeltaR between endcap negative side sectors", 50, 0., 1.);
0684   ugmtMuMuDREneg->setAxisTitle("#DeltaR", 1);
0685 }
0686 
0687 void L1TStage2uGMT::analyze(const edm::Event& e, const edm::EventSetup& c) {
0688   if (verbose_)
0689     edm::LogInfo("L1TStage2uGMT") << "L1TStage2uGMT: analyze..." << std::endl;
0690 
0691   if (!emul_) {
0692     edm::Handle<l1t::RegionalMuonCandBxCollection> BMTFBxCollection;
0693     e.getByToken(ugmtBMTFToken_, BMTFBxCollection);
0694 
0695     ugmtBMTFnMuons->Fill(BMTFBxCollection->size(0));
0696 
0697     for (int itBX = BMTFBxCollection->getFirstBX(); itBX <= BMTFBxCollection->getLastBX(); ++itBX) {
0698       for (l1t::RegionalMuonCandBxCollection::const_iterator BMTF = BMTFBxCollection->begin(itBX);
0699            BMTF != BMTFBxCollection->end(itBX);
0700            ++BMTF) {
0701         ugmtBMTFhwPt->Fill(BMTF->hwPt());
0702         if (displacedQuantities_) {
0703           ugmtBMTFhwPtUnconstrained->Fill(BMTF->hwPtUnconstrained());
0704           ugmtBMTFhwDXY->Fill(BMTF->hwDXY());
0705         }
0706         ugmtBMTFhwEta->Fill(BMTF->hwEta());
0707         ugmtBMTFhwPhi->Fill(BMTF->hwPhi());
0708         ugmtBMTFhwSign->Fill(BMTF->hwSign());
0709         ugmtBMTFhwSignValid->Fill(BMTF->hwSignValid());
0710         ugmtBMTFhwQual->Fill(BMTF->hwQual());
0711         ugmtBMTFlink->Fill(BMTF->link());
0712 
0713         int global_hw_phi =
0714             l1t::MicroGMTConfiguration::calcGlobalPhi(BMTF->hwPhi(), BMTF->trackFinderType(), BMTF->processor());
0715         ugmtBMTFglbPhi->Fill(global_hw_phi);
0716 
0717         ugmtBMTFProcvshwPhi->Fill(BMTF->hwPhi(), BMTF->processor());
0718 
0719         // Analyse muon correlations
0720         for (l1t::RegionalMuonCandBxCollection::const_iterator BMTF2 = BMTF + 1; BMTF2 != BMTFBxCollection->end(itBX);
0721              ++BMTF2) {
0722           int global_hw_phi2 =
0723               l1t::MicroGMTConfiguration::calcGlobalPhi(BMTF2->hwPhi(), BMTF2->trackFinderType(), BMTF2->processor());
0724           float dEta = (BMTF->hwEta() - BMTF2->hwEta()) * etaScale_;
0725           float dPhi = (global_hw_phi - global_hw_phi2) * phiScale_;
0726           float dR = sqrt(dEta * dEta + dPhi * dPhi);
0727 
0728           int dLink = std::abs(BMTF->link() - BMTF2->link());
0729           if (dLink == 1 || dLink == 11) {  // two adjacent wedges and wrap around
0730             ugmtBMTFMuMuDEta->Fill(dEta);
0731             ugmtBMTFMuMuDPhi->Fill(dPhi);
0732             ugmtBMTFMuMuDR->Fill(dR);
0733           }
0734         }
0735       }
0736     }
0737 
0738     edm::Handle<l1t::RegionalMuonCandBxCollection> OMTFBxCollection;
0739     e.getByToken(ugmtOMTFToken_, OMTFBxCollection);
0740 
0741     ugmtOMTFnMuons->Fill(OMTFBxCollection->size(0));
0742 
0743     for (int itBX = OMTFBxCollection->getFirstBX(); itBX <= OMTFBxCollection->getLastBX(); ++itBX) {
0744       for (l1t::RegionalMuonCandBxCollection::const_iterator OMTF = OMTFBxCollection->begin(itBX);
0745            OMTF != OMTFBxCollection->end(itBX);
0746            ++OMTF) {
0747         ugmtOMTFhwPt->Fill(OMTF->hwPt());
0748         ugmtOMTFhwEta->Fill(OMTF->hwEta());
0749         ugmtOMTFhwSign->Fill(OMTF->hwSign());
0750         ugmtOMTFhwSignValid->Fill(OMTF->hwSignValid());
0751         ugmtOMTFhwQual->Fill(OMTF->hwQual());
0752         ugmtOMTFlink->Fill(OMTF->link());
0753 
0754         int global_hw_phi =
0755             l1t::MicroGMTConfiguration::calcGlobalPhi(OMTF->hwPhi(), OMTF->trackFinderType(), OMTF->processor());
0756 
0757         l1t::tftype trackFinderType = OMTF->trackFinderType();
0758 
0759         if (trackFinderType == l1t::omtf_neg) {
0760           ugmtOMTFhwPhiNeg->Fill(OMTF->hwPhi());
0761           ugmtOMTFglbPhiNeg->Fill(global_hw_phi);
0762           ugmtOMTFProcvshwPhiNeg->Fill(OMTF->hwPhi(), OMTF->processor());
0763         } else {
0764           ugmtOMTFhwPhiPos->Fill(OMTF->hwPhi());
0765           ugmtOMTFglbPhiPos->Fill(global_hw_phi);
0766           ugmtOMTFProcvshwPhiPos->Fill(OMTF->hwPhi(), OMTF->processor());
0767         }
0768 
0769         // Analyse muon correlations
0770         for (l1t::RegionalMuonCandBxCollection::const_iterator OMTF2 = OMTF + 1; OMTF2 != OMTFBxCollection->end(itBX);
0771              ++OMTF2) {
0772           int global_hw_phi2 =
0773               l1t::MicroGMTConfiguration::calcGlobalPhi(OMTF2->hwPhi(), OMTF2->trackFinderType(), OMTF2->processor());
0774           float dEta = (OMTF->hwEta() - OMTF2->hwEta()) * etaScale_;
0775           float dPhi = (global_hw_phi - global_hw_phi2) * phiScale_;
0776           float dR = sqrt(dEta * dEta + dPhi * dPhi);
0777 
0778           int dLink = std::abs(OMTF->link() - OMTF2->link());
0779           if (dLink == 1 || dLink == 5) {  // two adjacent sectors and wrap around
0780             ugmtOMTFMuMuDEta->Fill(dEta);
0781             ugmtOMTFMuMuDPhi->Fill(dPhi);
0782             ugmtOMTFMuMuDR->Fill(dR);
0783           }
0784         }
0785       }
0786     }
0787 
0788     edm::Handle<l1t::RegionalMuonCandBxCollection> EMTFBxCollection;
0789     e.getByToken(ugmtEMTFToken_, EMTFBxCollection);
0790 
0791     ugmtEMTFnMuons->Fill(EMTFBxCollection->size(0));
0792 
0793     for (int itBX = EMTFBxCollection->getFirstBX(); itBX <= EMTFBxCollection->getLastBX(); ++itBX) {
0794       for (l1t::RegionalMuonCandBxCollection::const_iterator EMTF = EMTFBxCollection->begin(itBX);
0795            EMTF != EMTFBxCollection->end(itBX);
0796            ++EMTF) {
0797         ugmtEMTFhwPt->Fill(EMTF->hwPt());
0798         if (displacedQuantities_) {
0799           ugmtEMTFhwPtUnconstrained->Fill(EMTF->hwPtUnconstrained());
0800           ugmtEMTFhwDXY->Fill(EMTF->hwDXY());
0801         }
0802         ugmtEMTFhwEta->Fill(EMTF->hwEta());
0803         ugmtEMTFhwSign->Fill(EMTF->hwSign());
0804         ugmtEMTFhwSignValid->Fill(EMTF->hwSignValid());
0805         ugmtEMTFhwQual->Fill(EMTF->hwQual());
0806         ugmtEMTFlink->Fill(EMTF->link());
0807 
0808         int global_hw_phi =
0809             l1t::MicroGMTConfiguration::calcGlobalPhi(EMTF->hwPhi(), EMTF->trackFinderType(), EMTF->processor());
0810 
0811         l1t::tftype trackFinderType = EMTF->trackFinderType();
0812 
0813         if (trackFinderType == l1t::emtf_neg) {
0814           ugmtEMTFhwPhiNeg->Fill(EMTF->hwPhi());
0815           ugmtEMTFglbPhiNeg->Fill(global_hw_phi);
0816           ugmtEMTFProcvshwPhiNeg->Fill(EMTF->hwPhi(), EMTF->processor());
0817         } else {
0818           ugmtEMTFhwPhiPos->Fill(EMTF->hwPhi());
0819           ugmtEMTFglbPhiPos->Fill(global_hw_phi);
0820           ugmtEMTFProcvshwPhiPos->Fill(EMTF->hwPhi(), EMTF->processor());
0821         }
0822 
0823         // Analyse muon correlations
0824         for (l1t::RegionalMuonCandBxCollection::const_iterator EMTF2 = EMTF + 1; EMTF2 != EMTFBxCollection->end(itBX);
0825              ++EMTF2) {
0826           int global_hw_phi2 =
0827               l1t::MicroGMTConfiguration::calcGlobalPhi(EMTF2->hwPhi(), EMTF2->trackFinderType(), EMTF2->processor());
0828           float dEta = (EMTF->hwEta() - EMTF2->hwEta()) * etaScale_;
0829           float dPhi = (global_hw_phi - global_hw_phi2) * phiScale_;
0830           float dR = sqrt(dEta * dEta + dPhi * dPhi);
0831 
0832           int dLink = std::abs(EMTF->link() - EMTF2->link());
0833           if (dLink == 1 || dLink == 5) {  // two adjacent sectors and wrap around
0834             ugmtEMTFMuMuDEta->Fill(dEta);
0835             ugmtEMTFMuMuDPhi->Fill(dPhi);
0836             ugmtEMTFMuMuDR->Fill(dR);
0837           }
0838         }
0839       }
0840     }
0841 
0842     // Fill shower plots
0843     if (hadronicShowers_) {
0844       edm::Handle<l1t::RegionalMuonShowerBxCollection> EMTFShowersBxCollection;
0845       e.getByToken(ugmtEMTFShowerToken_, EMTFShowersBxCollection);
0846 
0847       for (int itBX = EMTFShowersBxCollection->getFirstBX(); itBX <= EMTFShowersBxCollection->getLastBX(); ++itBX) {
0848         for (l1t::RegionalMuonShowerBxCollection::const_iterator shower = EMTFShowersBxCollection->begin(itBX);
0849              shower != EMTFShowersBxCollection->end(itBX);
0850              ++shower) {
0851           if (not shower->isValid()) {
0852             continue;
0853           }
0854           if (shower->isOneNominalInTime()) {
0855             ugmtEMTFShowerTypeOccupancyPerSector->Fill(
0856                 shower->processor() + 1 + (shower->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0),
0857                 IDX_NOMINAL_SHOWER);
0858           }
0859           if (shower->isOneTightInTime()) {
0860             ugmtEMTFShowerTypeOccupancyPerSector->Fill(
0861                 shower->processor() + 1 + (shower->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0),
0862                 IDX_TIGHT_SHOWER);
0863           }
0864           if (shower->isOneLooseInTime()) {
0865             ugmtEMTFShowerTypeOccupancyPerSector->Fill(
0866                 shower->processor() + 1 + (shower->trackFinderType() == l1t::tftype::emtf_pos ? 6 : 0),
0867                 IDX_LOOSE_SHOWER);
0868           }
0869         }
0870       }
0871     }
0872 
0873     // barrel-overlap muon correlations
0874     int firstBxBO = (BMTFBxCollection->getFirstBX() < OMTFBxCollection->getFirstBX()) ? OMTFBxCollection->getFirstBX()
0875                                                                                       : BMTFBxCollection->getFirstBX();
0876     int lastBxBO = (BMTFBxCollection->getLastBX() > OMTFBxCollection->getLastBX()) ? OMTFBxCollection->getLastBX()
0877                                                                                    : BMTFBxCollection->getLastBX();
0878     for (int itBX = firstBxBO; itBX <= lastBxBO; ++itBX) {
0879       if (BMTFBxCollection->size(itBX) < 1 || OMTFBxCollection->size(itBX) < 1) {
0880         continue;
0881       }
0882       for (l1t::RegionalMuonCandBxCollection::const_iterator BMTF = BMTFBxCollection->begin(itBX);
0883            BMTF != BMTFBxCollection->end(itBX);
0884            ++BMTF) {
0885         int global_hw_phi_bmtf =
0886             l1t::MicroGMTConfiguration::calcGlobalPhi(BMTF->hwPhi(), BMTF->trackFinderType(), BMTF->processor());
0887 
0888         for (l1t::RegionalMuonCandBxCollection::const_iterator OMTF = OMTFBxCollection->begin(itBX);
0889              OMTF != OMTFBxCollection->end(itBX);
0890              ++OMTF) {
0891           int global_hw_phi_omtf =
0892               l1t::MicroGMTConfiguration::calcGlobalPhi(OMTF->hwPhi(), OMTF->trackFinderType(), OMTF->processor());
0893           float dEta = (BMTF->hwEta() - OMTF->hwEta()) * etaScale_;
0894           float dPhi = (global_hw_phi_bmtf - global_hw_phi_omtf) * phiScale_;
0895           float dR = sqrt(dEta * dEta + dPhi * dPhi);
0896           if (OMTF->trackFinderType() == l1t::omtf_neg) {
0897             ugmtBOMTFnegMuMuDEta->Fill(dEta);
0898             ugmtBOMTFnegMuMuDPhi->Fill(dPhi);
0899             ugmtBOMTFnegMuMuDR->Fill(dR);
0900           } else {
0901             ugmtBOMTFposMuMuDEta->Fill(dEta);
0902             ugmtBOMTFposMuMuDPhi->Fill(dPhi);
0903             ugmtBOMTFposMuMuDR->Fill(dR);
0904           }
0905         }
0906       }
0907     }
0908 
0909     // endcap-overlap muon correlations
0910     int firstBxEO = (EMTFBxCollection->getFirstBX() < OMTFBxCollection->getFirstBX()) ? OMTFBxCollection->getFirstBX()
0911                                                                                       : EMTFBxCollection->getFirstBX();
0912     int lastBxEO = (EMTFBxCollection->getLastBX() > OMTFBxCollection->getLastBX()) ? OMTFBxCollection->getLastBX()
0913                                                                                    : EMTFBxCollection->getLastBX();
0914     for (int itBX = firstBxEO; itBX <= lastBxEO; ++itBX) {
0915       if (EMTFBxCollection->size(itBX) < 1 || OMTFBxCollection->size(itBX) < 1) {
0916         continue;
0917       }
0918       for (l1t::RegionalMuonCandBxCollection::const_iterator EMTF = EMTFBxCollection->begin(itBX);
0919            EMTF != EMTFBxCollection->end(itBX);
0920            ++EMTF) {
0921         int global_hw_phi_emtf =
0922             l1t::MicroGMTConfiguration::calcGlobalPhi(EMTF->hwPhi(), EMTF->trackFinderType(), EMTF->processor());
0923 
0924         for (l1t::RegionalMuonCandBxCollection::const_iterator OMTF = OMTFBxCollection->begin(itBX);
0925              OMTF != OMTFBxCollection->end(itBX);
0926              ++OMTF) {
0927           int global_hw_phi_omtf =
0928               l1t::MicroGMTConfiguration::calcGlobalPhi(OMTF->hwPhi(), OMTF->trackFinderType(), OMTF->processor());
0929           float dEta = (EMTF->hwEta() - OMTF->hwEta()) * etaScale_;
0930           float dPhi = (global_hw_phi_emtf - global_hw_phi_omtf) * phiScale_;
0931           float dR = sqrt(dEta * dEta + dPhi * dPhi);
0932           if (EMTF->trackFinderType() == l1t::emtf_neg && OMTF->trackFinderType() == l1t::omtf_neg) {
0933             ugmtEOMTFnegMuMuDEta->Fill(dEta);
0934             ugmtEOMTFnegMuMuDPhi->Fill(dPhi);
0935             ugmtEOMTFnegMuMuDR->Fill(dR);
0936           } else if (EMTF->trackFinderType() == l1t::emtf_pos && OMTF->trackFinderType() == l1t::omtf_pos) {
0937             ugmtEOMTFposMuMuDEta->Fill(dEta);
0938             ugmtEOMTFposMuMuDPhi->Fill(dPhi);
0939             ugmtEOMTFposMuMuDR->Fill(dR);
0940           }
0941         }
0942       }
0943     }
0944   }
0945 
0946   edm::Handle<l1t::MuonBxCollection> MuonBxCollection;
0947   e.getByToken(ugmtMuonToken_, MuonBxCollection);
0948 
0949   ugmtnMuons->Fill(MuonBxCollection->size(0));
0950 
0951   for (int itBX = MuonBxCollection->getFirstBX(); itBX <= MuonBxCollection->getLastBX(); ++itBX) {
0952     for (l1t::MuonBxCollection::const_iterator Muon = MuonBxCollection->begin(itBX);
0953          Muon != MuonBxCollection->end(itBX);
0954          ++Muon) {
0955       int tfMuonIndex = Muon->tfMuonIndex();
0956 
0957       ugmtMuonBX->Fill(itBX);
0958       ugmtMuonIndex->Fill(tfMuonIndex);
0959       ugmtMuonhwPt->Fill(Muon->hwPt());
0960       if (displacedQuantities_) {
0961         ugmtMuonhwPtUnconstrained->Fill(Muon->hwPtUnconstrained());
0962         ugmtMuonhwDXY->Fill(Muon->hwDXY());
0963       }
0964       ugmtMuonhwEta->Fill(Muon->hwEta());
0965       ugmtMuonhwPhi->Fill(Muon->hwPhi());
0966       ugmtMuonhwEtaAtVtx->Fill(Muon->hwEtaAtVtx());
0967       ugmtMuonhwPhiAtVtx->Fill(Muon->hwPhiAtVtx());
0968       ugmtMuonhwCharge->Fill(Muon->hwCharge());
0969       ugmtMuonhwChargeValid->Fill(Muon->hwChargeValid());
0970       ugmtMuonhwQual->Fill(Muon->hwQual());
0971       ugmtMuonhwIso->Fill(Muon->hwIso());
0972 
0973       ugmtMuonPt->Fill(Muon->pt());
0974       if (displacedQuantities_) {
0975         ugmtMuonPtUnconstrained->Fill(Muon->ptUnconstrained());
0976       }
0977       ugmtMuonEta->Fill(Muon->eta());
0978       ugmtMuonPhi->Fill(Muon->phi());
0979       ugmtMuonEtaAtVtx->Fill(Muon->etaAtVtx());
0980       ugmtMuonPhiAtVtx->Fill(Muon->phiAtVtx());
0981       ugmtMuonCharge->Fill(Muon->charge());
0982 
0983       l1t::tftype tfType{getTfOrigin(tfMuonIndex)};
0984       if (tfType == l1t::emtf_pos || tfType == l1t::emtf_neg) {
0985         ugmtMuonPhiEmtf->Fill(Muon->phi());
0986         ugmtMuonDEtavsPtEmtf->Fill(Muon->pt(), Muon->hwDEtaExtra() * etaScale_);
0987         ugmtMuonDPhivsPtEmtf->Fill(Muon->pt(), Muon->hwDPhiExtra() * phiScale_);
0988       } else if (tfType == l1t::omtf_pos || tfType == l1t::omtf_neg) {
0989         ugmtMuonPhiOmtf->Fill(Muon->phi());
0990         ugmtMuonDEtavsPtOmtf->Fill(Muon->pt(), Muon->hwDEtaExtra() * etaScale_);
0991         ugmtMuonDPhivsPtOmtf->Fill(Muon->pt(), Muon->hwDPhiExtra() * phiScale_);
0992       } else if (tfType == l1t::bmtf) {
0993         ugmtMuonPhiBmtf->Fill(Muon->phi());
0994         ugmtMuonDEtavsPtBmtf->Fill(Muon->pt(), Muon->hwDEtaExtra() * etaScale_);
0995         ugmtMuonDPhivsPtBmtf->Fill(Muon->pt(), Muon->hwDPhiExtra() * phiScale_);
0996       }
0997 
0998       ugmtMuonPtvsEta->Fill(Muon->eta(), Muon->pt());
0999       ugmtMuonPtvsPhi->Fill(Muon->phi(), Muon->pt());
1000       ugmtMuonPhivsEta->Fill(Muon->eta(), Muon->phi());
1001 
1002       ugmtMuonPhiAtVtxvsEtaAtVtx->Fill(Muon->etaAtVtx(), Muon->phiAtVtx());
1003 
1004       ugmtMuonBXvsLink->Fill(int(Muon->tfMuonIndex() / 3.) + 36, itBX);
1005       ugmtMuonBXvshwPt->Fill(Muon->hwPt(), itBX);
1006       ugmtMuonBXvshwEta->Fill(Muon->hwEta(), itBX);
1007       ugmtMuonBXvshwPhi->Fill(Muon->hwPhi(), itBX);
1008       ugmtMuonBXvshwCharge->Fill(Muon->hwCharge(), itBX);
1009       ugmtMuonBXvshwChargeValid->Fill(Muon->hwChargeValid(), itBX);
1010       ugmtMuonBXvshwQual->Fill(Muon->hwQual(), itBX);
1011       ugmtMuonBXvshwIso->Fill(Muon->hwIso(), itBX);
1012       ugmtMuonChargevsLink->Fill(int(Muon->tfMuonIndex() / 3.) + 36, Muon->charge());
1013 
1014       int link = (int)std::floor(tfMuonIndex / 3.);
1015       reco::Candidate::PolarLorentzVector mu1{Muon->pt(), Muon->eta(), Muon->phi(), 0.106};
1016       reco::Candidate::PolarLorentzVector muAtVtx1{Muon->pt(), Muon->etaAtVtx(), Muon->phiAtVtx(), 0.106};
1017 
1018       // Analyse multi muon events
1019       for (l1t::MuonBxCollection::const_iterator Muon2 = Muon + 1; Muon2 != MuonBxCollection->end(itBX); ++Muon2) {
1020         reco::Candidate::PolarLorentzVector mu2{Muon2->pt(), Muon2->eta(), Muon2->phi(), 0.106};
1021         reco::Candidate::PolarLorentzVector muAtVtx2{Muon2->pt(), Muon2->etaAtVtx(), Muon2->phiAtVtx(), 0.106};
1022         ugmtMuMuInvMass->Fill((mu1 + mu2).M());
1023         ugmtMuMuInvMassAtVtx->Fill((muAtVtx1 + muAtVtx2).M());
1024 
1025         float dEta = Muon->eta() - Muon2->eta();
1026         float dPhi = Muon->phi() - Muon2->phi();
1027         float dR = sqrt(dEta * dEta + dPhi * dPhi);
1028         ugmtMuMuDEta->Fill(dEta);
1029         ugmtMuMuDPhi->Fill(dPhi);
1030         ugmtMuMuDR->Fill(dR);
1031 
1032         // muon distances between muons from different TFs and from different wedges/sectors of one TF
1033         int link2 = (int)std::floor(Muon2->tfMuonIndex() / 3.);
1034         l1t::tftype tfType2{getTfOrigin(Muon2->tfMuonIndex())};
1035         if ((tfType == l1t::bmtf && tfType2 == l1t::omtf_pos) || (tfType == l1t::omtf_pos && tfType2 == l1t::bmtf)) {
1036           ugmtMuMuDEtaBOpos->Fill(dEta);
1037           ugmtMuMuDPhiBOpos->Fill(dPhi);
1038           ugmtMuMuDRBOpos->Fill(dR);
1039         } else if ((tfType == l1t::bmtf && tfType2 == l1t::omtf_neg) ||
1040                    (tfType == l1t::omtf_neg && tfType2 == l1t::bmtf)) {
1041           ugmtMuMuDEtaBOneg->Fill(dEta);
1042           ugmtMuMuDPhiBOneg->Fill(dPhi);
1043           ugmtMuMuDRBOneg->Fill(dR);
1044         } else if ((tfType == l1t::emtf_pos && tfType2 == l1t::omtf_pos) ||
1045                    (tfType == l1t::omtf_pos && tfType2 == l1t::emtf_pos)) {
1046           ugmtMuMuDEtaEOpos->Fill(dEta);
1047           ugmtMuMuDPhiEOpos->Fill(dPhi);
1048           ugmtMuMuDREOpos->Fill(dR);
1049         } else if ((tfType == l1t::emtf_neg && tfType2 == l1t::omtf_neg) ||
1050                    (tfType == l1t::omtf_neg && tfType2 == l1t::emtf_neg)) {
1051           ugmtMuMuDEtaEOneg->Fill(dEta);
1052           ugmtMuMuDPhiEOneg->Fill(dPhi);
1053           ugmtMuMuDREOneg->Fill(dR);
1054         } else if (tfType == l1t::bmtf && tfType2 == l1t::bmtf) {
1055           if (std::abs(link - link2) == 1 || (std::abs(link - link2) == 11)) {  // two adjacent wedges and wrap around
1056             ugmtMuMuDEtaB->Fill(dEta);
1057             ugmtMuMuDPhiB->Fill(dPhi);
1058             ugmtMuMuDRB->Fill(dR);
1059           }
1060         } else if (tfType == l1t::omtf_pos && tfType2 == l1t::omtf_pos) {
1061           if (std::abs(link - link2) == 1 || (std::abs(link - link2) == 5)) {  // two adjacent sectors and wrap around
1062             ugmtMuMuDEtaOpos->Fill(dEta);
1063             ugmtMuMuDPhiOpos->Fill(dPhi);
1064             ugmtMuMuDROpos->Fill(dR);
1065           }
1066         } else if (tfType == l1t::omtf_neg && tfType2 == l1t::omtf_neg) {
1067           if (std::abs(link - link2) == 1 || (std::abs(link - link2) == 5)) {  // two adjacent sectors and wrap around
1068             ugmtMuMuDEtaOneg->Fill(dEta);
1069             ugmtMuMuDPhiOneg->Fill(dPhi);
1070             ugmtMuMuDROneg->Fill(dR);
1071           }
1072         } else if (tfType == l1t::emtf_pos && tfType2 == l1t::emtf_pos) {
1073           if (std::abs(link - link2) == 1 || (std::abs(link - link2) == 5)) {  // two adjacent sectors and wrap around
1074             ugmtMuMuDEtaEpos->Fill(dEta);
1075             ugmtMuMuDPhiEpos->Fill(dPhi);
1076             ugmtMuMuDREpos->Fill(dR);
1077           }
1078         } else if (tfType == l1t::emtf_neg && tfType2 == l1t::emtf_neg) {
1079           if (std::abs(link - link2) == 1 || (std::abs(link - link2) == 5)) {  // two adjacent sectors and wrap around
1080             ugmtMuMuDEtaEneg->Fill(dEta);
1081             ugmtMuMuDPhiEneg->Fill(dPhi);
1082             ugmtMuMuDREneg->Fill(dR);
1083           }
1084         }
1085       }
1086     }
1087   }
1088   // Fill shower plots
1089   if (hadronicShowers_) {
1090     edm::Handle<l1t::MuonShowerBxCollection> showersBxCollection;
1091     e.getByToken(ugmtMuonShowerToken_, showersBxCollection);
1092 
1093     for (int itBX = showersBxCollection->getFirstBX(); itBX <= showersBxCollection->getLastBX(); ++itBX) {
1094       for (l1t::MuonShowerBxCollection::const_iterator shower = showersBxCollection->begin(itBX);
1095            shower != showersBxCollection->end(itBX);
1096            ++shower) {
1097         if (not shower->isValid()) {
1098           continue;
1099         }
1100         if (shower->isOneNominalInTime()) {
1101           ugmtMuonShowerTypeOccupancyPerBx->Fill(itBX, IDX_NOMINAL_SHOWER);
1102         }
1103         if (shower->isOneTightInTime()) {
1104           ugmtMuonShowerTypeOccupancyPerBx->Fill(itBX, IDX_TIGHT_SHOWER);
1105         }
1106         if (shower->isTwoLooseDiffSectorsInTime()) {
1107           ugmtMuonShowerTypeOccupancyPerBx->Fill(itBX, IDX_LOOSE_SHOWER);
1108         }
1109       }
1110     }
1111   }
1112 }
1113 
1114 l1t::tftype L1TStage2uGMT::getTfOrigin(const int tfMuonIndex) {
1115   if (tfMuonIndex >= 0 && tfMuonIndex <= 17) {
1116     return l1t::emtf_pos;
1117   } else if (tfMuonIndex >= 90 && tfMuonIndex <= 107) {
1118     return l1t::emtf_neg;
1119   } else if (tfMuonIndex >= 18 && tfMuonIndex <= 35) {
1120     return l1t::omtf_pos;
1121   } else if (tfMuonIndex >= 72 && tfMuonIndex <= 89) {
1122     return l1t::omtf_neg;
1123   } else {
1124     return l1t::bmtf;
1125   }
1126 }