CMS 3D CMS Logo

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

#include <LedClient.h>

Inheritance diagram for ecaldqm::LedClient:
ecaldqm::DQWorkerClient ecaldqm::DQWorker

Public Member Functions

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

Private Member Functions

void setParams (edm::ParameterSet const &) override
 

Private Attributes

std::vector< double > expectedAmplitude_
 
std::vector< double > expectedPNAmplitude_
 
std::vector< double > expectedTiming_
 
float forwardFactor_
 
int minChannelEntries_
 
double toleranceAmplitude_
 
double toleranceAmpRMSRatio_
 
double tolerancePNAmp_
 
double tolerancePNRMSRatio_
 
double toleranceTiming_
 
double toleranceTimRMS_
 
std::map< int, unsigned > wlToME_
 

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 LedClient.h.

Constructor & Destructor Documentation

ecaldqm::LedClient::LedClient ( )

Definition at line 16 of file LedClient.cc.

16  :
18  wlToME_(),
23  expectedTiming_(0),
24  toleranceTiming_(0.),
25  toleranceTimRMS_(0.),
27  tolerancePNAmp_(0.),
29  forwardFactor_(0.)
30  {
31  }
double toleranceAmplitude_
Definition: LedClient.h:22
float forwardFactor_
Definition: LedClient.h:30
std::map< int, unsigned > wlToME_
Definition: LedClient.h:18
std::vector< double > expectedTiming_
Definition: LedClient.h:24
std::vector< double > expectedAmplitude_
Definition: LedClient.h:21
std::vector< double > expectedPNAmplitude_
Definition: LedClient.h:27
double toleranceAmpRMSRatio_
Definition: LedClient.h:23
double toleranceTimRMS_
Definition: LedClient.h:26
double toleranceTiming_
Definition: LedClient.h:25
double tolerancePNAmp_
Definition: LedClient.h:28
double tolerancePNRMSRatio_
Definition: LedClient.h:29
ecaldqm::LedClient::~LedClient ( )
inline

Definition at line 11 of file LedClient.h.

References producePlots(), and setParams().

11 {}

Member Function Documentation

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

Implements ecaldqm::DQWorkerClient.

Definition at line 84 of file LedClient.cc.

References funct::abs(), ecaldqm::MESetMulti::beginChannel(), DEFINE_ECALDQM_WORKER, EcalEndcap, patPFMETCorrections_cff::enabled, ecaldqm::MESetMulti::end(), expectedAmplitude_, expectedPNAmplitude_, expectedTiming_, ecaldqm::MESetMulti::fill(), forwardFactor_, ecaldqm::MESetMulti::getBinContent(), ecaldqm::MESet::getBinContent(), ecaldqm::MESetMulti::getBinEntries(), ecaldqm::MESetMulti::getBinError(), hcalTTPDigis_cfi::id, ecaldqm::isForward(), ecaldqm::DQWorkerClient::kBad, ecaldqm::kEBmLow, ecaldqm::kEBpHigh, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMBad, ecaldqm::DQWorkerClient::kMGood, ecaldqm::DQWorkerClient::kMUnknown, ecaldqm::DQWorkerClient::kUnknown, EcalDQMStatusHelper::LED_MEAN_ERROR, EcalDQMStatusHelper::LED_RMS_ERROR, EcalDQMStatusHelper::LED_TIMING_MEAN_ERROR, EcalDQMStatusHelper::LED_TIMING_RMS_ERROR, RecoTauDiscriminantConfiguration::mask, ecaldqm::MESetMulti::maskMatches(), ecaldqm::memDCCIndex(), ecaldqm::DQWorker::MEs_, minChannelEntries_, ecaldqm::nDCC, funct::pow(), ecaldqm::MESetMulti::setBinContent(), ecaldqm::DQWorkerClient::sources_, mathSSE::sqrt(), ecaldqm::DQWorkerClient::statusManager_, toleranceAmpRMSRatio_, tolerancePNRMSRatio_, toleranceTiming_, toleranceTimRMS_, ecaldqm::MESet::iterator::toNextChannel(), ecaldqm::DQWorkerClient::towerAverage_(), ecaldqm::MESetMulti::use(), and wlToME_.

Referenced by ~LedClient().

