CMS 3D CMS Logo

SiPixelWebInterface Class Reference

#include <DQM/SiPixelMonitorClient/interface/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)
 ~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 tkMapCreated
std::vector< std::string > tkMapOptions_


Detailed Description

Definition at line 13 of file SiPixelWebInterface.h.


Member Enumeration Documentation

enum SiPixelWebInterface::SiPixelActionType

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

Definition at line 18 of file SiPixelWebInterface.h.

00018                         {NoAction                 =  0,
00019                          Summary                  =  1,
00020                          setupQTest               =  2,
00021                          QTestResult              =  3,
00022                          CreateTkMap              =  4,
00023                          PlotSingleModuleHistos   =  5,
00024                          PlotSingleHistogram      =  6,
00025                          PlotTkMapHistogram       =  7,
00026                          periodicTrackerMapUpdate =  8,
00027                          PlotHistogramFromPath    =  9,
00028                          CreatePlots              = 10,
00029                          ComputeGlobalQualityFlag = 11,
00030                          dumpModIds               = 12,
00031                          Occupancy                = 13};


Constructor & Destructor Documentation

SiPixelWebInterface::SiPixelWebInterface ( DQMStore bei,
bool  offlineXMLfile 
)

Definition at line 21 of file SiPixelWebInterface.cc.

References actionExecutor_, infoExtractor_, NoAction, offlineXMLfile_, theActionFlag, tkMapCreated, and tkMapOptions_.

00021                                                                            : bei_(bei), offlineXMLfile_(offlineXMLfile) {
00022   
00023   theActionFlag = NoAction;
00024   actionExecutor_ = 0;
00025   infoExtractor_  = 0;
00026   tkMapOptions_.push_back("Persistant");
00027   tkMapOptions_.push_back("Temporary");
00028   tkMapCreated = false;
00029   if (actionExecutor_ == 0) actionExecutor_ = new SiPixelActionExecutor(offlineXMLfile_);
00030   if (infoExtractor_ == 0) infoExtractor_ = new SiPixelInformationExtractor(offlineXMLfile_);
00031 }

SiPixelWebInterface::~SiPixelWebInterface (  ) 

Definition at line 37 of file SiPixelWebInterface.cc.

References actionExecutor_, and infoExtractor_.

00037                                           {
00038   if (actionExecutor_) delete actionExecutor_;
00039   actionExecutor_ = 0;
00040   if (infoExtractor_)  delete infoExtractor_;
00041   infoExtractor_  = 0; 
00042 }


Member Function Documentation

bool SiPixelWebInterface::createTkMap (  ) 

Definition at line 306 of file SiPixelWebInterface.cc.

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

Referenced by performAction().

00306                                       {
00307   //DQMStore * bei = (*mui_p)->getBEInterface();
00308   if (theActionFlag == SiPixelWebInterface::CreateTkMap) {
00309     string sname     = get_from_multimap(requestMap_, "MEName");
00310     string theTKType = get_from_multimap(requestMap_, "TKMapType");
00311     actionExecutor_->createTkMap(bei_, sname, theTKType);
00312     return true;
00313   } else {
00314     return false;
00315   }
00316 }

std::string SiPixelWebInterface::get_from_multimap ( std::multimap< std::string, std::string > &  mymap,
std::string  key 
) [private]

Definition at line 343 of file SiPixelWebInterface.cc.

References it.

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

00344 {
00345   std::multimap<std::string, std::string>::iterator it;
00346   it = mymap.find(key);
00347   if (it != mymap.end())
00348     {
00349       return (it->second);
00350     }
00351   return "";
00352 }

SiPixelActionType SiPixelWebInterface::getActionFlag (  )  [inline]

Definition at line 41 of file SiPixelWebInterface.h.

References theActionFlag.

00041 {return theActionFlag;}

void SiPixelWebInterface::handleEDARequest ( xgi::Input *  in,
xgi::Output *  out,
int  niter 
)

Definition at line 48 of file SiPixelWebInterface.cc.

References ACBold, ACCyan, ACGreen, ACPlain, ACReverse, bei_, DQMStore::cd(), comment, ComputeGlobalQualityFlag, GenMuonPlsPt100GeV_cfg::cout, CreateTkMap, dumpModIds, lat::endl(), get_from_multimap(), SiPixelInformationExtractor::getHistosFromPath(), SiPixelInformationExtractor::getIMGCImage(), DQMStore::getMEs(), SiPixelInformationExtractor::getSingleModuleHistos(), SiPixelInformationExtractor::getTrackerMapHistos(), infoExtractor_, it, 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().

