CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/DQM/EcalBarrelMonitorClient/src/SummaryClient.cc

Go to the documentation of this file.
00001 #include "../interface/SummaryClient.h"
00002 
00003 #include "DQM/EcalBarrelMonitorClient/interface/IntegrityClient.h"
00004 #include "DQM/EcalBarrelMonitorClient/interface/PresampleClient.h"
00005 #include "DQM/EcalBarrelMonitorClient/interface/TimingClient.h"
00006 #include "DQM/EcalBarrelMonitorClient/interface/RawDataClient.h"
00007 #include "DQM/EcalBarrelMonitorTasks/interface/OccupancyTask.h"
00008 
00009 #include "DQMServices/Core/interface/MonitorElement.h"
00010 #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
00011 
00012 namespace ecaldqm {
00013 
00014   SummaryClient::SummaryClient(const edm::ParameterSet& _params, const edm::ParameterSet& _paths) :
00015     DQWorkerClient(_params, _paths, "SummaryClient")
00016   {
00017     edm::ParameterSet const& sources(_params.getUntrackedParameterSet("sources"));
00018     source_(sIntegrity, "IntegrityClient", IntegrityClient::kQuality, sources);
00019     source_(sPresample, "PresampleClient", PresampleClient::kQuality, sources);
00020     source_(sTiming, "TimingClient", TimingClient::kQuality, sources);
00021     source_(sRawData, "RawDataClient", RawDataClient::kQualitySummary, sources);
00022     source_(sDigiOccupancy, "OccupancyTask", OccupancyTask::kDigi, sources);
00023   }
00024 
00025   void
00026   SummaryClient::bookMEs()
00027   {
00028   }
00029 
00030   void
00031   SummaryClient::beginRun(const edm::Run &, const edm::EventSetup &)
00032   {
00033     for(unsigned iME(0); iME < MEs_.size(); ++iME)
00034       MEs_[iME]->book();
00035 
00036     MEs_[kQualitySummary]->resetAll(-1.);
00037     MEs_[kQualitySummary]->reset(1.);
00038     MEs_[kReportSummaryMap]->resetAll(-1.);
00039     MEs_[kReportSummaryMap]->reset(1.);
00040     MEs_[kReportSummaryContents]->reset(1.);
00041     MEs_[kReportSummary]->reset(1.);
00042   }
00043 
00044   void
00045   SummaryClient::producePlots()
00046   {
00047     MEs_[kQualitySummary]->reset(2.);
00048     MEs_[kReportSummaryMap]->reset(1.);
00049 
00050     float totalChannels(0.);
00051     float totalGood(0.);
00052 
00053     for(unsigned dccid(1); dccid <= 54; dccid++){
00054       MonitorElement const* me(sources_[sDigiOccupancy]->getME(dccid - 1));
00055       if(me && me->getTH1()->GetEntries() < 1.){
00056         MEs_[kReportSummaryContents]->fill(dccid, 1.);
00057         continue;
00058       }
00059 
00060       float dccChannels(0.);
00061       float dccGood(0.);
00062 
00063       for(unsigned tower(1); tower <= getNSuperCrystals(dccid); tower++){
00064         std::vector<DetId> ids(getElectronicsMap()->dccTowerConstituents(dccid, tower));
00065 
00066         if(ids.size() == 0) continue;
00067 
00068         float towerChannels(0.);
00069         float towerGood(0.);
00070 
00071         for(std::vector<DetId>::iterator idItr(ids.begin()); idItr != ids.end(); ++idItr){
00072 
00073           float integrity(sources_[sIntegrity]->getBinContent(*idItr));
00074 
00075           if(integrity == 2.) continue;
00076 
00077           float presample(sources_[sPresample]->getBinContent(*idItr));
00078           float timing(sources_[sTiming]->getBinContent(*idItr));
00079           float rawdata(sources_[sRawData]->getBinContent(*idItr));
00080 
00081           if(integrity > 2.) integrity = 1.;
00082           if(presample > 2.) presample = 1.;
00083           if(timing > 2.) timing = 1.;
00084           if(rawdata > 2.) rawdata = 1.;
00085 
00086           float status(1.);
00087           if(integrity < 2.) status *= integrity;
00088           if(presample < 2.) status *= presample;
00089           if(timing < 2.) status *= timing;
00090           if(rawdata < 2.) status *= rawdata;
00091 
00092           MEs_[kQualitySummary]->setBinContent(*idItr, status);
00093 
00094           if(status == 1.){
00095             towerGood += 1.;
00096             dccGood += 1.;
00097             totalGood += 1.;
00098           }
00099           towerChannels += 1.;
00100           dccChannels += 1.;
00101           totalChannels += 1.;
00102         }
00103 
00104         if(towerChannels < 1.) continue;
00105 
00106         if(dccid <= 9 || dccid >= 46){
00107           std::vector<EcalScDetId> scs(getElectronicsMap()->getEcalScDetId(dccid, tower));
00108           for(std::vector<EcalScDetId>::iterator scItr(scs.begin()); scItr != scs.end(); ++scItr)
00109             MEs_[kReportSummaryMap]->setBinContent(*scItr, towerGood / towerChannels);
00110         }
00111         else
00112           MEs_[kReportSummaryMap]->setBinContent(ids[0], towerGood / towerChannels);
00113       }
00114 
00115       if(dccChannels < 1.) continue;
00116 
00117       MEs_[kReportSummaryContents]->fill(dccid, dccGood / dccChannels);
00118     }
00119 
00120     if(totalChannels > 0.) MEs_[kReportSummary]->fill(totalGood / totalChannels);
00121 
00122   }
00123 
00124   /*static*/
00125   void
00126   SummaryClient::setMEData(std::vector<MEData>& _data)
00127   {
00128     _data[kQualitySummary] = MEData("QualitySummary", BinService::kEcal2P, BinService::kCrystal, MonitorElement::DQM_KIND_TH2F);
00129     _data[kReportSummaryMap] = MEData("ReportSummaryMap", BinService::kEcal, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F);
00130     _data[kReportSummaryContents] = MEData("ReportSummaryContents", BinService::kSM, BinService::kReport, MonitorElement::DQM_KIND_REAL);
00131     _data[kReportSummary] = MEData("ReportSummary", BinService::kEcal, BinService::kReport, MonitorElement::DQM_KIND_REAL);
00132   }
00133 
00134   DEFINE_ECALDQM_WORKER(SummaryClient);
00135 }
00136