CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

SiPixelWebInterface Class Reference

#include <SiPixelWebInterface.h>

List of all members.

Public Types

enum  SiPixelActionType {
  NoAction = 0, Summary = 1, setupQTest = 2, QTestResult = 3,
  CreateTkMap = 4, PlotSingleModuleHistos = 5, PlotSingleHistogram = 6, PlotTkMapHistogram = 7,
  periodicTrackerMapUpdate = 8, PlotHistogramFromPath = 9, CreatePlots = 10, ComputeGlobalQualityFlag = 11,
  dumpModIds = 12, Occupancy = 13
}

Public Member Functions

bool createTkMap ()
SiPixelActionType getActionFlag ()
void handleEDARequest (xgi::Input *in, xgi::Output *out, int niter)
void performAction ()
void periodicTkMapUpdate (xgi::Output *out)
bool readConfiguration (int &tkmap_freq, int &summary_freq)
void setActionFlag (SiPixelActionType flag)
 SiPixelWebInterface (DQMStore *bei, bool offlineXMLfile, bool Tier0Flag)
 ~SiPixelWebInterface ()

Private Member Functions

std::string get_from_multimap (std::multimap< std::string, std::string > &mymap, std::string key)
void returnReplyXml (xgi::Output *out, const std::string &name, const std::string &comment)

Private Attributes

SiPixelActionExecutoractionExecutor_
DQMStorebei_
SiPixelInformationExtractorinfoExtractor_
bool offlineXMLfile_
std::multimap< std::string,
std::string > 
requestMap_
SiPixelActionType theActionFlag
bool Tier0Flag_
bool tkMapCreated
std::vector< std::string > tkMapOptions_

Detailed Description

Definition at line 13 of file SiPixelWebInterface.h.


Member Enumeration Documentation

Enumerator:
NoAction 
Summary 
setupQTest 
QTestResult 
CreateTkMap 
PlotSingleModuleHistos 
PlotSingleHistogram 
PlotTkMapHistogram 
periodicTrackerMapUpdate 
PlotHistogramFromPath 
CreatePlots 
ComputeGlobalQualityFlag 
dumpModIds 
Occupancy 

Definition at line 18 of file SiPixelWebInterface.h.


Constructor & Destructor Documentation

SiPixelWebInterface::SiPixelWebInterface ( DQMStore bei,
bool  offlineXMLfile,
bool  Tier0Flag 
)
SiPixelWebInterface::~SiPixelWebInterface ( )

Definition at line 41 of file SiPixelWebInterface.cc.

References actionExecutor_, and infoExtractor_.


Member Function Documentation

bool SiPixelWebInterface::createTkMap ( )

Definition at line 332 of file SiPixelWebInterface.cc.

References actionExecutor_, bei_, CreateTkMap, SiPixelActionExecutor::createTkMap(), get_from_multimap(), requestMap_, and theActionFlag.

Referenced by performAction().

                                      {
  //DQMStore * bei = (*mui_p)->getBEInterface();
  if (theActionFlag == SiPixelWebInterface::CreateTkMap) {
    string sname     = get_from_multimap(requestMap_, "MEName");
    string theTKType = get_from_multimap(requestMap_, "TKMapType");
    actionExecutor_->createTkMap(bei_, sname, theTKType);
    return true;
  } else {
    return false;
  }
}
std::string SiPixelWebInterface::get_from_multimap ( std::multimap< std::string, std::string > &  mymap,
std::string  key 
) [private]

Definition at line 369 of file SiPixelWebInterface.cc.

Referenced by createTkMap(), handleEDARequest(), and periodicTkMapUpdate().

{
  std::multimap<std::string, std::string>::iterator it;
  it = mymap.find(key);
  if (it != mymap.end())
    {
      return (it->second);
    }
  return "";
}
SiPixelActionType SiPixelWebInterface::getActionFlag ( ) [inline]

Definition at line 42 of file SiPixelWebInterface.h.

References theActionFlag.

{return theActionFlag;}
void SiPixelWebInterface::handleEDARequest ( xgi::Input *  in,
xgi::Output *  out,
int  niter 
)

Definition at line 52 of file SiPixelWebInterface.cc.

References ACBold, ACCyan, ACGreen, ACPlain, ACReverse, bei_, BUF_SIZE, DQMStore::cd(), ExpressReco_HICollisions_FallBack::cerr, comment, ComputeGlobalQualityFlag, gather_cfg::cout, CreateTkMap, dumpModIds, get_from_multimap(), SiPixelInformationExtractor::getHistosFromPath(), SiPixelInformationExtractor::getIMGCImage(), DQMStore::getMEs(), SiPixelInformationExtractor::getSingleModuleHistos(), SiPixelInformationExtractor::getTrackerMapHistos(), infoExtractor_, AlCaRecoCosmics_cfg::name, NoAction, performAction(), periodicTkMapUpdate(), QTestResult, CgiReader::read_form(), SiPixelInformationExtractor::readAlarmTree(), SiPixelInformationExtractor::readModuleAndHistoList(), SiPixelInformationExtractor::readModuleHistoTree(), SiPixelInformationExtractor::readStatusMessage(), SiPixelInformationExtractor::readSummaryHistoTree(), requestMap_, returnReplyXml(), setupQTest, Summary, theActionFlag, and tkMapCreated.

