Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-17 23:26:22

0001 #include "DQM/EcalMonitorClient/interface/PNIntegrityClient.h"
0002 
0003 #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
0004 
0005 #include "DataFormats/EcalDetId/interface/EcalPnDiodeDetId.h"
0006 
0007 #include "CondFormats/EcalObjects/interface/EcalDQMStatusHelper.h"
0008 
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 
0011 namespace ecaldqm {
0012   PNIntegrityClient::PNIntegrityClient() : DQWorkerClient(), errFractionThreshold_(0.) {
0013     qualitySummaries_.insert("QualitySummary");
0014   }
0015 
0016   void PNIntegrityClient::setParams(edm::ParameterSet const& _params) {
0017     errFractionThreshold_ = _params.getUntrackedParameter<double>("errFractionThreshold");
0018   }
0019 
0020   void PNIntegrityClient::producePlots(ProcessType) {
0021     uint32_t mask(0x1 << EcalDQMStatusHelper::TT_SIZE_ERROR | 0x1 << EcalDQMStatusHelper::TT_ID_ERROR |
0022                   0x1 << EcalDQMStatusHelper::CH_ID_ERROR | 0x1 << EcalDQMStatusHelper::CH_GAIN_ZERO_ERROR);
0023 
0024     MESet& meQualitySummary(MEs_.at("QualitySummary"));
0025 
0026     MESet const& sOccupancy(sources_.at("Occupancy"));
0027     MESet const& sMEMChId(sources_.at("MEMChId"));
0028     MESet const& sMEMGain(sources_.at("MEMGain"));
0029     MESet const& sMEMBlockSize(sources_.at("MEMBlockSize"));
0030     MESet const& sMEMTowerId(sources_.at("MEMTowerId"));
0031 
0032     for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) {
0033       if (memDCCIndex(iDCC + 1) == unsigned(-1))
0034         continue;
0035       for (unsigned iPN(0); iPN < 10; ++iPN) {
0036         int subdet(0);
0037         if (iDCC >= kEBmLow && iDCC <= kEBpHigh)
0038           subdet = EcalBarrel;
0039         else
0040           subdet = EcalEndcap;
0041 
0042         EcalPnDiodeDetId id(subdet, iDCC + 1, iPN + 1);
0043 
0044         bool doMask(meQualitySummary.maskMatches(id, mask, statusManager_, GetTrigTowerMap()));
0045 
0046         float entries(sOccupancy.getBinContent(getEcalDQMSetupObjects(), id));
0047 
0048         float chid(sMEMChId.getBinContent(getEcalDQMSetupObjects(), id));
0049         float gain(sMEMGain.getBinContent(getEcalDQMSetupObjects(), id));
0050 
0051         float blocksize(sMEMBlockSize.getBinContent(getEcalDQMSetupObjects(), id));
0052         float towerid(sMEMTowerId.getBinContent(getEcalDQMSetupObjects(), id));
0053 
0054         if (entries + gain + chid + blocksize + towerid < 1.) {
0055           meQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, doMask ? kMUnknown : kUnknown);
0056           continue;
0057         }
0058 
0059         float chErr((gain + chid + blocksize + towerid) / (entries + gain + chid + blocksize + towerid));
0060 
0061         if (chErr > errFractionThreshold_)
0062           meQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, doMask ? kMBad : kBad);
0063         else
0064           meQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, doMask ? kMGood : kGood);
0065       }
0066     }
0067   }
0068 
0069   DEFINE_ECALDQM_WORKER(PNIntegrityClient);
0070 }  // namespace ecaldqm