Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /*
0002  * \file L1TCSCTPG.cc
0003  *
0004  * \author J. Berryhill
0005  *
0006  */
0007 
0008 #include "DQM/L1TMonitor/interface/L1TCSCTPG.h"
0009 
0010 using namespace std;
0011 using namespace edm;
0012 
0013 L1TCSCTPG::L1TCSCTPG(const ParameterSet& ps)
0014     : csctpgSource_(ps.getParameter<InputTag>("csctpgSource")),
0015       csctpgSource_token_(consumes<CSCCorrelatedLCTDigiCollection>(ps.getParameter<InputTag>("csctpgSource"))) {
0016   // verbosity switch
0017   verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
0018 
0019   if (verbose_)
0020     cout << "L1TCSCTPG: constructor...." << endl;
0021 
0022   outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
0023   if (!outputFile_.empty()) {
0024     cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
0025   }
0026 
0027   bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
0028   if (disable) {
0029     outputFile_ = "";
0030   }
0031 }
0032 
0033 L1TCSCTPG::~L1TCSCTPG() {}
0034 
0035 void L1TCSCTPG::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) {
0036   nev_ = 0;
0037   ibooker.setCurrentFolder("L1T/L1TCSCTPG");
0038 
0039   csctpgpattern = ibooker.book1D("CSC TPG hit pattern", "CSC TPG hit pattern", 8, -0.5, 7.5);
0040   csctpgquality = ibooker.book1D("CSC TPG quality", "CSC TPG quality", 16, 0.5, 16.5);
0041   csctpgwg = ibooker.book1D("CSC TPG wire group", "CSC TPG wire group", 116, -0.5, 115.5);
0042   csctpgstrip = ibooker.book1D("CSC TPG strip", "CSC TPG strip", 160, -0.5, 159.5);
0043   csctpgstriptype = ibooker.book1D("CSC TPG strip type", "CSC TPG strip type", 2, 0.5, 1.5);
0044   csctpgbend = ibooker.book1D("CSC TPG bend", "CSC TPG bend", 3, 0.5, 2.5);
0045   csctpgbx = ibooker.book1D("CSC TPG bx", "CSC TPG bx", 20, -0.5, 19.5);
0046 }
0047 
0048 void L1TCSCTPG::analyze(const Event& e, const EventSetup& c) {
0049   nev_++;
0050   if (verbose_)
0051     cout << "L1TCSCTPG: analyze...." << endl;
0052 
0053   Handle<CSCCorrelatedLCTDigiCollection> pCSCTPGcorrlcts;
0054   e.getByToken(csctpgSource_token_, pCSCTPGcorrlcts);
0055 
0056   if (!pCSCTPGcorrlcts.isValid()) {
0057     edm::LogInfo("DataNotFound") << "can't find CSCCorrelatedLCTDigiCollection with label " << csctpgSource_.label();
0058     return;
0059   }
0060 
0061   for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator cscItr1 = pCSCTPGcorrlcts->begin();
0062        cscItr1 != pCSCTPGcorrlcts->end();
0063        cscItr1++) {
0064     CSCCorrelatedLCTDigiCollection::Range range1 = pCSCTPGcorrlcts->get((*cscItr1).first);
0065     for (CSCCorrelatedLCTDigiCollection::const_iterator lctItr1 = range1.first; lctItr1 != range1.second; lctItr1++) {
0066       csctpgpattern->Fill(lctItr1->getCLCTPattern());
0067       if (verbose_) {
0068         std::cout << "CSC TPG CLCT pattern " << lctItr1->getCLCTPattern() << std::endl;
0069       }
0070 
0071       csctpgquality->Fill(lctItr1->getQuality());
0072       if (verbose_) {
0073         std::cout << "CSC LCT quality " << lctItr1->getQuality() << std::endl;
0074       }
0075 
0076       csctpgwg->Fill(lctItr1->getKeyWG());
0077       if (verbose_) {
0078         std::cout << "CSC LCT wire group " << lctItr1->getKeyWG() << std::endl;
0079       }
0080 
0081       csctpgstrip->Fill(lctItr1->getStrip());
0082       if (verbose_) {
0083         std::cout << "CSC LCT strip " << lctItr1->getStrip() << std::endl;
0084       }
0085 
0086       csctpgstriptype->Fill(lctItr1->getStripType());
0087       if (verbose_) {
0088         std::cout << "CSC LCT strip type" << lctItr1->getStripType() << std::endl;
0089       }
0090 
0091       csctpgbend->Fill(lctItr1->getBend());
0092       if (verbose_) {
0093         std::cout << "CSC LCT bend " << lctItr1->getBend() << std::endl;
0094       }
0095 
0096       csctpgbx->Fill(lctItr1->getBX());
0097       if (verbose_) {
0098         std::cout << "CSC LCT bx " << lctItr1->getBX() << std::endl;
0099       }
0100     }
0101   }
0102 }