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