CMS 3D CMS Logo

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

#include <SiPixelWebInterface.h>

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 
)

Definition at line 20 of file SiPixelWebInterface.cc.

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

22  :
23  bei_(bei),
24  offlineXMLfile_(offlineXMLfile),
25  Tier0Flag_(Tier0Flag) {
26 
28  actionExecutor_ = 0;
29  infoExtractor_ = 0;
30  tkMapOptions_.push_back("Persistant");
31  tkMapOptions_.push_back("Temporary");
32  tkMapCreated = false;
35 }
SiPixelActionExecutor * actionExecutor_
SiPixelInformationExtractor * infoExtractor_
std::vector< std::string > tkMapOptions_
SiPixelActionType theActionFlag
SiPixelWebInterface::~SiPixelWebInterface ( )

Definition at line 41 of file SiPixelWebInterface.cc.

References actionExecutor_, and infoExtractor_.

41  {
42  if (actionExecutor_) delete actionExecutor_;
43  actionExecutor_ = 0;
44  if (infoExtractor_) delete infoExtractor_;
45  infoExtractor_ = 0;
46 }
SiPixelActionExecutor * actionExecutor_
SiPixelInformationExtractor * 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_, lumiContext::sname, and theActionFlag.

Referenced by performAction().

332  {
333  //DQMStore * bei = (*mui_p)->getBEInterface();
335  string sname = get_from_multimap(requestMap_, "MEName");
336  string theTKType = get_from_multimap(requestMap_, "TKMapType");
337  actionExecutor_->createTkMap(bei_, sname, theTKType);
338  return true;
339  } else {
340  return false;
341  }
342 }
SiPixelActionExecutor * actionExecutor_
void createTkMap(DQMStore *bei, std::string mEName, std::string theTKType)
std::multimap< std::string, std::string > requestMap_
std::string get_from_multimap(std::multimap< std::string, std::string > &mymap, std::string key)
SiPixelActionType theActionFlag
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().

370 {
371  std::multimap<std::string, std::string>::iterator it;
372  it = mymap.find(key);
373  if (it != mymap.end())
374  {
375  return (it->second);
376  }
377  return "";
378 }
list key
Definition: combine.py:13
SiPixelActionType SiPixelWebInterface::getActionFlag ( )
inline

Definition at line 42 of file SiPixelWebInterface.h.

References theActionFlag.

42 {return theActionFlag;}
SiPixelActionType 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(), dtNoiseDBValidation_cfg::cerr, comment, ComputeGlobalQualityFlag, gather_cfg::cout, CreateTkMap, dumpModIds, groupFilesInBlocks::fin, get_from_multimap(), SiPixelInformationExtractor::getHistosFromPath(), SiPixelInformationExtractor::getIMGCImage(), DQMStore::getMEs(), SiPixelInformationExtractor::getSingleModuleHistos(), SiPixelInformationExtractor::getTrackerMapHistos(), infoExtractor_, mergeVDriftHistosByStation::name, NoAction, performAction(), periodicTkMapUpdate(), QTestResult, CgiReader::read_form(), SiPixelInformationExtractor::readAlarmTree(), matplotRender::reader, SiPixelInformationExtractor::readModuleAndHistoList(), SiPixelInformationExtractor::readModuleHistoTree(), SiPixelInformationExtractor::readStatusMessage(), SiPixelInformationExtractor::readSummaryHistoTree(), requestMap_, returnReplyXml(), setupQTest, lumiContext::sname, Summary, theActionFlag, and tkMapCreated.

Referenced by SiPixelEDAClient::defaultWebPage().

