CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ecaldqm::PedestalClient Class Reference

#include <PedestalClient.h>

Inheritance diagram for ecaldqm::PedestalClient:
ecaldqm::DQWorkerClient ecaldqm::DQWorker

Public Member Functions

 PedestalClient ()
 
void producePlots (ProcessType) override
 
 ~PedestalClient ()
 
- Public Member Functions inherited from ecaldqm::DQWorkerClient
void bookMEs (DQMStore::IBooker &) override
 
 DQWorkerClient ()
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void releaseMEs () override
 
void releaseSource ()
 
virtual void resetMEs ()
 
bool retrieveSource (DQMStore::IGetter &, ProcessType)
 
bool runsOn (ProcessType _type) const
 
void setStatusManager (StatusManager const &_manager)
 
virtual ~DQWorkerClient ()
 
- Public Member Functions inherited from ecaldqm::DQWorker
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
 DQWorker ()
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
std::string const & getName () const
 
bool onlineMode () const
 
void setEventNumber (edm::EventNumber_t _e)
 
void setLumiNumber (edm::LuminosityBlockNumber_t _l)
 
void setRunNumber (edm::RunNumber_t _r)
 
void setTime (time_t _t)
 
virtual ~DQWorker ()
 

Private Member Functions

void setParams (edm::ParameterSet const &) override
 

Private Attributes

float expectedMean_
 
float expectedPNMean_
 
std::map< int, unsigned > gainToME_
 
int minChannelEntries_
 
std::map< int, unsigned > pnGainToME_
 
float toleranceMean_
 
float tolerancePNMean_
 
std::vector< float > tolerancePNRMS_
 
std::vector< float > toleranceRMS_
 

Additional Inherited Members

- Public Types inherited from ecaldqm::DQWorkerClient
enum  ProcessType { kLumi, kJob, nProcessType }
 
enum  Quality {
  kBad = 0, kGood = 1, kUnknown = 2, kMBad = 3,
  kMGood = 4, kMUnknown = 5
}
 
- Static Public Member Functions inherited from ecaldqm::DQWorkerClient
static void fillDescriptions (edm::ParameterSetDescription &)
 
- Static Public Member Functions inherited from ecaldqm::DQWorker
static void fillDescriptions (edm::ParameterSetDescription &_desc)
 
- Protected Member Functions inherited from ecaldqm::DQWorkerClient
void setME (edm::ParameterSet const &_ps) final
 
void setSource (edm::ParameterSet const &) override
 
void towerAverage_ (MESet &, MESet const &, float)
 
bool using_ (std::string const &_name, ProcessType _type=kJob) const
 
- Protected Member Functions inherited from ecaldqm::DQWorker
void initialize (std::string const &_name, edm::ParameterSet const &)
 
void print_ (std::string const &, int=0) const
 
void setVerbosity (int _verbosity)
 
- Protected Attributes inherited from ecaldqm::DQWorkerClient
bool hasLumiPlots_
 
std::set< std::string > qualitySummaries_
 
MESetCollection sources_
 
StatusManager const * statusManager_
 
- Protected Attributes inherited from ecaldqm::DQWorker
bool booked_
 
MESetCollection MEs_
 
std::string name_
 
bool onlineMode_
 
Timestamp timestamp_
 
int verbosity_
 
bool willConvertToEDM_
 

Detailed Description

Definition at line 8 of file PedestalClient.h.

Constructor & Destructor Documentation

ecaldqm::PedestalClient::PedestalClient ( )

Definition at line 16 of file PedestalClient.cc.

16  :
18  gainToME_(),
19  pnGainToME_(),
21  expectedMean_(0.),
22  toleranceMean_(0.),
23  toleranceRMS_(0),
24  expectedPNMean_(0.),
25  tolerancePNMean_(0.),
27  {
28  }
std::vector< float > toleranceRMS_
std::map< int, unsigned > pnGainToME_
std::vector< float > tolerancePNRMS_
std::map< int, unsigned > gainToME_
ecaldqm::PedestalClient::~PedestalClient ( )
inline

Definition at line 11 of file PedestalClient.h.

11 {}

Member Function Documentation

