CMS 3D CMS Logo

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 () override
 
- 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 ()
 
void resetPerLumi ()
 
bool retrieveSource (DQMStore::IGetter &, ProcessType)
 
bool runsOn (ProcessType _type) const
 
void setStatusManager (StatusManager const &_manager)
 
virtual void setTokens (edm::ConsumesCollector &)
 
 ~DQWorkerClient () override
 
- 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 &)
 
bool checkElectronicsMap (bool=true)
 
bool checkGeometry (bool=true)
 
bool checkTopology (bool=true)
 
bool checkTrigTowerMap (bool=true)
 
 DQWorker ()
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
EcalDQMSetupObjects const getEcalDQMSetupObjects ()
 
EcalElectronicsMapping const * GetElectronicsMap ()
 
CaloGeometry const * GetGeometry ()
 
std::string const & getName () const
 
CaloTopology const * GetTopology ()
 
EcalTrigTowerConstituentsMap const * GetTrigTowerMap ()
 
bool onlineMode () const
 
void setEventNumber (edm::EventNumber_t _e)
 
void setLumiNumber (edm::LuminosityBlockNumber_t _l)
 
void setRunNumber (edm::RunNumber_t _r)
 
void setSetupObjects (edm::EventSetup const &)
 
void setSetupObjectsEndLumi (edm::EventSetup const &)
 
void setTime (time_t _t)
 
void setTokens (edm::ConsumesCollector &)
 
virtual ~DQWorker () noexcept(false)
 

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 > toleranceRMSEB_
 
std::vector< float > toleranceRMSEE_
 

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)
 
- Public Attributes inherited from ecaldqm::DQWorker
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdelecMapHandle
 
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdelecMapHandleEndLumi
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomHandle
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomHandleEndLumi
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordtopoHandle
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordtopoHandleEndLumi
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapHandle
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapHandleEndLumi
 
- Protected Types inherited from ecaldqm::DQWorker
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- 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 7 of file PedestalClient.h.

Constructor & Destructor Documentation

◆ PedestalClient()

ecaldqm::PedestalClient::PedestalClient ( )

Definition at line 15 of file PedestalClient.cc.

16  : DQWorkerClient(),
17  gainToME_(),
18  pnGainToME_(),
20  expectedMean_(0.),
21  toleranceMean_(0.),
22  toleranceRMSEB_(0),
23  toleranceRMSEE_(0),
24  expectedPNMean_(0.),
25  tolerancePNMean_(0.),
26  tolerancePNRMS_(0) {}
std::map< int, unsigned > pnGainToME_
std::vector< float > toleranceRMSEB_
std::vector< float > tolerancePNRMS_
std::map< int, unsigned > gainToME_
std::vector< float > toleranceRMSEE_

◆ ~PedestalClient()

ecaldqm::PedestalClient::~PedestalClient ( )
inlineoverride

Definition at line 10 of file PedestalClient.h.

10 {}

Member Function Documentation

◆ producePlots()

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

Implements ecaldqm::DQWorkerClient.

Definition at line 111 of file PedestalClient.cc.

References funct::abs(), ecaldqm::MESetCollection::at(), ecaldqm::MESetMulti::beginChannel(), EcalBarrel, EcalEndcap, ecaldqm::MESetMulti::end(), expectedMean_, expectedPNMean_, ecaldqm::MESetMulti::fill(), gainToME_, ecaldqm::MESetMulti::getBinContent(), ecaldqm::MESetMulti::getBinEntries(), ecaldqm::MESetMulti::getBinError(), ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), ecaldqm::DQWorker::GetTrigTowerMap(), l1ctLayer2EG_cff::id, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), ecaldqm::DQWorkerClient::kBad, ecaldqm::kEBmLow, ecaldqm::kEBpHigh, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMBad, ecaldqm::DQWorkerClient::kMGood, ecaldqm::DQWorkerClient::kMUnknown, ecaldqm::DQWorkerClient::kUnknown, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, ecaldqm::MESetMulti::maskMatches(), SiStripPI::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_, SiStripPI::rms, ecaldqm::MESetMulti::setBinContent(), ecaldqm::DQWorkerClient::sources_, mathSSE::sqrt(), ecaldqm::DQWorkerClient::statusManager_, toleranceMean_, tolerancePNMean_, tolerancePNRMS_, toleranceRMSEB_, toleranceRMSEE_, ecaldqm::MESet::iterator::toNextChannel(), ecaldqm::DQWorkerClient::towerAverage_(), and ecaldqm::MESetMulti::use().

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

◆ setParams()

void ecaldqm::PedestalClient::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 28 of file PedestalClient.cc.

References l1extraParticles_cfi::_params, ecaldqm::MESetCollection::at(), Exception, expectedMean_, expectedPNMean_, PedestalClient_cfi::gain, gainToME_, ecaldqm::MESetMulti::getIndex(), PedestalClient_cfi::MGPAGains, PedestalClient_cfi::MGPAGainsPN, minChannelEntries_, EcalCondDBWriter_cfi::pedestal, pnGainToME_, ecaldqm::DQWorkerClient::qualitySummaries_, ecaldqm::DQWorkerClient::sources_, to_string(), toleranceMean_, tolerancePNMean_, tolerancePNRMS_, toleranceRMSEB_, and toleranceRMSEE_.

