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 ()
 
- 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 > 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.

References producePlots(), and setParams().

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(), DEFINE_ECALDQM_WORKER, EcalBarrel, EcalEndcap, ecaldqm::MESetMulti::end(), gainToME_, ecaldqm::MESetMulti::getBinContent(), ecaldqm::MESetMulti::getBinEntries(), ecaldqm::MESetMulti::getBinError(), hcalTTPDigis_cfi::id, ecaldqm::DQWorkerClient::kBad, ecaldqm::kEBmLow, ecaldqm::kEBpHigh, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMBad, ecaldqm::DQWorkerClient::kMGood, ecaldqm::DQWorkerClient::kMUnknown, ecaldqm::DQWorkerClient::kUnknown, RecoTauDiscriminantConfiguration::mask, ecaldqm::MESetMulti::maskMatches(), ecaldqm::memDCCIndex(), ecaldqm::DQWorker::MEs_, minChannelEntries_, ecaldqm::nDCC, PNAmplitudeThreshold_, pnGainToME_, RecoTauDiscriminantConfiguration::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().

Referenced by ~TestPulseClient().

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::iterator rItr(meAmplitudeRMS);
145  MESet::const_iterator aItr(sAmplitude);
146  for(MESet::iterator qItr(meQuality.beginChannel()); qItr != qEnd; qItr.toNextChannel()){
147 
148  DetId id(qItr->getId());
149 
150  bool doMask(meQuality.maskMatches(id, mask, statusManager_));
151 
152  aItr = qItr;
153  rItr = qItr;
154 
155  float entries(aItr->getBinEntries());
156 
157  if(entries < minChannelEntries_){
158  qItr->setBinContent(doMask ? kMUnknown : kUnknown);
159  continue;
160  }
161 
162  float amp(aItr->getBinContent());
163  float rms(aItr->getBinError() * sqrt(entries));
164 
165  rItr->setBinContent(rms);
166 
167  if(amp < amplitudeThreshold_[gainItr->second] || rms > toleranceRMS_[gainItr->second])
168  qItr->setBinContent(doMask ? kMBad : kBad);
169  else
170  qItr->setBinContent(doMask ? kMGood : kGood);
171  }
172 
173  towerAverage_(meQualitySummary, meQuality, 0.2);
174  }
175 
176  for(map<int, unsigned>::iterator gainItr(pnGainToME_.begin()); gainItr != pnGainToME_.end(); ++gainItr){
177  mePNQualitySummary.use(gainItr->second);
178 
179  sPNAmplitude.use(gainItr->second);
180 
181  uint32_t mask(0);
182  switch(gainItr->first){
183  case 1:
186  break;
187  case 16:
190  break;
191  default:
192  break;
193  }
194 
195  for(unsigned iDCC(0); iDCC < nDCC; ++iDCC){
196 
197  if(memDCCIndex(iDCC + 1) == unsigned(-1)) continue;
198 
199  for(unsigned iPN(0); iPN < 10; ++iPN){
200  int subdet(0);
201  if(iDCC >= kEBmLow && iDCC <= kEBpHigh) subdet = EcalBarrel;
202  else subdet = EcalEndcap;
203 
204  EcalPnDiodeDetId id(subdet, iDCC + 1, iPN + 1);
205 
206  bool doMask(mePNQualitySummary.maskMatches(id, mask, statusManager_));
207 
208  float amp(sPNAmplitude.getBinContent(id));
209  float entries(sPNAmplitude.getBinEntries(id));
210  float rms(sPNAmplitude.getBinError(id) * sqrt(entries));
211 
212  if(entries < minChannelEntries_){
213  mePNQualitySummary.setBinContent(id, doMask ? kMUnknown : kUnknown);
214  continue;
215  }
216 
217  if(amp < PNAmplitudeThreshold_[gainItr->second] || rms > tolerancePNRMS_[gainItr->second])
218  mePNQualitySummary.setBinContent(id, doMask ? kMBad : kBad);
219  else
220  mePNQualitySummary.setBinContent(id, doMask ? kMGood : kGood);
221  }
222  }
223  }
224  }
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:18
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 CustomPhysics_cfi::amplitude, amplitudeThreshold_, Exception, muonCSCDigis_cfi::gain, gainToME_, ecaldqm::MESetMulti::getIndex(), edm::ParameterSet::getUntrackedParameter(), minChannelEntries_, PNAmplitudeThreshold_, pnGainToME_, ecaldqm::DQWorkerClient::qualitySummaries_, ecaldqm::DQWorkerClient::sources_, tolerancePNRMS_, and toleranceRMS_.

Referenced by ~TestPulseClient().

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::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().