00048                                                                                  {
00049   DQMScope enter;
00050   //DQMStore* bei = (*mui_p)->getBEInterface();
00051   CgiReader reader(in);
00052   reader.read_form(requestMap_);
00053   // get the string that identifies the request:
00054   std::string requestID = get_from_multimap(requestMap_, "RequestID");
00055   cout << ACGreen << ACBold << ACReverse 
00056        << "[SiPixelWebInterface::handleEDARequest]"
00057        << ACCyan 
00058        << " requestID " 
00059        << ACPlain
00060        << requestID << endl;
00061 
00062   if (requestID == "IsReady") {
00063     theActionFlag = NoAction;    
00064     returnReplyXml(out, "ReadyState", "wait");
00065   } else if (requestID == "CheckQTResults") {
00066    theActionFlag = QTestResult;
00067   } else if (requestID == "updateIMGCPlots") {    // <-----------------
00068     theActionFlag = NoAction;    
00069     std::string MEFolder = get_from_multimap(requestMap_, "MEFolder");
00070     //cout << ACYellow << ACBold
00071     //     << "[SiPixelWebInterface::handleEDARequest] "
00072     //   << ACPlain
00073     //   << "Collecting ME from folder " 
00074     //   << MEFolder
00075     //   << endl ;
00076     out->getHTTPResponseHeader().addHeader("Content-Type", "text/html");
00077     out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");   
00078     out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
00079     out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
00080     bei_->cd() ;
00081     bei_->cd(MEFolder) ;
00082 
00083     vector<std::string> meList = bei_->getMEs() ;
00084     
00085     *out << MEFolder << " " ;
00086     bei_->cd() ;
00087     for(vector<std::string>::iterator it=meList.begin(); it!=meList.end(); it++)
00088     {
00089      *out << *it << " " ;
00090     }
00091 
00092   } else if (requestID == "getIMGCPlot") {        // <-----------------
00093    infoExtractor_->getIMGCImage(requestMap_, out);
00094 
00095   } else if (requestID == "SetupQTest") {         // <-----------------
00096     theActionFlag = setupQTest;
00097 
00098   } else if (requestID == "CreateSummary") {      // <-----------------
00099     theActionFlag = Summary;
00100 
00101   } else if (requestID == "CreateTkMap") {
00102     std::string name = "TkMap";
00103     std::string comment;
00104     if (tkMapCreated) comment = "Successful";
00105     else  comment = "Failed";
00106     returnReplyXml(out, name, comment);
00107     theActionFlag = CreateTkMap;    
00108   } else if (requestID == "SingleModuleHistoList") {
00109     theActionFlag = NoAction;
00110     infoExtractor_->readModuleAndHistoList(bei_, out);    
00111   } else if (requestID == "ModuleHistoList") {
00112     theActionFlag = NoAction;
00113     string sname = get_from_multimap(requestMap_, "StructureName");
00114     //cout<<"in EDARequest: structure name= "<<sname<<endl;
00115     infoExtractor_->readModuleHistoTree(bei_, sname, out);    
00116   } else if (requestID == "SummaryHistoList") {
00117     theActionFlag = NoAction;
00118     string sname = get_from_multimap(requestMap_, "StructureName");
00119     infoExtractor_->readSummaryHistoTree(bei_, sname, out);    
00120   } else if (requestID == "AlarmList") {
00121     theActionFlag = NoAction;
00122     string sname = get_from_multimap(requestMap_, "StructureName");
00123     infoExtractor_->readAlarmTree(bei_, sname, out);    
00124   } else if (requestID == "ReadQTestStatus") {
00125     theActionFlag = NoAction;
00126     //string path = get_from_multimap(requestMap_, "Path");
00127     //infoExtractor_->readStatusMessage(bei_, path, out);
00128     infoExtractor_->readStatusMessage(bei_, requestMap_, out);
00129   } else if (requestID == "PlotAsModule") {
00130     //theActionFlag = PlotSingleModuleHistos;    
00131     theActionFlag = NoAction;  
00132     infoExtractor_->getSingleModuleHistos(bei_, requestMap_, out);    
00133   } else if (requestID == "PlotHistogramFromPath") {
00134    //theActionFlag = PlotHistogramFromPath;
00135    theActionFlag = NoAction;
00136    infoExtractor_->getHistosFromPath(bei_, requestMap_, out);    
00137   //} else if (requestID == "PlotSingleHistogram") {
00138   //  theActionFlag = PlotSingleHistogram;
00139 
00140   } else if (requestID == "PlotTkMapHistogram") {
00141     //string theMEName = get_from_multimap(requestMap_, "MEName");
00142     //string theModId  = get_from_multimap(requestMap_, "ModId");
00143     //infoExtractor_->plotTkMapHisto(bei, theModId, theMEName);
00144     //out->getHTTPResponseHeader().addHeader("Content-Type", "image/png");
00145     //out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");   
00146     //out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
00147     //out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
00148     //*out << infoExtractor_->getNamedImage(theMEName).str();
00149     theActionFlag = NoAction;    
00150     infoExtractor_->getTrackerMapHistos(bei_, requestMap_, out);
00151   //} else if (requestID == "UpdatePlot") {
00152   //  string theMEName = get_from_multimap(requestMap_, "MEName");
00153   //  out->getHTTPResponseHeader().addHeader("Content-Type", "image/png");
00154   //  out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");   
00155   //  out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
00156  //   out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
00157   //  *out << infoExtractor_->getImage().str();
00158   //  theActionFlag = NoAction;    
00159  // } else if (requestID == "UpdateTkMapPlot") {
00160  //   string theMEName = get_from_multimap(requestMap_, "MEName");
00161  //   out->getHTTPResponseHeader().addHeader("Content-Type", "image/png");
00162  //   out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");   
00163  //   out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
00164  //   out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
00165  //   *out << infoExtractor_->getNamedImage(theMEName).str();
00166  //    theActionFlag = NoAction;    
00167 
00168   } else if (requestID == "GetMEList") {
00169     theActionFlag = NoAction;
00170     infoExtractor_->readModuleAndHistoList(bei_, out);    
00171 
00172   } else if (requestID == "periodicTrackerMapUpdate") {
00173    theActionFlag = NoAction;
00174    periodicTkMapUpdate(out) ;
00175 
00176   } else if  (requestID == "globalQFlag") {
00177     //cout << ACYellow << ACBold << "[SiPixelWebInterface::handleEDARequest]  " 
00178     //     << ACPlain << "Compute global Pixel quality flag" << endl;
00179     theActionFlag = ComputeGlobalQualityFlag;
00180   } else if (requestID == "dumpModIds") {
00181     theActionFlag = dumpModIds;
00182   }
00183     
00184   performAction();
00185 }

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 190 of file SiPixelWebInterface.cc.

