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 
5 
7 
8 namespace ecaldqm {
9 
11  DQWorkerClient(_params, _paths, "IntegrityClient"),
12  errFractionThreshold_(0.)
13  {
14  edm::ParameterSet const& taskParams(_params.getUntrackedParameterSet(name_));
15  errFractionThreshold_ = taskParams.getUntrackedParameter<double>("errFractionThreshold");
16 
17  edm::ParameterSet const& sources(_params.getUntrackedParameterSet("sources"));
18  source_(sOccupancy, "OccupancyTask", OccupancyTask::kDigi, sources);
19  source_(sGain, "IntegrityTask", IntegrityTask::kGain, sources);
20  source_(sChId, "IntegrityTask", IntegrityTask::kChId, sources);
21  source_(sGainSwitch, "IntegrityTask", IntegrityTask::kGainSwitch, sources);
22  source_(sTowerId, "IntegrityTask", IntegrityTask::kTowerId, sources);
23  source_(sBlockSize, "IntegrityTask", IntegrityTask::kBlockSize, sources);
24  }
25 
26  void
28  {
30 
31  MEs_[kQuality]->resetAll(-1.);
32  MEs_[kQualitySummary]->resetAll(-1.);
33  }
34 
35  void
37  {
38  uint32_t mask(1 << EcalDQMStatusHelper::CH_ID_ERROR |
43 
44  for(unsigned dccid(1); dccid <= 54; dccid++){
45  for(unsigned tower(1); tower <= getNSuperCrystals(dccid); tower++){
46  std::vector<DetId> ids(getElectronicsMap()->dccTowerConstituents(dccid, tower));
47 
48  if(ids.size() == 0) continue;
49 
50  float towerEntries(0.);
51  bool towerGood(true);
52 
53  for(std::vector<DetId>::iterator idItr(ids.begin()); idItr != ids.end(); ++idItr){
54  float entries(sources_[sOccupancy]->getBinContent(*idItr));
55  towerEntries += entries;
56 
57  float gain(sources_[sGain]->getBinContent(*idItr));
58  float chid(sources_[sChId]->getBinContent(*idItr));
59  float gainswitch(sources_[sGainSwitch]->getBinContent(*idItr));
60 
61  if(entries + gain + chid + gainswitch < 1.){
62  fillQuality_(kQuality, *idItr, mask, 2.);
63  continue;
64  }
65 
66  float chErr((gain + chid + gainswitch) / (entries + gain + chid + gainswitch));
67 
68  if(chErr > errFractionThreshold_){
69  fillQuality_(kQuality, *idItr, mask, 0.);
70  towerGood = false;
71  }
72  else
73  fillQuality_(kQuality, *idItr, mask, 1.);
74  }
75 
76  float towerid(sources_[sTowerId]->getBinContent(ids[0]));
77  float blocksize(sources_[sBlockSize]->getBinContent(ids[0]));
78 
79  float quality(-1.);
80 
81  if(towerEntries + towerid + blocksize > 1.){
82  float towerErr((towerid + blocksize) / (towerEntries + towerid + blocksize));
83  if(towerErr > errFractionThreshold_) towerGood = false;
84 
85  quality = towerGood ? 1. : 0.;
86  }
87  else{
88  quality = 2.;
89  }
90 
91  if(dccid <= 9 || dccid >= 46){
92  std::vector<EcalScDetId> scs(getElectronicsMap()->getEcalScDetId(dccid, tower));
93  for(std::vector<EcalScDetId>::iterator scItr(scs.begin()); scItr != scs.end(); ++scItr)
94  fillQuality_(kQualitySummary, *scItr, mask, quality);
95  }
96  else
97  fillQuality_(kQualitySummary, ids[0], mask, quality);
98  }
99  }
100  }
101 
102  /*static*/
103  void
104  IntegrityClient::setMEData(std::vector<MEData>& _data)
105  {
108  }
109 
111 }
112 
const EcalElectronicsMapping * getElectronicsMap()
void producePlots() override
IntegrityClient(const edm::ParameterSet &, const edm::ParameterSet &)
static const int TT_SIZE_ERROR
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
void source_(unsigned, std::string const &, unsigned, edm::ParameterSet const &)
static const int CH_GAIN_SWITCH_ERROR
static void setMEData(std::vector< MEData > &)
virtual void bookMEs()
Definition: DQWorker.cc:48
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
unsigned getNSuperCrystals(unsigned)
static const int CH_GAIN_ZERO_ERROR
std::vector< MESet const * > sources_
static const int TT_ID_ERROR
DEFINE_ECALDQM_WORKER(CertificationClient)
void fillQuality_(unsigned, DetId const &, uint32_t, float)
static const int CH_ID_ERROR
std::string name_
Definition: DQWorker.h:55