CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes | Private Attributes
evf::ExceptionGenerator Class Reference

#include <ExceptionGenerator.h>

Inheritance diagram for evf::ExceptionGenerator:
edm::EDAnalyzer evf::ModuleWeb

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginJob ()
 
void beginRun (edm::Run &r)
 
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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from evf::ModuleWeb
 ModuleWeb (const std::string &)
 
virtual void publishToXmas (xdata::InfoSpace *)
 
virtual ~ModuleWeb ()
 

Static Public Attributes

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

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 
- Protected Attributes inherited from evf::ModuleWeb
std::string moduleName_
 

Detailed Description

Definition at line 20 of file ExceptionGenerator.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file ExceptionGenerator.cc.

30  :
31  ModuleWeb("ExceptionGenerator"),
32  actionId_(pset.getUntrackedParameter<int>("defaultAction",-1)),
33  intqualifier_(pset.getUntrackedParameter<int>("defaultQualifier",0)),
35  {
36 
37  }
T getUntrackedParameter(std::string const &, T const &) const
ModuleWeb(const std::string &)
Definition: ModuleWeb.cc:14
evf::ExceptionGenerator::~ExceptionGenerator ( )
inline

Definition at line 27 of file ExceptionGenerator.h.

27 {};

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 44 of file ExceptionGenerator.cc.

References actionId_, actionRequired_, edm::hlt::Exception, cmsRelvalreport::exit, intqualifier_, j, funct::log(), pi, qualifier_, stor::utils::sleep(), mathSSE::sqrt(), and launcher::step.

45  {
46  float dummy = 0.;
47  if(actionRequired_)
48  {
49  int *pi = 0;
50  int ind = 0;
51  int step = 1;
52  switch(actionId_)
53  {
54  case 0:
55  ::usleep(intqualifier_*1000);
56  break;
57  case 1:
58  ::sleep(0xFFFFFFF);
59  break;
60  case 2:
61  throw cms::Exception(qualifier_) << "This exception was generated by the ExceptionGenerator";
62  break;
63  case 3:
64  exit(-1);
65  break;
66  case 4:
67  abort();
68  break;
69  case 5:
70  throw qualifier_;
71  break;
72  case 6:
73  while(1){ind+=step; if(ind>1000000) step = -1; if(ind==0) step = 1;}
74  break;
75  case 7:
76  edm::LogError("TestErrorMessage") << qualifier_;
77  break;
78  case 8:
79  *pi=0;
80  break;
81  case 9:
82  for(unsigned int j=0; j<intqualifier_*1000;j++){
83  dummy += sqrt(log(float(j+1)))/float(j*j);
84  }
85  break;
86 
87  }
88  }
89  }
list step
Definition: launcher.py:15
void sleep(Duration_t)
Definition: Utils.h:163
T sqrt(T t)
Definition: SSEVec.h:28
int j
Definition: DBlmapReader.cc:9
Log< T >::type log(const T &t)
Definition: Log.h:22
double pi
void evf::ExceptionGenerator::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 38 of file ExceptionGenerator.cc.

39  {
40  }
void evf::ExceptionGenerator::beginRun ( edm::Run r)

Definition at line 41 of file ExceptionGenerator.cc.

42  {
43  }
void evf::ExceptionGenerator::defaultWebPage ( xgi::Input in,
xgi::Output out 
)
virtual

Reimplemented from evf::ModuleWeb.

Definition at line 96 of file ExceptionGenerator.cc.

References actionId_, actionRequired_, gather_cfg::cout, cmsCodeRules.cppFunctionSkipper::exception, first, i, collect_tpl::input, intqualifier_, menu, menu_items, evf::ModuleWeb::moduleName_, original_referrer_, path(), pos, qualifier_, o2o::query, edm::second(), benchmark_cfg::select, and EcalElecEmulTccFlatFileProducerFromTPG_cfg::tokens.

