CMS 3D CMS Logo

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

#include <LaserClient.h>

Inheritance diagram for ecaldqm::LaserClient:
ecaldqm::DQWorkerClient ecaldqm::DQWorker

Public Member Functions

 LaserClient ()
 
void producePlots (ProcessType) override
 
 ~LaserClient ()
 
- 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< float > expectedAmplitude_
 
std::vector< float > expectedPNAmplitude_
 
std::vector< float > expectedTiming_
 
float forwardFactor_
 
int minChannelEntries_
 
float toleranceAmplitudeHi_
 
float toleranceAmplitudeLo_
 
float toleranceAmpRMSRatio_
 
float tolerancePNAmp_
 
float tolerancePNRMSRatio_
 
float toleranceTiming_
 
float 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 LaserClient.h.

Constructor & Destructor Documentation

ecaldqm::LaserClient::LaserClient ( )

Definition at line 16 of file LaserClient.cc.

16  :
18  wlToME_(),
24  expectedTiming_(0),
25  toleranceTiming_(0.),
26  toleranceTimRMS_(0.),
28  tolerancePNAmp_(0.),
30  forwardFactor_(0.)
31  {
32  }
std::map< int, unsigned > wlToME_
Definition: LaserClient.h:18
std::vector< float > expectedPNAmplitude_
Definition: LaserClient.h:28
std::vector< float > expectedAmplitude_
Definition: LaserClient.h:21
std::vector< float > expectedTiming_
Definition: LaserClient.h:25
ecaldqm::LaserClient::~LaserClient ( )
inline

Definition at line 11 of file LaserClient.h.

References producePlots(), and setParams().

11 {}

Member Function Documentation

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

Implements ecaldqm::DQWorkerClient.

Definition at line 86 of file LaserClient.cc.

References funct::abs(), ecaldqm::MESetMulti::beginChannel(), DEFINE_ECALDQM_WORKER, EcalBarrel, 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::LASER_MEAN_ERROR, EcalDQMStatusHelper::LASER_RMS_ERROR, EcalDQMStatusHelper::LASER_TIMING_MEAN_ERROR, EcalDQMStatusHelper::LASER_TIMING_RMS_ERROR, RecoTauDiscriminantConfiguration::mask, ecaldqm::MESetMulti::maskMatches(), ecaldqm::memDCCIndex(), ecaldqm::DQWorker::MEs_, minChannelEntries_, ecaldqm::nDCC, ecaldqm::MESetMulti::setBinContent(), ecaldqm::DQWorkerClient::sources_, mathSSE::sqrt(), ecaldqm::DQWorkerClient::statusManager_, toleranceAmplitudeHi_, toleranceAmplitudeLo_, toleranceAmpRMSRatio_, tolerancePNRMSRatio_, toleranceTiming_, ecaldqm::MESet::iterator::toNextChannel(), ecaldqm::DQWorkerClient::towerAverage_(), ecaldqm::MESetMulti::use(), and wlToME_.

Referenced by ~LaserClient().

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

Reimplemented from ecaldqm::DQWorker.

Definition at line 35 of file LaserClient.cc.

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

Referenced by ~LaserClient().

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

Member Data Documentation

std::vector<float> ecaldqm::LaserClient::expectedAmplitude_
private

Definition at line 21 of file LaserClient.h.

Referenced by producePlots(), and setParams().

std::vector<float> ecaldqm::LaserClient::expectedPNAmplitude_
private

Definition at line 28 of file LaserClient.h.

Referenced by producePlots(), and setParams().

std::vector<float> ecaldqm::LaserClient::expectedTiming_
private

Definition at line 25 of file LaserClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::LaserClient::forwardFactor_
private

Definition at line 31 of file LaserClient.h.

Referenced by producePlots(), and setParams().

int ecaldqm::LaserClient::minChannelEntries_
private

Definition at line 20 of file LaserClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::LaserClient::toleranceAmplitudeHi_
private

Definition at line 23 of file LaserClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::LaserClient::toleranceAmplitudeLo_
private

Definition at line 22 of file LaserClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::LaserClient::toleranceAmpRMSRatio_
private

Definition at line 24 of file LaserClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::LaserClient::tolerancePNAmp_
private

Definition at line 29 of file LaserClient.h.

Referenced by setParams().

float ecaldqm::LaserClient::tolerancePNRMSRatio_
private

Definition at line 30 of file LaserClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::LaserClient::toleranceTiming_
private

Definition at line 26 of file LaserClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::LaserClient::toleranceTimRMS_
private

Definition at line 27 of file LaserClient.h.

Referenced by setParams().

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

Definition at line 18 of file LaserClient.h.

Referenced by producePlots(), and setParams().