CMS 3D CMS Logo

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