CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

evf::Stepper Class Reference

#include <Stepper.h>

Inheritance diagram for evf::Stepper:
evf::ServiceWeb

List of all members.

Public Member Functions

void defaultWebPage (xgi::Input *in, xgi::Output *out)
void postBeginJob ()
void postEndJob ()
void postEventProcessing (const edm::Event &, const edm::EventSetup &)
void postModule (const edm::ModuleDescription &)
void postSource ()
void preEventProcessing (const edm::EventID &, const edm::Timestamp &)
void preModule (const edm::ModuleDescription &)
void preSource ()
void publish (xdata::InfoSpace *)
 Stepper (const edm::ParameterSet &, edm::ActivityRegistry &)
 ~Stepper ()

Private Member Functions

void wait_on_signal ()

Private Attributes

pthread_cond_t cond_
unsigned int eid_
std::string epstate_
std::string modulelabel_
std::string modulename_
pthread_mutex_t mutex_
std::string original_referrer_
unsigned int rid_
bool step_

Detailed Description

Definition at line 20 of file Stepper.h.


Constructor & Destructor Documentation

evf::Stepper::Stepper ( const edm::ParameterSet iPS,
edm::ActivityRegistry reg 
)
evf::Stepper::~Stepper ( )

Definition at line 42 of file Stepper.cc.

  {
  }

Member Function Documentation

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

Reimplemented from evf::ServiceWeb.

Definition at line 95 of file Stepper.cc.

References cond_, alignCSCRings::e, eid_, epstate_, exception, LaserDQM_cfg::input, modulelabel_, modulename_, mutex_, original_referrer_, getHLTPrescaleColumns::path, rid_, and evf::ServiceWeb::serviceName_.

  {

    std::string path;
    std::string urn;
    std::string mname;
    try 
      {
        cgicc::Cgicc cgi(in);
        if ( xgi::Utils::hasFormElement(cgi,"service") )
          mname = xgi::Utils::getFormElement(cgi, "service")->getValue();
        if ( xgi::Utils::hasFormElement(cgi,"step") )
          {
            pthread_mutex_lock(&mutex_);
            
            pthread_cond_signal(&cond_);
            
            pthread_mutex_unlock(&mutex_);
          }
        cgicc::CgiEnvironment cgie(in);
        if(original_referrer_ == "")
          original_referrer_ = cgie.getReferrer();
        path = cgie.getPathInfo() + "?" + cgie.getQueryString();
        
      }
      catch (const std::exception & e) 
        {
          // don't care if it did not work
        }
      
      
      using std::endl;
      *out << "<html>"                                                   << endl;
      *out << "<head>"                                                   << endl;


      *out << "<STYLE type=\"text/css\"> #T1 {border-width: 2px; border: solid blue; text-align: center} </STYLE> "                                      << endl; 
      *out << "<link type=\"text/css\" rel=\"stylesheet\"";
      *out << " href=\"/" <<  urn
           << "/styles.css\"/>"                   << endl;

      *out << "<title>" << serviceName_
           << " MAIN</title>"                                            << endl;

      *out << "</head>"                                                  << endl;
      *out << "<body onload=\"loadXMLDoc()\">"                           << endl;
      *out << "<table border=\"0\" width=\"100%\">"                      << endl;
      *out << "<tr>"                                                     << endl;
      *out << "  <td align=\"left\">"                                    << endl;
      *out << "    <img"                                                 << endl;
      *out << "     align=\"middle\""                                    << endl;
      *out << "     src=\"/evf/images/stepper.jpg\""                     << endl;
      *out << "     alt=\"main\""                                        << endl;
      *out << "     width=\"90\""                                        << endl;
      *out << "     height=\"64\""                                       << endl;
      *out << "     border=\"\"/>"                                       << endl;
      *out << "    <b>"                                                  << endl;
      *out <<             serviceName_                                   << endl;
      *out << "    </b>"                                                 << endl;
      *out << "  </td>"                                                  << endl;
      *out << "  <td width=\"32\">"                                      << endl;
      *out << "    <a href=\"/urn:xdaq-application:lid=3\">"             << endl;
      *out << "      <img"                                               << endl;
      *out << "       align=\"middle\""                                  << endl;
      *out << "       src=\"/hyperdaq/images/HyperDAQ.jpg\""             << endl;
      *out << "       alt=\"HyperDAQ\""                                  << endl;
      *out << "       width=\"32\""                                      << endl;
      *out << "       height=\"32\""                                     << endl;
      *out << "       border=\"\"/>"                                     << endl;
      *out << "    </a>"                                                 << endl;
      *out << "  </td>"                                                  << endl;
      *out << "  <td width=\"32\">"                                      << endl;
      *out << "  </td>"                                                  << endl;
      *out << "  <td width=\"32\">"                                      << endl;
      *out << "    <a href=\"" << original_referrer_  << "\">"           << endl;
      *out << "      <img"                                               << endl;
      *out << "       align=\"middle\""                                  << endl;
      *out << "       src=\"/evf/images/epicon.jpg\""                    << endl;
      *out << "       alt=\"main\""                                      << endl;
      *out << "       width=\"32\""                                      << endl;
      *out << "       height=\"32\""                                     << endl;
      *out << "       border=\"\"/>"                                     << endl;
      *out << "    </a>"                                                 << endl;
      *out << "  </td>"                                                  << endl;
      *out << "</tr>"                                                    << endl;
      *out << "</table>"                                                 << endl;

      *out << "<hr/>"                                                    << endl;
      
      *out << "run number        " << rid_ << "<br>" << endl;
      *out << "event number      " << eid_ << "<br>" << endl;

      *out << "event processor   " << epstate_ << "<br>" << endl;

      *out << "next module type  " << modulename_ << "<br>" << endl;
      *out << "next module label " << modulelabel_ << "<br>" << endl;

      *out << "<hr/>"                                                    << endl;
  
      *out << cgicc::form().set("method","GET").set("action", path ) 
           << std::endl;
      *out << cgicc::input().set("type","hidden").set("name","service").set("value", mname) 
           << std::endl;
      *out << cgicc::input().set("type","hidden").set("name","step").set("value", "yes") 
           << std::endl;
      *out << cgicc::input().set("type","submit").set("value","Step")      << std::endl;
      *out << cgicc::form()                                                << std::endl;  

      *out << "</body>"                                                  << endl;
      *out << "</html>"                                                  << endl;
  }
