CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalEndcapMonitorDbModule.cc
Go to the documentation of this file.
1 /*
2  * \file EcalEndcapMonitorDbModule.cc
3  *
4  * \author G. Della Ricca
5  *
6 */
7 
8 #include <unistd.h>
9 
10 #include <iostream>
11 #include <cmath>
12 
15 
16 #include "RelationalAccess/IConnectionService.h"
17 #include "RelationalAccess/IConnectionServiceConfiguration.h"
18 
19 #include "CoralBase/Attribute.h"
20 #include "CoralKernel/Context.h"
21 
23 
25 
27 
29 
30  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
31 
32  xmlFile_ = ps.getUntrackedParameter<std::string>( "xmlFile", "" );
33  if ( xmlFile_.size() != 0 ) {
34  std::cout << "Monitor Elements from DB xml source file is " << xmlFile_ << std::endl;
35  }
36 
37  sleepTime_ = ps.getUntrackedParameter<int>( "sleepTime", 0 );
38  std::cout << "Sleep time is " << sleepTime_ << " second(s)." << std::endl;
39 
40  // html output directory
41  htmlDir_ = ps.getUntrackedParameter<std::string>("htmlDir", ".");
42 
43  if ( htmlDir_.size() != 0 ) {
44  std::cout << " HTML output will go to"
45  << " htmlDir = " << htmlDir_ << std::endl;
46  } else {
47  std::cout << " HTML output is disabled" << std::endl;
48  }
49 
50  ME_Db_ = new MonitorElementsDb( ps, xmlFile_ );
51 
53 
54  icycle_ = 0;
55  session_ = 0;
56 
57 }
58 
60 
61  if ( ME_Db_ ) delete ME_Db_;
62 
63 }
64 
66 
67  icycle_ = 0;
68 
69  if ( ME_Db_ ) ME_Db_->beginJob();
70 
71 }
72 
74 
75  if ( ME_Db_ ) ME_Db_->endJob();
76 
77  std::cout << "EcalEndcapMonitorDbModule: endJob, icycle = " << icycle_ << std::endl;
78 
79 }
80 
82 
83  icycle_++;
84 
85  std::cout << "EcalEndcapMonitorDbModule: icycle = " << icycle_ << std::endl;
86 
87  try {
88  coral::Context& context = coral::Context::instance();
89  context.loadComponent("CORAL/Services/ConnectionService");
90  context.loadComponent("CORAL/Services/EnvironmentAuthenticationService");
91  coral::IHandle<coral::IConnectionService> connectionService = context.query<coral::IConnectionService>("CORAL/Services/ConnectionService");
92  context.loadComponent("CORAL/RelationalPlugins/oracle");
93 
94  // Set configuration parameters
95  coral::IConnectionServiceConfiguration& config = connectionService->configuration();
96  config.setConnectionRetrialPeriod(1);
97  config.setConnectionRetrialTimeOut(10);
98 
99  session_ = connectionService->connect("ECAL CondDB", coral::ReadOnly);
100 
101  if ( ME_Db_ ) ME_Db_->analyze(e, c, session_ );
102 
103  } catch (coral::Exception& e) {
104  std::cerr << "CORAL Exception : " << e.what() << std::endl;
105  } catch (std::exception& e) {
106  std::cerr << "Standard C++ exception : " << e.what() << std::endl;
107  }
108 
109  if ( htmlDir_.size() != 0 ) {
110 
112 
113  }
114 
115  delete session_;
116 
117  sleep( sleepTime_ );
118 
119 }
120 
T getUntrackedParameter(std::string const &, T const &) const
static PFTauRenderPlugin instance
Generate a Monitor Element from DB data.
void analyze(const edm::Event &e, const edm::EventSetup &c, coral::ISessionProxy *s)
Analyze.
virtual ~EcalEndcapMonitorDbModule()
Destructor.
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
EcalEndcapMonitorDbModule(const edm::ParameterSet &ps)
Constructor.
tuple cout
Definition: gather_cfg.py:121
void showDirStructure(void) const
Definition: DQMStore.cc:2961
void htmlOutput(std::string &htmlDir)