85  {
90 
91  MESetMulti& meQuality(static_cast<MESetMulti&>(MEs_.at("Quality")));
92  MESetMulti& meQualitySummary(static_cast<MESetMulti&>(MEs_.at("QualitySummary")));
93  MESetMulti& meAmplitudeMean(static_cast<MESetMulti&>(MEs_.at("AmplitudeMean")));
94  MESetMulti& meAmplitudeRMS(static_cast<MESetMulti&>(MEs_.at("AmplitudeRMS")));
95  MESetMulti& meTimingMean(static_cast<MESetMulti&>(MEs_.at("TimingMean")));
96  MESetMulti& meTimingRMSMap(static_cast<MESetMulti&>(MEs_.at("TimingRMSMap")));
97  MESetMulti& mePNQualitySummary(static_cast<MESetMulti&>(MEs_.at("PNQualitySummary")));
98 
99  MESetMulti const& sAmplitude(static_cast<MESetMulti const&>(sources_.at("Amplitude")));
100  MESetMulti const& sTiming(static_cast<MESetMulti const&>(sources_.at("Timing")));
101  MESetMulti const& sPNAmplitude(static_cast<MESetMulti const&>(sources_.at("PNAmplitude")));
102  MESet const& sCalibStatus(static_cast<MESet const&>(sources_.at("CalibStatus")));
103 
104  for(std::map<int, unsigned>::iterator wlItr(wlToME_.begin()); wlItr != wlToME_.end(); ++wlItr){
105  meQuality.use(wlItr->second);
106  meQualitySummary.use(wlItr->second);
107  meAmplitudeMean.use(wlItr->second);
108  meAmplitudeRMS.use(wlItr->second);
109  meTimingMean.use(wlItr->second);
110  meTimingRMSMap.use(wlItr->second);
111  mePNQualitySummary.use(wlItr->second);
112 
113  sAmplitude.use(wlItr->second);
114  sTiming.use(wlItr->second);
115  sPNAmplitude.use(wlItr->second);
116 
117  MESet::iterator qEnd(meQuality.end());
118 
119  MESet::const_iterator tItr(sTiming);
120  MESet::const_iterator aItr(sAmplitude);
121 
122  int wl(wlItr->first+3);
123  bool enabled(wl < 0? false: sCalibStatus.getBinContent(wl) > 0 ? true: false);
124  for(MESet::iterator qItr(meQuality.beginChannel()); qItr != qEnd; qItr.toNextChannel()){
125 
126  DetId id(qItr->getId());
127 
128  bool doMask(meQuality.maskMatches(id, mask, statusManager_));
129 
130  aItr = qItr;
131 
132  float aEntries(aItr->getBinEntries());
133 
134  if(aEntries < minChannelEntries_){
135  qItr->setBinContent(enabled ? (doMask ? kMUnknown : kUnknown) : kMUnknown);
136  continue;
137  }
138 
139  float aMean(aItr->getBinContent());
140  float aRms(aItr->getBinError() * sqrt(aEntries));
141 
142  meAmplitudeMean.fill(id, aMean);
143  meAmplitudeRMS.setBinContent(id, aRms);
144 
145  tItr = qItr;
146 
147  float tEntries(tItr->getBinEntries());
148 
149  if(tEntries < minChannelEntries_) continue;
150 
151  float tMean(tItr->getBinContent());
152  float tRms(tItr->getBinError() * sqrt(tEntries));
153 
154  meTimingMean.fill(id, tMean);
155  meTimingRMSMap.setBinContent(id, tRms);
156 
157  float intensity(aMean / expectedAmplitude_[wlItr->second]);
158  if(isForward(id)) intensity /= forwardFactor_;
159 
160  float aRmsThr( sqrt(pow(aMean*toleranceAmpRMSRatio_,2) + pow(3.,2)) );
161  if(intensity < toleranceAmplitude_ || aRms > aRmsThr ||
162  std::abs(tMean - expectedTiming_[wlItr->second]) > toleranceTiming_ || tRms > toleranceTimRMS_)
163  qItr->setBinContent(doMask ? kMBad : kBad);
164  else
165  qItr->setBinContent(doMask ? kMGood : kGood);
166  }
167 
168  towerAverage_(meQualitySummary, meQuality, 0.2);
169 
170  for(unsigned iDCC(0); iDCC < nDCC; ++iDCC){
171 
172  if(memDCCIndex(iDCC + 1) == unsigned(-1)) continue;
173  if(iDCC >= kEBmLow && iDCC <= kEBpHigh) continue;
174 
175  for(unsigned iPN(0); iPN < 10; ++iPN){
176  EcalPnDiodeDetId id(EcalEndcap, iDCC + 1, iPN + 1);
177 
178  bool doMask(mePNQualitySummary.maskMatches(id, mask, statusManager_));
179 
180  float pEntries(sPNAmplitude.getBinEntries(id));
181 
182  if(pEntries < minChannelEntries_){
183  mePNQualitySummary.setBinContent(id, doMask ? kMUnknown : kUnknown);
184  continue;
185  }
186 
187  float pMean(sPNAmplitude.getBinContent(id));
188  float pRms(sPNAmplitude.getBinError(id) * sqrt(pEntries));
189  float intensity(pMean / expectedPNAmplitude_[wlItr->second]);
190 
191  if(intensity < tolerancePNAmp_ || pRms > pMean * tolerancePNRMSRatio_)
192  mePNQualitySummary.setBinContent(id, doMask ? kMBad : kBad);
193  else
194  mePNQualitySummary.setBinContent(id, doMask ? kMGood : kGood);
195  }
196  }
197  }
198  }
static const int LED_MEAN_ERROR
unsigned memDCCIndex(unsigned)
void towerAverage_(MESet &, MESet const &, float)
bool isForward(DetId const &)
float forwardFactor_
Definition: LedClient.h:30
std::map< int, unsigned > wlToME_
Definition: LedClient.h:18
std::vector< double > expectedTiming_
Definition: LedClient.h:24
T sqrt(T t)
Definition: SSEVec.h:18
StatusManager const * statusManager_
std::vector< double > expectedAmplitude_
Definition: LedClient.h:21
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > expectedPNAmplitude_
Definition: LedClient.h:27
static const int LED_TIMING_MEAN_ERROR
double toleranceAmpRMSRatio_
Definition: LedClient.h:23
MESetCollection sources_
Definition: DetId.h:18
static const int LED_TIMING_RMS_ERROR
MESetCollection MEs_
Definition: DQWorker.h:75
double toleranceTimRMS_
Definition: LedClient.h:26
double toleranceTiming_
Definition: LedClient.h:25
static const int LED_RMS_ERROR
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double tolerancePNRMSRatio_
Definition: LedClient.h:29
void ecaldqm::LedClient::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 34 of file LedClient.cc.

