CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IntegrityClient.cc
Go to the documentation of this file.
1 #include "../interface/IntegrityClient.h"
2 
4 
6 
10 
11 namespace ecaldqm
12 {
15  errFractionThreshold_(0.)
16  {
17  qualitySummaries_.insert("Quality");
18  qualitySummaries_.insert("QualitySummary");
19  }
20 
21  void
23  {
24  errFractionThreshold_ = _params.getUntrackedParameter<double>("errFractionThreshold");
25  }
26 
27  // Check Channel Status Record at every endLumi
28  // Used to fill Channel Status Map MEs
29  void
31  {
32  _es.get<EcalChannelStatusRcd>().get( chStatus );
33  }
34 
35  void
37  {
38  uint32_t mask(1 << EcalDQMStatusHelper::CH_ID_ERROR |
43 
44  MESet& meQuality(MEs_.at("Quality"));
45  MESet& meQualitySummary(MEs_.at("QualitySummary"));
46  MESet& meChStatus( MEs_.at("ChStatus") );
47 
48  MESet const& sOccupancy(sources_.at("Occupancy"));
49  MESet const& sGain(sources_.at("Gain"));
50  MESet const& sChId(sources_.at("ChId"));
51  MESet const& sGainSwitch(sources_.at("GainSwitch"));
52  MESet const& sTowerId(sources_.at("TowerId"));
53  MESet const& sBlockSize(sources_.at("BlockSize"));
54 
55  // Fill Channel Status Map MEs
56  // Record is checked for updates at every endLumi and filled here
57  MESet::iterator chSEnd( meChStatus.end() );
58  for( MESet::iterator chSItr(meChStatus.beginChannel()); chSItr != chSEnd; chSItr.toNextChannel() ){
59 
60  DetId id( chSItr->getId() );
61 
63 
64  // Set appropriate channel map (EB or EE)
65  if( id.subdetId() == EcalBarrel ){
66  EBDetId ebid(id);
67  chIt = chStatus->find( ebid );
68  }
69  else {
70  EEDetId eeid(id);
71  chIt = chStatus->find( eeid );
72  }
73 
74  // Get status code and fill ME
75  if ( chIt != chStatus->end() ){
76  uint16_t code( chIt->getEncodedStatusCode() );
77  chSItr->setBinContent( code );
78  }
79 
80  } // Channel Status Map
81 
82  MESet::iterator qEnd(meQuality.end());
83  MESet::const_iterator occItr(sOccupancy);
84  for(MESet::iterator qItr(meQuality.beginChannel()); qItr != qEnd; qItr.toNextChannel()){
85 
86  occItr = qItr;
87 
88  DetId id(qItr->getId());
89 
90  bool doMask(meQuality.maskMatches(id, mask, statusManager_));
91 
92  float entries(occItr->getBinContent());
93 
94  float gain(sGain.getBinContent(id));
95  float chid(sChId.getBinContent(id));
96  float gainswitch(sGainSwitch.getBinContent(id));
97 
98  float towerid(sTowerId.getBinContent(id));
99  float blocksize(sBlockSize.getBinContent(id));
100 
101  if(entries + gain + chid + gainswitch + towerid + blocksize < 1.){
102  qItr->setBinContent(doMask ? kMUnknown : kUnknown);
103  meQualitySummary.setBinContent(id, doMask ? kMUnknown : kUnknown);
104  continue;
105  }
106 
107  float chErr((gain + chid + gainswitch + towerid + blocksize) / (entries + gain + chid + gainswitch + towerid + blocksize));
108 
109  if(chErr > errFractionThreshold_){
110  qItr->setBinContent(doMask ? kMBad : kBad);
111  meQualitySummary.setBinContent(id, doMask ? kMBad : kBad);
112  }
113  else{
114  qItr->setBinContent(doMask ? kMGood : kGood);
115  meQualitySummary.setBinContent(id, doMask ? kMGood : kGood);
116  }
117  }
118 
119  } // producePlots()
120 
122 }
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:108
void producePlots(ProcessType) override
edm::ESHandle< EcalChannelStatus > chStatus
static const int TT_SIZE_ERROR
static const int CH_GAIN_SWITCH_ERROR
const_iterator & toNextChannel()
Definition: MESet.h:271
void setParams(edm::ParameterSet const &) override
std::set< std::string > qualitySummaries_
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
StatusManager const * statusManager_
MESetCollection sources_
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:56
static const int CH_GAIN_ZERO_ERROR
std::vector< Item >::const_iterator const_iterator
MESetCollection MEs_
Definition: DQWorker.h:75
static const int TT_ID_ERROR
static const int CH_ID_ERROR