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  usesResource("DQMStore");
31 
32  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
33 
34  xmlFile_ = ps.getUntrackedParameter<std::string>("xmlFile", "");
35  if (!xmlFile_.empty()) {
36  std::cout << "Monitor Elements from DB xml source file is " << xmlFile_ << std::endl;
37  }
38 
39  sleepTime_ = ps.getUntrackedParameter<int>("sleepTime", 0);
40  std::cout << "Sleep time is " << sleepTime_ << " second(s)." << std::endl;
41 
42  // html output directory
43  htmlDir_ = ps.getUntrackedParameter<std::string>("htmlDir", ".");
44 
45  if (!htmlDir_.empty()) {
46  std::cout << " HTML output will go to"
47  << " htmlDir = " << htmlDir_ << std::endl;
48  } else {
49  std::cout << " HTML output is disabled" << std::endl;
50  }
51 
53 
54  icycle_ = 0;
55  session_ = nullptr;
56 }
57 
59  if (ME_Db_)
60  delete ME_Db_;
61 }
62 
64  icycle_ = 0;
65 
66  if (ME_Db_)
67  ME_Db_->beginJob();
68 }
69 
71  if (ME_Db_)
72  ME_Db_->endJob();
73 
74  std::cout << "EcalBarrelMonitorDbModule: endJob, icycle = " << icycle_ << std::endl;
75 }
76 
78  icycle_++;
79 
80  std::cout << "EcalBarrelMonitorDbModule: icycle = " << icycle_ << std::endl;
81 
82  try {
83  coral::Context &context = coral::Context::instance();
84  context.loadComponent("CORAL/Services/ConnectionService");
85  context.loadComponent("CORAL/Services/EnvironmentAuthenticationService");
86  coral::IHandle<coral::IConnectionService> connectionService =
87  context.query<coral::IConnectionService>("CORAL/Services/ConnectionService");
88  context.loadComponent("CORAL/RelationalPlugins/oracle");
89 
90  // Set configuration parameters
91  coral::IConnectionServiceConfiguration &config = connectionService->configuration();
92  config.setConnectionRetrialPeriod(1);
93  config.setConnectionRetrialTimeOut(10);
94 
95  session_ = connectionService->connect("ECAL CondDB", coral::ReadOnly);
96 
97  if (ME_Db_)
99 
100  } catch (coral::Exception &e) {
101  std::cerr << "CORAL Exception : " << e.what() << std::endl;
102  } catch (std::exception &e) {
103  std::cerr << "Standard C++ exception : " << e.what() << std::endl;
104  }
105 
106  if (!htmlDir_.empty()) {
108  }
109 
110  delete session_;
111 
112  sleep(sleepTime_);
113 }
114 
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
static PFTauRenderPlugin instance
Definition: config.py:1
Generate a Monitor Element from DB data.
EcalBarrelMonitorDbModule(const edm::ParameterSet &ps)
Constructor.
void analyze(const edm::Event &e, const edm::EventSetup &c, coral::ISessionProxy *s)
Analyze.
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void htmlOutput(std::string &htmlDir)
~EcalBarrelMonitorDbModule() override
Destructor.