Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DQM/L1TMonitor/interface/L1TStage2uGMTMuon.h"
0002 
0003 L1TStage2uGMTMuon::L1TStage2uGMTMuon(const edm::ParameterSet& ps)
0004     : ugmtMuonToken(consumes<l1t::MuonBxCollection>(ps.getParameter<edm::InputTag>("muonProducer"))),
0005       monitorDir(ps.getUntrackedParameter<std::string>("monitorDir")),
0006       titlePrefix(ps.getUntrackedParameter<std::string>("titlePrefix")),
0007       verbose(ps.getUntrackedParameter<bool>("verbose")),
0008       makeMuonAtVtxPlots(ps.getUntrackedParameter<bool>("makeMuonAtVtxPlots")),
0009       displacedQuantities_(ps.getUntrackedParameter<bool>("displacedQuantities")) {}
0010 
0011 L1TStage2uGMTMuon::~L1TStage2uGMTMuon() {}
0012 
0013 void L1TStage2uGMTMuon::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0014   edm::ParameterSetDescription desc;
0015   desc.add<edm::InputTag>("muonProducer");
0016   desc.addUntracked<std::string>("monitorDir", "")
0017       ->setComment("Target directory in the DQM file. Will be created if not existing.");
0018   desc.addUntracked<std::string>("titlePrefix", "")->setComment("Prefix text for the histogram titles.");
0019   desc.addUntracked<bool>("verbose", false);
0020   desc.addUntracked<bool>("makeMuonAtVtxPlots", false);
0021   desc.addUntracked<bool>("displacedQuantities", false);
0022   descriptions.add("l1tStage2uGMTMuon", desc);
0023 }
0024 
0025 void L1TStage2uGMTMuon::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) {
0026   // Subsystem Monitoring and Muon Output
0027   ibooker.setCurrentFolder(monitorDir);
0028 
0029   ugmtMuonBX = ibooker.book1D("ugmtMuonBX", (titlePrefix + "BX").c_str(), 7, -3.5, 3.5);
0030   ugmtMuonBX->setAxisTitle("BX", 1);
0031 
0032   ugmtnMuons = ibooker.book1D("ugmtnMuons", (titlePrefix + "Multiplicity").c_str(), 9, -0.5, 8.5);
0033   ugmtnMuons->setAxisTitle("Muon Multiplicity (BX == 0)", 1);
0034 
0035   ugmtMuonhwPt = ibooker.book1D("ugmtMuonhwPt", (titlePrefix + "HW p_{T}").c_str(), 512, -0.5, 511.5);
0036   ugmtMuonhwPt->setAxisTitle("Hardware p_{T}", 1);
0037 
0038   if (displacedQuantities_) {
0039     ugmtMuonhwPtUnconstrained =
0040         ibooker.book1D("ugmtMuonhwPtUnconstrained", (titlePrefix + "HW p_{T} unconstrained").c_str(), 256, -0.5, 255.5);
0041     ugmtMuonhwPtUnconstrained->setAxisTitle("Hardware p_{T} unconstrained", 1);
0042 
0043     ugmtMuonhwDXY = ibooker.book1D("ugmtMuonhwDXY", (titlePrefix + "HW impact parameter").c_str(), 4, -0.5, 3.5);
0044     ugmtMuonhwDXY->setAxisTitle("Hardware dXY", 1);
0045   }
0046 
0047   ugmtMuonhwEta = ibooker.book1D("ugmtMuonhwEta", (titlePrefix + "HW #eta").c_str(), 461, -230.5, 230.5);
0048   ugmtMuonhwEta->setAxisTitle("Hardware Eta", 1);
0049 
0050   ugmtMuonhwPhi = ibooker.book1D("ugmtMuonhwPhi", (titlePrefix + "HW #phi").c_str(), 577, -1.5, 575.5);
0051   ugmtMuonhwPhi->setAxisTitle("Hardware Phi", 1);
0052 
0053   ugmtMuonhwCharge = ibooker.book1D("ugmtMuonhwCharge", (titlePrefix + "HW Charge").c_str(), 4, -1.5, 2.5);
0054   ugmtMuonhwCharge->setAxisTitle("Hardware Charge", 1);
0055 
0056   ugmtMuonhwChargeValid = ibooker.book1D("ugmtMuonhwChargeValid", (titlePrefix + "ChargeValid").c_str(), 2, -0.5, 1.5);
0057   ugmtMuonhwChargeValid->setAxisTitle("ChargeValid", 1);
0058 
0059   ugmtMuonhwQual = ibooker.book1D("ugmtMuonhwQual", (titlePrefix + "Quality").c_str(), 16, -0.5, 15.5);
0060   ugmtMuonhwQual->setAxisTitle("Quality", 1);
0061 
0062   ugmtMuonPt = ibooker.book1D("ugmtMuonPt", (titlePrefix + "p_{T}").c_str(), 128, -0.5, 255.5);
0063   ugmtMuonPt->setAxisTitle("p_{T} [GeV]", 1);
0064 
0065   if (displacedQuantities_) {
0066     ugmtMuonPtUnconstrained =
0067         ibooker.book1D("ugmtMuonPtUnconstrained", (titlePrefix + "p_{T} unconstrained").c_str(), 128, -0.5, 255.5);
0068     ugmtMuonPtUnconstrained->setAxisTitle("p_{T} unconstrained [GeV]", 1);
0069   }
0070 
0071   ugmtMuonEta = ibooker.book1D("ugmtMuonEta", (titlePrefix + "#eta").c_str(), 52, -2.6, 2.6);
0072   ugmtMuonEta->setAxisTitle("#eta", 1);
0073 
0074   ugmtMuonPhi = ibooker.book1D("ugmtMuonPhi", (titlePrefix + "#phi").c_str(), 66, -3.3, 3.3);
0075   ugmtMuonPhi->setAxisTitle("#phi", 1);
0076 
0077   ugmtMuonCharge = ibooker.book1D("ugmtMuonCharge", (titlePrefix + "Charge").c_str(), 3, -1.5, 1.5);
0078   ugmtMuonCharge->setAxisTitle("Charge", 1);
0079 
0080   ugmtMuonPtvsEta =
0081       ibooker.book2D("ugmtMuonPtvsEta", (titlePrefix + "p_{T} vs #eta").c_str(), 100, -2.5, 2.5, 128, -0.5, 255.5);
0082   ugmtMuonPtvsEta->setAxisTitle("#eta", 1);
0083   ugmtMuonPtvsEta->setAxisTitle("p_{T} [GeV]", 2);
0084 
0085   ugmtMuonPtvsPhi =
0086       ibooker.book2D("ugmtMuonPtvsPhi", (titlePrefix + "p_{T} vs #phi").c_str(), 64, -3.2, 3.2, 128, -0.5, 255.5);
0087   ugmtMuonPtvsPhi->setAxisTitle("#phi", 1);
0088   ugmtMuonPtvsPhi->setAxisTitle("p_{T} [GeV]", 2);
0089 
0090   ugmtMuonPhivsEta =
0091       ibooker.book2D("ugmtMuonPhivsEta", (titlePrefix + "#phi vs #eta").c_str(), 100, -2.5, 2.5, 64, -3.2, 3.2);
0092   ugmtMuonPhivsEta->setAxisTitle("#eta", 1);
0093   ugmtMuonPhivsEta->setAxisTitle("#phi", 2);
0094 
0095   ugmtMuonBXvshwPt =
0096       ibooker.book2D("ugmtMuonBXvshwPt", (titlePrefix + "BX vs HW p_{T}").c_str(), 128, -0.5, 511.5, 5, -2.5, 2.5);
0097   ugmtMuonBXvshwPt->setAxisTitle("Hardware p_{T}", 1);
0098   ugmtMuonBXvshwPt->setAxisTitle("BX", 2);
0099 
0100   ugmtMuonBXvshwEta =
0101       ibooker.book2D("ugmtMuonBXvshwEta", (titlePrefix + "BX vs HW #eta").c_str(), 93, -232.5, 232.5, 5, -2.5, 2.5);
0102   ugmtMuonBXvshwEta->setAxisTitle("Hardware #eta", 1);
0103   ugmtMuonBXvshwEta->setAxisTitle("BX", 2);
0104 
0105   ugmtMuonBXvshwPhi =
0106       ibooker.book2D("ugmtMuonBXvshwPhi", (titlePrefix + "BX vs HW #phi").c_str(), 116, -2.5, 577.5, 5, -2.5, 2.5);
0107   ugmtMuonBXvshwPhi->setAxisTitle("Hardware #phi", 1);
0108   ugmtMuonBXvshwPhi->setAxisTitle("BX", 2);
0109 
0110   ugmtMuonBXvshwCharge =
0111       ibooker.book2D("ugmtMuonBXvshwCharge", (titlePrefix + "BX vs HW Charge").c_str(), 2, -0.5, 1.5, 5, -2.5, 2.5);
0112   ugmtMuonBXvshwCharge->setAxisTitle("Hardware Charge", 1);
0113   ugmtMuonBXvshwCharge->setAxisTitle("BX", 2);
0114 
0115   ugmtMuonBXvshwChargeValid = ibooker.book2D(
0116       "ugmtMuonBXvshwChargeValid", (titlePrefix + "BX vs ChargeValid").c_str(), 2, -0.5, 1.5, 5, -2.5, 2.5);
0117   ugmtMuonBXvshwChargeValid->setAxisTitle("ChargeValid", 1);
0118   ugmtMuonBXvshwChargeValid->setAxisTitle("BX", 2);
0119 
0120   ugmtMuonBXvshwQual =
0121       ibooker.book2D("ugmtMuonBXvshwQual", (titlePrefix + "BX vs Quality").c_str(), 16, -0.5, 15.5, 5, -2.5, 2.5);
0122   ugmtMuonBXvshwQual->setAxisTitle("Quality", 1);
0123   ugmtMuonBXvshwQual->setAxisTitle("BX", 2);
0124 
0125   if (makeMuonAtVtxPlots) {
0126     ugmtMuonhwEtaAtVtx =
0127         ibooker.book1D("ugmtMuonhwEtaAtVtx", (titlePrefix + "HW #eta at vertex").c_str(), 461, -230.5, 230.5);
0128     ugmtMuonhwEtaAtVtx->setAxisTitle("Hardware Eta at Vertex", 1);
0129 
0130     ugmtMuonhwPhiAtVtx =
0131         ibooker.book1D("ugmtMuonhwPhiAtVtx", (titlePrefix + "HW #phi at vertex").c_str(), 577, -1.5, 575.5);
0132     ugmtMuonhwPhiAtVtx->setAxisTitle("Hardware Phi at Vertex", 1);
0133 
0134     ugmtMuonEtaAtVtx = ibooker.book1D("ugmtMuonEtaAtVtx", (titlePrefix + "#eta at vertex").c_str(), 52, -2.6, 2.6);
0135     ugmtMuonEtaAtVtx->setAxisTitle("#eta at Vertex", 1);
0136 
0137     ugmtMuonPhiAtVtx = ibooker.book1D("ugmtMuonPhiAtVtx", (titlePrefix + "#phi at vertex").c_str(), 66, -3.3, 3.3);
0138     ugmtMuonPhiAtVtx->setAxisTitle("#phi at Vertex", 1);
0139 
0140     ugmtMuonPtvsEtaAtVtx = ibooker.book2D(
0141         "ugmtMuonPtvsEtaAtVtx", (titlePrefix + "p_{T} vs #eta at vertex").c_str(), 100, -2.5, 2.5, 128, -0.5, 255.5);
0142     ugmtMuonPtvsEtaAtVtx->setAxisTitle("#eta at Vertex", 1);
0143     ugmtMuonPtvsEtaAtVtx->setAxisTitle("p_{T} [GeV]", 2);
0144 
0145     ugmtMuonPhiAtVtxvsEtaAtVtx = ibooker.book2D(
0146         "ugmtMuonPhiAtVtxvsEtaAtVtx", (titlePrefix + "#phi_{vtx} vs #eta_{vtx}").c_str(), 100, -2.5, 2.5, 64, -3.2, 3.2);
0147     ugmtMuonPhiAtVtxvsEtaAtVtx->setAxisTitle("#eta at Vertex", 1);
0148     ugmtMuonPhiAtVtxvsEtaAtVtx->setAxisTitle("#phi at Vertex", 2);
0149 
0150     ugmtMuonPtvsPhiAtVtx = ibooker.book2D(
0151         "ugmtMuonPtvsPhiAtVtx", (titlePrefix + "p_{T} vs #phi at vertex").c_str(), 64, -3.2, 3.2, 128, -0.5, 255.5);
0152     ugmtMuonPtvsPhiAtVtx->setAxisTitle("#phi at Vertex", 1);
0153     ugmtMuonPtvsPhiAtVtx->setAxisTitle("p_{T} [GeV]", 2);
0154 
0155     ugmtMuonBXvshwEtaAtVtx = ibooker.book2D(
0156         "ugmtMuonBXvshwEtaAtVtx", (titlePrefix + "BX vs HW #eta at vertex").c_str(), 93, -232.5, 232.5, 5, -2.5, 2.5);
0157     ugmtMuonBXvshwEtaAtVtx->setAxisTitle("Hardware #eta at Vertex", 1);
0158     ugmtMuonBXvshwEtaAtVtx->setAxisTitle("BX", 2);
0159 
0160     ugmtMuonBXvshwPhiAtVtx = ibooker.book2D(
0161         "ugmtMuonBXvshwPhiAtVtx", (titlePrefix + "BX vs HW #phi at vertex").c_str(), 116, -2.5, 577.5, 5, -2.5, 2.5);
0162     ugmtMuonBXvshwPhiAtVtx->setAxisTitle("Hardware #phi at Vertex", 1);
0163     ugmtMuonBXvshwPhiAtVtx->setAxisTitle("BX", 2);
0164   }
0165 }
0166 
0167 void L1TStage2uGMTMuon::analyze(const edm::Event& e, const edm::EventSetup& c) {
0168   if (verbose)
0169     edm::LogInfo("L1TStage2uGMTMuon") << "L1TStage2uGMTMuon: analyze..." << std::endl;
0170 
0171   edm::Handle<l1t::MuonBxCollection> MuonBxCollection;
0172   e.getByToken(ugmtMuonToken, MuonBxCollection);
0173 
0174   ugmtnMuons->Fill(MuonBxCollection->size(0));
0175 
0176   for (int itBX = MuonBxCollection->getFirstBX(); itBX <= MuonBxCollection->getLastBX(); ++itBX) {
0177     for (l1t::MuonBxCollection::const_iterator Muon = MuonBxCollection->begin(itBX);
0178          Muon != MuonBxCollection->end(itBX);
0179          ++Muon) {
0180       ugmtMuonBX->Fill(itBX);
0181       ugmtMuonhwPt->Fill(Muon->hwPt());
0182       if (displacedQuantities_) {
0183         ugmtMuonhwPtUnconstrained->Fill(Muon->hwPtUnconstrained());
0184         ugmtMuonhwDXY->Fill(Muon->hwDXY());
0185         ugmtMuonPtUnconstrained->Fill(Muon->ptUnconstrained());
0186       }
0187       ugmtMuonhwEta->Fill(Muon->hwEta());
0188       ugmtMuonhwPhi->Fill(Muon->hwPhi());
0189       ugmtMuonhwCharge->Fill(Muon->hwCharge());
0190       ugmtMuonhwChargeValid->Fill(Muon->hwChargeValid());
0191       ugmtMuonhwQual->Fill(Muon->hwQual());
0192 
0193       ugmtMuonPt->Fill(Muon->pt());
0194       ugmtMuonEta->Fill(Muon->eta());
0195       ugmtMuonPhi->Fill(Muon->phi());
0196       ugmtMuonCharge->Fill(Muon->charge());
0197 
0198       ugmtMuonPtvsEta->Fill(Muon->eta(), Muon->pt());
0199       ugmtMuonPtvsPhi->Fill(Muon->phi(), Muon->pt());
0200       ugmtMuonPhivsEta->Fill(Muon->eta(), Muon->phi());
0201 
0202       ugmtMuonBXvshwPt->Fill(Muon->hwPt(), itBX);
0203       ugmtMuonBXvshwEta->Fill(Muon->hwEta(), itBX);
0204       ugmtMuonBXvshwPhi->Fill(Muon->hwPhi(), itBX);
0205       ugmtMuonBXvshwCharge->Fill(Muon->hwCharge(), itBX);
0206       ugmtMuonBXvshwChargeValid->Fill(Muon->hwChargeValid(), itBX);
0207       ugmtMuonBXvshwQual->Fill(Muon->hwQual(), itBX);
0208 
0209       if (makeMuonAtVtxPlots) {
0210         ugmtMuonhwEtaAtVtx->Fill(Muon->hwEtaAtVtx());
0211         ugmtMuonhwPhiAtVtx->Fill(Muon->hwPhiAtVtx());
0212         ugmtMuonEtaAtVtx->Fill(Muon->etaAtVtx());
0213         ugmtMuonPhiAtVtx->Fill(Muon->phiAtVtx());
0214         ugmtMuonPtvsEtaAtVtx->Fill(Muon->etaAtVtx(), Muon->pt());
0215         ugmtMuonPtvsPhiAtVtx->Fill(Muon->phiAtVtx(), Muon->pt());
0216         ugmtMuonPhiAtVtxvsEtaAtVtx->Fill(Muon->etaAtVtx(), Muon->phiAtVtx());
0217         ugmtMuonBXvshwEtaAtVtx->Fill(Muon->hwEtaAtVtx(), itBX);
0218         ugmtMuonBXvshwPhiAtVtx->Fill(Muon->hwPhiAtVtx(), itBX);
0219       }
0220     }
0221   }
0222 }