Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:14

0001 #include "DQM/RPCMonitorDigi/interface/RPCMonitorLinkSynchro.h"
0002 #include "DQM/RPCMonitorDigi/interface/RPCLinkSynchroHistoMaker.h"
0003 
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/ESTransientHandle.h"
0007 
0008 #include "CondFormats/RPCObjects/interface/RPCReadOutMapping.h"
0009 
0010 #include <memory>
0011 
0012 RPCMonitorLinkSynchro::RPCMonitorLinkSynchro(const edm::ParameterSet& cfg)
0013     : theConfig(cfg),
0014       theSynchroStat(RPCLinkSynchroStat(theConfig.getUntrackedParameter<bool>("useFirstHitOnly", false)))
0015 
0016 {
0017   rpcRawSynchroProdItemTag_ =
0018       consumes<RPCRawSynchro::ProdItem>(cfg.getParameter<edm::InputTag>("rpcRawSynchroProdItemTag"));
0019   rpcEMapToken_ = esConsumes<edm::Transition::BeginRun>();
0020 }
0021 
0022 void RPCMonitorLinkSynchro::endLuminosityBlock(const edm::LuminosityBlock& ls, const edm::EventSetup& es) {
0023   RPCLinkSynchroHistoMaker hm(theSynchroStat);
0024   hm.fill(me_delaySummary->getTH1F(), me_delaySpread->getTH2F(), me_topOccup->getTH2F(), me_topSpread->getTH2F());
0025 }
0026 
0027 void RPCMonitorLinkSynchro::dqmBeginRun(const edm::Run& r, const edm::EventSetup& es) {
0028   if (theCablingWatcher.check(es)) {
0029     edm::ESTransientHandle<RPCEMap> readoutMapping = es.getTransientHandle(rpcEMapToken_);
0030     std::unique_ptr<RPCReadOutMapping const> cabling{readoutMapping->convert()};
0031     edm::LogInfo("RPCMonitorLinkSynchro")
0032         << "RPCMonitorLinkSynchro - record has CHANGED!!, read map, VERSION: " << cabling->version();
0033     theSynchroStat.init(cabling.get(), theConfig.getUntrackedParameter<bool>("dumpDelays"));
0034   }
0035 }
0036 
0037 void RPCMonitorLinkSynchro::bookHistograms(DQMStore::IBooker& ibooker,
0038                                            edm::Run const& iRun,
0039                                            edm::EventSetup const& es) {
0040   ibooker.cd();
0041   ibooker.setCurrentFolder("RPC/LinkMonitor/");
0042 
0043   me_delaySummary = ibooker.book1D("delaySummary", "LinkDelaySummary", 8, -3.5, 4.5);
0044   me_delaySummary->getTH1F()->SetStats(true);
0045 
0046   me_delaySpread = ibooker.book2D("delaySpread", "LinkDelaySpread", 71, -3.05, 4.05, 31, -0.05, 3.05);
0047   me_delaySpread->getTH2F()->SetStats(false);
0048 
0049   me_notComplete[0] = ibooker.book2D("notComplete790", "FED790: not All Paths hit", 36, -0.5, 35.5, 18, -0.5, 17.5);
0050   me_notComplete[1] = ibooker.book2D("notComplete791", "FED791: not All Paths hit", 36, -0.5, 35.5, 18, -0.5, 17.5);
0051   me_notComplete[2] = ibooker.book2D("notComplete792", "FED792: not All Paths hit", 36, -0.5, 35.5, 18, -0.5, 17.5);
0052   for (unsigned int i = 0; i < 3; ++i) {
0053     me_notComplete[i]->getTH2F()->GetXaxis()->SetNdivisions(512);
0054     me_notComplete[i]->getTH2F()->GetYaxis()->SetNdivisions(505);
0055     me_notComplete[i]->setAxisTitle("rmb");
0056     me_notComplete[i]->getTH2F()->SetYTitle("link");
0057     me_notComplete[i]->getTH2F()->SetStats(false);
0058   }
0059   me_topOccup = ibooker.book2D("topOccup", "Top10 LinkBoard occupancy", 8, -0.5, 7.5, 10, 0., 10.);
0060   me_topSpread = ibooker.book2D("topSpread", "Top10 LinkBoard delay spread", 8, -0.5, 7.5, 10, 0., 10.);
0061   me_topOccup->getTH2F()->GetXaxis()->SetNdivisions(110);
0062   me_topSpread->getTH2F()->GetXaxis()->SetNdivisions(110);
0063   me_topOccup->getTH2F()->SetStats(false);
0064   me_topSpread->getTH2F()->SetStats(false);
0065 }
0066 
0067 void RPCMonitorLinkSynchro::analyze(const edm::Event& ev, const edm::EventSetup& es) {
0068   edm::Handle<RPCRawSynchro::ProdItem> synchroCounts;
0069   ev.getByToken(rpcRawSynchroProdItemTag_, synchroCounts);
0070   std::vector<LinkBoardElectronicIndex> problems;
0071   const RPCRawSynchro::ProdItem& vItem = select(*synchroCounts.product(), ev, es);
0072   theSynchroStat.add(vItem, problems);
0073 
0074   for (std::vector<LinkBoardElectronicIndex>::const_iterator it = problems.begin(); it != problems.end(); ++it) {
0075     me_notComplete[it->dccId - 790]->Fill(it->dccInputChannelNum, it->tbLinkInputNum);
0076   }
0077 }