CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/EcalBarrelMonitorClient/src/SelectiveReadoutClient.cc

Go to the documentation of this file.
00001 #include "../interface/SelectiveReadoutClient.h"
00002 
00003 #include "DQM/EcalBarrelMonitorTasks/interface/SelectiveReadoutTask.h"
00004 
00005 #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
00006 
00007 #include <cmath>
00008 
00009 namespace ecaldqm {
00010 
00011   SelectiveReadoutClient::SelectiveReadoutClient(const edm::ParameterSet& _params, const edm::ParameterSet& _paths) :
00012     DQWorkerClient(_params, _paths, "SelectiveReadoutClient")
00013   {
00014     edm::ParameterSet const& sources(_params.getUntrackedParameterSet("sources"));
00015     source_(sFlagCounterMap, "SelectiveReadoutTask", SelectiveReadoutTask::kFlagCounterMap, sources);
00016     source_(sRUForcedMap, "SelectiveReadoutTask", SelectiveReadoutTask::kRUForcedMap, sources);
00017     source_(sFullReadoutMap, "SelectiveReadoutTask", SelectiveReadoutTask::kFullReadoutMap, sources);
00018     source_(sZS1Map, "SelectiveReadoutTask", SelectiveReadoutTask::kZS1Map, sources);
00019     source_(sZSMap, "SelectiveReadoutTask", SelectiveReadoutTask::kZSMap, sources);
00020     source_(sZSFullReadoutMap, "SelectiveReadoutTask", SelectiveReadoutTask::kZSFullReadoutMap, sources);
00021     source_(sFRDroppedMap, "SelectiveReadoutTask", SelectiveReadoutTask::kFRDroppedMap, sources);
00022   }
00023 
00024   void
00025   SelectiveReadoutClient::producePlots()
00026   {
00027     using namespace std;
00028 
00029     MEs_[kFRDropped]->reset();
00030     MEs_[kZSReadout]->reset();
00031     MEs_[kFR]->reset();
00032     MEs_[kRUForced]->reset();
00033     MEs_[kZS1]->reset();
00034 
00035     for(unsigned dccid(1); dccid <= 54; dccid++){
00036 
00037       for(unsigned tower(1); tower <= getNSuperCrystals(dccid); tower++){
00038         vector<DetId> ids(getElectronicsMap()->dccTowerConstituents(dccid, tower));
00039 
00040         if(ids.size() == 0) continue;
00041 
00042         float nFlags(0.);
00043         float nRUForced(0.);
00044         float nFullReadoutFlags(0.);
00045         float nZS1Flags(0.);
00046         float nZS12Flags(0.);
00047         float nZSFullReadout(0.);
00048         float nFRDropped(0.);
00049         if(dccid <= 9 || dccid >= 46){
00050           vector<EcalScDetId> scids(getElectronicsMap()->getEcalScDetId(dccid, tower));
00051           for(vector<EcalScDetId>::iterator scItr(scids.begin()); scItr != scids.end(); ++scItr){
00052             nFlags += sources_[sFlagCounterMap]->getBinContent(*scItr);
00053             nRUForced += sources_[sRUForcedMap]->getBinContent(*scItr);
00054             nFullReadoutFlags += sources_[sFullReadoutMap]->getBinContent(*scItr);
00055             nZS1Flags += sources_[sZS1Map]->getBinContent(*scItr);
00056             nZS12Flags += sources_[sZSMap]->getBinContent(*scItr);
00057             nZSFullReadout += sources_[sZSFullReadoutMap]->getBinContent(*scItr);
00058             nFRDropped += sources_[sFRDroppedMap]->getBinContent(*scItr);
00059           }
00060 
00061           for(vector<EcalScDetId>::iterator scItr(scids.begin()); scItr != scids.end(); ++scItr){
00062             if(nFlags > 0.) MEs_[kFR]->setBinContent(*scItr, nFullReadoutFlags / nFlags);
00063             if(nFlags > 0.) MEs_[kZS1]->setBinContent(*scItr, nZS1Flags / nFlags);
00064             if(nFlags > 0.) MEs_[kRUForced]->setBinContent(*scItr, nRUForced / nFlags);
00065             if(nZS12Flags > 0.) MEs_[kZSReadout]->setBinContent(*scItr, nZSFullReadout / nZS12Flags);
00066             if(nFullReadoutFlags > 0.) MEs_[kFRDropped]->setBinContent(*scItr, nFRDropped / nFullReadoutFlags);
00067           }
00068         }
00069         else{
00070           nFlags = sources_[sFlagCounterMap]->getBinContent(ids[0]);
00071           nRUForced = sources_[sRUForcedMap]->getBinContent(ids[0]);
00072           nFullReadoutFlags = sources_[sFullReadoutMap]->getBinContent(ids[0]);
00073           nZS1Flags = sources_[sZS1Map]->getBinContent(ids[0]);
00074           nZS12Flags = sources_[sZSMap]->getBinContent(ids[0]);
00075           nZSFullReadout = sources_[sZSFullReadoutMap]->getBinContent(ids[0]);
00076           nFRDropped = sources_[sFRDroppedMap]->getBinContent(ids[0]);
00077 
00078 
00079           if(nFlags > 0.) MEs_[kFR]->setBinContent(ids[0], nFullReadoutFlags / nFlags);
00080           if(nFlags > 0.) MEs_[kZS1]->setBinContent(ids[0], nZS1Flags / nFlags);
00081           if(nFlags > 0.) MEs_[kRUForced]->setBinContent(ids[0], nRUForced / nFlags);
00082           if(nZS12Flags > 0.) MEs_[kZSReadout]->setBinContent(ids[0], nZSFullReadout / nZS12Flags);
00083           if(nFullReadoutFlags > 0.) MEs_[kFRDropped]->setBinContent(ids[0], nFRDropped / nFullReadoutFlags);
00084         }
00085       }
00086     }
00087   }
00088 
00089   /*static*/
00090   void
00091   SelectiveReadoutClient::setMEData(std::vector<MEData>& _data)
00092   {
00093     _data[kFRDropped] = MEData("FRDropped", BinService::kEcal2P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F);
00094     _data[kZSReadout] = MEData("ZSReadout", BinService::kEcal2P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F);
00095     _data[kFR] = MEData("FR", BinService::kEcal2P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F);
00096     _data[kRUForced] = MEData("RUForced", BinService::kEcal2P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F);
00097     _data[kZS1] = MEData("ZS1", BinService::kEcal2P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F);
00098   }
00099 
00100   DEFINE_ECALDQM_WORKER(SelectiveReadoutClient);
00101 }
00102