52  {
53  DQMScope enter;
54  //DQMStore* bei = (*mui_p)->getBEInterface();
56  reader.read_form(requestMap_);
57  // get the string that identifies the request:
58  std::string requestID = get_from_multimap(requestMap_, "RequestID");
59  cout << ACGreen << ACBold << ACReverse
60  << "[SiPixelWebInterface::handleEDARequest]"
61  << ACCyan
62  << " requestID "
63  << ACPlain
64  << requestID << endl;
65 
66  if (requestID == "IsReady") {
68  returnReplyXml(out, "ReadyState", "wait");
69  } else if (requestID == "CheckQTResults") {
71  } else if (requestID == "updateIMGCPlots") { // <-----------------
73  std::string MEFolder = get_from_multimap(requestMap_, "MEFolder");
74  //cout << ACYellow << ACBold
75  // << "[SiPixelWebInterface::handleEDARequest] "
76  // << ACPlain
77  // << "Collecting ME from folder "
78  // << MEFolder
79  // << endl ;
80  out->getHTTPResponseHeader().addHeader("Content-Type", "text/html");
81  out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");
82  out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
83  out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
84  bei_->cd() ;
85  bei_->cd(MEFolder) ;
86 
87  vector<std::string> meList = bei_->getMEs() ;
88 
89  *out << MEFolder << " " ;
90  bei_->cd() ;
91  for(vector<std::string>::iterator it=meList.begin(); it!=meList.end(); it++)
92  {
93  *out << *it << " " ;
94  }
95 
96  } else if (requestID == "getIMGCPlot") { // <-----------------
98 
99  } else if (requestID == "SetupQTest") { // <-----------------
101 
102  } else if (requestID == "CreateSummary") { // <-----------------
104 
105  } else if (requestID == "CreateTkMap") {
106  std::string name = "TkMap";
107  std::string comment;
108  if (tkMapCreated) comment = "Successful";
109  else comment = "Failed";
110  returnReplyXml(out, name, comment);
112  } else if (requestID == "SingleModuleHistoList") {
115  } else if (requestID == "ModuleHistoList") {
117  string sname = get_from_multimap(requestMap_, "StructureName");
118  //cout<<"in EDARequest: structure name= "<<sname<<endl;
120  } else if (requestID == "SummaryHistoList") {
122  string sname = get_from_multimap(requestMap_, "StructureName");
124  } else if (requestID == "AlarmList") {
126  string sname = get_from_multimap(requestMap_, "StructureName");
128  } else if (requestID == "ReadQTestStatus") {
130  //string path = get_from_multimap(requestMap_, "Path");
131  //infoExtractor_->readStatusMessage(bei_, path, out);
133  } else if (requestID == "PlotAsModule") {
134  //theActionFlag = PlotSingleModuleHistos;
137  } else if (requestID == "PlotHistogramFromPath") {
138  //theActionFlag = PlotHistogramFromPath;
141  //} else if (requestID == "PlotSingleHistogram") {
142  // theActionFlag = PlotSingleHistogram;
143 
144  } else if (requestID == "PlotTkMapHistogram") {
145  //string theMEName = get_from_multimap(requestMap_, "MEName");
146  //string theModId = get_from_multimap(requestMap_, "ModId");
147  //infoExtractor_->plotTkMapHisto(bei, theModId, theMEName);
148  //out->getHTTPResponseHeader().addHeader("Content-Type", "image/png");
149  //out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");
150  //out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
151  //out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
152  //*out << infoExtractor_->getNamedImage(theMEName).str();
155  //} else if (requestID == "UpdatePlot") {
156  // string theMEName = get_from_multimap(requestMap_, "MEName");
157  // out->getHTTPResponseHeader().addHeader("Content-Type", "image/png");
158  // out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");
159  // out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
160  // out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
161  // *out << infoExtractor_->getImage().str();
162  // theActionFlag = NoAction;
163  // } else if (requestID == "UpdateTkMapPlot") {
164  // string theMEName = get_from_multimap(requestMap_, "MEName");
165  // out->getHTTPResponseHeader().addHeader("Content-Type", "image/png");
166  // out->getHTTPResponseHeader().addHeader("Pragma", "no-cache");
167  // out->getHTTPResponseHeader().addHeader("Cache-Control", "no-store, no-cache, must-revalidate,max-age=0");
168  // out->getHTTPResponseHeader().addHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT");
169  // *out << infoExtractor_->getNamedImage(theMEName).str();
170  // theActionFlag = NoAction;
171 
172  } else if (requestID == "GetMEList") {
175 
176  } else if (requestID == "GetTkMap") {
178 
179  ifstream fin("dqmtmapviewer.xhtml");
180  char buf[BUF_SIZE];
181  std::ostringstream html_out;
182  if (!fin) {
183  std::cerr << "Input File: dqmtmapviewer.xhtml "<< " could not be opened!" << std::endl;
184  return;
185  }
186  while (fin.getline(buf, BUF_SIZE, '\n')) { // pops off the newline character
187  html_out << buf << std::endl;
188  }
189  fin.close();
190 
191  out->getHTTPResponseHeader().addHeader("Content-type","application/xhtml+xml");
192  *out << html_out.str();
193  } else if (requestID == "periodicTrackerMapUpdate") {
196 
197  } else if (requestID == "globalQFlag") {
198  //cout << ACYellow << ACBold << "[SiPixelWebInterface::handleEDARequest] "
199  // << ACPlain << "Compute global Pixel quality flag" << endl;
201  } else if (requestID == "dumpModIds") {
203  }
204 
205  performAction();
206 }
void getTrackerMapHistos(DQMStore *bei, const std::multimap< std::string, std::string > &req_map, xgi::Output *out)
void getIMGCImage(const std::multimap< std::string, std::string > &req_map, xgi::Output *out)
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:406
void periodicTkMapUpdate(xgi::Output *out)
void readModuleHistoTree(DQMStore *bei, std::string &str_name, xgi::Output *out)
(Documentation under construction).
SiPixelInformationExtractor * infoExtractor_
std::multimap< std::string, std::string > requestMap_
void readStatusMessage(DQMStore *bei, std::multimap< std::string, std::string > &req_map, xgi::Output *out)
void getHistosFromPath(DQMStore *bei, const std::multimap< std::string, std::string > &req_map, xgi::Output *out)
#define ACReverse
Definition: ANSIColors.h:32
tuple out
Definition: dbtoconf.py:99
void readModuleAndHistoList(DQMStore *bei, xgi::Output *out)
(Documentation under construction).
#define ACCyan
Definition: ANSIColors.h:14
void getSingleModuleHistos(DQMStore *bei, const std::multimap< std::string, std::string > &req_map, xgi::Output *out)
std::string get_from_multimap(std::multimap< std::string, std::string > &mymap, std::string key)
std::vector< std::string > getMEs(void) const
get list of (non-dir) MEs of current directory
Definition: DQMStore.cc:1442
#define ACGreen
Definition: ANSIColors.h:13
#define BUF_SIZE
void readAlarmTree(DQMStore *bei, std::string &str_name, xgi::Output *out)
(Documentation under construction).
tuple cout
Definition: gather_cfg.py:121
#define ACPlain
Definition: ANSIColors.h:28
void readSummaryHistoTree(DQMStore *bei, std::string &str_name, xgi::Output *out)
(Documentation under construction).
SiPixelActionType theActionFlag
#define ACBold
Definition: ANSIColors.h:29
void returnReplyXml(xgi::Output *out, const std::string &name, const std::string &comment)
#define comment(par)
Definition: vmac.h:162
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().

