CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ecaldqm::TestPulseClient Class Reference

#include <TestPulseClient.h>

Inheritance diagram for ecaldqm::TestPulseClient:
ecaldqm::DQWorkerClient ecaldqm::DQWorker

Public Member Functions

void producePlots (ProcessType) override
 
 TestPulseClient ()
 
 ~TestPulseClient () 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

std::vector< float > amplitudeThreshold_
 
std::map< int, unsigned > gainToME_
 
int minChannelEntries_
 
std::vector< float > PNAmplitudeThreshold_
 
std::map< int, unsigned > pnGainToME_
 
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)
 
- 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 TestPulseClient.h.

Constructor & Destructor Documentation

◆ TestPulseClient()

ecaldqm::TestPulseClient::TestPulseClient ( )

Definition at line 15 of file TestPulseClient.cc.

16  : DQWorkerClient(),
17  gainToME_(),
18  pnGainToME_(),
21  toleranceRMS_(0),
23  tolerancePNRMS_(0) {}
std::vector< float > PNAmplitudeThreshold_
std::vector< float > tolerancePNRMS_
std::map< int, unsigned > gainToME_
std::map< int, unsigned > pnGainToME_
std::vector< float > toleranceRMS_
std::vector< float > amplitudeThreshold_

◆ ~TestPulseClient()

ecaldqm::TestPulseClient::~TestPulseClient ( )
inlineoverride

Definition at line 10 of file TestPulseClient.h.

10 {}

Member Function Documentation

◆ producePlots()

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

Implements ecaldqm::DQWorkerClient.

Definition at line 108 of file TestPulseClient.cc.

References amplitudeThreshold_, ecaldqm::MESetCollection::at(), ecaldqm::MESetMulti::beginChannel(), EcalBarrel, EcalEndcap, ecaldqm::MESetMulti::end(), gainToME_, ecaldqm::MESetMulti::getBinContent(), ecaldqm::MESetMulti::getBinEntries(), ecaldqm::MESetMulti::getBinError(), ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), ecaldqm::DQWorker::GetTrigTowerMap(), l1ctLayer2EG_cff::id, ecaldqm::DQWorkerClient::kBad, ecaldqm::kEBmLow, ecaldqm::kEBpHigh, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMBad, ecaldqm::DQWorkerClient::kMGood, ecaldqm::DQWorkerClient::kMUnknown, ecaldqm::DQWorkerClient::kUnknown, gpuClustering::pixelStatus::mask, ecaldqm::MESetMulti::maskMatches(), ecaldqm::memDCCIndex(), ecaldqm::DQWorker::MEs_, minChannelEntries_, ecaldqm::nDCC, PNAmplitudeThreshold_, pnGainToME_, SiStripPI::rms, ecaldqm::MESetMulti::setBinContent(), ecaldqm::DQWorkerClient::sources_, mathSSE::sqrt(), ecaldqm::DQWorkerClient::statusManager_, EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_MEAN_ERROR, EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_RMS_ERROR, EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_MEAN_ERROR, EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_RMS_ERROR, EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_MEAN_ERROR, EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_RMS_ERROR, tolerancePNRMS_, toleranceRMS_, ecaldqm::MESet::iterator::toNextChannel(), ecaldqm::DQWorkerClient::towerAverage_(), and ecaldqm::MESetMulti::use().

