test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
ecaldqm::EcalDQMonitor Class Reference

#include <EcalDQMonitor.h>

Inheritance diagram for ecaldqm::EcalDQMonitor:
EcalDQMonitorClient EcalDQMonitorTask

Public Member Functions

 EcalDQMonitor (edm::ParameterSet const &)
 
virtual ~EcalDQMonitor ()
 

Static Public Member Functions

static void fillDescriptions (edm::ParameterSetDescription &)
 

Protected Member Functions

void ecaldqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
void ecaldqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
void ecaldqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
void ecaldqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void ecaldqmGetSetupObjects (edm::EventSetup const &)
 
template<typename FuncOnWorker >
void executeOnWorkers_ (FuncOnWorker, std::string const &, std::string const &="", int=1)
 

Protected Attributes

std::string const moduleName_
 
int const verbosity_
 
std::vector< DQWorker * > workers_
 

Detailed Description

Definition at line 22 of file EcalDQMonitor.h.

Constructor & Destructor Documentation

ecaldqm::EcalDQMonitor::EcalDQMonitor ( edm::ParameterSet const &  _ps)

Definition at line 22 of file EcalDQMonitor.cc.

References cppFunctionSkipper::exception, edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), moduleName_, mergeVDriftHistosByStation::name, ecaldqm::DQWorker::onlineMode(), ecaldqm::DQWorker::setTime(), ecaldqm::WorkerFactoryStore::singleton(), AlCaHLTBitMon_QueryRunRegistry::string, verbosity_, and workers_.

22  :
23  workers_(),
24  moduleName_(_ps.getUntrackedParameter<std::string>("moduleName")),
25  verbosity_(_ps.getUntrackedParameter<int>("verbosity"))
26  {
27  std::vector<std::string> workerNames(_ps.getUntrackedParameter<std::vector<std::string> >("workers"));
28  edm::ParameterSet const& workerParams(_ps.getUntrackedParameterSet("workerParameters"));
29  edm::ParameterSet const& commonParams(_ps.getUntrackedParameterSet("commonParameters"));
30 
31  std::for_each(workerNames.begin(), workerNames.end(), [&](std::string const& name){
32  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << moduleName_ << ": Setting up " << name << std::endl;
33  try{
34  DQWorker* worker(WorkerFactoryStore::singleton()->getWorker(name, verbosity_, commonParams, workerParams.getUntrackedParameterSet(name)));
35  if(worker->onlineMode()) worker->setTime(time(0));
36  workers_.push_back(worker);
37  }
38  catch(std::exception&){
39  edm::LogError("EcalDQM") << "Worker " << name << " not defined";
40  throw;
41  }
42  });
43  }
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:38
static WorkerFactoryStore * singleton()
Definition: DQWorker.cc:117
std::string const moduleName_
Definition: EcalDQMonitor.h:39
ecaldqm::EcalDQMonitor::~EcalDQMonitor ( )
virtual

Definition at line 45 of file EcalDQMonitor.cc.

References executeOnWorkers_(), moduleName_, and verbosity_.

46  {
47  if(verbosity_ > 2) edm::LogInfo("EcalDQM") << moduleName_ << ": Deleting workers";
48 
49  executeOnWorkers_([](DQWorker* worker){
50  delete worker;
51  }, "Dtor");
52  }
std::string const moduleName_
Definition: EcalDQMonitor.h:39
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:45

Member Function Documentation

void ecaldqm::EcalDQMonitor::ecaldqmBeginLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
)
protected

Definition at line 124 of file EcalDQMonitor.cc.

References ecaldqm::DQWorker::beginLuminosityBlock(), executeOnWorkers_(), edm::LuminosityBlockBase::luminosityBlock(), moduleName_, ecaldqm::DQWorker::onlineMode(), ecaldqm::DQWorker::setLumiNumber(), ecaldqm::DQWorker::setTime(), and verbosity_.

Referenced by EcalDQMonitorTask::beginLuminosityBlock().

