CMS 3D CMS Logo

evf::ExceptionGenerator Class Reference

#include <EventFilter/Utilities/plugins/ExceptionGenerator.h>

Inheritance diagram for evf::ExceptionGenerator:

edm::EDAnalyzer evf::ModuleWeb

List of all members.

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
void defaultWebPage (xgi::Input *in, xgi::Output *out)
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 ExceptionGenerator (const edm::ParameterSet &)
void publish (xdata::InfoSpace *)
 ~ExceptionGenerator ()

Static Public Attributes

static const std::string menu [menu_items]
static const int menu_items = 8

Private Attributes

int actionId_
bool actionRequired_
unsigned int intqualifier_
std::string original_referrer_
std::string qualifier_


Detailed Description

Definition at line 21 of file ExceptionGenerator.h.


Constructor & Destructor Documentation

evf::ExceptionGenerator::ExceptionGenerator ( const edm::ParameterSet pset  )  [explicit]

Definition at line 27 of file ExceptionGenerator.cc.

00027                                                                        : 
00028       ModuleWeb("ExceptionGenerator"), actionRequired_(false), actionId_(-1)
00029     {
00030       
00031 
00032     }

evf::ExceptionGenerator::~ExceptionGenerator (  )  [inline]

Definition at line 28 of file ExceptionGenerator.h.

00028 {};


Member Function Documentation