211  {
212 //cout<<"entering performAction..."<<endl;
213  //DQMStore * bei_ = (*mui_p)->getBEInterface();
214  switch (theActionFlag) {
216  {
217  if (createTkMap()) {
218 // cout<<"calling the dtor before this?"<<endl;
219  tkMapCreated = true;
220 // theOut->getHTTPResponseHeader().addHeader("Content-Type", "text/xml");
221 // *theOut << "<?xml version=\"1.0\" ?>" << endl;
222 // *theOut << "<TkMap>" << endl;
223 // *theOut << " <Response>Successfull</Response>" << endl;
224 // *theOut << "</TkMap>" << endl;
225 //cout<<"Done creating the TkMap in WI::performAction, what now?!"<<endl;
226  }
227  break;
228  }
230  {
232  break;
233  }
235  {
237  break;
238  }
240  {
242  break;
243  }
245  {
247  break;
248  }
250  {
251 // infoExtractor_->plotSingleModuleHistos(bei_, requestMap_);
252  break;
253  }
255  {
256 // string theMEName = get_from_multimap(requestMap_, "MEName");
257 // string theModId = get_from_multimap(requestMap_, "ModId");
258 // infoExtractor_->plotTkMapHisto(bei_, theModId, theMEName);
259 //
260 // cout << ACYellow << ACBold
261 // << "[SiPixelWebInterface::PlotTkMapHistogram()]"
262 // << ACPlain
263 // << " Buffer for "
264 // << theMEName
265 // << " stored away: shipping back header (" << theOut << ")"
266 // << endl ;
279  break;
280  }
282  {
283 // infoExtractor_->plotSingleHistogram(bei_, requestMap_);
284  break;
285  }
287  {
288  break;
289  }
291  {
292 // infoExtractor_->getHistosFromPath(bei_, requestMap_);
293  break;
294  }
296  {
298  break;
299  }
301  {
302  break;
303  }
305  {
306  break;
307  }
309  {
310  break;
311  }
312  }
314 // cout<<"leaving performAction..."<<endl;
315 }
SiPixelActionExecutor * actionExecutor_
SiPixelInformationExtractor * infoExtractor_
void setupQTests(DQMStore *bei)
void createOccupancy(DQMStore *bei)
void setActionFlag(SiPixelActionType flag)
void checkQTestResults(DQMStore *bei)
SiPixelActionType theActionFlag
void createSummary(DQMStore *bei)
void SiPixelWebInterface::periodicTkMapUpdate ( xgi::Output out)