void ecaldqm::PedestalClient::producePlots ( ProcessType  )
overridevirtual

Implements ecaldqm::DQWorkerClient.

Definition at line 106 of file PedestalClient.cc.

References funct::abs(), ecaldqm::MESetMulti::beginChannel(), EcalBarrel, EcalEndcap, ecaldqm::MESetMulti::end(), python.tagInventory::entries, expectedMean_, expectedPNMean_, ecaldqm::MESetMulti::fill(), gainToME_, ecaldqm::MESetMulti::getBinContent(), ecaldqm::MESetMulti::getBinEntries(), ecaldqm::MESetMulti::getBinError(), ecaldqm::DQWorkerClient::kBad, ecaldqm::kEBmLow, ecaldqm::kEBpHigh, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMBad, ecaldqm::DQWorkerClient::kMGood, ecaldqm::DQWorkerClient::kMUnknown, ecaldqm::DQWorkerClient::kUnknown, ecaldqm::MESetMulti::maskMatches(), timingPdfMaker::mean, ecaldqm::memDCCIndex(), ecaldqm::DQWorker::MEs_, minChannelEntries_, ecaldqm::nDCC, EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR, EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR, EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR, EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR, EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR, EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR, pnGainToME_, plotscripts::rms(), ecaldqm::MESetMulti::setBinContent(), ecaldqm::DQWorkerClient::sources_, mathSSE::sqrt(), ecaldqm::DQWorkerClient::statusManager_, toleranceMean_, tolerancePNMean_, tolerancePNRMS_, toleranceRMS_, ecaldqm::MESet::iterator::toNextChannel(), ecaldqm::DQWorkerClient::towerAverage_(), and ecaldqm::MESetMulti::use().

