CMS 3D CMS Logo

DQWorker.cc
Go to the documentation of this file.
2 
4 
9 
11 
16 
22 
23 namespace ecaldqm {
25  : name_(""),
26  MEs_(),
27  booked_(false),
28  timestamp_(),
29  verbosity_(0),
30  onlineMode_(false),
31  willConvertToEDM_(true),
32  edso_() {}
33 
34  DQWorker::~DQWorker() noexcept(false) {}
35 
36  /*static*/
38  _desc.addUntracked<bool>("onlineMode", false);
39  _desc.addUntracked<bool>("willConvertToEDM", true);
40 
41  edm::ParameterSetDescription meParameters;
42  edm::ParameterSetDescription meNodeParameters;
43  fillMESetDescriptions(meNodeParameters);
44  meParameters.addNode(
46  _desc.addUntracked("MEs", meParameters);
47 
49  workerParameters.setUnknown();
50  _desc.addUntracked("params", workerParameters);
51  }
52 
58 
63  }
64 
65  void DQWorker::initialize(std::string const &_name, edm::ParameterSet const &_commonParams) {
66  name_ = _name;
67  onlineMode_ = _commonParams.getUntrackedParameter<bool>("onlineMode");
68  willConvertToEDM_ = _commonParams.getUntrackedParameter<bool>("willConvertToEDM");
69  }
70 
71  void DQWorker::setME(edm::ParameterSet const &_meParams) {
72  std::vector<std::string> const &MENames(_meParams.getParameterNames());
73 
74  for (unsigned iME(0); iME != MENames.size(); iME++) {
75  std::string name(MENames[iME]);
77 
78  if (!onlineMode_ && params.getUntrackedParameter<bool>("online"))
79  continue;
80 
81  try {
83  } catch (std::exception &) {
84  edm::LogError("EcalDQM") << "Exception caught while constructing MESet " << name;
85  throw;
86  }
87  }
88  }
89 
91  for (MESetCollection::iterator mItr(MEs_.begin()); mItr != MEs_.end(); ++mItr)
92  mItr->second->clear();
93  booked_ = false;
94  }
95 
97  if (booked_)
98  return;
99  for (MESetCollection::iterator mItr(MEs_.begin()); mItr != MEs_.end(); ++mItr)
100  mItr->second->book(_booker, GetElectronicsMap());
101  booked_ = true;
102  }
103 
109  }
110 
116  }
117 
119  if (!edso_.electronicsMap)
120  throw cms::Exception("InvalidCall") << "Electronics Mapping not initialized";
121  return edso_.electronicsMap;
122  }
123 
125  if (!edso_.trigtowerMap)
126  throw cms::Exception("InvalidCall") << "TrigTowerConstituentsMap not initialized";
127  return edso_.trigtowerMap;
128  }
129 
131  if (!edso_.geometry)
132  throw cms::Exception("InvalidCall") << "CaloGeometry not initialized";
133  return edso_.geometry;
134  }
135 
137  if (!edso_.topology)
138  throw cms::Exception("InvalidCall") << "CaloTopology not initialized";
139  return edso_.topology;
140  }
141 
143  if (!edso_.electronicsMap)
144  throw cms::Exception("InvalidCall") << "Electronics Mapping not initialized";
145  if (!edso_.trigtowerMap)
146  throw cms::Exception("InvalidCall") << "TrigTowerConstituentsMap not initialized";
147  if (!edso_.geometry)
148  throw cms::Exception("InvalidCall") << "CaloGeometry not initialized";
149  if (!edso_.topology)
150  throw cms::Exception("InvalidCall") << "CaloTopology not initialized";
151  return edso_;
152  }
153 
154  void DQWorker::print_(std::string const &_message, int _threshold /* = 0*/) const {
155  if (verbosity_ > _threshold)
156  edm::LogInfo("EcalDQM") << name_ << ": " << _message;
157  }
158 
160  int _verbosity,
161  edm::ParameterSet const &_commonParams,
162  edm::ParameterSet const &_workerParams) const {
163  DQWorker *worker(workerFactories_.at(_name)());
164  worker->setVerbosity(_verbosity);
165  worker->initialize(_name, _commonParams);
166  worker->setME(_workerParams.getUntrackedParameterSet("MEs"));
167  if (_workerParams.existsAs<edm::ParameterSet>("sources", false))
168  worker->setSource(_workerParams.getUntrackedParameterSet("sources"));
169  if (_workerParams.existsAs<edm::ParameterSet>("params", false))
170  worker->setParams(_workerParams.getUntrackedParameterSet("params"));
171  return worker;
172  }
173 
174  /*static*/
176  static WorkerFactoryStore workerFactoryStore;
177  return &workerFactoryStore;
178  }
179 
180 } // namespace ecaldqm
ecaldqm::DQWorker::topoHandle
edm::ESGetToken< CaloTopology, CaloTopologyRecord > topoHandle
Definition: DQWorker.h:106
ecaldqm::DQWorker::setSetupObjectsEndLumi
void setSetupObjectsEndLumi(edm::EventSetup const &)
Definition: DQWorker.cc:111
EcalElectronicsMapping
Definition: EcalElectronicsMapping.h:28
MessageLogger.h
ecaldqm::DQWorker::setTokens
void setTokens(edm::ConsumesCollector &)
Definition: DQWorker.cc:53
funct::false
false
Definition: Factorize.h:29
ecaldqm
Definition: DQWorker.h:37
ecaldqm::WorkerFactoryStore::workerFactories_
tbb::concurrent_unordered_map< std::string, WorkerFactory > workerFactories_
Definition: DQWorker.h:157
ecaldqm::EcalDQMSetupObjects::topology
const CaloTopology * topology
Definition: MESet.h:37
ecaldqm::DQWorker::name_
std::string name_
Definition: DQWorker.h:124
edm::ParameterSet::getUntrackedParameterSet
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
Definition: ParameterSet.cc:2136
edm::ParameterWildcard
Definition: ParameterWildcard.h:23
ecaldqm::DQWorker::geomHandle
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomHandle
Definition: DQWorker.h:105
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
ecaldqm::DQWorker::ttMapHandle
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapHandle
Definition: DQWorker.h:104
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ecaldqm::DQWorker::bookMEs
virtual void bookMEs(DQMStore::IBooker &)
Definition: DQWorker.cc:96
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:159
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:154
ecaldqm::DQWorker::booked_
bool booked_
Definition: DQWorker.h:126
ecaldqm::DQWorker::geomHandleEndLumi
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomHandleEndLumi
Definition: DQWorker.h:110
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
CaloTopology
Definition: CaloTopology.h:19
ecaldqm::DQWorker::elecMapHandleEndLumi
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > elecMapHandleEndLumi
Definition: DQWorker.h:108
ecaldqm::DQWorker::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: DQWorker.cc:118
ecaldqm::DQWorker::releaseMEs
virtual void releaseMEs()
Definition: DQWorker.cc:90
ecaldqm::DQWorker
Definition: DQWorker.h:41
ecaldqm::DQWorker::setSetupObjects
void setSetupObjects(edm::EventSetup const &)
Definition: DQWorker.cc:104
CaloGeometry
Definition: CaloGeometry.h:21
ecaldqm::MESetCollection::end
auto end() const
Definition: MESet.h:393
ecaldqm::DQWorker::GetGeometry
const CaloGeometry * GetGeometry()
Definition: DQWorker.cc:130
Service.h
EventID.h
EcalMappingRcd.h
ecaldqm::DQWorker::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &_desc)
Definition: DQWorker.cc:37
ecaldqm::DQWorker::elecMapHandle
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > elecMapHandle
Definition: DQWorker.h:103
ecaldqm::DQWorker::GetTrigTowerMap
const EcalTrigTowerConstituentsMap * GetTrigTowerMap()
Definition: DQWorker.cc:124
ParameterSetDescription.h
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:125
CaloGeometryRecord.h
ecaldqm::WorkerFactoryStore
Definition: DQWorker.h:142
EcalTrigTowerConstituentsMap
Definition: EcalTrigTowerConstituentsMap.h:19
ecaldqm::DQWorker::onlineMode_
bool onlineMode_
Definition: DQWorker.h:132
ecaldqm::DQWorker::setVerbosity
void setVerbosity(int _verbosity)
Definition: DQWorker.h:57
ecaldqm::DQWorker::setParams
virtual void setParams(edm::ParameterSet const &)
Definition: DQWorker.h:62
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:387
ecaldqm::EcalDQMSetupObjects
Definition: MESet.h:33
ecaldqm::EcalDQMSetupObjects::geometry
const CaloGeometry * geometry
Definition: MESet.h:36
EcalElectronicsMapping.h
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:65
DQWorker.h
ecaldqm::MESetCollection::begin
auto begin()
Definition: MESet.h:392
IdealGeometryRecord.h
ecaldqm::DQWorker::edso_
EcalDQMSetupObjects edso_
Definition: DQWorker.h:136
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
ecaldqm::DQWorker::willConvertToEDM_
bool willConvertToEDM_
Definition: DQWorker.h:133
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ecaldqm::EcalDQMSetupObjects::trigtowerMap
const EcalTrigTowerConstituentsMap * trigtowerMap
Definition: MESet.h:35
ecaldqm::DQWorker::setME
virtual void setME(edm::ParameterSet const &)
Definition: DQWorker.cc:71
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
CaloTopology.h
ecaldqm::DQWorker::getEcalDQMSetupObjects
const EcalDQMSetupObjects getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
CaloTopologyRecord.h
EcalTrigTowerConstituentsMap.h
edm::Transition::EndLuminosityBlock
ecaldqm::EcalDQMSetupObjects::electronicsMap
const EcalElectronicsMapping * electronicsMap
Definition: MESet.h:34
ecaldqm::createMESet
MESet * createMESet(edm::ParameterSet const &)
Definition: MESetUtils.cc:18
edm::Transition::BeginRun
ecaldqm::DQWorker::~DQWorker
virtual ~DQWorker() noexcept(false)
Definition: DQWorker.cc:34
Exception
Definition: hltDiff.cc:245
CaloGeometry.h
MESetUtils.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Exception.h
ecaldqm::DQWorker::verbosity_
int verbosity_
Definition: DQWorker.h:129
dqm::implementation::IBooker
Definition: DQMStore.h:43
ecaldqm::WorkerFactoryStore::singleton
static WorkerFactoryStore * singleton()
Definition: DQWorker.cc:175
ConsumesCollector.h
ecaldqm::MESetCollection::iterator
MESetColletionType::iterator iterator
Definition: MESet.h:384
ecaldqm::DQWorker::topoHandleEndLumi
edm::ESGetToken< CaloTopology, CaloTopologyRecord > topoHandleEndLumi
Definition: DQWorker.h:111
ecaldqm::DQWorker::ttMapHandleEndLumi
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapHandleEndLumi
Definition: DQWorker.h:109
ecaldqm::DQWorker::setSource
virtual void setSource(edm::ParameterSet const &)
Definition: DQWorker.h:61
edm::RequireZeroOrMore
Definition: ParameterWildcardBase.h:17
ecaldqm::DQWorker::DQWorker
DQWorker()
Definition: DQWorker.cc:24
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
ecaldqm::DQWorker::GetTopology
const CaloTopology * GetTopology()
Definition: DQWorker.cc:136