CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalBarrelMonitorXdaqClient.cc
Go to the documentation of this file.
1 /*
2  * \file EcalBarrelMonitorXdaqClient.cc
3  *
4  * $Date: 2010/03/27 20:30:36 $
5  * $Revision: 1.4 $
6  * \author G. Della Ricca
7  *
8 */
9 
14 
15 #ifdef WITH_ECAL_COND_DB
18 #endif
19 
21 
23 
24 #include "xgi/Input.h"
25 #include "xgi/Output.h"
26 
27 #include "xgi/Method.h"
28 #include "xgi/Utils.h"
29 
30 #include "cgicc/Cgicc.h"
31 #include "cgicc/FormEntry.h"
32 #include "cgicc/HTMLClasses.h"
33 
35 
36 public:
37 
39 EcalBarrelMonitorXdaqClient(const edm::ParameterSet & ps) : EcalBarrelMonitorClient(ps), ModuleWeb("EcalBarrelMonitorXdaqClient") {};
40 
43 
46 
47  std::string path;
48  std::string mname;
49 
50  static bool autorefresh_ = false;
51 
52  try {
53 
54  cgicc::Cgicc cgi(in);
55 
56  if ( xgi::Utils::hasFormElement(cgi,"autorefresh") ) {
57  autorefresh_ = xgi::Utils::getFormElement(cgi, "autorefresh")->getIntegerValue() != 0;
58  }
59 
60  if ( xgi::Utils::hasFormElement(cgi,"module") ) {
61  mname = xgi::Utils::getFormElement(cgi, "module")->getValue();
62  }
63 
64  cgicc::CgiEnvironment cgie(in);
65  path = cgie.getPathInfo() + "?" + cgie.getQueryString();
66 
67  } catch (std::exception &e) {
68 
69  std::cerr << "Standard C++ exception : " << e.what() << std::endl;
70 
71  }
72 
73  *out << cgicc::HTMLDoctype(cgicc::HTMLDoctype::eStrict) << std::endl;
74  *out << cgicc::html().set("lang", "en").set("dir","ltr") << std::endl;
75 
76  *out << "<html>" << std::endl;
77 
78  *out << "<head>" << std::endl;
79 
80  *out << "<title>" << typeid(EcalBarrelMonitorXdaqClient).name()
81  << " MAIN</title>" << std::endl;
82 
83  if ( autorefresh_ ) {
84  *out << "<meta http-equiv=\"refresh\" content=\"3\">" << std::endl;
85  }
86 
87  *out << "</head>" << std::endl;
88 
89  *out << "<body>" << std::endl;
90 
91  *out << cgicc::form().set("method","GET").set("action", path )
92  << std::endl;
93  *out << cgicc::input().set("type","hidden").set("name","module").set("value", mname)
94  << std::endl;
95  *out << cgicc::input().set("type","hidden").set("name","autorefresh").set("value", autorefresh_?"0":"1")
96  << std::endl;
97  *out << cgicc::input().set("type","submit").set("value",autorefresh_?"Toggle AutoRefresh OFF":"Toggle AutoRefresh ON")
98  << std::endl;
99  *out << cgicc::form() << std::endl;
100 
101  *out << cgicc::h3( "EcalBarrelMonitorXdaqClient Status" ).set( "style", "font-family:arial" ) << std::endl;
102 
103  *out << "<table style=\"font-family: arial\"><tr><td>" << std::endl;
104 
105  *out << "<p style=\"font-family: arial\">"
106  << "<table border=1>"
107  << "<tr><th>Cycle</th><td align=right>" << ievt_;
108  int nevt = 0;
109  if ( h_ != 0 ) nevt = int( h_->GetEntries());
110  *out << "<tr><th>Event</th><td align=right>" << nevt
111  << "</td><tr><th>Run</th><td align=right>" << run_
112  << "</td><tr><th>Run Type</th><td align=right> " << this->getRunType()
113  << "</td></table></p>" << std::endl;
114 
115  *out << "</td><td>" << std::endl;
116 
117  *out << "<p style=\"font-family: arial\">"
118  << "<table border=1>"
119  << "<tr><th>Evt Type</th><th>Evt/Run</th><th>Evt Type</th><th>Evt/Run</th>" << std::endl;
120  for( unsigned int i = 0, j = 0; i < runTypes_.size(); i++ ) {
121  if ( strcmp(runTypes_[i].c_str(), "UNKNOWN") != 0 ) {
122  if ( j++%2 == 0 ) *out << "<tr>";
123  nevt = 0;
124  if ( h_ != 0 ) nevt = int( h_->GetBinContent(i+1) );
125  *out << "<td>" << runTypes_[i]
126  << "</td><td align=right>" << nevt << std::endl;
127  }
128  }
129  *out << "</td></table></p>" << std::endl;
130 
131  *out << "</td><tr><td colspan=2>" << std::endl;
132 
133  *out << "<p style=\"font-family: arial\">"
134  << "<table border=1>"
135  << "<tr><th>Client</th><th>Cyc/Job</th><th>Cyc/Run</th><th>Client</th><th>Cyc/Job</th><th>Cyc/Run</th>" << std::endl;
136  for( unsigned int i = 0; i < clients_.size(); i++ ) {
137  if ( clients_[i] != 0 ) {
138  if ( i%2 == 0 ) *out << "<tr>";
139  *out << "<td>" << clientsNames_[i]
140  << "</td><td align=right>" << clients_[i]->getEvtPerJob()
141  << "</td><td align=right>" << clients_[i]->getEvtPerRun() << std::endl;
142  }
143  }
144  *out << "</td></table></p>" << std::endl;
145 
146  *out << "</td><tr><td>" << std::endl;
147 
148 #ifdef WITH_ECAL_COND_DB
149  *out << "<p style=\"font-family: arial\">"
150  << "<table border=1>"
151  << "<tr><th colspan=2>RunIOV</th>"
152  << "<tr><td>Run Number</td><td align=right> " << runiov_.getRunNumber()
153  << "</td><tr><td>Run Start</td><td align=right> " << runiov_.getRunStart().str()
154  << "</td><tr><td>Run End</td><td align=right> " << runiov_.getRunEnd().str()
155  << "</td></table></p>" << std::endl;
156 
157  *out << "</td><td colsapn=2>" << std::endl;
158 
159  *out << "<p style=\"font-family: arial\">"
160  << "<table border=1>"
161  << "<tr><th colspan=2>RunTag</th>"
162  << "<tr><td>GeneralTag</td><td align=right> " << runiov_.getRunTag().getGeneralTag()
163  << "</td><tr><td>Location</td><td align=right> " << runiov_.getRunTag().getLocationDef().getLocation()
164  << "</td><tr><td>Run Type</td><td align=right> " << runiov_.getRunTag().getRunTypeDef().getRunType()
165  << "</td></table></p>" << std::endl;
166 
167  *out << "</td><tr><td>" << std::endl;
168 
169  *out << "<p style=\"font-family: arial\">"
170  << "<table border=1>"
171  << "<tr><th colspan=2>MonRunIOV</th>"
172  << "<tr><td>SubRun Number</td><td align=right> " << moniov_.getSubRunNumber()
173  << "</td><tr><td>SubRun Start</td><td align=right> " << moniov_.getSubRunStart().str()
174  << "</td><tr><td>SubRun End</td><td align=right> " << moniov_.getSubRunEnd().str()
175  << "</td></table></p>" << std::endl;
176 
177  *out << "</td><td colspan=2>" << std::endl;
178 
179  *out << "<p style=\"font-family: arial\">"
180  << "<table border=1>"
181  << "<tr><th colspan=2>MonRunTag</th>"
182  << "<tr><td>GeneralTag</td><td align=right> " << moniov_.getMonRunTag().getGeneralTag()
183  << "</td><tr><td>Monitoring Version</td><td align=right> " << moniov_.getMonRunTag().getMonVersionDef().getMonitoringVersion()
184  << "</td></table></p>" << std::endl;
185 #endif
186 
187  *out << "</td><table>" << std::endl;
188 
189  *out << "</body>" << std::endl;
190 
191  *out << "</html>" << std::endl;
192 
193  };
194 
195 void publish(xdata::InfoSpace *) {};
196 
197 };
198 
201 
int i
Definition: DBlmapReader.cc:9
#define Input(cl)
Definition: vmac.h:189
std::vector< std::string > clientsNames_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual ~EcalBarrelMonitorXdaqClient()
Destructor.
list path
Definition: scaleCards.py:51
int j
Definition: DBlmapReader.cc:9
ModuleWeb(const std::string &)
Definition: ModuleWeb.cc:15
std::vector< EBClient * > clients_
tuple out
Definition: dbtoconf.py:99
std::vector< std::string > runTypes_
#define Output(cl)
Definition: vmac.h:193
EcalBarrelMonitorXdaqClient(const edm::ParameterSet &ps)
Constructor.
void defaultWebPage(xgi::Input *in, xgi::Output *out)
XDAQ web page.