References actionExecutor_, bei_, SiPixelActionExecutor::checkQTestResults(), SiPixelInformationExtractor::createImages(), SiPixelActionExecutor::createOccupancy(), CreatePlots, SiPixelActionExecutor::createSummary(), CreateTkMap, createTkMap(), dumpModIds, SiPixelActionExecutor::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().

00190                                         {
00191 //cout<<"entering performAction..."<<endl;
00192   //DQMStore * bei_ = (*mui_p)->getBEInterface();
00193   switch (theActionFlag) {
00194   case SiPixelWebInterface::CreateTkMap :
00195     {
00196      if (createTkMap()) {
00197        tkMapCreated = true;
00198 //       theOut->getHTTPResponseHeader().addHeader("Content-Type", "text/xml");
00199 //      *theOut << "<?xml version=\"1.0\" ?>"        << endl;
00200 //      *theOut << "<TkMap>"                         << endl;
00201 //      *theOut << " <Response>Successfull</Response>" << endl;
00202 //      *theOut << "</TkMap>"                        << endl;
00203      }
00204       break;
00205     }
00206   case SiPixelWebInterface::Summary :
00207     {
00208       actionExecutor_->createSummary(bei_);
00209       break;
00210     }
00211   case SiPixelWebInterface::Occupancy :
00212     {
00213       actionExecutor_->createOccupancy(bei_);
00214       break;
00215     }
00216   case SiPixelWebInterface::setupQTest :
00217     {
00218       actionExecutor_->setupQTests(bei_);
00219       break;
00220     }
00221   case SiPixelWebInterface::QTestResult :
00222     {
00223       actionExecutor_->checkQTestResults(bei_);
00224       break;
00225     }
00226   case SiPixelWebInterface::PlotSingleModuleHistos :
00227     {
00228 //      infoExtractor_->plotSingleModuleHistos(bei_, requestMap_);
00229       break;
00230     }
00231   case SiPixelWebInterface::PlotTkMapHistogram :
00232     {
00233 //      string theMEName = get_from_multimap(requestMap_, "MEName");
00234 //      string theModId  = get_from_multimap(requestMap_, "ModId");
00235 //      infoExtractor_->plotTkMapHisto(bei_, theModId, theMEName);
00236 //
00237 //      cout << ACYellow << ACBold 
00238 //           << "[SiPixelWebInterface::PlotTkMapHistogram()]"
00239 //           << ACPlain
00240 //           << " Buffer for "
00241 //         <<  theMEName
00242 //         << " stored away: shipping back header (" << theOut << ")" 
00243 //           << endl ;
00256       break;
00257     }
00258   case SiPixelWebInterface::PlotSingleHistogram :
00259     {
00260 //      infoExtractor_->plotSingleHistogram(bei_, requestMap_);
00261       break;
00262     }
00263   case SiPixelWebInterface::periodicTrackerMapUpdate :
00264     {
00265       break;
00266     }
00267   case SiPixelWebInterface::PlotHistogramFromPath :
00268     {
00269 //      infoExtractor_->getHistosFromPath(bei_, requestMap_);
00270       break;
00271     }
00272   case SiPixelWebInterface::CreatePlots :
00273     {
00274       infoExtractor_->createImages(bei_);
00275       break;
00276     }
00277   case SiPixelWebInterface::dumpModIds  :
00278     {
00279       actionExecutor_->dumpModIds(bei_);
00280       break;
00281     }
00282   case SiPixelWebInterface::NoAction :
00283     {
00284       break;
00285     }
00286   }
00287   setActionFlag(SiPixelWebInterface::NoAction);
00288 //  cout<<"leaving performAction..."<<endl;
00289 }