97  {
98  std::string path;
99  std::string urn;
100  std::string mname;
101  std::string query;
102  try
103  {
104  cgicc::Cgicc cgi(in);
105  if ( xgi::Utils::hasFormElement(cgi,"exceptiontype") )
106  {
107  actionId_ = xgi::Utils::getFormElement(cgi, "exceptiontype")->getIntegerValue();
108  qualifier_ = xgi::Utils::getFormElement(cgi, "qualifier")->getValue();
109  intqualifier_ = xgi::Utils::getFormElement(cgi, "qualifier")->getIntegerValue();
110  actionRequired_ = true;
111  }
112  if ( xgi::Utils::hasFormElement(cgi,"module") )
113  mname = xgi::Utils::getFormElement(cgi, "module")->getValue();
114  cgicc::CgiEnvironment cgie(in);
115  if(original_referrer_ == "")
116  original_referrer_ = cgie.getReferrer();
117  path = cgie.getPathInfo();
118  query = cgie.getQueryString();
119  if(actionId_>=0)
120  std::cout << " requested action " << actionId_ << " "
121  << menu[actionId_] << ". Number of cycles "
122  << intqualifier_ << std::endl;
123  }
124  catch (const std::exception & e)
125  {
126  // don't care if it did not work
127  }
128 
129  using std::endl;
130  *out << "<html>" << endl;
131  *out << "<head>" << endl;
132 
133 
134  *out << "<STYLE type=\"text/css\"> #T1 {border-width: 2px; border: solid blue; text-align: center} </STYLE> " << endl;
135  *out << "<link type=\"text/css\" rel=\"stylesheet\"";
136  *out << " href=\"/" << urn
137  << "/styles.css\"/>" << endl;
138 
139  *out << "<title>" << moduleName_
140  << " MAIN</title>" << endl;
141 
142  *out << "</head>" << endl;
143  *out << "<body onload=\"loadXMLDoc()\">" << endl;
144  *out << "<table border=\"0\" width=\"100%\">" << endl;
145  *out << "<tr>" << endl;
146  *out << " <td align=\"left\">" << endl;
147  *out << " <img" << endl;
148  *out << " align=\"middle\"" << endl;
149  *out << " src=\"/evf/images/systemerror.jpg\"" << endl;
150  *out << " alt=\"main\"" << endl;
151  *out << " width=\"90\"" << endl;
152  *out << " height=\"64\"" << endl;
153  *out << " border=\"\"/>" << endl;
154  *out << " <b>" << endl;
155  *out << moduleName_ << endl;
156  *out << " </b>" << endl;
157  *out << " </td>" << endl;
158  *out << " <td width=\"32\">" << endl;
159  *out << " <a href=\"/urn:xdaq-application:lid=3\">" << endl;
160  *out << " <img" << endl;
161  *out << " align=\"middle\"" << endl;
162  *out << " src=\"/hyperdaq/images/HyperDAQ.jpg\"" << endl;
163  *out << " alt=\"HyperDAQ\"" << endl;
164  *out << " width=\"32\"" << endl;
165  *out << " height=\"32\"" << endl;
166  *out << " border=\"\"/>" << endl;
167  *out << " </a>" << endl;
168  *out << " </td>" << endl;
169  *out << " <td width=\"32\">" << endl;
170  *out << " </td>" << endl;
171  *out << " <td width=\"32\">" << endl;
172  *out << " <a href=\"" << original_referrer_ << "\">" << endl;
173  *out << " <img" << endl;
174  *out << " align=\"middle\"" << endl;
175  *out << " src=\"/evf/images/spoticon.jpg\"" << endl;
176  *out << " alt=\"main\"" << endl;
177  *out << " width=\"32\"" << endl;
178  *out << " height=\"32\"" << endl;
179  *out << " border=\"\"/>" << endl;
180  *out << " </a>" << endl;
181  *out << " </td>" << endl;
182  *out << "</tr>" << endl;
183  *out << "</table>" << endl;
184 
185  *out << "<hr/>" << endl;
186 
187  *out << cgicc::form().set("method","GET").set("action", path )
188  << std::endl;
189  boost::char_separator<char> sep("&");
190  boost::tokenizer<boost::char_separator<char> > tokens(query, sep);
191  for (boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
192  tok_iter != tokens.end(); ++tok_iter){
193  size_t pos = (*tok_iter).find_first_of("=");
194  if(pos != std::string::npos){
195  std::string first = (*tok_iter).substr(0 , pos);
196  std::string second = (*tok_iter).substr(pos+1, (*tok_iter).length()-pos-1);
197  *out << cgicc::input().set("type","hidden").set("name",first).set("value", second)
198  << std::endl;
199  }
200  }
201 
202  *out << "Select " << endl;
203  *out << cgicc::select().set("name","exceptiontype") << std::endl;
204  char istring[2];
205 
206  for(int i = 0; i < menu_items; i++)
207  {
208  sprintf(istring,"%d",i);
209  *out << cgicc::option().set("value",istring) << menu[i] << cgicc::option() << std::endl;
210  }
211  *out << cgicc::select() << std::endl;
212  *out << "<br>" << endl;
213  *out << "Qualifier" << endl;
214  *out << cgicc::input().set("type","text").set("name","qualifier") << std::endl;
215  *out << cgicc::input().set("type","submit").set("value","Do It !") << std::endl;
216  *out << cgicc::form() << std::endl;
217 
218  *out << "</body>" << endl;
219  *out << "</html>" << endl;
220  }
int i
Definition: DBlmapReader.cc:9
boost::tokenizer< boost::char_separator< char > > tokenizer
int path() const
Definition: HLTadd.h:3
U second(std::pair< T, U > const &p)
bool first
Definition: L1TdeRCT.cc:79
std::string moduleName_
Definition: ModuleWeb.h:23
static const int menu_items
tuple input
Definition: collect_tpl.py:10
tuple out
Definition: dbtoconf.py:99
static const std::string menu[menu_items]
tuple query
Definition: o2o.py:269
tuple cout
Definition: gather_cfg.py:41
void evf::ExceptionGenerator::endLuminosityBlock ( edm::LuminosityBlock const &  lb,
edm::EventSetup const &  es 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 91 of file ExceptionGenerator.cc.

92  {
93 
94  }
void evf::ExceptionGenerator::publish ( xdata::InfoSpace *  is)
virtual

Implements evf::ModuleWeb.

Definition at line 221 of file ExceptionGenerator.cc.

222  {
223  }

Member Data Documentation

int evf::ExceptionGenerator::actionId_
private

Definition at line 37 of file ExceptionGenerator.h.

Referenced by analyze(), and defaultWebPage().

bool evf::ExceptionGenerator::actionRequired_
private

Definition at line 40 of file ExceptionGenerator.h.

Referenced by analyze(), and defaultWebPage().

unsigned int evf::ExceptionGenerator::intqualifier_
private

Definition at line 38 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", "Segfault",
"Burn CPU"}

Definition at line 24 of file ExceptionGenerator.h.

Referenced by defaultWebPage(), python.Vispa.Gui.WidgetContainer.WidgetContainer::mouseMoveEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), python.Vispa.Gui.WidgetContainer.WidgetContainer::showMenu(), and python.Vispa.Gui.WidgetContainer.WidgetContainer::toggleCollapse().

const int evf::ExceptionGenerator::menu_items = 10
static

Definition at line 23 of file ExceptionGenerator.h.

Referenced by defaultWebPage().

std::string evf::ExceptionGenerator::original_referrer_
private

Definition at line 41 of file ExceptionGenerator.h.

Referenced by defaultWebPage().

std::string evf::ExceptionGenerator::qualifier_
private

Definition at line 39 of file ExceptionGenerator.h.

Referenced by analyze(), and defaultWebPage().