Referenced by SiPixelEDAClient::defaultWebPage().

                                                                                 {
  DQMScope enter;
  //DQMStore* bei = (*mui_p)->getBEInterface();
  CgiReader reader(in);
  reader.read_form(requestMap_);
  // get the string that identifies the request:
  std::string requestID = get_from_multimap(requestMap_, "RequestID");
  cout << ACGreen << ACBold << ACReverse 
       << "[SiPixelWebInterface::handleEDARequest]"
       << ACCyan 
       << " requestID " 
       << ACPlain
       << requestID << endl;

  if (requestID == "IsReady") {
    theActionFlag = NoAction;    
    returnReplyXml(out, "ReadyState", "wait");
  } else if (requestID == "CheckQTResults") {
   theActionFlag = QTestResult;
  } else if (requestID == "updateIMGCPlots") {    // <-----------------
    theActionFlag = NoAction;    
    std::string MEFolder = get_from_multimap(requestMap_, "MEFolder");
    //cout << ACYellow << ACBold
    //     << "[SiPixelWebInterface::handleEDARequest] "
    //   << ACPlain
    //   << "Collecting ME from folder " 
    //   << MEFolder
    //   << endl ;
    out->getHTTPResponseHeader().addHeader("Content-Type", "text/html");
    out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");   
    out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
    out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
    bei_->cd() ;
    bei_->cd(MEFolder) ;

    vector<std::string> meList = bei_->getMEs() ;
    
    *out << MEFolder << " " ;
    bei_->cd() ;
    for(vector<std::string>::iterator it=meList.begin(); it!=meList.end(); it++)
    {
     *out << *it << " " ;
    }

  } else if (requestID == "getIMGCPlot") {        // <-----------------
   infoExtractor_->getIMGCImage(requestMap_, out);

  } else if (requestID == "SetupQTest") {         // <-----------------
    theActionFlag = setupQTest;

  } else if (requestID == "CreateSummary") {      // <-----------------
    theActionFlag = Summary;

  } else if (requestID == "CreateTkMap") {
    std::string name = "TkMap";
    std::string comment;
    if (tkMapCreated) comment = "Successful";
    else  comment = "Failed";
    returnReplyXml(out, name, comment);
    theActionFlag = CreateTkMap;    
  } else if (requestID == "SingleModuleHistoList") {
    theActionFlag = NoAction;
    infoExtractor_->readModuleAndHistoList(bei_, out);    
  } else if (requestID == "ModuleHistoList") {
    theActionFlag = NoAction;
    string sname = get_from_multimap(requestMap_, "StructureName");
    //cout<<"in EDARequest: structure name= "<<sname<<endl;
    infoExtractor_->readModuleHistoTree(bei_, sname, out);    
  } else if (requestID == "SummaryHistoList") {
    theActionFlag = NoAction;
    string sname = get_from_multimap(requestMap_, "StructureName");
    infoExtractor_->readSummaryHistoTree(bei_, sname, out);    
  } else if (requestID == "AlarmList") {
    theActionFlag = NoAction;
    string sname = get_from_multimap(requestMap_, "StructureName");
    infoExtractor_->readAlarmTree(bei_, sname, out);    
  } else if (requestID == "ReadQTestStatus") {
    theActionFlag = NoAction;
    //string path = get_from_multimap(requestMap_, "Path");
    //infoExtractor_->readStatusMessage(bei_, path, out);
    infoExtractor_->readStatusMessage(bei_, requestMap_, out);
  } else if (requestID == "PlotAsModule") {
    //theActionFlag = PlotSingleModuleHistos;    
    theActionFlag = NoAction;  
    infoExtractor_->getSingleModuleHistos(bei_, requestMap_, out);    
  } else if (requestID == "PlotHistogramFromPath") {
   //theActionFlag = PlotHistogramFromPath;
   theActionFlag = NoAction;
   infoExtractor_->getHistosFromPath(bei_, requestMap_, out);    
  //} else if (requestID == "PlotSingleHistogram") {
  //  theActionFlag = PlotSingleHistogram;

  } else if (requestID == "PlotTkMapHistogram") {
    //string theMEName = get_from_multimap(requestMap_, "MEName");
    //string theModId  = get_from_multimap(requestMap_, "ModId");
    //infoExtractor_->plotTkMapHisto(bei, theModId, theMEName);
    //out->getHTTPResponseHeader().addHeader("Content-Type", "image/png");
    //out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");   
    //out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
    //out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
    //*out << infoExtractor_->getNamedImage(theMEName).str();
    theActionFlag = NoAction;    
    infoExtractor_->getTrackerMapHistos(bei_, requestMap_, out);
  //} else if (requestID == "UpdatePlot") {
  //  string theMEName = get_from_multimap(requestMap_, "MEName");
  //  out->getHTTPResponseHeader().addHeader("Content-Type", "image/png");
  //  out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");   
  //  out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
 //   out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
  //  *out << infoExtractor_->getImage().str();
  //  theActionFlag = NoAction;    
 // } else if (requestID == "UpdateTkMapPlot") {
 //   string theMEName = get_from_multimap(requestMap_, "MEName");
 //   out->getHTTPResponseHeader().addHeader("Content-Type", "image/png");
 //   out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");   
 //   out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
 //   out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
 //   *out << infoExtractor_->getNamedImage(theMEName).str();
 //    theActionFlag = NoAction;    

  } else if (requestID == "GetMEList") {
    theActionFlag = NoAction;
    infoExtractor_->readModuleAndHistoList(bei_, out);    

  } else if (requestID == "GetTkMap") { 
    theActionFlag = NoAction;    
    
    ifstream fin("dqmtmapviewer.xhtml");
    char buf[BUF_SIZE];
    std::ostringstream html_out;
    if (!fin) {
      std::cerr << "Input File: dqmtmapviewer.xhtml "<< " could not be opened!" << std::endl;
      return;
    }
    while (fin.getline(buf, BUF_SIZE, '\n')) { // pops off the newline character 
      html_out << buf << std::endl;
    }
    fin.close();
    
    out->getHTTPResponseHeader().addHeader("Content-type","application/xhtml+xml");
    *out << html_out.str();
  } else if (requestID == "periodicTrackerMapUpdate") {
   theActionFlag = NoAction;
   periodicTkMapUpdate(out) ;

  } else if  (requestID == "globalQFlag") {
    //cout << ACYellow << ACBold << "[SiPixelWebInterface::handleEDARequest]  " 
    //     << ACPlain << "Compute global Pixel quality flag" << endl;
    theActionFlag = ComputeGlobalQualityFlag;
  } else if (requestID == "dumpModIds") {
    theActionFlag = dumpModIds;
  }
    
  performAction();
}
void SiPixelWebInterface::performAction ( )

