CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Stepper.cc
Go to the documentation of this file.
1 
2 
4 
5 #include "xgi/Input.h"
6 #include "xgi/Output.h"
7 #include "xgi/Utils.h"
8 
9 #include "cgicc/Cgicc.h"
10 #include "cgicc/FormEntry.h"
11 #include "cgicc/HTMLClasses.h"
12 
13 #include <iostream>
14 
15 #include <string>
16 
17 
18 namespace evf{
19 
21  edm::ActivityRegistry& reg) : ServiceWeb("Stepper"), rid_(0), eid_(0), step_(false)
22  {
23 
26 
31 
34  epstate_ = "BJ";
35  modulename_ = "NOT YET";
36  modulelabel_ = "INIT";
37  pthread_mutex_init(&mutex_,0);
38  pthread_cond_init(&cond_,0);
39  }
40 
41 
43  {
44  }
45 
47  {
48  // wait_on_signal();
49  epstate_ = "BJD";
50  }
51 
53  {
55  epstate_ = "EJ";
56  modulelabel_ = "done";
57  }
58 
60  const edm::Timestamp& iTime)
61  {
62  rid_ = iID.run();
63  eid_ = iID.event();
65  epstate_ = "PRO";
66  }
67 
69  {
70  }
72  {
74  modulename_ = "source";
75  modulelabel_ = "IN";
76  }
77 
79  {
81  modulelabel_ = "IND";
82  }
83 
85  {
87  modulename_ = desc.moduleName();
88  modulelabel_ = desc.moduleLabel();
89  }
90 
92  {
93  }
94 
96  {
97 
98  std::string path;
99  std::string urn;
100  std::string mname;
101  try
102  {
103  cgicc::Cgicc cgi(in);
104  if ( xgi::Utils::hasFormElement(cgi,"service") )
105  mname = xgi::Utils::getFormElement(cgi, "service")->getValue();
106  if ( xgi::Utils::hasFormElement(cgi,"step") )
107  {
108  pthread_mutex_lock(&mutex_);
109 
110  pthread_cond_signal(&cond_);
111 
112  pthread_mutex_unlock(&mutex_);
113  }
114  cgicc::CgiEnvironment cgie(in);
115  if(original_referrer_ == "")
116  original_referrer_ = cgie.getReferrer();
117  path = cgie.getPathInfo() + "?" + cgie.getQueryString();
118 
119  }
120  catch (const std::exception & e)
121  {
122  // don't care if it did not work
123  }
124 
125 
126  using std::endl;
127  *out << "<html>" << endl;
128  *out << "<head>" << endl;
129 
130 
131  *out << "<STYLE type=\"text/css\"> #T1 {border-width: 2px; border: solid blue; text-align: center} </STYLE> " << endl;
132  *out << "<link type=\"text/css\" rel=\"stylesheet\"";
133  *out << " href=\"/" << urn
134  << "/styles.css\"/>" << endl;
135 
136  *out << "<title>" << serviceName_
137  << " MAIN</title>" << endl;
138 
139  *out << "</head>" << endl;
140  *out << "<body onload=\"loadXMLDoc()\">" << endl;
141  *out << "<table border=\"0\" width=\"100%\">" << endl;
142  *out << "<tr>" << endl;
143  *out << " <td align=\"left\">" << endl;
144  *out << " <img" << endl;
145  *out << " align=\"middle\"" << endl;
146  *out << " src=\"/evf/images/stepper.jpg\"" << endl;
147  *out << " alt=\"main\"" << endl;
148  *out << " width=\"90\"" << endl;
149  *out << " height=\"64\"" << endl;
150  *out << " border=\"\"/>" << endl;
151  *out << " <b>" << endl;
152  *out << serviceName_ << endl;
153  *out << " </b>" << endl;
154  *out << " </td>" << endl;
155  *out << " <td width=\"32\">" << endl;
156  *out << " <a href=\"/urn:xdaq-application:lid=3\">" << endl;
157  *out << " <img" << endl;
158  *out << " align=\"middle\"" << endl;
159  *out << " src=\"/hyperdaq/images/HyperDAQ.jpg\"" << endl;
160  *out << " alt=\"HyperDAQ\"" << endl;
161  *out << " width=\"32\"" << endl;
162  *out << " height=\"32\"" << endl;
163  *out << " border=\"\"/>" << endl;
164  *out << " </a>" << endl;
165  *out << " </td>" << endl;
166  *out << " <td width=\"32\">" << endl;
167  *out << " </td>" << endl;
168  *out << " <td width=\"32\">" << endl;
169  *out << " <a href=\"" << original_referrer_ << "\">" << endl;
170  *out << " <img" << endl;
171  *out << " align=\"middle\"" << endl;
172  *out << " src=\"/evf/images/epicon.jpg\"" << endl;
173  *out << " alt=\"main\"" << endl;
174  *out << " width=\"32\"" << endl;
175  *out << " height=\"32\"" << endl;
176  *out << " border=\"\"/>" << endl;
177  *out << " </a>" << endl;
178  *out << " </td>" << endl;
179  *out << "</tr>" << endl;
180  *out << "</table>" << endl;
181 
182  *out << "<hr/>" << endl;
183 
184  *out << "run number " << rid_ << "<br>" << endl;
185  *out << "event number " << eid_ << "<br>" << endl;
186 
187  *out << "event processor " << epstate_ << "<br>" << endl;
188 
189  *out << "next module type " << modulename_ << "<br>" << endl;
190  *out << "next module label " << modulelabel_ << "<br>" << endl;
191 
192  *out << "<hr/>" << endl;
193 
194  *out << cgicc::form().set("method","GET").set("action", path )
195  << std::endl;
196  *out << cgicc::input().set("type","hidden").set("name","service").set("value", mname)
197  << std::endl;
198  *out << cgicc::input().set("type","hidden").set("name","step").set("value", "yes")
199  << std::endl;
200  *out << cgicc::input().set("type","submit").set("value","Step") << std::endl;
201  *out << cgicc::form() << std::endl;
202 
203  *out << "</body>" << endl;
204  *out << "</html>" << endl;
205  }
206 } //end namespace evf
207 
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
#define Input(cl)
Definition: vmac.h:189
pthread_cond_t cond_
Definition: Stepper.h:56
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void watchPostModule(PostModule::slot_type const &iSlot)
void watchPreProcessEvent(PreProcessEvent::slot_type const &iSlot)
std::string const & moduleName() const
void preEventProcessing(const edm::EventID &, const edm::Timestamp &)
Definition: Stepper.cc:59
std::string const & moduleLabel() const
void postModule(const edm::ModuleDescription &)
Definition: Stepper.cc:91
void watchPreModule(PreModule::slot_type const &iSlot)
std::string epstate_
Definition: Stepper.h:49
void preSource()
Definition: Stepper.cc:71
void watchPostProcessEvent(PostProcessEvent::slot_type const &iSlot)
list path
Definition: scaleCards.py:51
std::string serviceName_
Definition: ServiceWeb.h:26
std::string modulename_
Definition: Stepper.h:51
void postBeginJob()
Definition: Stepper.cc:46
std::string original_referrer_
Definition: Stepper.h:54
unsigned int eid_
Definition: Stepper.h:53
void watchPreSource(PreSource::slot_type const &iSlot)
void wait_on_signal()
Definition: Stepper.h:43
tuple out
Definition: dbtoconf.py:99
void defaultWebPage(xgi::Input *in, xgi::Output *out)
Definition: Stepper.cc:95
void preModule(const edm::ModuleDescription &)
Definition: Stepper.cc:84
Stepper(const edm::ParameterSet &, edm::ActivityRegistry &)
Definition: Stepper.cc:20
pthread_mutex_t mutex_
Definition: Stepper.h:55
std::string modulelabel_
Definition: Stepper.h:50
void postEndJob()
Definition: Stepper.cc:52
unsigned int rid_
Definition: Stepper.h:52
void postEventProcessing(const edm::Event &, const edm::EventSetup &)
Definition: Stepper.cc:68
void watchPostSource(PostSource::slot_type const &iSlot)
#define Output(cl)
Definition: vmac.h:193
void postSource()
Definition: Stepper.cc:78
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal