CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalBarrelMonitorDbModule.cc
Go to the documentation of this file.
1 /*
2  * \file EcalBarrelMonitorDbModule.cc
3  *
4  * \author G. Della Ricca
5  *
6 */
7 
8 #include "../interface/EcalBarrelMonitorDbModule.h"
9 
10 #include <unistd.h>
11 
12 #include <iostream>
13 #include <cmath>
14 
17 
18 #include "RelationalAccess/IConnectionService.h"
19 #include "RelationalAccess/IConnectionServiceConfiguration.h"
20 
21 #include "CoralBase/Attribute.h"
22 #include "CoralKernel/Context.h"
23 
24 #include "../interface/MonitorElementsDb.h"
25 
27 
29 
31 
32  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
33 
34  xmlFile_ = ps.getUntrackedParameter<std::string>( "xmlFile", "" );
35  if ( xmlFile_.size() != 0 ) {
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_.size() != 0 ) {
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 
52  ME_Db_ = new MonitorElementsDb( ps, xmlFile_ );
53 
55 
56  icycle_ = 0;
57  session_ = 0;
58 }
59 
61 
62  if ( ME_Db_ ) delete ME_Db_;
63 
64 }
65 
67 
68  icycle_ = 0;
69 
70  if ( ME_Db_ ) ME_Db_->beginJob();
71 
72 }
73 
75 
76  if ( ME_Db_ ) ME_Db_->endJob();
77 
78  std::cout << "EcalBarrelMonitorDbModule: endJob, icycle = " << icycle_ << std::endl;
79 
80 }
81 
83 
84  icycle_++;
85 
86  std::cout << "EcalBarrelMonitorDbModule: icycle = " << icycle_ << std::endl;
87 
88  try {
89  coral::Context& context = coral::Context::instance();
90  context.loadComponent("CORAL/Services/ConnectionService");
91  context.loadComponent("CORAL/Services/EnvironmentAuthenticationService");
92  coral::IHandle<coral::IConnectionService> connectionService = context.query<coral::IConnectionService>("CORAL/Services/ConnectionService");
93  context.loadComponent("CORAL/RelationalPlugins/oracle");
94 
95  // Set configuration parameters
96  coral::IConnectionServiceConfiguration& config = connectionService->configuration();
97  config.setConnectionRetrialPeriod(1);
98  config.setConnectionRetrialTimeOut(10);
99 
100  session_ = connectionService->connect("ECAL CondDB", coral::ReadOnly);
101 
102  if ( ME_Db_ ) ME_Db_->analyze(e, c, session_ );
103 
104  } catch (coral::Exception& e) {
105  std::cerr << "CORAL Exception : " << e.what() << std::endl;
106  } catch (std::exception& e) {
107  std::cerr << "Standard C++ exception : " << e.what() << std::endl;
108  }
109 
110  if ( htmlDir_.size() != 0 ) {
111 
113 
114  }
115 
116  delete session_;
117 
118  sleep( sleepTime_ );
119 
120 }
121 
T getUntrackedParameter(std::string const &, T const &) const
static PFTauRenderPlugin instance
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
EcalBarrelMonitorDbModule(const edm::ParameterSet &ps)
Constructor.
void analyze(const edm::Event &e, const edm::EventSetup &c, coral::ISessionProxy *s)
Analyze.
virtual ~EcalBarrelMonitorDbModule()
Destructor.
tuple cout
Definition: gather_cfg.py:121
void showDirStructure(void) const
Definition: DQMStore.cc:3332
void htmlOutput(std::string &htmlDir)
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.