void evf::ExceptionGenerator::analyze ( const edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 33 of file ExceptionGenerator.cc.

References actionId_, actionRequired_, Exception, cmsRelvalreport::exit, intqualifier_, qualifier_, and cmsRelvalreportInput::step.

00034     {
00035       if(actionRequired_) 
00036         {
00037           int ind = 0; 
00038           int step = 1; 
00039           switch(actionId_)
00040             {
00041             case 0:
00042               ::usleep(intqualifier_*1000);
00043               break;
00044             case 1:
00045               ::sleep(0xFFFFFFF);
00046               break;
00047             case 2:
00048               throw cms::Exception(qualifier_) << "This exception was generated by the ExceptionGenerator";
00049               break;
00050             case 3:
00051               exit(-1);
00052               break;
00053             case 4:
00054               abort();
00055               break;
00056             case 5:
00057               throw qualifier_;
00058               break;
00059             case 6:
00060               while(1){ind+=step; if(ind>1000000) step = -1; if(ind==0) step = 1;}
00061               break;
00062             case 7:
00063               edm::LogError("TestErrorMessage") << qualifier_;
00064             }
00065         }
00066     }

void evf::ExceptionGenerator::defaultWebPage ( xgi::Input *  in,
xgi::Output *  out 
) [virtual]

Reimplemented from evf::ModuleWeb.

Definition at line 73 of file ExceptionGenerator.cc.

References actionId_, actionRequired_, e, lat::endl(), exception, i, iggi_31X_cfg::input, intqualifier_, menu, menu_items, evf::ModuleWeb::moduleName_, btag::LeptonSelector::option(), original_referrer_, path(), qualifier_, and dummy::select().

00074     {
00075 
00076       std::string path;
00077       std::string urn;
00078       std::string mname;
00079       try 
00080         {
00081           cgicc::Cgicc cgi(in);
00082           if ( xgi::Utils::hasFormElement(cgi,"exceptiontype") )
00083             {
00084               actionId_ = xgi::Utils::getFormElement(cgi, "exceptiontype")->getIntegerValue();
00085               if(actionId_>0)
00086                 qualifier_ = xgi::Utils::getFormElement(cgi, "qualifier")->getValue();
00087               else
00088                 intqualifier_ =  xgi::Utils::getFormElement(cgi, "qualifier")->getIntegerValue();
00089               actionRequired_ = true;
00090             }
00091           if ( xgi::Utils::hasFormElement(cgi,"module") )
00092             mname = xgi::Utils::getFormElement(cgi, "module")->getValue();
00093           cgicc::CgiEnvironment cgie(in);
00094           if(original_referrer_ == "")
00095             original_referrer_ = cgie.getReferrer();
00096           path = cgie.getPathInfo() + "?" + cgie.getQueryString();
00097           
00098         }
00099       catch (const std::exception & e) 
00100         {
00101           // don't care if it did not work
00102         }
00103       
00104       
00105       using std::endl;
00106       *out << "<html>"                                                   << endl;
00107       *out << "<head>"                                                   << endl;
00108 
00109 
00110       *out << "<STYLE type=\"text/css\"> #T1 {border-width: 2px; border: solid blue; text-align: center} </STYLE> "                                      << endl; 
00111       *out << "<link type=\"text/css\" rel=\"stylesheet\"";
00112       *out << " href=\"/" <<  urn
00113            << "/styles.css\"/>"                   << endl;
00114 
00115       *out << "<title>" << moduleName_
00116            << " MAIN</title>"                                            << endl;
00117 
00118       *out << "</head>"                                                  << endl;
00119       *out << "<body onload=\"loadXMLDoc()\">"                           << endl;
00120       *out << "<table border=\"0\" width=\"100%\">"                      << endl;
00121       *out << "<tr>"                                                     << endl;
00122       *out << "  <td align=\"left\">"                                    << endl;
00123       *out << "    <img"                                                 << endl;
00124       *out << "     align=\"middle\""                                    << endl;
00125       *out << "     src=\"/evf/images/systemerror.jpg\""                 << endl;
00126       *out << "     alt=\"main\""                                        << endl;
00127       *out << "     width=\"90\""                                        << endl;
00128       *out << "     height=\"64\""                                       << endl;
00129       *out << "     border=\"\"/>"                                       << endl;
00130       *out << "    <b>"                                                  << endl;
00131       *out <<             moduleName_                                    << endl;
00132       *out << "    </b>"                                                 << endl;
00133       *out << "  </td>"                                                  << endl;
00134       *out << "  <td width=\"32\">"                                      << endl;
00135       *out << "    <a href=\"/urn:xdaq-application:lid=3\">"             << endl;
00136       *out << "      <img"                                               << endl;
00137       *out << "       align=\"middle\""                                  << endl;
00138       *out << "       src=\"/hyperdaq/images/HyperDAQ.jpg\""             << endl;
00139       *out << "       alt=\"HyperDAQ\""                                  << endl;
00140       *out << "       width=\"32\""                                      << endl;
00141       *out << "       height=\"32\""                                     << endl;
00142       *out << "       border=\"\"/>"                                     << endl;
00143       *out << "    </a>"                                                 << endl;
00144       *out << "  </td>"                                                  << endl;
00145       *out << "  <td width=\"32\">"                                      << endl;
00146       *out << "  </td>"                                                  << endl;
00147       *out << "  <td width=\"32\">"                                      << endl;
00148       *out << "    <a href=\"" << original_referrer_  << "\">"           << endl;
00149       *out << "      <img"                                               << endl;
00150       *out << "       align=\"middle\""                                  << endl;
00151       *out << "       src=\"/evf/images/spoticon.jpg\""                  << endl;
00152       *out << "       alt=\"main\""                                      << endl;
00153       *out << "       width=\"32\""                                      << endl;
00154       *out << "       height=\"32\""                                     << endl;
00155       *out << "       border=\"\"/>"                                     << endl;
00156       *out << "    </a>"                                                 << endl;
00157       *out << "  </td>"                                                  << endl;
00158       *out << "</tr>"                                                    << endl;
00159       *out << "</table>"                                                 << endl;
00160 
00161       *out << "<hr/>"                                                    << endl;
00162 
00163   
00164       *out << cgicc::form().set("method","GET").set("action", path ) 
00165            << std::endl;
00166       *out << cgicc::input().set("type","hidden").set("name","module").set("value", mname) 
00167            << std::endl;
00168       *out << "Select   "                                                << endl;
00169       *out << cgicc::select().set("name","exceptiontype")     << std::endl;
00170       char istring[2];
00171 
00172       for(int i = 0; i < menu_items; i++)
00173         {
00174           sprintf(istring,"%d",i);
00175           *out << cgicc::option().set("value",istring) << menu[i] << cgicc::option()       << std::endl;
00176         }
00177       *out << cgicc::select()        << std::endl;
00178       *out << "<br>"                                                     << endl;
00179       *out << "Qualifier"                                                << endl;
00180       *out << cgicc::input().set("type","text").set("name","qualifier")              << std::endl;
00181       *out << cgicc::input().set("type","submit").set("value","Do It !")             << std::endl;
00182       *out << cgicc::form()                                                << std::endl;  
00183 
00184       *out << "</body>"                                                  << endl;
00185       *out << "</html>"                                                  << endl;
00186     }

void evf::ExceptionGenerator::endLuminosityBlock ( edm::LuminosityBlock const &  lb,
edm::EventSetup const &  es 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 68 of file ExceptionGenerator.cc.

00069     {
00070 
00071     }

void evf::ExceptionGenerator::publish ( xdata::InfoSpace *   )  [inline, virtual]

Implements evf::ModuleWeb.

Definition at line 34 of file ExceptionGenerator.h.

00034 {};


Member Data Documentation

int evf::ExceptionGenerator::actionId_ [private]

Definition at line 41 of file ExceptionGenerator.h.

Referenced by analyze(), and defaultWebPage().

bool evf::ExceptionGenerator::actionRequired_ [private]

Definition at line 34 of file ExceptionGenerator.h.

Referenced by analyze(), and defaultWebPage().

unsigned int evf::ExceptionGenerator::intqualifier_ [private]

Definition at line 39 of file ExceptionGenerator.h.

Referenced by analyze(), and defaultWebPage().

const std::string evf::ExceptionGenerator::menu [static]

Initial value:

  
      {"Sleep x ms", "SleepForever", "Cms Exception", "Exit with error", "Abort", "Unknown Exception", "Endless loop", "Generate Error Message" }

Definition at line 25 of file ExceptionGenerator.h.

Referenced by defaultWebPage().

const int evf::ExceptionGenerator::menu_items = 8 [static]

Definition at line 24 of file ExceptionGenerator.h.

Referenced by defaultWebPage().

std::string evf::ExceptionGenerator::original_referrer_ [private]

Definition at line 40 of file ExceptionGenerator.h.

Referenced by defaultWebPage().

std::string evf::ExceptionGenerator::qualifier_ [private]

Definition at line 38 of file ExceptionGenerator.h.

Referenced by analyze(), and defaultWebPage().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:46:47 2009 for CMSSW by  doxygen 1.5.4