void evf::Stepper::postBeginJob ( )

Definition at line 46 of file Stepper.cc.

References epstate_.

Referenced by Stepper().

  {
    //    wait_on_signal();
    epstate_ = "BJD";
  }
void evf::Stepper::postEndJob ( )

Definition at line 52 of file Stepper.cc.

References epstate_, modulelabel_, and wait_on_signal().

Referenced by Stepper().

  {
    wait_on_signal();
    epstate_ = "EJ";
    modulelabel_ = "done";
  }
void evf::Stepper::postEventProcessing ( const edm::Event e,
const edm::EventSetup  
)

Definition at line 68 of file Stepper.cc.

Referenced by Stepper().

  {
  }
void evf::Stepper::postModule ( const edm::ModuleDescription desc)

Definition at line 91 of file Stepper.cc.

Referenced by Stepper().

  {
  }
void evf::Stepper::postSource ( )

Definition at line 78 of file Stepper.cc.

References modulelabel_, and wait_on_signal().

Referenced by Stepper().

  {
    wait_on_signal();
    modulelabel_ = "IND";
  }
void evf::Stepper::preEventProcessing ( const edm::EventID iID,
const edm::Timestamp iTime 
)

Definition at line 59 of file Stepper.cc.

References eid_, epstate_, edm::EventID::event(), rid_, edm::EventID::run(), and wait_on_signal().

Referenced by Stepper().

  {
    rid_ = iID.run();
    eid_ = iID.event();
    wait_on_signal();
    epstate_ = "PRO";
  }
void evf::Stepper::preModule ( const edm::ModuleDescription desc)
void evf::Stepper::preSource ( )

Definition at line 71 of file Stepper.cc.

References modulelabel_, modulename_, and wait_on_signal().

Referenced by Stepper().

  {
    wait_on_signal();
    modulename_ = "source";
    modulelabel_ = "IN";
  }
void evf::Stepper::publish ( xdata::InfoSpace *  ) [inline, virtual]

Implements evf::ServiceWeb.

Definition at line 39 of file Stepper.h.

{}
void evf::Stepper::wait_on_signal ( ) [inline, private]

Definition at line 43 of file Stepper.h.

References cond_, and mutex_.

Referenced by postEndJob(), postSource(), preEventProcessing(), preModule(), and preSource().

        {
          pthread_mutex_lock(&mutex_);
          pthread_cond_wait(&cond_,&mutex_);
          pthread_mutex_unlock(&mutex_);
        }

Member Data Documentation

pthread_cond_t evf::Stepper::cond_ [private]

Definition at line 56 of file Stepper.h.

Referenced by defaultWebPage(), Stepper(), and wait_on_signal().

unsigned int evf::Stepper::eid_ [private]

Definition at line 53 of file Stepper.h.

Referenced by defaultWebPage(), and preEventProcessing().

std::string evf::Stepper::epstate_ [private]

Definition at line 49 of file Stepper.h.

Referenced by defaultWebPage(), postBeginJob(), postEndJob(), preEventProcessing(), and Stepper().

std::string evf::Stepper::modulelabel_ [private]

Definition at line 50 of file Stepper.h.

Referenced by defaultWebPage(), postEndJob(), postSource(), preModule(), preSource(), and Stepper().

std::string evf::Stepper::modulename_ [private]

Definition at line 51 of file Stepper.h.

Referenced by defaultWebPage(), preModule(), preSource(), and Stepper().

pthread_mutex_t evf::Stepper::mutex_ [private]

Definition at line 55 of file Stepper.h.

Referenced by defaultWebPage(), Stepper(), and wait_on_signal().

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

Definition at line 54 of file Stepper.h.

Referenced by defaultWebPage().

unsigned int evf::Stepper::rid_ [private]

Definition at line 52 of file Stepper.h.

Referenced by defaultWebPage(), and preEventProcessing().

bool evf::Stepper::step_ [private]

Definition at line 57 of file Stepper.h.