void SiPixelWebInterface::periodicTkMapUpdate ( xgi::Output *  out  ) 

Definition at line 320 of file SiPixelWebInterface.cc.

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

Referenced by handleEDARequest().

00321 {
00322   //DQMStore * bei = (*mui_p)->getBEInterface();
00323   string sname     = get_from_multimap(requestMap_, "MEName");
00324   string theTKType = get_from_multimap(requestMap_, "TKMapType");
00325   infoExtractor_->sendTkUpdatedStatus(bei_, out, sname, theTKType) ;
00326 }

bool SiPixelWebInterface::readConfiguration ( int tkmap_freq,
int summary_freq 
)

Definition at line 329 of file SiPixelWebInterface.cc.

References actionExecutor_, and SiPixelActionExecutor::readConfiguration().

Referenced by SiPixelEDAClient::beginJob().

00329                                                                             {
00330   bool success=false;
00331   tkmap_freq = -1;
00332   summary_freq = -1;
00333   if (actionExecutor_)  {
00334     actionExecutor_->readConfiguration(tkmap_freq,summary_freq);
00335     if(tkmap_freq!=-1 && summary_freq!=-1) success=true;
00336   }
00337   return success;
00338 }

void SiPixelWebInterface::returnReplyXml ( xgi::Output *  out,
const std::string &  name,
const std::string &  comment 
) [private]

Definition at line 293 of file SiPixelWebInterface.cc.

References lat::endl().

Referenced by handleEDARequest().

00295                                                                   {
00296    out->getHTTPResponseHeader().addHeader("Content-Type", "text/xml");
00297   *out << "<?xml version=\"1.0\" ?>" << std::endl;
00298   *out << "<TkMap>" << endl;
00299   *out << " <Response>" << comment << "</Response>" << endl;
00300   *out << "</TkMap>" << endl;
00301 
00302 }

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

Definition at line 42 of file SiPixelWebInterface.h.

References theActionFlag.

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

00042 {theActionFlag = flag;}


Member Data Documentation

SiPixelActionExecutor* SiPixelWebInterface::actionExecutor_ [private]

Definition at line 56 of file SiPixelWebInterface.h.

Referenced by createTkMap(), performAction(), readConfiguration(), SiPixelWebInterface(), and ~SiPixelWebInterface().

DQMStore* SiPixelWebInterface::bei_ [private]

Definition at line 66 of file SiPixelWebInterface.h.

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

SiPixelInformationExtractor* SiPixelWebInterface::infoExtractor_ [private]

Definition at line 57 of file SiPixelWebInterface.h.

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

bool SiPixelWebInterface::offlineXMLfile_ [private]

Definition at line 67 of file SiPixelWebInterface.h.

Referenced by SiPixelWebInterface().

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

Definition at line 65 of file SiPixelWebInterface.h.

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

SiPixelActionType SiPixelWebInterface::theActionFlag [private]

Definition at line 55 of file SiPixelWebInterface.h.

Referenced by createTkMap(), getActionFlag(), handleEDARequest(), performAction(), setActionFlag(), and SiPixelWebInterface().

bool SiPixelWebInterface::tkMapCreated [private]

Definition at line 64 of file SiPixelWebInterface.h.

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

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

Definition at line 63 of file SiPixelWebInterface.h.

Referenced by SiPixelWebInterface().


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