125  {
126  executeOnWorkers_([&_lumi, &_es](DQWorker* worker){
127  if(worker->onlineMode()) worker->setTime(time(0));
128  worker->setLumiNumber(_lumi.luminosityBlock());
129  worker->beginLuminosityBlock(_lumi, _es);
130  }, "beginLumi");
131 
132  if(verbosity_ > 1) edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmBeginLuminosityBlock";
133  }
std::string const moduleName_
Definition: EcalDQMonitor.h:39
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:45
void ecaldqm::EcalDQMonitor::ecaldqmBeginRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
protected

Definition at line 100 of file EcalDQMonitor.cc.

References ecaldqm::DQWorker::beginRun(), executeOnWorkers_(), moduleName_, ecaldqm::DQWorker::onlineMode(), edm::RunBase::run(), ecaldqm::DQWorker::setRunNumber(), ecaldqm::DQWorker::setTime(), and verbosity_.

Referenced by EcalDQMonitorClient::beginRun(), and EcalDQMonitorTask::dqmBeginRun().

101  {
102  executeOnWorkers_([&_run, &_es](DQWorker* worker){
103  if(worker->onlineMode()) worker->setTime(time(0));
104  worker->setRunNumber(_run.run());
105  worker->beginRun(_run, _es);
106  }, "beginRun");
107 
108  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmBeginRun";
109  }
std::string const moduleName_
Definition: EcalDQMonitor.h:39
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:45
void ecaldqm::EcalDQMonitor::ecaldqmEndLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
)
protected

Definition at line 136 of file EcalDQMonitor.cc.

References ecaldqm::DQWorker::endLuminosityBlock(), executeOnWorkers_(), edm::LuminosityBlockBase::luminosityBlock(), moduleName_, ecaldqm::DQWorker::onlineMode(), ecaldqm::DQWorker::setLumiNumber(), ecaldqm::DQWorker::setTime(), and verbosity_.

Referenced by EcalDQMonitorClient::dqmEndLuminosityBlock(), and EcalDQMonitorTask::endLuminosityBlock().

137  {
138  executeOnWorkers_([&_lumi, &_es](DQWorker* worker){
139  if(worker->onlineMode()) worker->setTime(time(0));
140  worker->setLumiNumber(_lumi.luminosityBlock());
141  worker->endLuminosityBlock(_lumi, _es);
142  }, "endLumi");
143 
144  if(verbosity_ > 2) edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmEndLuminosityBlock";
145  }
std::string const moduleName_
Definition: EcalDQMonitor.h:39
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:45
void ecaldqm::EcalDQMonitor::ecaldqmEndRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
protected

Definition at line 112 of file EcalDQMonitor.cc.

References ecaldqm::DQWorker::endRun(), executeOnWorkers_(), moduleName_, ecaldqm::DQWorker::onlineMode(), edm::RunBase::run(), ecaldqm::DQWorker::setRunNumber(), ecaldqm::DQWorker::setTime(), and verbosity_.

Referenced by EcalDQMonitorClient::endRun(), and EcalDQMonitorTask::endRun().

113  {
114  executeOnWorkers_([&_run, &_es](DQWorker* worker){
115  if(worker->onlineMode()) worker->setTime(time(0));
116  worker->setRunNumber(_run.run());
117  worker->endRun(_run, _es);
118  }, "endRun");
119 
120  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmEndRun";
121  }
std::string const moduleName_
Definition: EcalDQMonitor.h:39
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:45
void ecaldqm::EcalDQMonitor::ecaldqmGetSetupObjects ( edm::EventSetup const &  _es)
protected

Definition at line 69 of file EcalDQMonitor.cc.

References ecaldqm::checkElectronicsMap(), ecaldqm::checkGeometry(), ecaldqm::checkTopology(), ecaldqm::checkTrigTowerMap(), edm::EventSetup::get(), edm::ESHandle< class >::product(), ecaldqm::setElectronicsMap(), ecaldqm::setGeometry(), ecaldqm::setTopology(), and ecaldqm::setTrigTowerMap().

Referenced by EcalDQMonitorClient::beginRun(), and EcalDQMonitorTask::bookHistograms().

