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 &)
 
template<typename Booker >
void ecaldqmBookHistograms (Booker &)
 
void ecaldqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
void ecaldqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void ecaldqmGetSetupObjects (edm::EventSetup const &)
 
void ecaldqmReleaseHistograms ()
 
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 21 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, cond::rpcobgas::time, 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:39
static WorkerFactoryStore * singleton()
Definition: DQWorker.cc:126
std::string const moduleName_
Definition: EcalDQMonitor.h:40
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:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56

Member Function Documentation

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

Definition at line 132 of file EcalDQMonitor.cc.

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

Referenced by EcalDQMonitorTask::beginLuminosityBlock().

133  {
134  executeOnWorkers_([&_lumi, &_es](DQWorker* worker){
135  if(worker->onlineMode()) worker->setTime(time(0));
136  worker->setLumiNumber(_lumi.luminosityBlock());
137  worker->beginLuminosityBlock(_lumi, _es);
138  }, "beginLumi");
139 
140  if(verbosity_ > 1) edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmBeginLuminosityBlock";
141  }
std::string const moduleName_
Definition: EcalDQMonitor.h:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
void ecaldqm::EcalDQMonitor::ecaldqmBeginRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
protected

Definition at line 108 of file EcalDQMonitor.cc.

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

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

109  {
110  executeOnWorkers_([&_run, &_es](DQWorker* worker){
111  if(worker->onlineMode()) worker->setTime(time(0));
112  worker->setRunNumber(_run.run());
113  worker->beginRun(_run, _es);
114  }, "beginRun");
115 
116  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmBeginRun";
117  }
std::string const moduleName_
Definition: EcalDQMonitor.h:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
template<typename Booker >
void ecaldqm::EcalDQMonitor::ecaldqmBookHistograms ( Booker &  _booker)
protected

Definition at line 46 of file EcalDQMonitor.h.

References ecaldqm::DQWorker::bookMEs(), executeOnWorkers_(), and ecaldqm::DQWorker::releaseMEs().

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

47  {
48  executeOnWorkers_([&_booker](ecaldqm::DQWorker* worker){
49  worker->releaseMEs();
50  worker->bookMEs(_booker);
51  }, "bookMEs", "Booking MEs");
52  }
virtual void releaseMEs()
Definition: DQWorker.cc:76
virtual void bookMEs(DQMStore &)
Definition: DQWorker.cc:83
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
void ecaldqm::EcalDQMonitor::ecaldqmEndLuminosityBlock ( edm::LuminosityBlock const &  _lumi,
edm::EventSetup const &  _es 
)
protected

Definition at line 144 of file EcalDQMonitor.cc.

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

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

145  {
146  executeOnWorkers_([&_lumi, &_es](DQWorker* worker){
147  if(worker->onlineMode()) worker->setTime(time(0));
148  worker->setLumiNumber(_lumi.luminosityBlock());
149  worker->endLuminosityBlock(_lumi, _es);
150  }, "endLumi");
151 
152  if(verbosity_ > 2) edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmEndLuminosityBlock";
153  }
std::string const moduleName_
Definition: EcalDQMonitor.h:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
void ecaldqm::EcalDQMonitor::ecaldqmEndRun ( edm::Run const &  _run,
edm::EventSetup const &  _es 
)
protected

Definition at line 120 of file EcalDQMonitor.cc.

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

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

121  {
122  executeOnWorkers_([&_run, &_es](DQWorker* worker){
123  if(worker->onlineMode()) worker->setTime(time(0));
124  worker->setRunNumber(_run.run());
125  worker->endRun(_run, _es);
126  }, "endRun");
127 
128  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << moduleName_ << "::ecaldqmEndRun";
129  }
std::string const moduleName_
Definition: EcalDQMonitor.h:40
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
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:62
bool checkTrigTowerMap(bool=true)
void setElectronicsMap(EcalElectronicsMapping const *)
void setTrigTowerMap(EcalTrigTowerConstituentsMap const *)
bool checkGeometry(bool=true)
void ecaldqm::EcalDQMonitor::ecaldqmReleaseHistograms ( )
protected

Definition at line 100 of file EcalDQMonitor.cc.

References executeOnWorkers_(), and ecaldqm::DQWorker::releaseMEs().

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

101  {
102  executeOnWorkers_([](DQWorker* worker){
103  worker->releaseMEs();
104  }, "releaseMEs", "releasing histograms");
105  }
void executeOnWorkers_(FuncOnWorker, std::string const &, std::string const &="", int=1)
Definition: EcalDQMonitor.h:56
template<typename FuncOnWorker >
void ecaldqm::EcalDQMonitor::executeOnWorkers_ ( FuncOnWorker  _func,
std::string const &  _context,
std::string const &  _message = "",
int  _verbThreshold = 1 
)
protected

Definition at line 56 of file EcalDQMonitor.h.

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

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

57  {
58  std::for_each(workers_.begin(), workers_.end(), [&](DQWorker* worker){
59  if(verbosity_ > _verbThreshold && _message != "") edm::LogInfo("EcalDQM") << moduleName_ << ": " << _message << " @ " << worker->getName();
60  try{
61  _func(worker);
62  }
63  catch(std::exception&){
64  edm::LogError("EcalDQM") << moduleName_ << ": Exception in " << _context << " @ " << worker->getName();
65  throw;
66  }
67  });
68  }
std::vector< DQWorker * > workers_
Definition: EcalDQMonitor.h:39
std::string const moduleName_
Definition: EcalDQMonitor.h:40
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 39 of file EcalDQMonitor.h.

Referenced by EcalDQMonitor(), and executeOnWorkers_().