References CustomPhysics_cfi::amplitude, Exception, expectedAmplitude_, expectedPNAmplitude_, expectedTiming_, forwardFactor_, ecaldqm::MESetMulti::getIndex(), edm::ParameterSet::getUntrackedParameter(), minChannelEntries_, ecaldqm::DQWorkerClient::qualitySummaries_, ecaldqm::DQWorkerClient::sources_, toleranceAmplitude_, toleranceAmpRMSRatio_, tolerancePNAmp_, tolerancePNRMSRatio_, toleranceTiming_, toleranceTimRMS_, and wlToME_.

Referenced by ~LedClient().

35  {
36  minChannelEntries_ = _params.getUntrackedParameter<int>("minChannelEntries");
37  toleranceAmplitude_ = _params.getUntrackedParameter<double>("toleranceAmplitude");
38  toleranceAmpRMSRatio_ = _params.getUntrackedParameter<double>("toleranceAmpRMSRatio");
39  toleranceTiming_ = _params.getUntrackedParameter<double>("toleranceTiming");
40  toleranceTimRMS_ = _params.getUntrackedParameter<double>("toleranceTimRMS");
41  tolerancePNAmp_ = _params.getUntrackedParameter<double>("tolerancePNAmp");
42  tolerancePNRMSRatio_ = _params.getUntrackedParameter<double>("tolerancePNRMSRatio");
43  forwardFactor_ = _params.getUntrackedParameter<double>("forwardFactor");
44 
45  std::vector<int> ledWavelengths(_params.getUntrackedParameter<std::vector<int> >("ledWavelengths"));
46 
47  // wavelengths are not necessarily ordered
48  // create a map wl -> MESet index
49  // using Amplitude here but any multi-wavelength plot is fine
50 
52 
53  MESetMulti const& amplitude(static_cast<MESetMulti const&>(sources_.at("Amplitude")));
54  unsigned nWL(ledWavelengths.size());
55  for(unsigned iWL(0); iWL != nWL; ++iWL){
56  int wl(ledWavelengths[iWL]);
57  if(wl != 1 && wl != 2) throw cms::Exception("InvalidConfiguration") << "Led Wavelength";
58  repl["wl"] = std::to_string(wl);
59  wlToME_[wl] = amplitude.getIndex(repl);
60  }
61 
62  expectedAmplitude_.resize(nWL);
63  expectedTiming_.resize(nWL);
64  expectedPNAmplitude_.resize(nWL);
65 
66  std::vector<double> inExpectedAmplitude(_params.getUntrackedParameter<std::vector<double> >("expectedAmplitude"));
67  std::vector<double> inExpectedTiming(_params.getUntrackedParameter<std::vector<double> >("expectedTiming"));
68  std::vector<double> inExpectedPNAmplitude(_params.getUntrackedParameter<std::vector<double> >("expectedPNAmplitude"));
69 
70  for(std::map<int, unsigned>::iterator wlItr(wlToME_.begin()); wlItr != wlToME_.end(); ++wlItr){
71  unsigned iME(wlItr->second);
72  int iWL(wlItr->first - 1);
73  expectedAmplitude_[iME] = inExpectedAmplitude[iWL];
74  expectedTiming_[iME] = inExpectedTiming[iWL];
75  expectedPNAmplitude_[iME] = inExpectedPNAmplitude[iWL];
76  }
77 
78  qualitySummaries_.insert("Quality");
79  qualitySummaries_.insert("QualitySummary");
80  qualitySummaries_.insert("PNQualitySummary");
81  }
double toleranceAmplitude_
Definition: LedClient.h:22
float forwardFactor_
Definition: LedClient.h:30
std::map< int, unsigned > wlToME_
Definition: LedClient.h:18
std::set< std::string > qualitySummaries_
std::vector< double > expectedTiming_
Definition: LedClient.h:24
std::vector< double > expectedAmplitude_
Definition: LedClient.h:21
std::vector< double > expectedPNAmplitude_
Definition: LedClient.h:27
double toleranceAmpRMSRatio_
Definition: LedClient.h:23
MESetCollection sources_
double toleranceTimRMS_
Definition: LedClient.h:26
double toleranceTiming_
Definition: LedClient.h:25
double tolerancePNAmp_
Definition: LedClient.h:28
std::map< std::string, std::string > PathReplacements
Definition: MESet.h:31
double tolerancePNRMSRatio_
Definition: LedClient.h:29