107  {
108  using namespace std;
109 
110  MESetMulti& meQuality(static_cast<MESetMulti&>(MEs_.at("Quality")));
111  MESetMulti& meQualitySummary(static_cast<MESetMulti&>(MEs_.at("QualitySummary")));
112  MESetMulti& meMean(static_cast<MESetMulti&>(MEs_.at("Mean")));
113  MESetMulti& meRMS(static_cast<MESetMulti&>(MEs_.at("RMS")));
114  MESetMulti& mePNQualitySummary(static_cast<MESetMulti&>(MEs_.at("PNQualitySummary")));
115  MESetMulti& mePNRMS(static_cast<MESetMulti&>(MEs_.at("PNRMS")));
116 
117  MESetMulti const& sPedestal(static_cast<MESetMulti const&>(sources_.at("Pedestal")));
118  MESetMulti const& sPNPedestal(static_cast<MESetMulti const&>(sources_.at("PNPedestal")));
119 
120  for(map<int, unsigned>::iterator gainItr(gainToME_.begin()); gainItr != gainToME_.end(); ++gainItr){
121  meQuality.use(gainItr->second);
122  meQualitySummary.use(gainItr->second);
123  meMean.use(gainItr->second);
124  meRMS.use(gainItr->second);
125 
126  sPedestal.use(gainItr->second);
127 
128  uint32_t mask(0);
129  switch(gainItr->first){
130  case 1:
133  break;
134  case 6:
137  break;
138  case 12:
141  break;
142  default:
143  break;
144  }
145 
146  MESet::iterator qEnd(meQuality.end());
147  MESet::const_iterator pItr(sPedestal);
148  for(MESet::iterator qItr(meQuality.beginChannel()); qItr != qEnd; qItr.toNextChannel()){
149 
150  DetId id(qItr->getId());
151 
152  bool doMask(meQuality.maskMatches(id, mask, statusManager_));
153 
154  pItr = qItr;
155 
156  float entries(pItr->getBinEntries());
157 
159  qItr->setBinContent(doMask ? kMUnknown : kUnknown);
160  continue;
161  }
162 
163  float mean(pItr->getBinContent());
164  float rms(pItr->getBinError() * sqrt(entries));
165 
166  meMean.fill(id, mean);
167  meRMS.fill(id, rms);
168 
169  if(abs(mean - expectedMean_) > toleranceMean_ || rms > toleranceRMS_[gainItr->second])
170  qItr->setBinContent(doMask ? kMBad : kBad);
171  else
172  qItr->setBinContent(doMask ? kMGood : kGood);
173  }
174 
175  towerAverage_(meQualitySummary, meQuality, 0.2);
176  }
177 
178  for(map<int, unsigned>::iterator gainItr(pnGainToME_.begin()); gainItr != pnGainToME_.end(); ++gainItr){
179  mePNQualitySummary.use(gainItr->second);
180  mePNRMS.use(gainItr->second);
181 
182  sPNPedestal.use(gainItr->second);
183 
184  uint32_t mask(0);
185  switch(gainItr->first){
186  case 1:
189  break;
190  case 16:
193  break;
194  default:
195  break;
196  }
197 
198  for(unsigned iDCC(0); iDCC < nDCC; ++iDCC){
199 
200  if(memDCCIndex(iDCC + 1) == unsigned(-1)) continue;
201 
202  for(unsigned iPN(0); iPN < 10; ++iPN){
203  int subdet(0);
204  if(iDCC >= kEBmLow && iDCC <= kEBpHigh) subdet = EcalBarrel;
205  else subdet = EcalEndcap;
206 
207  EcalPnDiodeDetId id(subdet, iDCC + 1, iPN + 1);
208 
209  bool doMask(mePNQualitySummary.maskMatches(id, mask, statusManager_));
210 
211  float entries(sPNPedestal.getBinEntries(id));
212 
214  mePNQualitySummary.setBinContent(id, doMask ? kMUnknown : kUnknown);
215  continue;
216  }
217 
218  float mean(sPNPedestal.getBinContent(id));
219  float rms(sPNPedestal.getBinError(id) * sqrt(entries));
220 
221  mePNRMS.fill(id, rms);
222 
223  if(abs(mean - expectedPNMean_) > tolerancePNMean_ || rms > tolerancePNRMS_[gainItr->second])
224  mePNQualitySummary.setBinContent(id, doMask ? kMBad : kBad);
225  else
226  mePNQualitySummary.setBinContent(id, doMask ? kMGood : kGood);
227  }
228  }
229  }
230  }
unsigned memDCCIndex(unsigned)
static const int PEDESTAL_MIDDLE_GAIN_RMS_ERROR
void towerAverage_(MESet &, MESet const &, float)
static const int PEDESTAL_HIGH_GAIN_MEAN_ERROR
std::vector< float > toleranceRMS_
static const int PEDESTAL_LOW_GAIN_RMS_ERROR
static const int PEDESTAL_HIGH_GAIN_RMS_ERROR
T sqrt(T t)
Definition: SSEVec.h:48
StatusManager const * statusManager_
std::map< int, unsigned > pnGainToME_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MESetCollection sources_
static const int PEDESTAL_LOW_GAIN_MEAN_ERROR
Definition: DetId.h:18
std::vector< float > tolerancePNRMS_
MESetCollection MEs_
Definition: DQWorker.h:75
std::map< int, unsigned > gainToME_
static const int PEDESTAL_MIDDLE_GAIN_MEAN_ERROR
void ecaldqm::PedestalClient::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 31 of file PedestalClient.cc.

References Exception, expectedMean_, expectedPNMean_, gainToME_, ecaldqm::MESetMulti::getIndex(), edm::ParameterSet::getUntrackedParameter(), minChannelEntries_, EcalCondDBWriter_cfi::pedestal, pnGainToME_, ecaldqm::DQWorkerClient::qualitySummaries_, ecaldqm::DQWorkerClient::sources_, cond::to_string(), toleranceMean_, tolerancePNMean_, tolerancePNRMS_, and toleranceRMS_.