108  {
109  using namespace std;
110 
111  MESetMulti& meQuality(static_cast<MESetMulti&>(MEs_.at("Quality")));
112  MESetMulti& meAmplitudeRMS(static_cast<MESetMulti&>(MEs_.at("AmplitudeRMS")));
113  MESetMulti& meQualitySummary(static_cast<MESetMulti&>(MEs_.at("QualitySummary")));
114  MESetMulti& mePNQualitySummary(static_cast<MESetMulti&>(MEs_.at("PNQualitySummary")));
115 
116  MESetMulti const& sAmplitude(static_cast<MESetMulti const&>(sources_.at("Amplitude")));
117  MESetMulti const& sPNAmplitude(static_cast<MESetMulti const&>(sources_.at("PNAmplitude")));
118 
119  for (map<int, unsigned>::iterator gainItr(gainToME_.begin()); gainItr != gainToME_.end(); ++gainItr) {
120  meQuality.use(gainItr->second);
121  meQualitySummary.use(gainItr->second);
122  meAmplitudeRMS.use(gainItr->second);
123 
124  sAmplitude.use(gainItr->second);
125 
126  uint32_t mask(0);
127  switch (gainItr->first) {
128  case 1:
131  break;
132  case 6:
135  break;
136  case 12:
139  break;
140  default:
141  break;
142  }
143 
144  MESet::iterator qEnd(meQuality.end(GetElectronicsMap()));
145  MESet::iterator rItr(GetElectronicsMap(), meAmplitudeRMS);
146  MESet::const_iterator aItr(GetElectronicsMap(), sAmplitude);
147  for (MESet::iterator qItr(meQuality.beginChannel(GetElectronicsMap())); qItr != qEnd;
148  qItr.toNextChannel(GetElectronicsMap())) {
149  DetId id(qItr->getId());
150 
151  bool doMask(meQuality.maskMatches(id, mask, statusManager_, GetTrigTowerMap()));
152 
153  aItr = qItr;
154  rItr = qItr;
155 
156  float entries(aItr->getBinEntries());
157 
158  if (entries < minChannelEntries_) {
159  qItr->setBinContent(doMask ? kMUnknown : kUnknown);
160  continue;
161  }
162 
163  float amp(aItr->getBinContent());
164  float rms(aItr->getBinError() * sqrt(entries));
165 
166  rItr->setBinContent(rms);
167 
168  if (amp < amplitudeThreshold_[gainItr->second] || rms > toleranceRMS_[gainItr->second])
169  qItr->setBinContent(doMask ? kMBad : kBad);
170  else
171  qItr->setBinContent(doMask ? kMGood : kGood);
172  }
173 
174  towerAverage_(meQualitySummary, meQuality, 0.2);
175  }
176 
177  for (map<int, unsigned>::iterator gainItr(pnGainToME_.begin()); gainItr != pnGainToME_.end(); ++gainItr) {
178  mePNQualitySummary.use(gainItr->second);
179 
180  sPNAmplitude.use(gainItr->second);
181 
182  uint32_t mask(0);
183  switch (gainItr->first) {
184  case 1:
187  break;
188  case 16:
191  break;
192  default:
193  break;
194  }
195 
196  for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) {
197  if (memDCCIndex(iDCC + 1) == unsigned(-1))
198  continue;
199 
200  for (unsigned iPN(0); iPN < 10; ++iPN) {
201  int subdet(0);
202  if (iDCC >= kEBmLow && iDCC <= kEBpHigh)
203  subdet = EcalBarrel;
204  else
205  subdet = EcalEndcap;
206 
207  EcalPnDiodeDetId id(subdet, iDCC + 1, iPN + 1);
208 
209  bool doMask(mePNQualitySummary.maskMatches(id, mask, statusManager_, GetTrigTowerMap()));
210 
211  float amp(sPNAmplitude.getBinContent(getEcalDQMSetupObjects(), id));
212  float entries(sPNAmplitude.getBinEntries(getEcalDQMSetupObjects(), id));
213  float rms(sPNAmplitude.getBinError(getEcalDQMSetupObjects(), id) * sqrt(entries));
214 
215  if (entries < minChannelEntries_) {
216  mePNQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, doMask ? kMUnknown : kUnknown);
217  continue;
218  }
219 
220  if (amp < PNAmplitudeThreshold_[gainItr->second] || rms > tolerancePNRMS_[gainItr->second])
221  mePNQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, doMask ? kMBad : kBad);
222  else
223  mePNQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, doMask ? kMGood : kGood);
224  }
225  }
226  }
227  }
unsigned memDCCIndex(unsigned)
void towerAverage_(MESet &, MESet const &, float)
static const int TESTPULSE_LOW_GAIN_RMS_ERROR
MESet & at(const std::string &key)
Definition: MESet.h:399
std::vector< float > PNAmplitudeThreshold_
static const int TESTPULSE_MIDDLE_GAIN_MEAN_ERROR
std::vector< float > tolerancePNRMS_
constexpr uint32_t mask
Definition: gpuClustering.h:26
std::map< int, unsigned > gainToME_
static const int TESTPULSE_MIDDLE_GAIN_RMS_ERROR
T sqrt(T t)
Definition: SSEVec.h:19
StatusManager const * statusManager_
static const int TESTPULSE_HIGH_GAIN_RMS_ERROR
MESetCollection sources_
std::map< int, unsigned > pnGainToME_
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:150
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:170
Definition: DetId.h:17
static const int TESTPULSE_LOW_GAIN_MEAN_ERROR
MESetCollection MEs_
Definition: DQWorker.h:131
std::vector< float > toleranceRMS_
std::vector< float > amplitudeThreshold_
EcalTrigTowerConstituentsMap const * GetTrigTowerMap()
Definition: DQWorker.cc:155
static const int TESTPULSE_HIGH_GAIN_MEAN_ERROR

◆ setParams()

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

Reimplemented from ecaldqm::DQWorker.

Definition at line 25 of file TestPulseClient.cc.

References l1extraParticles_cfi::_params, CustomPhysics_cfi::amplitude, amplitudeThreshold_, ecaldqm::MESetCollection::at(), Exception, PedestalClient_cfi::gain, gainToME_, ecaldqm::MESetMulti::getIndex(), PedestalClient_cfi::MGPAGains, PedestalClient_cfi::MGPAGainsPN, minChannelEntries_, PNAmplitudeThreshold_, pnGainToME_, ecaldqm::DQWorkerClient::qualitySummaries_, ecaldqm::DQWorkerClient::sources_, cond::impl::to_string(), tolerancePNRMS_, and toleranceRMS_.