Member Data Documentation

std::vector<double> ecaldqm::LedClient::expectedAmplitude_
private

Definition at line 21 of file LedClient.h.

Referenced by producePlots(), and setParams().

std::vector<double> ecaldqm::LedClient::expectedPNAmplitude_
private

Definition at line 27 of file LedClient.h.

Referenced by producePlots(), and setParams().

std::vector<double> ecaldqm::LedClient::expectedTiming_
private

Definition at line 24 of file LedClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::LedClient::forwardFactor_
private

Definition at line 30 of file LedClient.h.

Referenced by producePlots(), and setParams().

int ecaldqm::LedClient::minChannelEntries_
private

Definition at line 20 of file LedClient.h.

Referenced by producePlots(), and setParams().

double ecaldqm::LedClient::toleranceAmplitude_
private

Definition at line 22 of file LedClient.h.

Referenced by setParams().

double ecaldqm::LedClient::toleranceAmpRMSRatio_
private

Definition at line 23 of file LedClient.h.

Referenced by producePlots(), and setParams().

double ecaldqm::LedClient::tolerancePNAmp_
private

Definition at line 28 of file LedClient.h.

Referenced by setParams().

double ecaldqm::LedClient::tolerancePNRMSRatio_
private

Definition at line 29 of file LedClient.h.

Referenced by producePlots(), and setParams().

double ecaldqm::LedClient::toleranceTiming_
private

Definition at line 25 of file LedClient.h.

Referenced by producePlots(), and setParams().

double ecaldqm::LedClient::toleranceTimRMS_
private

Definition at line 26 of file LedClient.h.

Referenced by producePlots(), and setParams().

std::map<int, unsigned> ecaldqm::LedClient::wlToME_
private

Definition at line 18 of file LedClient.h.

Referenced by producePlots(), and setParams().