Definition at line 346 of file SiPixelWebInterface.cc.

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

Referenced by handleEDARequest().

347 {
348  //DQMStore * bei = (*mui_p)->getBEInterface();
349  string sname = get_from_multimap(requestMap_, "MEName");
350  string theTKType = get_from_multimap(requestMap_, "TKMapType");
351  infoExtractor_->sendTkUpdatedStatus(bei_, out, sname, theTKType) ;
352 }
void sendTkUpdatedStatus(DQMStore *bei, xgi::Output *out, std::string &meName, std::string &theTKType)
(Documentation under construction).
SiPixelInformationExtractor * infoExtractor_
std::multimap< std::string, std::string > requestMap_
tuple out
Definition: dbtoconf.py:99
std::string get_from_multimap(std::multimap< std::string, std::string > &mymap, std::string key)
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().

355  {
356  bool success=false;
357  tkmap_freq = -1;
358  summary_freq = -1;
359  if (actionExecutor_) {
360  actionExecutor_->readConfiguration(tkmap_freq,summary_freq);
361  if(tkmap_freq!=-1 && summary_freq!=-1) success=true;
362  }
363  return success;
364 }
SiPixelActionExecutor * actionExecutor_
bool readConfiguration(int &tkmap_freq, int &sum_barrel_freq, int &sum_endcap_freq, int &sum_grandbarrel_freq, int &sum_grandendcap_freq, int &message_limit, int &source_type, int &calib_type)
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().

321  {
322  out->getHTTPResponseHeader().addHeader("Content-Type", "text/xml");
323  *out << "<?xml version=\"1.0\" ?>" << std::endl;
324  *out << "<TkMap>" << endl;
325  *out << " <Response>" << comment << "</Response>" << endl;
326  *out << "</TkMap>" << endl;
327 
328 }
tuple out
Definition: dbtoconf.py:99
#define comment(par)
Definition: vmac.h:162
void SiPixelWebInterface::setActionFlag ( SiPixelActionType  flag)
inline

Member Data Documentation

SiPixelActionExecutor* SiPixelWebInterface::actionExecutor_
private
DQMStore* SiPixelWebInterface::bei_
private
SiPixelInformationExtractor* SiPixelWebInterface::infoExtractor_
private
bool SiPixelWebInterface::offlineXMLfile_
private

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().

SiPixelActionType SiPixelWebInterface::theActionFlag
private
bool SiPixelWebInterface::Tier0Flag_
private

Definition at line 69 of file SiPixelWebInterface.h.

Referenced by SiPixelWebInterface().

bool SiPixelWebInterface::tkMapCreated
private

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().