25  {
26  minChannelEntries_ = _params.getUntrackedParameter<int>("minChannelEntries");
27 
28  std::vector<int> MGPAGains(_params.getUntrackedParameter<std::vector<int> >("MGPAGains"));
29  std::vector<int> MGPAGainsPN(_params.getUntrackedParameter<std::vector<int> >("MGPAGainsPN"));
30 
32 
33  MESetMulti const& amplitude(static_cast<MESetMulti const&>(sources_.at("Amplitude")));
34  unsigned nG(MGPAGains.size());
35  for (unsigned iG(0); iG != nG; ++iG) {
36  int gain(MGPAGains[iG]);
37  if (gain != 1 && gain != 6 && gain != 12)
38  throw cms::Exception("InvalidConfiguration") << "MGPA gain";
39  repl["gain"] = std::to_string(gain);
40  gainToME_[gain] = amplitude.getIndex(repl);
41  }
42 
43  repl.clear();
44 
45  MESetMulti const& pnAmplitude(static_cast<MESetMulti const&>(sources_.at("PNAmplitude")));
46  unsigned nGPN(MGPAGainsPN.size());
47  for (unsigned iG(0); iG != nGPN; ++iG) {
48  int gain(MGPAGainsPN[iG]);
49  if (gain != 1 && gain != 16)
50  throw cms::Exception("InvalidConfiguration") << "PN MGPA gain";
51  repl["pngain"] = std::to_string(gain);
52  pnGainToME_[gain] = pnAmplitude.getIndex(repl);
53  }
54 
55  amplitudeThreshold_.resize(nG);
56  toleranceRMS_.resize(nG);
57 
58  std::vector<double> inAmplitudeThreshold(_params.getUntrackedParameter<std::vector<double> >("amplitudeThreshold"));
59  std::vector<double> inToleranceRMS(_params.getUntrackedParameter<std::vector<double> >("toleranceRMS"));
60 
61  for (std::map<int, unsigned>::iterator gainItr(gainToME_.begin()); gainItr != gainToME_.end(); ++gainItr) {
62  unsigned iME(gainItr->second);
63  unsigned iGain(0);
64  switch (gainItr->first) {
65  case 1:
66  iGain = 0;
67  break;
68  case 6:
69  iGain = 1;
70  break;
71  case 12:
72  iGain = 2;
73  break;
74  }
75 
76  amplitudeThreshold_[iME] = inAmplitudeThreshold[iGain];
77  toleranceRMS_[iME] = inToleranceRMS[iGain];
78  }
79 
80  PNAmplitudeThreshold_.resize(nGPN);
81  tolerancePNRMS_.resize(nGPN);
82 
83  std::vector<double> inPNAmplitudeThreshold(
84  _params.getUntrackedParameter<std::vector<double> >("PNAmplitudeThreshold"));
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;
93  break;
94  case 16:
95  iGain = 1;
96  break;
97  }
98 
99  PNAmplitudeThreshold_[iME] = inPNAmplitudeThreshold[iGain];
100  tolerancePNRMS_[iME] = inTolerancePNRMS[iGain];
101  }
102 
103  qualitySummaries_.insert("Quality");
104  qualitySummaries_.insert("QualitySummary");
105  qualitySummaries_.insert("PNQualitySummary");
106  }
MESet & at(const std::string &key)
Definition: MESet.h:399
std::vector< float > PNAmplitudeThreshold_
std::string to_string(const V &value)
Definition: OMSAccess.h:71
std::vector< float > tolerancePNRMS_
std::map< int, unsigned > gainToME_
std::set< std::string > qualitySummaries_
MESetCollection sources_
std::map< int, unsigned > pnGainToME_
std::vector< float > toleranceRMS_
std::vector< float > amplitudeThreshold_
std::map< std::string, std::string > PathReplacements
Definition: MESet.h:46

Member Data Documentation

◆ amplitudeThreshold_

std::vector<float> ecaldqm::TestPulseClient::amplitudeThreshold_
private

Definition at line 21 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

◆ gainToME_

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

Definition at line 17 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

◆ minChannelEntries_

int ecaldqm::TestPulseClient::minChannelEntries_
private

Definition at line 20 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

◆ PNAmplitudeThreshold_

std::vector<float> ecaldqm::TestPulseClient::PNAmplitudeThreshold_
private

Definition at line 23 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

◆ pnGainToME_

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

Definition at line 18 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

◆ tolerancePNRMS_

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

Definition at line 24 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

◆ toleranceRMS_

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

Definition at line 22 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().