Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /*
0002  * \L1TStage2OMTF.cc
0003  * \author Esmaeel Eskandari Tadavani
0004  * \November 2015
0005 */
0006 
0007 #include "DQM/L1TMonitor/interface/L1TStage2OMTF.h"
0008 
0009 L1TStage2OMTF::L1TStage2OMTF(const edm::ParameterSet& ps)
0010     : monitorDir(ps.getUntrackedParameter<std::string>("monitorDir", "")),
0011       omtfSource(ps.getParameter<edm::InputTag>("omtfSource")),
0012       verbose(ps.getUntrackedParameter<bool>("verbose", false)),
0013       global_phi(-1000) {
0014   omtfToken = consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("omtfSource"));
0015 }
0016 
0017 L1TStage2OMTF::~L1TStage2OMTF() {}
0018 
0019 void L1TStage2OMTF::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& iRun, const edm::EventSetup& eveSetup) {
0020   ibooker.setCurrentFolder(monitorDir);
0021 
0022   omtf_hwEta = ibooker.book1D("omtf_hwEta", "HW #eta", 447, -223.5, 223.5);
0023   omtf_hwLocalPhi = ibooker.book1D("omtf_hwLocalPhi", "HW Local #phi", 201, -100.5, 100.5);
0024   omtf_hwPt = ibooker.book1D("omtf_hwPt", "HW p_{T}", 511, -0.5, 510.5);
0025   omtf_hwQual = ibooker.book1D("omtf_hwQual", "HW Quality", 20, -0.5, 19.5);
0026   omtf_bx = ibooker.book1D("omtf_bx", "BX", 5, -2.5, 2.5);
0027 
0028   omtf_hwEta_hwLocalPhi =
0029       ibooker.book2D("omtf_hwEta_hwLocalPhi", "HW #eta vs HW Local #phi", 447, -223.5, 223.5, 201, -100.5, 100.5);
0030   omtf_hwEta_hwLocalPhi->setTitle(";HW #eta; HW Local #phi");
0031 
0032   omtf_hwPt_hwEta = ibooker.book2D("omtf_hwPt_hwEta", "HW p_{T} vs HW #eta", 511, -0.5, 510.5, 447, -223.5, 223.5);
0033   omtf_hwPt_hwEta->setTitle(";HW p_{T}; HW #eta");
0034 
0035   omtf_hwPt_hwLocalPhi =
0036       ibooker.book2D("omtf_hwPt_hwLocalPhi", "HW p_{T} vs HW Local #phi", 511, -0.5, 510.5, 201, -100.5, 100.5);
0037   omtf_hwPt_hwLocalPhi->setTitle(";HW p_{T}; HW Local #phi");
0038 
0039   omtf_hwEta_bx = ibooker.book2D("omtf_hwEta_bx", "HW #eta vs BX", 447, -223.5, 223.5, 5, -2.5, 2.5);
0040   omtf_hwEta_bx->setTitle(";HW #eta; BX");
0041 
0042   omtf_hwLocalPhi_bx = ibooker.book2D("omtf_hwLocalPhi_bx", "HW Local #phi vs BX", 201, -100.5, 100.5, 5, -2.5, 2.5);
0043   omtf_hwLocalPhi_bx->setTitle(";HW Local #phi; BX");
0044 
0045   omtf_hwPt_bx = ibooker.book2D("omtf_hwPt_bx", "HW p_{T} vs BX", 511, -0.5, 510.5, 5, -2.5, 2.5);
0046   omtf_hwPt_bx->setTitle(";HW p_{T}; BX");
0047 
0048   omtf_hwQual_bx = ibooker.book2D("omtf_hwQual_bx", "HW Quality vs BX", 20, -0.5, 19.5, 5, -2.5, 2.5);
0049   omtf_hwQual_bx->setTitle("; HW Quality; BX");
0050 }
0051 
0052 void L1TStage2OMTF::analyze(const edm::Event& eve, const edm::EventSetup& eveSetup) {
0053   if (verbose) {
0054     edm::LogInfo("L1TStage2OMTF") << "L1TStage2OMTF: analyze...." << std::endl;
0055   }
0056 
0057   edm::Handle<l1t::RegionalMuonCandBxCollection> omtfMuon;
0058   eve.getByToken(omtfToken, omtfMuon);
0059 
0060   for (int itBX = omtfMuon->getFirstBX(); itBX <= omtfMuon->getLastBX(); ++itBX) {
0061     for (l1t::RegionalMuonCandBxCollection::const_iterator itMuon = omtfMuon->begin(itBX);
0062          itMuon != omtfMuon->end(itBX);
0063          ++itMuon) {
0064       omtf_hwEta->Fill(itMuon->hwEta());
0065       omtf_hwLocalPhi->Fill(itMuon->hwPhi());
0066       omtf_hwPt->Fill(itMuon->hwPt());
0067       omtf_hwQual->Fill(itMuon->hwQual());
0068 
0069       omtf_bx->Fill(itBX);
0070       omtf_hwEta_bx->Fill(itMuon->hwEta(), itBX);
0071       omtf_hwLocalPhi_bx->Fill(itMuon->hwPhi(), itBX);
0072       omtf_hwPt_bx->Fill(itMuon->hwPt(), itBX);
0073       omtf_hwQual_bx->Fill(itMuon->hwQual(), itBX);
0074 
0075       omtf_hwEta_hwLocalPhi->Fill(itMuon->hwEta(), itMuon->hwPhi());
0076       omtf_hwPt_hwEta->Fill(itMuon->hwPt(), itMuon->hwEta());
0077       omtf_hwPt_hwLocalPhi->Fill(itMuon->hwPt(), itMuon->hwPhi());
0078     }
0079   }
0080 }