theOut->getHTTPResponseHeader().addHeader("Content-Type", "image/png"); theOut->getHTTPResponseHeader().addHeader("Pragma", "no-cache"); theOut->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0"); theOut->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT"); cout << ACYellow << ACBold << "[SiPixelWebInterface::PlotTkMapHistogram()]" << ACPlain << " Buffer for " << theMEName << " stored away: shipping back data (" << theOut << ")" << endl ; theOut << infoExtractor_->getNamedImage(theMEName).str();

Definition at line 211 of file SiPixelWebInterface.cc.

References actionExecutor_, bei_, SiPixelActionExecutor::checkQTestResults(), ComputeGlobalQualityFlag, SiPixelInformationExtractor::createImages(), SiPixelActionExecutor::createOccupancy(), CreatePlots, SiPixelActionExecutor::createSummary(), CreateTkMap, createTkMap(), dumpModIds, infoExtractor_, NoAction, Occupancy, periodicTrackerMapUpdate, PlotHistogramFromPath, PlotSingleHistogram, PlotSingleModuleHistos, PlotTkMapHistogram, QTestResult, setActionFlag(), setupQTest, SiPixelActionExecutor::setupQTests(), Summary, theActionFlag, and tkMapCreated.

Referenced by SiPixelEDAClient::analyze(), SiPixelEDAClient::endLuminosityBlock(), SiPixelEDAClient::endRun(), and handleEDARequest().

                                        {
//cout<<"entering performAction..."<<endl;
  //DQMStore * bei_ = (*mui_p)->getBEInterface();
  switch (theActionFlag) {
  case SiPixelWebInterface::CreateTkMap :
    {
     if (createTkMap()) {
//     cout<<"calling the dtor before this?"<<endl;
       tkMapCreated = true;
//       theOut->getHTTPResponseHeader().addHeader("Content-Type", "text/xml");
//      *theOut << "<?xml version=\"1.0\" ?>"        << endl;
//      *theOut << "<TkMap>"                         << endl;
//      *theOut << " <Response>Successfull</Response>" << endl;
//      *theOut << "</TkMap>"                        << endl;
//cout<<"Done creating the TkMap in WI::performAction, what now?!"<<endl;
     }
      break;
    }
  case SiPixelWebInterface::Summary :
    {
      actionExecutor_->createSummary(bei_);
      break;
    }
  case SiPixelWebInterface::Occupancy :
    {
      actionExecutor_->createOccupancy(bei_);
      break;
    }
  case SiPixelWebInterface::setupQTest :
    {
      actionExecutor_->setupQTests(bei_);
      break;
    }
  case SiPixelWebInterface::QTestResult :
    {
      actionExecutor_->checkQTestResults(bei_);
      break;
    }
  case SiPixelWebInterface::PlotSingleModuleHistos :
    {
//      infoExtractor_->plotSingleModuleHistos(bei_, requestMap_);
      break;
    }
  case SiPixelWebInterface::PlotTkMapHistogram :
    {
//      string theMEName = get_from_multimap(requestMap_, "MEName");
//      string theModId  = get_from_multimap(requestMap_, "ModId");
//      infoExtractor_->plotTkMapHisto(bei_, theModId, theMEName);
//
//      cout << ACYellow << ACBold 
//           << "[SiPixelWebInterface::PlotTkMapHistogram()]"
//           << ACPlain
//           << " Buffer for "
//         <<  theMEName
//         << " stored away: shipping back header (" << theOut << ")" 
//           << endl ;
      break;
    }
  case SiPixelWebInterface::PlotSingleHistogram :
    {
//      infoExtractor_->plotSingleHistogram(bei_, requestMap_);
      break;
    }
  case SiPixelWebInterface::periodicTrackerMapUpdate :
    {
      break;
    }
  case SiPixelWebInterface::PlotHistogramFromPath :
    {
//      infoExtractor_->getHistosFromPath(bei_, requestMap_);
      break;
    }
  case SiPixelWebInterface::CreatePlots :
    {
      infoExtractor_->createImages(bei_);
      break;
    }
  case SiPixelWebInterface::dumpModIds  :
    {
      break;
    }
  case SiPixelWebInterface::ComputeGlobalQualityFlag :
    {
      break;
    }
  case SiPixelWebInterface::NoAction :
    {
      break;
    }
  }
  setActionFlag(SiPixelWebInterface::NoAction);
//  cout<<"leaving performAction..."<<endl;
}
void SiPixelWebInterface::periodicTkMapUpdate ( xgi::Output *  out)

