CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/DQM/EcalBarrelMonitorClient/src/TrigPrimClient.cc

Go to the documentation of this file.
00001 #include "../interface/TrigPrimClient.h"
00002 
00003 #include "DQM/EcalBarrelMonitorTasks/interface/TrigPrimTask.h"
00004 
00005 #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
00006 
00007 #include <cmath>
00008 
00009 namespace ecaldqm {
00010 
00011   TrigPrimClient::TrigPrimClient(const edm::ParameterSet& _params, const edm::ParameterSet& _paths) :
00012     DQWorkerClient(_params, _paths, "TrigPrimClient")
00013   {
00014     edm::ParameterSet const& sources(_params.getUntrackedParameterSet("sources"));
00015     source_(sEtRealMap, "TrigPrimTask", TrigPrimTask::kEtRealMap, sources);
00016     source_(sEtEmulError, "TrigPrimTask", TrigPrimTask::kEtEmulError, sources);
00017     source_(sTimingError, "TrigPrimTask", TrigPrimTask::kTimingError, sources);
00018     source_(sMatchedIndex, "TrigPrimTask", TrigPrimTask::kMatchedIndex, sources);
00019   }
00020 
00021   void
00022   TrigPrimClient::bookMEs()
00023   {
00024     DQWorker::bookMEs();
00025 
00026     MEs_[kEmulQualitySummary]->resetAll(-1.);
00027   }
00028 
00029   void
00030   TrigPrimClient::producePlots()
00031   {
00032     //    MEs_[kTiming]->reset();
00033     MEs_[kTimingSummary]->reset();
00034     MEs_[kNonSingleSummary]->reset();
00035 
00036     uint32_t mask(1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING);
00037 
00038     for(unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++){
00039       EcalTrigTowerDetId ttid(EcalTrigTowerDetId::detIdFromDenseIndex(iTT));
00040 
00041       float towerEntries(0.);
00042       float tMax(0.5);
00043       float nMax(0.);
00044       for(int iBin(0); iBin < 6; iBin++){
00045         float entries(sources_[sMatchedIndex]->getBinEntries(ttid, iBin + 1));
00046         towerEntries += entries;
00047 
00048         if(entries > nMax){
00049           nMax = entries;
00050           tMax = iBin == 0 ? -0.5 : iBin + 0.5; // historical reasons.. much clearer to say "no entry = -0.5"
00051         }
00052       }
00053 
00054       //      MEs_[kTiming]->setBinContent(ttid, tMax);
00055       MEs_[kTimingSummary]->setBinContent(ttid, tMax);
00056 
00057       if(towerEntries < 1.){
00058         fillQuality_(kEmulQualitySummary, ttid, mask, 2.);
00059         continue;
00060       }
00061 
00062       float nonsingleFraction(1. - nMax / towerEntries);
00063 
00064       if(nonsingleFraction > 0.)
00065         MEs_[kNonSingleSummary]->setBinContent(ttid, nonsingleFraction);
00066 
00067       float quality(sources_[sEtEmulError]->getBinContent(ttid) > 0. || sources_[sTimingError]->getBinContent(ttid) > 0. ? 0. : 1.);
00068       fillQuality_(kEmulQualitySummary, ttid, mask, quality);
00069     }
00070   }
00071 
00072   /*static*/
00073   void
00074   TrigPrimClient::setMEData(std::vector<MEData>& _data)
00075   {
00076     _data[kTimingSummary] = MEData("TimingSummary", BinService::kEcal2P, BinService::kTriggerTower, MonitorElement::DQM_KIND_TH2F);
00077     _data[kNonSingleSummary] = MEData("NonSingleSummary", BinService::kEcal2P, BinService::kTriggerTower, MonitorElement::DQM_KIND_TH2F);
00078     _data[kEmulQualitySummary] = MEData("EmulQualitySummary", BinService::kEcal2P, BinService::kTriggerTower, MonitorElement::DQM_KIND_TH2F);
00079   }
00080 
00081   DEFINE_ECALDQM_WORKER(TrigPrimClient);
00082 }
00083