Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "FWCore/Framework/interface/Event.h"
00011 #include "FWCore/Framework/interface/EventSetup.h"
00012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00013 #include "FWCore/Framework/interface/EDAnalyzer.h"
00014
00015 #ifdef WITH_ECAL_COND_DB
00016 #include "OnlineDB/EcalCondDB/interface/RunDat.h"
00017 #include "OnlineDB/EcalCondDB/interface/MonRunDat.h"
00018 #endif
00019
00020 #include "DQM/EcalEndcapMonitorClient/interface/EcalEndcapMonitorClient.h"
00021
00022 #include "EventFilter/Utilities/interface/ModuleWeb.h"
00023
00024 #include "xgi/Input.h"
00025 #include "xgi/Output.h"
00026
00027 #include "xgi/Method.h"
00028 #include "xgi/Utils.h"
00029
00030 #include "cgicc/Cgicc.h"
00031 #include "cgicc/FormEntry.h"
00032 #include "cgicc/HTMLClasses.h"
00033
00034 class EcalEndcapMonitorXdaqClient: public EcalEndcapMonitorClient, public evf::ModuleWeb{
00035
00036 public:
00037
00039 EcalEndcapMonitorXdaqClient(const edm::ParameterSet & ps) : EcalEndcapMonitorClient(ps), ModuleWeb("EcalEndcapMonitorXdaqClient") {};
00040
00042 virtual ~EcalEndcapMonitorXdaqClient() {};
00043
00045 void defaultWebPage(xgi::Input *in, xgi::Output *out) {
00046
00047 std::string path;
00048 std::string mname;
00049
00050 static bool autorefresh_ = false;
00051
00052 try {
00053
00054 cgicc::Cgicc cgi(in);
00055
00056 if ( xgi::Utils::hasFormElement(cgi,"autorefresh") ) {
00057 autorefresh_ = xgi::Utils::getFormElement(cgi, "autorefresh")->getIntegerValue() != 0;
00058 }
00059
00060 if ( xgi::Utils::hasFormElement(cgi,"module") ) {
00061 mname = xgi::Utils::getFormElement(cgi, "module")->getValue();
00062 }
00063
00064 cgicc::CgiEnvironment cgie(in);
00065 path = cgie.getPathInfo() + "?" + cgie.getQueryString();
00066
00067 } catch (std::exception &e) {
00068
00069 std::cerr << "Standard C++ exception : " << e.what() << std::endl;
00070
00071 }
00072
00073 *out << cgicc::HTMLDoctype(cgicc::HTMLDoctype::eStrict) << std::endl;
00074 *out << cgicc::html().set("lang", "en").set("dir","ltr") << std::endl;
00075
00076 *out << "<html>" << std::endl;
00077
00078 *out << "<head>" << std::endl;
00079
00080 *out << "<title>" << typeid(EcalEndcapMonitorXdaqClient).name()
00081 << " MAIN</title>" << std::endl;
00082
00083 if ( autorefresh_ ) {
00084 *out << "<meta http-equiv=\"refresh\" content=\"3\">" << std::endl;
00085 }
00086
00087 *out << "</head>" << std::endl;
00088
00089 *out << "<body>" << std::endl;
00090
00091 *out << cgicc::form().set("method","GET").set("action", path )
00092 << std::endl;
00093 *out << cgicc::input().set("type","hidden").set("name","module").set("value", mname)
00094 << std::endl;
00095 *out << cgicc::input().set("type","hidden").set("name","autorefresh").set("value", autorefresh_?"0":"1")
00096 << std::endl;
00097 *out << cgicc::input().set("type","submit").set("value",autorefresh_?"Toggle AutoRefresh OFF":"Toggle AutoRefresh ON")
00098 << std::endl;
00099 *out << cgicc::form() << std::endl;
00100
00101 *out << cgicc::h3( "EcalEndcapMonitorXdaqClient Status" ).set( "style", "font-family:arial" ) << std::endl;
00102
00103 *out << "<table style=\"font-family: arial\"><tr><td>" << std::endl;
00104
00105 *out << "<p style=\"font-family: arial\">"
00106 << "<table border=1>"
00107 << "<tr><th>Cycle</th><td align=right>" << ievt_;
00108 int nevt = 0;
00109 if ( h_ != 0 ) nevt = int( h_->GetEntries());
00110 *out << "<tr><th>Event</th><td align=right>" << nevt
00111 << "</td><tr><th>Run</th><td align=right>" << run_
00112 << "</td><tr><th>Run Type</th><td align=right> " << this->getRunType()
00113 << "</td></table></p>" << std::endl;
00114
00115 *out << "</td><td>" << std::endl;
00116
00117 *out << "<p style=\"font-family: arial\">"
00118 << "<table border=1>"
00119 << "<tr><th>Evt Type</th><th>Evt/Run</th><th>Evt Type</th><th>Evt/Run</th>" << std::endl;
00120 for( unsigned int i = 0, j = 0; i < runTypes_.size(); i++ ) {
00121 if ( strcmp(runTypes_[i].c_str(), "UNKNOWN") != 0 ) {
00122 if ( j++%2 == 0 ) *out << "<tr>";
00123 nevt = 0;
00124 if ( h_ != 0 ) nevt = int( h_->GetBinContent(i+1) );
00125 *out << "<td>" << runTypes_[i]
00126 << "</td><td align=right>" << nevt << std::endl;
00127 }
00128 }
00129 *out << "</td></table></p>" << std::endl;
00130
00131 *out << "</td><tr><td colspan=2>" << std::endl;
00132
00133 *out << "<p style=\"font-family: arial\">"
00134 << "<table border=1>"
00135 << "<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;
00136 for( unsigned int i = 0; i < clients_.size(); i++ ) {
00137 if ( clients_[i] != 0 ) {
00138 if ( i%2 == 0 ) *out << "<tr>";
00139 *out << "<td>" << clientsNames_[i]
00140 << "</td><td align=right>" << clients_[i]->getEvtPerJob()
00141 << "</td><td align=right>" << clients_[i]->getEvtPerRun() << std::endl;
00142 }
00143 }
00144 *out << "</td></table></p>" << std::endl;
00145
00146 *out << "</td><tr><td>" << std::endl;
00147
00148 #ifdef WITH_ECAL_COND_DB
00149 *out << "<p style=\"font-family: arial\">"
00150 << "<table border=1>"
00151 << "<tr><th colspan=2>RunIOV</th>"
00152 << "<tr><td>Run Number</td><td align=right> " << runiov_.getRunNumber()
00153 << "</td><tr><td>Run Start</td><td align=right> " << runiov_.getRunStart().str()
00154 << "</td><tr><td>Run End</td><td align=right> " << runiov_.getRunEnd().str()
00155 << "</td></table></p>" << std::endl;
00156
00157 *out << "</td><td colsapn=2>" << std::endl;
00158
00159 *out << "<p style=\"font-family: arial\">"
00160 << "<table border=1>"
00161 << "<tr><th colspan=2>RunTag</th>"
00162 << "<tr><td>GeneralTag</td><td align=right> " << runiov_.getRunTag().getGeneralTag()
00163 << "</td><tr><td>Location</td><td align=right> " << runiov_.getRunTag().getLocationDef().getLocation()
00164 << "</td><tr><td>Run Type</td><td align=right> " << runiov_.getRunTag().getRunTypeDef().getRunType()
00165 << "</td></table></p>" << std::endl;
00166
00167 *out << "</td><tr><td>" << std::endl;
00168
00169 *out << "<p style=\"font-family: arial\">"
00170 << "<table border=1>"
00171 << "<tr><th colspan=2>MonRunIOV</th>"
00172 << "<tr><td>SubRun Number</td><td align=right> " << moniov_.getSubRunNumber()
00173 << "</td><tr><td>SubRun Start</td><td align=right> " << moniov_.getSubRunStart().str()
00174 << "</td><tr><td>SubRun End</td><td align=right> " << moniov_.getSubRunEnd().str()
00175 << "</td></table></p>" << std::endl;
00176
00177 *out << "</td><td colspan=2>" << std::endl;
00178
00179 *out << "<p style=\"font-family: arial\">"
00180 << "<table border=1>"
00181 << "<tr><th colspan=2>MonRunTag</th>"
00182 << "<tr><td>GeneralTag</td><td align=right> " << moniov_.getMonRunTag().getGeneralTag()
00183 << "</td><tr><td>Monitoring Version</td><td align=right> " << moniov_.getMonRunTag().getMonVersionDef().getMonitoringVersion()
00184 << "</td></table></p>" << std::endl;
00185 #endif
00186
00187 *out << "</td><table>" << std::endl;
00188
00189 *out << "</body>" << std::endl;
00190
00191 *out << "</html>" << std::endl;
00192
00193 };
00194
00195 void publish(xdata::InfoSpace *) {};
00196
00197 };
00198
00199 #include "FWCore/Framework/interface/MakerMacros.h"
00200 DEFINE_FWK_MODULE(EcalEndcapMonitorXdaqClient);
00201