File indexing completed on 2023-03-17 10:54:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "DQM/DTMonitorClient/src/DTDAQInfo.h"
0011 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0012
0013 #include "FWCore/ServiceRegistry/interface/Service.h"
0014 #include "FWCore/Framework/interface/ESHandle.h"
0015 #include "FWCore/Framework/interface/EventSetup.h"
0016
0017 #include "DQMServices/Core/interface/DQMStore.h"
0018
0019 #include "CondFormats/RunInfo/interface/RunInfo.h"
0020 #include "CondFormats/RunInfo/interface/RunSummary.h"
0021
0022 #include "CondFormats/DTObjects/interface/DTReadOutMapping.h"
0023
0024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0025
0026 using namespace std;
0027 using namespace edm;
0028
0029 DTDAQInfo::DTDAQInfo(const ParameterSet& pset)
0030 : mappingToken_(esConsumes<edm::Transition::EndLuminosityBlock>()),
0031 runInfoToken_(esConsumes<edm::Transition::EndLuminosityBlock>()) {
0032 bookingdone = false;
0033 checkUros = pset.getUntrackedParameter<bool>("checkUros", true);
0034 }
0035
0036 DTDAQInfo::~DTDAQInfo() {}
0037
0038 void DTDAQInfo::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker,
0039 DQMStore::IGetter& igetter,
0040 edm::LuminosityBlock const& lumiSeg,
0041 edm::EventSetup const& setup) {
0042 if (!bookingdone) {
0043
0044 mapping = &setup.getData(mappingToken_);
0045
0046
0047
0048
0049 ibooker.setCurrentFolder("DT/EventInfo");
0050
0051 totalDAQFraction = ibooker.bookFloat("DAQSummary");
0052 totalDAQFraction->Fill(-1);
0053
0054
0055 daqMap = ibooker.book2D("DAQSummaryMap", "DT Certification Summary Map", 12, 1, 13, 5, -2, 3);
0056 daqMap->setAxisTitle("sector", 1);
0057 daqMap->setAxisTitle("wheel", 2);
0058
0059
0060
0061 ibooker.setCurrentFolder("DT/EventInfo/DAQContents");
0062 for (int wheel = -2; wheel != 3; ++wheel) {
0063 stringstream streams;
0064 streams << "DT_Wheel" << wheel;
0065
0066 daqFractions[wheel] = ibooker.bookFloat(streams.str());
0067 daqFractions[wheel]->Fill(-1);
0068 }
0069 bookingdone = true;
0070 }
0071
0072 if (auto runInfoRec = setup.tryToGet<RunInfoRcd>()) {
0073
0074 totalDAQFraction->Fill(0.);
0075 daqFractions[-2]->Fill(0.);
0076 daqFractions[-1]->Fill(0.);
0077 daqFractions[-0]->Fill(0.);
0078 daqFractions[1]->Fill(0.);
0079 daqFractions[2]->Fill(0.);
0080
0081 daqMap->Reset();
0082
0083 auto sumFED = runInfoRec->get(runInfoToken_);
0084 const vector<int> fedInIDs = sumFED.m_fed_in;
0085
0086
0087 static const int FEDIDmin = FEDNumbering::MINDTFEDID;
0088 static const int FEDIDMax = FEDNumbering::MAXDTFEDID;
0089
0090
0091 if (checkUros) {
0092 LogTrace("DQM|DTMonitorClient|DTDAQInfo") << "Checking uROS FEDs as Legacy FEDs" << endl;
0093 }
0094
0095
0096 for (vector<int>::const_iterator fed = fedInIDs.begin(); fed != fedInIDs.end(); ++fed) {
0097
0098 if (!(*fed >= FEDIDmin && *fed <= FEDIDMax))
0099 continue;
0100
0101
0102 int wheel = -99;
0103 int sector = -99;
0104 int dummy = -99;
0105 for (int ros = 1; ros != 13; ++ros) {
0106 if (!mapping->readOutToGeometry(*fed, ros, 2, 2, 2, wheel, dummy, sector, dummy, dummy, dummy)) {
0107 LogTrace("DQM|DTMonitorClient|DTDAQInfo")
0108 << "FED: " << *fed << " Ch: " << ros << " wheel: " << wheel << " Sect: " << sector << endl;
0109 daqFractions[wheel]->Fill(daqFractions[wheel]->getFloatValue() + 1. / 12.);
0110 totalDAQFraction->Fill(totalDAQFraction->getFloatValue() + 1. / 60.);
0111 daqMap->Fill(sector, wheel);
0112 }
0113 }
0114 }
0115 } else {
0116 LogWarning("DQM|DTMonitorClient|DTDAQInfo") << "*** Warning: record key not found for RunInfoRcd" << endl;
0117 totalDAQFraction->Fill(-1);
0118 for (int wheel = -2; wheel != 3; ++wheel) {
0119 daqFractions[wheel]->Fill(-1);
0120 }
0121 return;
0122 }
0123 }
0124
0125 void DTDAQInfo::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) {}