CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PresampleClient.cc
Go to the documentation of this file.
1 #include "../interface/PresampleClient.h"
2 
4 
6 
7 #include <cmath>
8 
9 namespace ecaldqm {
10 
12  DQWorkerClient(_params, _paths, "PresampleClient"),
13  minChannelEntries_(0),
14  minTowerEntries_(0),
15  expectedMean_(0.),
16  meanThreshold_(0.),
17  rmsThreshold_(0.),
18  rmsThresholdHighEta_(0.),
19  noisyFracThreshold_(0.)
20  {
21  edm::ParameterSet const& taskParams(_params.getUntrackedParameterSet(name_));
22  minChannelEntries_ = taskParams.getUntrackedParameter<int>("minChannelEntries");
23  minTowerEntries_ = taskParams.getUntrackedParameter<int>("minTowerEntries");
24  expectedMean_ = taskParams.getUntrackedParameter<double>("expectedMean");
25  meanThreshold_ = taskParams.getUntrackedParameter<double>("meanThreshold");
26  rmsThreshold_ = taskParams.getUntrackedParameter<double>("rmsThreshold");
27  rmsThresholdHighEta_ = taskParams.getUntrackedParameter<double>("rmsThresholdHighEta");
28  noisyFracThreshold_ = taskParams.getUntrackedParameter<double>("noisyFracThreshold");
29 
30  edm::ParameterSet const& sources(_params.getUntrackedParameterSet("sources"));
31  source_(sPedestal, "PresampleTask", PresampleTask::kPedestal, sources);
32  }
33 
34  void
36  {
38 
39  MEs_[kQuality]->resetAll(-1.);
40  MEs_[kRMSMap]->resetAll(-1.);
41  MEs_[kRMSMapSummary]->resetAll(-1.);
42  MEs_[kQualitySummary]->resetAll(-1.);
43  }
44 
45  void
47  {
48  MEs_[kMean]->reset();
49  MEs_[kMeanDCC]->reset();
50  MEs_[kRMS]->reset();
51  MEs_[kRMSMap]->reset(-1.);
52  MEs_[kRMSMapSummary]->reset(-1.);
53 
56 
57  for(unsigned dccid(1); dccid <= 54; dccid++){
58 
59  for(unsigned tower(1); tower <= getNSuperCrystals(dccid); tower++){
60  std::vector<DetId> ids(getElectronicsMap()->dccTowerConstituents(dccid, tower));
61 
62  if(ids.size() == 0) continue;
63 
64  unsigned iSM(dccid - 1);
65  float rmsThresh(rmsThreshold_);
66  if(iSM <= kEEmHigh || iSM >= kEEpLow || tower > 48) rmsThresh = rmsThresholdHighEta_;
67 
68  float nNoisy(0.);
69  float towerEntries(0.);
70  float towerMean(0.);
71  float towerRMS(0.);
72 
73  for(std::vector<DetId>::iterator idItr(ids.begin()); idItr != ids.end(); ++idItr){
74  float entries(sources_[sPedestal]->getBinEntries(*idItr));
75  float mean(sources_[sPedestal]->getBinContent(*idItr));
76  float rms(sources_[sPedestal]->getBinError(*idItr) * std::sqrt(entries));
77  towerEntries += entries;
78  towerMean += mean * entries;
79  towerRMS += (rms * rms + mean * mean) * entries;
80 
81  if(entries < minChannelEntries_){
82  fillQuality_(kQuality, *idItr, mask, 2.);
83  continue;
84  }
85 
86  MEs_[kMean]->fill(*idItr, mean);
87  MEs_[kMeanDCC]->fill(*idItr, mean);
88  MEs_[kRMS]->fill(*idItr, rms);
89  MEs_[kRMSMap]->fill(*idItr, rms);
90 
91  if(std::abs(mean - expectedMean_) > meanThreshold_ || rms > rmsThresh){
92  fillQuality_(kQuality, *idItr, mask, 0.);
93  nNoisy += 1.;
94  }
95  else
96  fillQuality_(kQuality, *idItr, mask, 1.);
97  }
98 
99  towerMean /= towerEntries;
100  towerRMS = std::sqrt(towerRMS / towerEntries - towerMean * towerMean);
101 
102  float quality(-1.);
103 
104  if(towerEntries > minTowerEntries_)
105  quality = nNoisy / ids.size() > noisyFracThreshold_ ? 0. : 1.;
106  else
107  quality = 2.;
108 
109  if(dccid <= 9 || dccid >= 46){
110  std::vector<EcalScDetId> scs(getElectronicsMap()->getEcalScDetId(dccid, tower));
111  for(std::vector<EcalScDetId>::iterator scItr(scs.begin()); scItr != scs.end(); ++scItr){
112  fillQuality_(kQualitySummary, *scItr, mask, quality);
113  MEs_[kRMSMapSummary]->setBinContent(*scItr, towerRMS);
114  }
115  }
116  else{
117  fillQuality_(kQualitySummary, ids[0], mask, quality);
118  MEs_[kRMSMapSummary]->setBinContent(ids[0], towerRMS);
119  }
120  }
121  }
122  }
123 
124  /*static*/
125  void
126  PresampleClient::setMEData(std::vector<MEData>& _data)
127  {
129 
131 
132  axis.nbins = 120;
133  axis.low = 170.;
134  axis.high = 230.;
137 
138  axis.nbins = 100;
139  axis.low = 0.;
140  axis.high = 10.;
144 
146  }
147 
149 }
150 
const EcalElectronicsMapping * getElectronicsMap()
static const int PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
#define abs(x)
Definition: mlp_lapack.h:159
void source_(unsigned, std::string const &, unsigned, edm::ParameterSet const &)
ParameterSet const & getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
PresampleClient(const edm::ParameterSet &, const edm::ParameterSet &)
T sqrt(T t)
Definition: SSEVec.h:48
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 PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR
std::vector< MESet const * > sources_
DEFINE_ECALDQM_WORKER(CertificationClient)
void fillQuality_(unsigned, DetId const &, uint32_t, float)
std::string name_
Definition: DQWorker.h:55