CMS 3D CMS Logo

EcalBarrelMonitorDbModule.cc
Go to the documentation of this file.
1 /*
2  * \file EcalBarrelMonitorDbModule.cc
3  *
4  * \author G. Della Ricca
5  *
6  */
7 
9 
10 #include <unistd.h>
11 
12 #include <cmath>
13 #include <iostream>
14 
17 
18 #include "RelationalAccess/IConnectionService.h"
19 #include "RelationalAccess/IConnectionServiceConfiguration.h"
20 
21 #include "CoralBase/Attribute.h"
22 #include "CoralKernel/Context.h"
23 
25 
27 
29  dqmStore_ = edm::Service<DQMStore>().operator->();
30 
31  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
32 
33  xmlFile_ = ps.getUntrackedParameter<std::string>("xmlFile", "");
34  if (!xmlFile_.empty()) {
35  std::cout << "Monitor Elements from DB xml source file is " << xmlFile_ << std::endl;
36  }
37 
38  sleepTime_ = ps.getUntrackedParameter<int>("sleepTime", 0);
39  std::cout << "Sleep time is " << sleepTime_ << " second(s)." << std::endl;
40 
41  // html output directory
42  htmlDir_ = ps.getUntrackedParameter<std::string>("htmlDir", ".");
43 
44  if (!htmlDir_.empty()) {
45  std::cout << " HTML output will go to"
46  << " htmlDir = " << htmlDir_ << std::endl;
47  } else {
48  std::cout << " HTML output is disabled" << std::endl;
49  }
50 
52 
53  icycle_ = 0;
54  session_ = nullptr;
55 }
56 
58  if (ME_Db_)
59  delete ME_Db_;
60 }
61 
63  icycle_ = 0;
64 
65  if (ME_Db_)
66  ME_Db_->beginJob();
67 }
68 
70  if (ME_Db_)
71  ME_Db_->endJob();
72 
73  std::cout << "EcalBarrelMonitorDbModule: endJob, icycle = " << icycle_ << std::endl;
74 }
75 
77  icycle_++;
78 
79  std::cout << "EcalBarrelMonitorDbModule: icycle = " << icycle_ << std::endl;
80 
81  try {
82  coral::Context &context = coral::Context::instance();
83  context.loadComponent("CORAL/Services/ConnectionService");
84  context.loadComponent("CORAL/Services/EnvironmentAuthenticationService");
85  coral::IHandle<coral::IConnectionService> connectionService =
86  context.query<coral::IConnectionService>("CORAL/Services/ConnectionService");
87  context.loadComponent("CORAL/RelationalPlugins/oracle");
88 
89  // Set configuration parameters
90  coral::IConnectionServiceConfiguration &config = connectionService->configuration();
91  config.setConnectionRetrialPeriod(1);
92  config.setConnectionRetrialTimeOut(10);
93 
94  session_ = connectionService->connect("ECAL CondDB", coral::ReadOnly);
95 
96  if (ME_Db_)
98 
99  } catch (coral::Exception &e) {
100  std::cerr << "CORAL Exception : " << e.what() << std::endl;
101  } catch (std::exception &e) {
102  std::cerr << "Standard C++ exception : " << e.what() << std::endl;
103  }
104 
105  if (!htmlDir_.empty()) {
107  }
108 
109  delete session_;
110 
111  sleep(sleepTime_);
112 }
113 
EcalBarrelMonitorDbModule::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
Definition: EcalBarrelMonitorDbModule.cc:76
EcalBarrelMonitorDbModule::dqmStore_
DQMStore * dqmStore_
Definition: EcalBarrelMonitorDbModule.h:48
EcalBarrelMonitorDbModule.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DQMStore.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EcalBarrelMonitorDbModule::endJob
void endJob(void) override
Definition: EcalBarrelMonitorDbModule.cc:69
EcalBarrelMonitorDbModule::icycle_
int icycle_
Definition: EcalBarrelMonitorDbModule.h:46
MonitorElementsDb::htmlOutput
void htmlOutput(std::string &htmlDir)
Definition: MonitorElementsDb.cc:194
visDQMUpload.context
context
Definition: visDQMUpload.py:37
config
Definition: config.py:1
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
EcalBarrelMonitorDbModule::~EcalBarrelMonitorDbModule
~EcalBarrelMonitorDbModule() override
Destructor.
Definition: EcalBarrelMonitorDbModule.cc:57
EcalBarrelMonitorDbModule
Definition: EcalBarrelMonitorDbModule.h:24
MonitorElementsDb.h
Generate a Monitor Element from DB data.
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
edm::ParameterSet
Definition: ParameterSet.h:47
MonitorElementsDb::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c, coral::ISessionProxy *s)
Analyze.
Definition: MonitorElementsDb.cc:104
edm::Service
Definition: Service.h:30
edm::EventSetup
Definition: EventSetup.h:58
MonitorElementsDb::endJob
void endJob(void)
Definition: MonitorElementsDb.cc:102
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
EcalBarrelMonitorDbModule::htmlDir_
std::string htmlDir_
Definition: EcalBarrelMonitorDbModule.h:52
EcalBarrelMonitorDbModule::xmlFile_
std::string xmlFile_
Definition: EcalBarrelMonitorDbModule.h:54
EcalBarrelMonitorDbModule::beginJob
void beginJob(void) override
Definition: EcalBarrelMonitorDbModule.cc:62
MonitorElementsDb
Definition: MonitorElementsDb.h:25
EcalBarrelMonitorDbModule::EcalBarrelMonitorDbModule
EcalBarrelMonitorDbModule(const edm::ParameterSet &ps)
Constructor.
Definition: EcalBarrelMonitorDbModule.cc:28
Exception
Definition: hltDiff.cc:245
EcalBarrelMonitorDbModule::prefixME_
std::string prefixME_
Definition: EcalBarrelMonitorDbModule.h:50
EcalBarrelMonitorDbModule::session_
coral::ISessionProxy * session_
Definition: EcalBarrelMonitorDbModule.h:60
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
edm::Event
Definition: Event.h:73
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
EcalBarrelMonitorDbModule::sleepTime_
unsigned int sleepTime_
Definition: EcalBarrelMonitorDbModule.h:58
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
MonitorElementsDb::beginJob
void beginJob(void)
Definition: MonitorElementsDb.cc:100
EcalBarrelMonitorDbModule::ME_Db_
MonitorElementsDb * ME_Db_
Definition: EcalBarrelMonitorDbModule.h:56