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::TestPulseClient Class Reference

#include <TestPulseClient.h>

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

Public Member Functions

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

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)
 
- 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 TestPulseClient.h.

Constructor & Destructor Documentation

ecaldqm::TestPulseClient::TestPulseClient ( )

Definition at line 16 of file TestPulseClient.cc.

16  :
18  gainToME_(),
19  pnGainToME_(),
22  toleranceRMS_(0),
25  {
26  }
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_
ecaldqm::TestPulseClient::~TestPulseClient ( )
inline

Definition at line 11 of file TestPulseClient.h.

11 {}

Member Function Documentation

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

Implements ecaldqm::DQWorkerClient.

Definition at line 106 of file TestPulseClient.cc.

References amplitudeThreshold_, ecaldqm::MESetMulti::beginChannel(), EcalBarrel, EcalEndcap, ecaldqm::MESetMulti::end(), python.tagInventory::entries, 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(), ecaldqm::memDCCIndex(), ecaldqm::DQWorker::MEs_, minChannelEntries_, ecaldqm::nDCC, PNAmplitudeThreshold_, pnGainToME_, plotscripts::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().

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

Reimplemented from ecaldqm::DQWorker.

Definition at line 29 of file TestPulseClient.cc.

References amplitudeThreshold_, edm::hlt::Exception, gainToME_, ecaldqm::MESetMulti::getIndex(), edm::ParameterSet::getUntrackedParameter(), minChannelEntries_, PNAmplitudeThreshold_, pnGainToME_, ecaldqm::DQWorkerClient::qualitySummaries_, ecaldqm::DQWorkerClient::sources_, cond::to_string(), tolerancePNRMS_, and toleranceRMS_.

30  {
31  minChannelEntries_ = _params.getUntrackedParameter<int>("minChannelEntries");
32 
33  std::vector<int> MGPAGains(_params.getUntrackedParameter<std::vector<int> >("MGPAGains"));
34  std::vector<int> MGPAGainsPN(_params.getUntrackedParameter<std::vector<int> >("MGPAGainsPN"));
35 
37 
38  MESetMulti const& amplitude(static_cast<MESetMulti const&>(sources_.at("Amplitude")));
39  unsigned nG(MGPAGains.size());
40  for(unsigned iG(0); iG != nG; ++iG){
41  int gain(MGPAGains[iG]);
42  if(gain != 1 && gain != 6 && gain != 12) throw cms::Exception("InvalidConfiguration") << "MGPA gain";
43  repl["gain"] = std::to_string(gain);
44  gainToME_[gain] = amplitude.getIndex(repl);
45  }
46 
47  repl.clear();
48 
49  MESetMulti const& pnAmplitude(static_cast<MESetMulti const&>(sources_.at("PNAmplitude")));
50  unsigned nGPN(MGPAGainsPN.size());
51  for(unsigned iG(0); iG != nGPN; ++iG){
52  int gain(MGPAGainsPN[iG]);
53  if(gain != 1 && gain != 16) throw cms::Exception("InvalidConfiguration") << "PN MGPA gain";
54  repl["pngain"] = std::to_string(gain);
55  pnGainToME_[gain] = pnAmplitude.getIndex(repl);
56  }
57 
58  amplitudeThreshold_.resize(nG);
59  toleranceRMS_.resize(nG);
60 
61  std::vector<double> inAmplitudeThreshold(_params.getUntrackedParameter<std::vector<double> >("amplitudeThreshold"));
62  std::vector<double> inToleranceRMS(_params.getUntrackedParameter<std::vector<double> >("toleranceRMS"));
63 
64  for(std::map<int, unsigned>::iterator gainItr(gainToME_.begin()); gainItr != gainToME_.end(); ++gainItr){
65  unsigned iME(gainItr->second);
66  unsigned iGain(0);
67  switch(gainItr->first){
68  case 1:
69  iGain = 0; break;
70  case 6:
71  iGain = 1; break;
72  case 12:
73  iGain = 2; 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(_params.getUntrackedParameter<std::vector<double> >("PNAmplitudeThreshold"));
84  std::vector<double> inTolerancePNRMS(_params.getUntrackedParameter<std::vector<double> >("tolerancePNRMS"));
85 
86  for(std::map<int, unsigned>::iterator gainItr(pnGainToME_.begin()); gainItr != pnGainToME_.end(); ++gainItr){
87  unsigned iME(gainItr->second);
88  unsigned iGain(0);
89  switch(gainItr->first){
90  case 1:
91  iGain = 0; break;
92  case 16:
93  iGain = 1; break;
94  }
95 
96  PNAmplitudeThreshold_[iME] = inPNAmplitudeThreshold[iGain];
97  tolerancePNRMS_[iME] = inTolerancePNRMS[iGain];
98  }
99 
100  qualitySummaries_.insert("Quality");
101  qualitySummaries_.insert("QualitySummary");
102  qualitySummaries_.insert("PNQualitySummary");
103  }
std::vector< float > PNAmplitudeThreshold_
std::vector< float > tolerancePNRMS_
std::map< int, unsigned > gainToME_
std::string to_string(const T &t)
Definition: Logger.cc:26
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:31

Member Data Documentation

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

Definition at line 22 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

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

Definition at line 18 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

int ecaldqm::TestPulseClient::minChannelEntries_
private

Definition at line 21 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

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

Definition at line 24 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

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

Definition at line 19 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

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

Definition at line 25 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().

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

Definition at line 23 of file TestPulseClient.h.

Referenced by producePlots(), and setParams().