Definition at line 346 of file SiPixelWebInterface.cc.

References bei_, get_from_multimap(), infoExtractor_, requestMap_, and SiPixelInformationExtractor::sendTkUpdatedStatus().

Referenced by handleEDARequest().

{
  //DQMStore * bei = (*mui_p)->getBEInterface();
  string sname     = get_from_multimap(requestMap_, "MEName");
  string theTKType = get_from_multimap(requestMap_, "TKMapType");
  infoExtractor_->sendTkUpdatedStatus(bei_, out, sname, theTKType) ;
}
bool SiPixelWebInterface::readConfiguration ( int &  tkmap_freq,
int &  summary_freq 
)

Definition at line 355 of file SiPixelWebInterface.cc.

References actionExecutor_, SiPixelActionExecutor::readConfiguration(), and summarizeEdmComparisonLogfiles::success.

Referenced by SiPixelEDAClient::beginRun().

                                                                            {
  bool success=false;
  tkmap_freq = -1;
  summary_freq = -1;
  if (actionExecutor_)  {
    actionExecutor_->readConfiguration(tkmap_freq,summary_freq);
    if(tkmap_freq!=-1 && summary_freq!=-1) success=true;
  }
  return success;
}
void SiPixelWebInterface::returnReplyXml ( xgi::Output *  out,
const std::string &  name,
const std::string &  comment 
) [private]

Definition at line 319 of file SiPixelWebInterface.cc.

Referenced by handleEDARequest().

                                                                  {
   out->getHTTPResponseHeader().addHeader("Content-Type", "text/xml");
  *out << "<?xml version=\"1.0\" ?>" << std::endl;
  *out << "<TkMap>" << endl;
  *out << " <Response>" << comment << "</Response>" << endl;
  *out << "</TkMap>" << endl;

}
void SiPixelWebInterface::setActionFlag ( SiPixelActionType  flag) [inline]

Member Data Documentation

Definition at line 68 of file SiPixelWebInterface.h.

Referenced by SiPixelWebInterface().

std::multimap<std::string, std::string> SiPixelWebInterface::requestMap_ [private]

Definition at line 66 of file SiPixelWebInterface.h.

Referenced by createTkMap(), handleEDARequest(), and periodicTkMapUpdate().

Definition at line 69 of file SiPixelWebInterface.h.

Referenced by SiPixelWebInterface().

Definition at line 65 of file SiPixelWebInterface.h.

Referenced by handleEDARequest(), performAction(), and SiPixelWebInterface().

std::vector<std::string> SiPixelWebInterface::tkMapOptions_ [private]

Definition at line 64 of file SiPixelWebInterface.h.

Referenced by SiPixelWebInterface().