00001 #include "../interface/IntegrityClient.h"
00002
00003 #include "DQM/EcalBarrelMonitorTasks/interface/OccupancyTask.h"
00004 #include "DQM/EcalBarrelMonitorTasks/interface/IntegrityTask.h"
00005
00006 #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
00007
00008 namespace ecaldqm {
00009
00010 IntegrityClient::IntegrityClient(const edm::ParameterSet& _params, const edm::ParameterSet& _paths) :
00011 DQWorkerClient(_params, _paths, "IntegrityClient"),
00012 errFractionThreshold_(0.)
00013 {
00014 edm::ParameterSet const& taskParams(_params.getUntrackedParameterSet(name_));
00015 errFractionThreshold_ = taskParams.getUntrackedParameter<double>("errFractionThreshold");
00016
00017 edm::ParameterSet const& sources(_params.getUntrackedParameterSet("sources"));
00018 source_(sOccupancy, "OccupancyTask", OccupancyTask::kDigi, sources);
00019 source_(sGain, "IntegrityTask", IntegrityTask::kGain, sources);
00020 source_(sChId, "IntegrityTask", IntegrityTask::kChId, sources);
00021 source_(sGainSwitch, "IntegrityTask", IntegrityTask::kGainSwitch, sources);
00022 source_(sTowerId, "IntegrityTask", IntegrityTask::kTowerId, sources);
00023 source_(sBlockSize, "IntegrityTask", IntegrityTask::kBlockSize, sources);
00024 }
00025
00026 void
00027 IntegrityClient::bookMEs()
00028 {
00029 DQWorker::bookMEs();
00030
00031 MEs_[kQuality]->resetAll(-1.);
00032 MEs_[kQualitySummary]->resetAll(-1.);
00033 }
00034
00035 void
00036 IntegrityClient::producePlots()
00037 {
00038 uint32_t mask(1 << EcalDQMStatusHelper::CH_ID_ERROR |
00039 1 << EcalDQMStatusHelper::CH_GAIN_ZERO_ERROR |
00040 1 << EcalDQMStatusHelper::CH_GAIN_SWITCH_ERROR |
00041 1 << EcalDQMStatusHelper::TT_ID_ERROR |
00042 1 << EcalDQMStatusHelper::TT_SIZE_ERROR);
00043
00044 for(unsigned dccid(1); dccid <= 54; dccid++){
00045 for(unsigned tower(1); tower <= getNSuperCrystals(dccid); tower++){
00046 std::vector<DetId> ids(getElectronicsMap()->dccTowerConstituents(dccid, tower));
00047
00048 if(ids.size() == 0) continue;
00049
00050 float towerEntries(0.);
00051 bool towerGood(true);
00052
00053 for(std::vector<DetId>::iterator idItr(ids.begin()); idItr != ids.end(); ++idItr){
00054 float entries(sources_[sOccupancy]->getBinContent(*idItr));
00055 towerEntries += entries;
00056
00057 float gain(sources_[sGain]->getBinContent(*idItr));
00058 float chid(sources_[sChId]->getBinContent(*idItr));
00059 float gainswitch(sources_[sGainSwitch]->getBinContent(*idItr));
00060
00061 if(entries + gain + chid + gainswitch < 1.){
00062 fillQuality_(kQuality, *idItr, mask, 2.);
00063 continue;
00064 }
00065
00066 float chErr((gain + chid + gainswitch) / (entries + gain + chid + gainswitch));
00067
00068 if(chErr > errFractionThreshold_){
00069 fillQuality_(kQuality, *idItr, mask, 0.);
00070 towerGood = false;
00071 }
00072 else
00073 fillQuality_(kQuality, *idItr, mask, 1.);
00074 }
00075
00076 float towerid(sources_[sTowerId]->getBinContent(ids[0]));
00077 float blocksize(sources_[sBlockSize]->getBinContent(ids[0]));
00078
00079 float quality(-1.);
00080
00081 if(towerEntries + towerid + blocksize > 1.){
00082 float towerErr((towerid + blocksize) / (towerEntries + towerid + blocksize));
00083 if(towerErr > errFractionThreshold_) towerGood = false;
00084
00085 quality = towerGood ? 1. : 0.;
00086 }
00087 else{
00088 quality = 2.;
00089 }
00090
00091 if(dccid <= 9 || dccid >= 46){
00092 std::vector<EcalScDetId> scs(getElectronicsMap()->getEcalScDetId(dccid, tower));
00093 for(std::vector<EcalScDetId>::iterator scItr(scs.begin()); scItr != scs.end(); ++scItr)
00094 fillQuality_(kQualitySummary, *scItr, mask, quality);
00095 }
00096 else
00097 fillQuality_(kQualitySummary, ids[0], mask, quality);
00098 }
00099 }
00100 }
00101
00102
00103 void
00104 IntegrityClient::setMEData(std::vector<MEData>& _data)
00105 {
00106 _data[kQuality] = MEData("Quality", BinService::kSM, BinService::kCrystal, MonitorElement::DQM_KIND_TH2F);
00107 _data[kQualitySummary] = MEData("QualitySummary", BinService::kEcal2P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F);
00108 }
00109
00110 DEFINE_ECALDQM_WORKER(IntegrityClient);
00111 }
00112