CMS 3D CMS Logo

DQWorker.cc
Go to the documentation of this file.
2 
4 
9 
11 
12 namespace ecaldqm {
14  : name_(""), MEs_(), booked_(false), timestamp_(), verbosity_(0), onlineMode_(false), willConvertToEDM_(true) {}
15 
16  DQWorker::~DQWorker() noexcept(false) {}
17 
18  /*static*/
20  _desc.addUntracked<bool>("onlineMode", false);
21  _desc.addUntracked<bool>("willConvertToEDM", true);
22 
23  edm::ParameterSetDescription meParameters;
24  edm::ParameterSetDescription meNodeParameters;
25  fillMESetDescriptions(meNodeParameters);
26  meParameters.addNode(
28  _desc.addUntracked("MEs", meParameters);
29 
31  workerParameters.setUnknown();
32  _desc.addUntracked("params", workerParameters);
33  }
34 
35  void DQWorker::initialize(std::string const &_name, edm::ParameterSet const &_commonParams) {
36  name_ = _name;
37  onlineMode_ = _commonParams.getUntrackedParameter<bool>("onlineMode");
38  willConvertToEDM_ = _commonParams.getUntrackedParameter<bool>("willConvertToEDM");
39  }
40 
41  void DQWorker::setME(edm::ParameterSet const &_meParams) {
42  std::vector<std::string> const &MENames(_meParams.getParameterNames());
43 
44  for (unsigned iME(0); iME != MENames.size(); iME++) {
45  std::string name(MENames[iME]);
47 
48  if (!onlineMode_ && params.getUntrackedParameter<bool>("online"))
49  continue;
50 
51  try {
53  } catch (std::exception &) {
54  edm::LogError("EcalDQM") << "Exception caught while constructing MESet " << name;
55  throw;
56  }
57  }
58  }
59 
61  for (MESetCollection::iterator mItr(MEs_.begin()); mItr != MEs_.end(); ++mItr)
62  mItr->second->clear();
63  booked_ = false;
64  }
65 
67  if (booked_)
68  return;
69  for (MESetCollection::iterator mItr(MEs_.begin()); mItr != MEs_.end(); ++mItr)
70  mItr->second->book(_booker);
71  booked_ = true;
72  }
73 
74  void DQWorker::print_(std::string const &_message, int _threshold /* = 0*/) const {
75  if (verbosity_ > _threshold)
76  edm::LogInfo("EcalDQM") << name_ << ": " << _message;
77  }
78 
80  int _verbosity,
81  edm::ParameterSet const &_commonParams,
82  edm::ParameterSet const &_workerParams) const {
83  DQWorker *worker(workerFactories_.at(_name)());
84  worker->setVerbosity(_verbosity);
85  worker->initialize(_name, _commonParams);
86  worker->setME(_workerParams.getUntrackedParameterSet("MEs"));
87  if (_workerParams.existsAs<edm::ParameterSet>("sources", false))
88  worker->setSource(_workerParams.getUntrackedParameterSet("sources"));
89  if (_workerParams.existsAs<edm::ParameterSet>("params", false))
90  worker->setParams(_workerParams.getUntrackedParameterSet("params"));
91  return worker;
92  }
93 
94  /*static*/
96  static WorkerFactoryStore workerFactoryStore;
97  return &workerFactoryStore;
98  }
99 
100 } // namespace ecaldqm
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
ecaldqm
Definition: DQWorker.h:24
ecaldqm::WorkerFactoryStore::workerFactories_
tbb::concurrent_unordered_map< std::string, WorkerFactory > workerFactories_
Definition: DQWorker.h:107
ecaldqm::DQWorker::name_
std::string name_
Definition: DQWorker.h:77
edm::ParameterSet::getUntrackedParameterSet
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
Definition: ParameterSet.cc:2136
edm::ParameterWildcard
Definition: ParameterWildcard.h:23
ecaldqm::fillMESetDescriptions
void fillMESetDescriptions(edm::ParameterSetDescription &)
Definition: MESetUtils.cc:144
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ecaldqm::DQWorker::bookMEs
virtual void bookMEs(DQMStore::IBooker &)
Definition: DQWorker.cc:66
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
ecaldqm::WorkerFactoryStore::getWorker
DQWorker * getWorker(std::string const &, int, edm::ParameterSet const &, edm::ParameterSet const &) const
Definition: DQWorker.cc:79
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
ecaldqm::DQWorker::print_
void print_(std::string const &, int=0) const
Definition: DQWorker.cc:74
ecaldqm::DQWorker::booked_
bool booked_
Definition: DQWorker.h:79
ecaldqm::DQWorker::releaseMEs
virtual void releaseMEs()
Definition: DQWorker.cc:60
ecaldqm::DQWorker
Definition: DQWorker.h:28
ecaldqm::MESetCollection::end
auto end() const
Definition: MESet.h:356
Service.h
EventID.h
ecaldqm::DQWorker::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &_desc)
Definition: DQWorker.cc:19
ParameterSetDescription.h
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:78
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ecaldqm::WorkerFactoryStore
Definition: DQWorker.h:92
ecaldqm::DQWorker::onlineMode_
bool onlineMode_
Definition: DQWorker.h:85
ecaldqm::DQWorker::setVerbosity
void setVerbosity(int _verbosity)
Definition: DQWorker.h:44
ecaldqm::DQWorker::setParams
virtual void setParams(edm::ParameterSet const &)
Definition: DQWorker.h:49
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
funct::true
true
Definition: Factorize.h:173
EcalCalibMonitorClient_cfi.workerParameters
workerParameters
Definition: EcalCalibMonitorClient_cfi.py:28
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
edm::ParameterSet
Definition: ParameterSet.h:47
ecaldqm::MESetCollection::insert
void insert(const std::string &key, MESet *ptr)
Definition: MESet.h:350
edm::ParameterSet::getParameterNames
std::vector< std::string > getParameterNames() const
Definition: ParameterSet.cc:663
ecaldqm::DQWorker::initialize
void initialize(std::string const &_name, edm::ParameterSet const &)
Definition: DQWorker.cc:35
DQWorker.h
ecaldqm::MESetCollection::begin
auto begin()
Definition: MESet.h:355
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
ecaldqm::DQWorker::willConvertToEDM_
bool willConvertToEDM_
Definition: DQWorker.h:86
ecaldqm::DQWorker::setME
virtual void setME(edm::ParameterSet const &)
Definition: DQWorker.cc:41
ecaldqm::createMESet
MESet * createMESet(edm::ParameterSet const &)
Definition: MESetUtils.cc:18
ecaldqm::DQWorker::~DQWorker
virtual ~DQWorker() noexcept(false)
Definition: DQWorker.cc:16
MESetUtils.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Exception.h
ecaldqm::DQWorker::verbosity_
int verbosity_
Definition: DQWorker.h:82
dqm::implementation::IBooker
Definition: DQMStore.h:43
ecaldqm::WorkerFactoryStore::singleton
static WorkerFactoryStore * singleton()
Definition: DQWorker.cc:95
ecaldqm::MESetCollection::iterator
MESetColletionType::iterator iterator
Definition: MESet.h:347
ecaldqm::DQWorker::setSource
virtual void setSource(edm::ParameterSet const &)
Definition: DQWorker.h:48
edm::RequireZeroOrMore
Definition: ParameterWildcardBase.h:17
ecaldqm::DQWorker::DQWorker
DQWorker()
Definition: DQWorker.cc:13