70  {
71  if(!checkElectronicsMap(false)){
72  // set up electronicsMap in EcalDQMCommonUtils
74  _es.get<EcalMappingRcd>().get(elecMapHandle);
75  setElectronicsMap(elecMapHandle.product());
76  }
77 
78  if(!checkTrigTowerMap(false)){
79  // set up trigTowerMap in EcalDQMCommonUtils
81  _es.get<IdealGeometryRecord>().get(ttMapHandle);
82  setTrigTowerMap(ttMapHandle.product());
83  }
84 
85  if(!checkGeometry(false)){
86  edm::ESHandle<CaloGeometry> geomHandle;
87  _es.get<CaloGeometryRecord>().get(geomHandle);
88  setGeometry(geomHandle.product());
89  }
90 
91  if(!checkTopology(false)){
92  // set up trigTowerMap in EcalDQMCommonUtils
93  edm::ESHandle<CaloTopology> topoHandle;
94  _es.get<CaloTopologyRecord>().get(topoHandle);
95  setTopology(topoHandle.product());
96  }
97  }
bool checkElectronicsMap(bool=true)
void setGeometry(CaloGeometry const *)
void setTopology(CaloTopology const *)
bool checkTopology(bool=true)
T const * product() const
Definition: ESHandle.h:86
bool checkTrigTowerMap(bool=true)
void setElectronicsMap(EcalElectronicsMapping const *)
void setTrigTowerMap(EcalTrigTowerConstituentsMap const *)
bool checkGeometry(bool=true)
template<typename FuncOnWorker >
void ecaldqm::EcalDQMonitor::executeOnWorkers_ ( FuncOnWorker  _func,
std::string const &  _context,
std::string const &  _message = "",
int  _verbThreshold = 1 
)
protected

Definition at line 45 of file EcalDQMonitor.h.

References cppFunctionSkipper::exception, moduleName_, verbosity_, and workers_.

Referenced by EcalDQMonitorTask::analyze(), EcalDQMonitorTask::bookHistograms(), EcalDQMonitorClient::dqmEndJob(), EcalDQMonitorClient::dqmEndLuminosityBlock(), ecaldqmBeginLuminosityBlock(), ecaldqmBeginRun(), ecaldqmEndLuminosityBlock(), ecaldqmEndRun(), EcalDQMonitorClient::EcalDQMonitorClient(), EcalDQMonitorTask::EcalDQMonitorTask(), EcalDQMonitorTask::endLuminosityBlock(), EcalDQMonitorTask::endRun(), EcalDQMonitorTask::runOnCollection(), EcalDQMonitorClient::runWorkers(), and ~EcalDQMonitor().

46  {
47  std::for_each(workers_.begin(), workers_.end(), [&](DQWorker* worker){
48  if(verbosity_ > _verbThreshold && _message != "") edm::LogInfo("EcalDQM") << moduleName_ << ": " << _message << " @ " << worker->getName();
49  try{
50  _func(worker);
51  }
52  catch(std::exception&){
53  edm::LogError("EcalDQM") << moduleName_ << ": Exception in " << _context << " @ " << worker->getName();
54  throw;
55  }
56  });
57  }
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:38
std::string const moduleName_
Definition: EcalDQMonitor.h:39
void ecaldqm::EcalDQMonitor::fillDescriptions ( edm::ParameterSetDescription _desc)
static

Definition at line 56 of file EcalDQMonitor.cc.

References edm::ParameterSetDescription::addUntracked(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EcalDQMonitorClient::fillDescriptions(), and EcalDQMonitorTask::fillDescriptions().

57  {
58  _desc.addUntracked<std::string>("moduleName", "Ecal Monitor Module");
59  _desc.addUntracked<std::vector<std::string> >("workers");
60  _desc.addUntracked<int>("verbosity", 0);
61 
62  edm::ParameterSetDescription commonParameters;
63  commonParameters.addUntracked<bool>("onlineMode", false);
64  commonParameters.addUntracked<bool>("willConvertToEDM", true);
65  _desc.addUntracked("commonParameters", commonParameters);
66  }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)

Member Data Documentation

std::string const ecaldqm::EcalDQMonitor::moduleName_
protected
int const ecaldqm::EcalDQMonitor::verbosity_
protected
std::vector<DQWorker*> ecaldqm::EcalDQMonitor::workers_
protected

Definition at line 38 of file EcalDQMonitor.h.

Referenced by EcalDQMonitor(), and executeOnWorkers_().