CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
SiStripQualityWithFromFedErrorsHelper Class Reference

#include <SiStripQualityWithFromFedErrorsHelper.h>

Public Member Functions

bool addBadCompFromFedErr () const
 
bool endRun (const edm::EventSetup &)
 
const SiStripQualitygetMergedQuality (dqm::harvesting::DQMStore::IGetter &getter)
 
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > & qualityToken () const
 
 SiStripQualityWithFromFedErrorsHelper (const edm::ParameterSet &iConfig, edm::ConsumesCollector iC, bool keepCopy=false)
 

Static Public Member Functions

static void fillDescription (edm::ParameterSetDescription &desc)
 

Private Attributes

bool addBadCompFromFedErr_ = false
 
std::unique_ptr< SiStripFedCablingfedCabling_
 
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcdfedCablingToken_
 
float fedErrCutoff_
 
unsigned int fedErrFileRunNumber_
 
std::string fedErrLegacyFile_
 
bool keepCopy_
 
bool merged_ = false
 
std::unique_ptr< SiStripQualitymergedQuality_
 
edm::ESGetToken< SiStripQuality, SiStripQualityRcdstripQualityToken_
 
edm::ESWatcher< SiStripQualityRcdstripQualityWatcher_
 

Detailed Description

Definition at line 42 of file SiStripQualityWithFromFedErrorsHelper.h.

Constructor & Destructor Documentation

◆ SiStripQualityWithFromFedErrorsHelper()

SiStripQualityWithFromFedErrorsHelper::SiStripQualityWithFromFedErrorsHelper ( const edm::ParameterSet iConfig,
edm::ConsumesCollector  iC,
bool  keepCopy = false 
)
inline

Definition at line 44 of file SiStripQualityWithFromFedErrorsHelper.h.

References addBadCompFromFedErr_, edm::EndRun, edm::ConsumesCollector::esConsumes(), fedCablingToken_, fedErrCutoff_, fedErrFileRunNumber_, fedErrLegacyFile_, nano_mu_digi_cff::float, edm::ParameterSet::getParameter(), keepCopy_, AlCaHLTBitMon_QueryRunRegistry::string, and stripQualityToken_.

46  {
47  const auto& fedErrConfig = iConfig.getParameter<edm::ParameterSet>("BadComponentsFromFedErrors");
48  addBadCompFromFedErr_ = fedErrConfig.getParameter<bool>("Add");
49  fedErrCutoff_ = float(fedErrConfig.getParameter<double>("Cutoff"));
50  fedErrLegacyFile_ = fedErrConfig.getParameter<std::string>("LegacyDQMFile");
51  fedErrFileRunNumber_ = fedErrConfig.getParameter<unsigned int>("FileRunNumber");
53  edm::ESInputTag{"", iConfig.getParameter<std::string>("StripQualityLabel")});
56  }
57  // can be set if a copy should be made even if BadComponentsFromFedErrors is false
58  // (e.g. for producing a new payloads)
59  keepCopy_ = keepCopy || addBadCompFromFedErr_;
60  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > stripQualityToken_

Member Function Documentation

◆ addBadCompFromFedErr()

bool SiStripQualityWithFromFedErrorsHelper::addBadCompFromFedErr ( ) const
inline

◆ endRun()

bool SiStripQualityWithFromFedErrorsHelper::endRun ( const edm::EventSetup iSetup)

Definition at line 186 of file SiStripQualityWithFromFedErrorsHelper.cc.

References addBadCompFromFedErr_, edm::ESWatcher< T >::check(), fedCabling_, fedCablingToken_, edm::EventSetup::getData(), keepCopy_, merged_, mergedQuality_, stripQualityToken_, and stripQualityWatcher_.

Referenced by SiStripBadStripFromQualityDBWriter::endRun(), SiStripQualityStatistics::endRun(), and SiStripBadComponentInfo::endRun().

