Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:09:36

0001 
0002 /*
0003  *  See header file for a description of this class.
0004  *
0005  *  \author G. Cerminara - INFN Torino
0006  */
0007 
0008 #include "DQM/DTMonitorClient/src/DTCertificationSummary.h"
0009 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0010 
0011 #include "FWCore/ServiceRegistry/interface/Service.h"
0012 #include "FWCore/Framework/interface/ESHandle.h"
0013 #include "FWCore/Framework/interface/EventSetup.h"
0014 
0015 #include "DQMServices/Core/interface/DQMStore.h"
0016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0017 
0018 using namespace std;
0019 using namespace edm;
0020 
0021 DTCertificationSummary::DTCertificationSummary(const ParameterSet& pset) {}
0022 
0023 DTCertificationSummary::~DTCertificationSummary() {}
0024 
0025 void DTCertificationSummary::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker,
0026                                                    DQMStore::IGetter& igetter,
0027                                                    edm::LuminosityBlock const& lumiSeg,
0028                                                    edm::EventSetup const& context) {
0029   //FR moved here from beginJob
0030 
0031   // book the ME
0032   ibooker.setCurrentFolder("DT/EventInfo");
0033   // global fraction
0034   if (!igetter.get("CertificationSummary")) {
0035     totalCertFraction = ibooker.bookFloat("CertificationSummary");
0036     totalCertFraction->Fill(-1);
0037 
0038     // certification map
0039     certMap = ibooker.book2D("CertificationSummaryMap", "DT Certification Summary Map", 12, 1, 13, 5, -2, 3);
0040     certMap->setAxisTitle("sector", 1);
0041     certMap->setAxisTitle("wheel", 2);
0042 
0043     ibooker.setCurrentFolder("DT/EventInfo/CertificationContents");
0044     // Wheel "fractions" -> will be 0 or 1
0045     for (int wheel = -2; wheel != 3; ++wheel) {
0046       stringstream streams;
0047       streams << "DT_Wheel" << wheel;
0048       certFractions[wheel] = ibooker.bookFloat(streams.str());
0049       certFractions[wheel]->Fill(-1);
0050     }
0051   }
0052 }
0053 
0054 void DTCertificationSummary::beginRun(const Run& run, const EventSetup& setup) {}
0055 
0056 void DTCertificationSummary::endRun(const Run& run, const EventSetup& setup) {}
0057 
0058 void DTCertificationSummary::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) {
0059   // get the relevant summary histos
0060   MonitorElement* effSummary = igetter.get("DT/05-ChamberEff/EfficiencyGlbSummary");
0061   MonitorElement* resSummary = igetter.get("DT/02-Segments/ResidualsGlbSummary");
0062   MonitorElement* segQualSummary = igetter.get("DT/02-Segments/segmentSummary");
0063 
0064   // check that all needed histos are there
0065   if (effSummary == nullptr || resSummary == nullptr || segQualSummary == nullptr) {
0066     LogWarning("DQM|DTMonitorClient|DTCertificationSummary")
0067         << "*** Warning: not all needed summaries are present!" << endl;
0068     return;
0069   }
0070 
0071   // reset the MEs
0072   totalCertFraction->Fill(0.);
0073   certFractions[-2]->Fill(0.);
0074   certFractions[-1]->Fill(0.);
0075   certFractions[-0]->Fill(0.);
0076   certFractions[1]->Fill(0.);
0077   certFractions[2]->Fill(0.);
0078   certMap->Reset();
0079 
0080   // loop over all sectors and wheels
0081   for (int wheel = -2; wheel != 3; ++wheel) {
0082     for (int sector = 1; sector != 13; ++sector) {
0083       double eff = effSummary->getBinContent(sector, wheel + 3);
0084       double res = resSummary->getBinContent(sector, wheel + 3);
0085       double segQual = segQualSummary->getBinContent(sector, wheel + 3);
0086 
0087       double total = 0;
0088       if (segQual != 0) {
0089         total = min(res, eff);
0090       } else {
0091         total = eff;
0092       }
0093 
0094       certMap->Fill(sector, wheel, total);
0095       // can use variable weight depending on the sector
0096       double weight = 1. / 12.;
0097       certFractions[wheel]->Fill(certFractions[wheel]->getFloatValue() + weight * total);
0098       double totalWeight = 1. / 60.;
0099       totalCertFraction->Fill(totalCertFraction->getFloatValue() + totalWeight * total);
0100     }
0101   }
0102 }