32  {
33  minChannelEntries_ = _params.getUntrackedParameter<int>("minChannelEntries");
34  expectedMean_ = _params.getUntrackedParameter<double>("expectedMean");
35  toleranceMean_ = _params.getUntrackedParameter<double>("toleranceMean");
36  expectedPNMean_ = _params.getUntrackedParameter<double>("expectedPNMean");
37  tolerancePNMean_ = _params.getUntrackedParameter<double>("tolerancePNMean");
38 
39  std::vector<int> MGPAGains(_params.getUntrackedParameter<std::vector<int> >("MGPAGains"));
40  std::vector<int> MGPAGainsPN(_params.getUntrackedParameter<std::vector<int> >("MGPAGainsPN"));
41 
43 
44  MESetMulti const& pedestal(static_cast<MESetMulti const&>(sources_.at("Pedestal")));
45  unsigned nG(MGPAGains.size());
46  for(unsigned iG(0); iG != nG; ++iG){
47  int gain(MGPAGains[iG]);
48  if(gain != 1 && gain != 6 && gain != 12) throw cms::Exception("InvalidConfiguration") << "MGPA gain";
49  repl["gain"] = std::to_string(gain);
50  gainToME_[gain] = pedestal.getIndex(repl);
51  }
52 
53  repl.clear();
54 
55  MESetMulti const& pnPedestal(static_cast<MESetMulti const&>(sources_.at("PNPedestal")));
56  unsigned nGPN(MGPAGainsPN.size());
57  for(unsigned iG(0); iG != nGPN; ++iG){
58  int gain(MGPAGainsPN[iG]);
59  if(gain != 1 && gain != 16) throw cms::Exception("InvalidConfiguration") << "PN MGPA gain";
60  repl["pngain"] = std::to_string(gain);
61  pnGainToME_[gain] = pnPedestal.getIndex(repl);
62  }
63 
64  toleranceRMS_.resize(nG);
65 
66  std::vector<double> inToleranceRMS(_params.getUntrackedParameter<std::vector<double> >("toleranceRMS"));
67 
68  for(std::map<int, unsigned>::iterator gainItr(gainToME_.begin()); gainItr != gainToME_.end(); ++gainItr){
69  unsigned iME(gainItr->second);
70  unsigned iGain(0);
71  switch(gainItr->first){
72  case 1:
73  iGain = 0; break;
74  case 6:
75  iGain = 1; break;
76  case 12:
77  iGain = 2; break;
78  }
79 
80  toleranceRMS_[iME] = inToleranceRMS[iGain];
81  }
82 
83  tolerancePNRMS_.resize(nGPN);
84 
85  std::vector<double> inTolerancePNRMS(_params.getUntrackedParameter<std::vector<double> >("tolerancePNRMS"));
86 
87  for(std::map<int, unsigned>::iterator gainItr(pnGainToME_.begin()); gainItr != pnGainToME_.end(); ++gainItr){
88  unsigned iME(gainItr->second);
89  unsigned iGain(0);
90  switch(gainItr->first){
91  case 1:
92  iGain = 0; break;
93  case 16:
94  iGain = 1; break;
95  }
96 
97  tolerancePNRMS_[iME] = inTolerancePNRMS[iGain];
98  }
99 
100  qualitySummaries_.insert("Quality");
101  qualitySummaries_.insert("QualitySummary");
102  qualitySummaries_.insert("PNQualitySummary");
103  }
std::vector< float > toleranceRMS_
std::string to_string(const T &t)
Definition: Logger.cc:26
std::set< std::string > qualitySummaries_
std::map< int, unsigned > pnGainToME_
MESetCollection sources_
std::vector< float > tolerancePNRMS_
std::map< int, unsigned > gainToME_
std::map< std::string, std::string > PathReplacements
Definition: MESet.h:31

Member Data Documentation

float ecaldqm::PedestalClient::expectedMean_
private

Definition at line 22 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::PedestalClient::expectedPNMean_
private

Definition at line 25 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

std::map<int, unsigned> ecaldqm::PedestalClient::gainToME_
private

Definition at line 18 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

int ecaldqm::PedestalClient::minChannelEntries_
private

Definition at line 21 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

std::map<int, unsigned> ecaldqm::PedestalClient::pnGainToME_
private

Definition at line 19 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::PedestalClient::toleranceMean_
private

Definition at line 23 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::PedestalClient::tolerancePNMean_
private

Definition at line 26 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

std::vector<float> ecaldqm::PedestalClient::tolerancePNRMS_
private

Definition at line 27 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

std::vector<float> ecaldqm::PedestalClient::toleranceRMS_
private

Definition at line 24 of file PedestalClient.h.

Referenced by producePlots(), and setParams().