28  {
29  minChannelEntries_ = _params.getUntrackedParameter<int>("minChannelEntries");
30  expectedMean_ = _params.getUntrackedParameter<double>("expectedMean");
31  toleranceMean_ = _params.getUntrackedParameter<double>("toleranceMean");
32  expectedPNMean_ = _params.getUntrackedParameter<double>("expectedPNMean");
33  tolerancePNMean_ = _params.getUntrackedParameter<double>("tolerancePNMean");
34 
35  std::vector<int> MGPAGains(_params.getUntrackedParameter<std::vector<int> >("MGPAGains"));
36  std::vector<int> MGPAGainsPN(_params.getUntrackedParameter<std::vector<int> >("MGPAGainsPN"));
37 
39 
40  MESetMulti const& pedestal(static_cast<MESetMulti const&>(sources_.at("Pedestal")));
41  unsigned nG(MGPAGains.size());
42  for (unsigned iG(0); iG != nG; ++iG) {
43  int gain(MGPAGains[iG]);
44  if (gain != 1 && gain != 6 && gain != 12)
45  throw cms::Exception("InvalidConfiguration") << "MGPA gain";
46  repl["gain"] = std::to_string(gain);
47  gainToME_[gain] = pedestal.getIndex(repl);
48  }
49 
50  repl.clear();
51 
52  MESetMulti const& pnPedestal(static_cast<MESetMulti const&>(sources_.at("PNPedestal")));
53  unsigned nGPN(MGPAGainsPN.size());
54  for (unsigned iG(0); iG != nGPN; ++iG) {
55  int gain(MGPAGainsPN[iG]);
56  if (gain != 1 && gain != 16)
57  throw cms::Exception("InvalidConfiguration") << "PN MGPA gain";
58  repl["pngain"] = std::to_string(gain);
59  pnGainToME_[gain] = pnPedestal.getIndex(repl);
60  }
61 
62  toleranceRMSEB_.resize(nG);
63  toleranceRMSEE_.resize(nG);
64 
65  std::vector<double> inToleranceRMSEB(_params.getUntrackedParameter<std::vector<double> >("toleranceRMSEB"));
66  std::vector<double> inToleranceRMSEE(_params.getUntrackedParameter<std::vector<double> >("toleranceRMSEE"));
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;
74  break;
75  case 6:
76  iGain = 1;
77  break;
78  case 12:
79  iGain = 2;
80  break;
81  }
82 
83  toleranceRMSEB_[iME] = inToleranceRMSEB[iGain];
84  toleranceRMSEE_[iME] = inToleranceRMSEE[iGain];
85  }
86 
87  tolerancePNRMS_.resize(nGPN);
88 
89  std::vector<double> inTolerancePNRMS(_params.getUntrackedParameter<std::vector<double> >("tolerancePNRMS"));
90 
91  for (std::map<int, unsigned>::iterator gainItr(pnGainToME_.begin()); gainItr != pnGainToME_.end(); ++gainItr) {
92  unsigned iME(gainItr->second);
93  unsigned iGain(0);
94  switch (gainItr->first) {
95  case 1:
96  iGain = 0;
97  break;
98  case 16:
99  iGain = 1;
100  break;
101  }
102 
103  tolerancePNRMS_[iME] = inTolerancePNRMS[iGain];
104  }
105 
106  qualitySummaries_.insert("Quality");
107  qualitySummaries_.insert("QualitySummary");
108  qualitySummaries_.insert("PNQualitySummary");
109  }
MESet & at(const std::string &key)
Definition: MESet.h:399
static std::string to_string(const XMLCh *ch)
std::set< std::string > qualitySummaries_
std::map< int, unsigned > pnGainToME_
MESetCollection sources_
std::vector< float > toleranceRMSEB_
std::vector< float > tolerancePNRMS_
std::map< int, unsigned > gainToME_
std::map< std::string, std::string > PathReplacements
Definition: MESet.h:46
std::vector< float > toleranceRMSEE_

Member Data Documentation

◆ expectedMean_

float ecaldqm::PedestalClient::expectedMean_
private

Definition at line 21 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

◆ expectedPNMean_

float ecaldqm::PedestalClient::expectedPNMean_
private

Definition at line 25 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

◆ gainToME_

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

Definition at line 17 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

◆ minChannelEntries_

int ecaldqm::PedestalClient::minChannelEntries_
private

Definition at line 20 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

◆ pnGainToME_

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

Definition at line 18 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

◆ toleranceMean_

float ecaldqm::PedestalClient::toleranceMean_
private

Definition at line 22 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

◆ tolerancePNMean_

float ecaldqm::PedestalClient::tolerancePNMean_
private

Definition at line 26 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

◆ tolerancePNRMS_

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

Definition at line 27 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

◆ toleranceRMSEB_

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

Definition at line 23 of file PedestalClient.h.

Referenced by producePlots(), and setParams().

◆ toleranceRMSEE_

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

Definition at line 24 of file PedestalClient.h.

Referenced by producePlots(), and setParams().