186  {
187  if (stripQualityWatcher_.check(iSetup)) {
188  if (keepCopy_) {
189  mergedQuality_ = std::make_unique<SiStripQuality>(iSetup.getData(stripQualityToken_));
190  if (addBadCompFromFedErr_) {
191  fedCabling_ = std::make_unique<SiStripFedCabling>(iSetup.getData(fedCablingToken_));
192  }
193  merged_ = false;
194  }
195  return true;
196  } else {
197  return false;
198  }
199 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESWatcher< SiStripQualityRcd > stripQualityWatcher_
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > stripQualityToken_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57

◆ fillDescription()

static void SiStripQualityWithFromFedErrorsHelper::fillDescription ( edm::ParameterSetDescription desc)
inlinestatic

Definition at line 62 of file SiStripQualityWithFromFedErrorsHelper.h.

References edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by SiStripBadStripFromQualityDBWriter::fillDescriptions(), SiStripQualityStatistics::fillDescriptions(), and SiStripBadComponentInfo::fillDescriptions().

62  {
63  desc.add<std::string>("StripQualityLabel", "");
65  descFedErr.add<bool>("Add", false);
66  descFedErr.add<double>("Cutoff", 0.8);
67  descFedErr.add<std::string>("LegacyDQMFile", "");
68  descFedErr.add<unsigned int>("FileRunNumber", -1);
69  desc.add<edm::ParameterSetDescription>("BadComponentsFromFedErrors", descFedErr);
70  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)

◆ getMergedQuality()

const SiStripQuality & SiStripQualityWithFromFedErrorsHelper::getMergedQuality ( dqm::harvesting::DQMStore::IGetter getter)

Definition at line 201 of file SiStripQualityWithFromFedErrorsHelper.cc.

References addBadCompFromFedErr_, sistrip::badStripFromFedErr(), sistrip::badStripFromFedErrLegacyDQMFile(), fedCabling_, fedErrCutoff_, fedErrFileRunNumber_, fedErrLegacyFile_, merged_, and mergedQuality_.

Referenced by SiStripBadStripFromQualityDBWriter::dqmEndJob(), SiStripQualityStatistics::dqmEndJob(), and SiStripBadComponentInfo::dqmEndJob().

202  {
203  if (!merged_) {
204  if (addBadCompFromFedErr_) {
205  std::unique_ptr<SiStripQuality> fedErrQuality{};
206  if (fedErrLegacyFile_.empty()) {
207  edm::LogInfo("SiStripQuality") << "Adding bad components from FED errors in DQM store";
208  fedErrQuality = sistrip::badStripFromFedErr(getter, *fedCabling_, fedErrCutoff_);
209  } else {
210  edm::LogInfo("SiStripQuality") << "Adding bad components from FED errors in legacy DQM file "
214  }
215  mergedQuality_->add(fedErrQuality.get());
216  mergedQuality_->cleanUp();
217  mergedQuality_->fillBadComponents();
218  }
219  merged_ = true;
220  }
221 
222  return *mergedQuality_;
223 }
std::unique_ptr< SiStripQuality > badStripFromFedErr(dqm::harvesting::DQMStore::IGetter &dqmStore, const SiStripFedCabling &fedCabling, float cutoff)
Log< level::Info, false > LogInfo
std::unique_ptr< SiStripQuality > badStripFromFedErrLegacyDQMFile(const std::string &fileName, unsigned int runNumber, const SiStripFedCabling &fedCabling, float cutoff)

◆ qualityToken()

const edm::ESGetToken<SiStripQuality, SiStripQualityRcd>& SiStripQualityWithFromFedErrorsHelper::qualityToken ( ) const
inline

Definition at line 76 of file SiStripQualityWithFromFedErrorsHelper.h.

References stripQualityToken_.

Referenced by SiStripQualityStatistics::endRun(), and SiStripBadComponentInfo::endRun().

76 { return stripQualityToken_; }
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > stripQualityToken_

Member Data Documentation

◆ addBadCompFromFedErr_

bool SiStripQualityWithFromFedErrorsHelper::addBadCompFromFedErr_ = false
private

◆ fedCabling_

std::unique_ptr<SiStripFedCabling> SiStripQualityWithFromFedErrorsHelper::fedCabling_
private

Definition at line 86 of file SiStripQualityWithFromFedErrorsHelper.h.

Referenced by endRun(), and getMergedQuality().

◆ fedCablingToken_

edm::ESGetToken<SiStripFedCabling, SiStripFedCablingRcd> SiStripQualityWithFromFedErrorsHelper::fedCablingToken_
private

◆ fedErrCutoff_

float SiStripQualityWithFromFedErrorsHelper::fedErrCutoff_
private

◆ fedErrFileRunNumber_

unsigned int SiStripQualityWithFromFedErrorsHelper::fedErrFileRunNumber_
private

◆ fedErrLegacyFile_

std::string SiStripQualityWithFromFedErrorsHelper::fedErrLegacyFile_
private

◆ keepCopy_

bool SiStripQualityWithFromFedErrorsHelper::keepCopy_
private

◆ merged_

bool SiStripQualityWithFromFedErrorsHelper::merged_ = false
private

Definition at line 88 of file SiStripQualityWithFromFedErrorsHelper.h.

Referenced by endRun(), and getMergedQuality().

◆ mergedQuality_

std::unique_ptr<SiStripQuality> SiStripQualityWithFromFedErrorsHelper::mergedQuality_
private

Definition at line 87 of file SiStripQualityWithFromFedErrorsHelper.h.

Referenced by endRun(), and getMergedQuality().

◆ stripQualityToken_

edm::ESGetToken<SiStripQuality, SiStripQualityRcd> SiStripQualityWithFromFedErrorsHelper::stripQualityToken_
private

◆ stripQualityWatcher_

edm::ESWatcher<SiStripQualityRcd> SiStripQualityWithFromFedErrorsHelper::stripQualityWatcher_
private

Definition at line 85 of file SiStripQualityWithFromFedErrorsHelper.h.

Referenced by endRun().