CMS 3D CMS Logo

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

#include <SiStripInformationExtractor.h>

Public Member Functions

void createImages (DQMStore *dqm_store)
 
void plotHistosFromLayout (DQMStore *dqm_store)
 
 SiStripInformationExtractor ()
 
 ~SiStripInformationExtractor ()
 

Private Member Functions

void getItemList (const std::multimap< std::string, std::string > &req_map, std::string item_name, std::vector< std::string > &items)
 
std::string getItemValue (const std::multimap< std::string, std::string > &req_map, std::string item_name)
 
bool hasItem (const std::multimap< std::string, std::string > &req_map, std::string item_name)
 
void printAlarmList (DQMStore *dqm_store, std::ostringstream &str_val)
 
void printNonGeomHistoList (DQMStore *dqm_store, std::ostringstream &str_val)
 
void printSummaryHistoList (DQMStore *dqm_store, std::ostringstream &str_val)
 
void readConfiguration ()
 
void selectColor (std::string &col, int status)
 
void selectColor (std::string &col, std::vector< QReport * > &reports)
 
void selectImage (std::string &name, int status)
 
void selectImage (std::string &name, std::vector< QReport * > &reports)
 

Private Attributes

SiStripHistoPlotterhistoPlotter_
 
std::map< std::string,
std::vector< std::string > > 
layoutMap
 
SiStripLayoutParserlayoutParser_
 
bool readReference_
 
std::vector< std::string > subdetVec
 

Detailed Description

Definition at line 20 of file SiStripInformationExtractor.h.

Constructor & Destructor Documentation

SiStripInformationExtractor::SiStripInformationExtractor ( )

Definition at line 22 of file SiStripInformationExtractor.cc.

References histoPlotter_, layoutMap, layoutParser_, and readConfiguration().

22  {
23  edm::LogInfo("SiStripInformationExtractor") <<
24  " Creating SiStripInformationExtractor " << "\n" ;
25  layoutParser_ = 0;
26  layoutMap.clear();
27  histoPlotter_=0;
30 }
std::map< std::string, std::vector< std::string > > layoutMap
SiStripInformationExtractor::~SiStripInformationExtractor ( )

Definition at line 34 of file SiStripInformationExtractor.cc.

References histoPlotter_, and layoutParser_.

34  {
35  edm::LogInfo("SiStripInformationExtractor") <<
36  " Deleting SiStripInformationExtractor " << "\n" ;
37  if (layoutParser_) delete layoutParser_;
38  if (histoPlotter_) delete histoPlotter_;
39 
40 }

Member Function Documentation

void SiStripInformationExtractor::createImages ( DQMStore dqm_store)
void SiStripInformationExtractor::getItemList ( const std::multimap< std::string, std::string > &  req_map,
std::string  item_name,
std::vector< std::string > &  items 
)
private

Definition at line 595 of file SiStripInformationExtractor.cc.

595  {
596  items.clear();
597  for (std::multimap<std::string, std::string>::const_iterator it = req_map.begin();
598  it != req_map.end(); it++) {
599 
600  if (it->first == item_name) {
601  items.push_back(it->second);
602  }
603  }
604 }
std::string SiStripInformationExtractor::getItemValue ( const std::multimap< std::string, std::string > &  req_map,
std::string  item_name 
)
private

Definition at line 617 of file SiStripInformationExtractor.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

618  {
619  std::multimap<std::string,std::string>::const_iterator pos = req_map.find(item_name);
620  std::string value = " ";
621  if (pos != req_map.end()) {
622  value = pos->second;
623  }
624  return value;
625 }
bool SiStripInformationExtractor::hasItem ( const std::multimap< std::string, std::string > &  req_map,
std::string  item_name 
)
private

Definition at line 608 of file SiStripInformationExtractor.cc.

609  {
610  std::multimap<std::string,std::string>::const_iterator pos = req_map.find(item_name);
611  if (pos != req_map.end()) return true;
612  return false;
613 }
void SiStripInformationExtractor::plotHistosFromLayout ( DQMStore dqm_store)

Definition at line 279 of file SiStripInformationExtractor.cc.

References SiStripHistoPlotter::createStaticPlot(), alignmentValidation::fname, DQMStore::get(), MonitorElement::getName(), histoPlotter_, layoutMap, GenerateHcalLaserBadRunList::out, create_public_lumi_plots::path_name, and AlCaHLTBitMon_QueryRunRegistry::string.

279  {
280  if (layoutMap.size() == 0) return;
281 
282  std::ofstream image_file;
283 
284  for (std::map<std::string, std::vector< std::string > >::iterator it = layoutMap.begin() ; it != layoutMap.end(); it++) {
285  unsigned int ival = 0;
286  std::string image_list = "images/" + it->first +".lis";
287  image_file.open(image_list.c_str(), std::ios::out);
288  if (!image_file) return;
289 
290  image_file << "[";
291  for (std::vector<std::string>::iterator im = it->second.begin();
292  im != it->second.end(); im++) {
293  std::string path_name = (*im);
294  if (path_name.size() == 0) continue;
295  MonitorElement* me = dqm_store->get(path_name);
296  ival++;
297  std::ostringstream fname, ftitle;
298  if (!me) {
299  fname << "images/EmptyPlot.png";
300  ftitle << "EmptyPlot";
301  } else {
302  fname << "images/" << it->first << "_" <<ival << ".png";
303  ftitle << me->getName();
304  histoPlotter_->createStaticPlot(me, fname.str());
305  }
306  image_file << "["<< "\"" << fname.str() << "\",\"" << path_name << "\"]";
307  if (ival != it->second.size()) image_file << ","<< std::endl;
308  }
309  image_file << "]" << std::endl;
310  image_file.close();
311  }
312 }
const std::string & getName(void) const
get name of ME
void createStaticPlot(MonitorElement *me, const std::string &file_name)
std::map< std::string, std::vector< std::string > > layoutMap
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1771
string fname
main script
void SiStripInformationExtractor::printAlarmList ( DQMStore dqm_store,
std::ostringstream &  str_val 
)
private

Definition at line 115 of file SiStripInformationExtractor.cc.

References DQMStore::cd(), RefreshWebPage::dname, DQMStore::getContents(), MonitorElement::getName(), MonitorElement::getQReports(), DQMStore::getStatus(), DQMStore::getSubdirs(), DQMStore::goUp(), DQMStore::pwd(), selectImage(), and AlCaHLTBitMon_QueryRunRegistry::string.

115  {
116  static std::string indent_str = "";
117 
118  std::string currDir = dqm_store->pwd();
119  std::string dname = currDir.substr(currDir.find_last_of("/")+1);
120  std::string image_name;
121  selectImage(image_name,dqm_store->getStatus(currDir));
122  str_val << "<li><span class=\"folder\">"
123  << dname << "<img src=\""
124  << image_name << "\"></span>" << std::endl;
125  std::vector<std::string> subDirVec = dqm_store->getSubdirs();
126  std::vector<MonitorElement *> meVec = dqm_store->getContents(currDir);
127 
128  if (subDirVec.size() == 0 && meVec.size() == 0) {
129  str_val << "</li> "<< std::endl;
130  return;
131  }
132  str_val << "<ul>" << std::endl;
133  if (dname.find("module_") != std::string::npos) {
134  if (meVec.size() > 0) {
135  for (std::vector<MonitorElement *>::const_iterator it = meVec.begin();
136  it != meVec.end(); it++) {
137  MonitorElement * me = (*it);
138  if (!me) continue;
139  std::vector<QReport*> q_reports = me->getQReports();
140  if (q_reports.size() > 0) {
141  std::string image_name1;
142  selectImage(image_name1,q_reports);
143  str_val << "<li><span class=\"file\"><a href=\"javascript:RequestHistos.ReadAlarmStatus('"
144  << currDir << "')\">"<<me->getName()
145  << "</a><img src=\""
146  << image_name1 << "\">"
147  << "</span></li>" << std::endl;
148  }
149  }
150  }
151  }
152  for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
153  ic != subDirVec.end(); ic++) {
154  dqm_store->cd(*ic);
155  printAlarmList(dqm_store, str_val);
156  dqm_store->goUp();
157  }
158  str_val << "</ul> "<< std::endl;
159  str_val << "</li> "<< std::endl;
160 }
const std::string & getName(void) const
get name of ME
int getStatus(const std::string &path="") const
Definition: DQMStore.cc:3369
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1722
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:700
void printAlarmList(DQMStore *dqm_store, std::ostringstream &str_val)
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1800
std::vector< QReport * > getQReports(void) const
get map of QReports
void selectImage(std::string &name, int status)
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:734
const std::string & pwd(void) const
Definition: DQMStore.cc:695
void SiStripInformationExtractor::printNonGeomHistoList ( DQMStore dqm_store,
std::ostringstream &  str_val 
)
private

Definition at line 868 of file SiStripInformationExtractor.cc.

References DQMStore::cd(), RefreshWebPage::dname, DQMStore::getContents(), DQMStore::getSubdirs(), DQMStore::goUp(), mergeVDriftHistosByStation::name, DQMStore::pwd(), and AlCaHLTBitMon_QueryRunRegistry::string.

868  {
869  static std::string indent_str = "";
870 
871  std::string currDir = dqm_store->pwd();
872  std::string dname = currDir.substr(currDir.find_last_of("/")+1);
873  str_val << "<li><span class=\"folder\">" << dname << "</span>" << std::endl;
874  std::vector<MonitorElement *> meVec = dqm_store->getContents(currDir);
875  std::vector<std::string> subDirVec = dqm_store->getSubdirs();
876  if ( meVec.size()== 0 && subDirVec.size() == 0 ) {
877  str_val << "</li> "<< std::endl;
878  return;
879  }
880  str_val << "<ul>" << std::endl;
881  for (std::vector<MonitorElement *>::const_iterator it = meVec.begin();
882  it != meVec.end(); it++) {
883  MonitorElement* me = (*it);
884  if (!me) continue;
885  std::string name = (*it)->getName();
886  str_val << "<li> <span class=\"file\"><a href=\"javascript:RequestHistos.DrawSummaryHistogram('"
887  << currDir
888  << "')\">" << name << "</a></span></li>" << std::endl;
889  }
890  for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
891  ic != subDirVec.end(); ic++) {
892  dqm_store->cd(*ic);
893  printNonGeomHistoList(dqm_store, str_val);
894  dqm_store->goUp();
895  }
896  str_val << "</ul> "<< std::endl;
897  str_val << "</li> "<< std::endl;
898 }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1722
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:700
void printNonGeomHistoList(DQMStore *dqm_store, std::ostringstream &str_val)
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1800
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:734
const std::string & pwd(void) const
Definition: DQMStore.cc:695
void SiStripInformationExtractor::printSummaryHistoList ( DQMStore dqm_store,
std::ostringstream &  str_val 
)
private

Definition at line 68 of file SiStripInformationExtractor.cc.

References DQMStore::cd(), RefreshWebPage::dname, DQMStore::getContents(), DQMStore::getSubdirs(), DQMStore::goUp(), mergeVDriftHistosByStation::name, DQMStore::pwd(), and AlCaHLTBitMon_QueryRunRegistry::string.

68  {
69  static std::string indent_str = "";
70 
71  std::string currDir = dqm_store->pwd();
72  std::string dname = currDir.substr(currDir.find_last_of("/")+1);
73  if (dname.find("module_") ==0) return;
74  // str_val << "<li><a href=\"#\" id=\"" << currDir << "\">" << dname << "</a>" << std::endl;
75  str_val << "<li><span class=\"folder\">" << dname << "</span>" << std::endl;
76  std::vector<MonitorElement *> meVec = dqm_store->getContents(currDir);
77  std::vector<std::string> subDirVec = dqm_store->getSubdirs();
78  if ( meVec.size()== 0 && subDirVec.size() == 0 ) {
79  str_val << "</li> "<< std::endl;
80  return;
81  }
82  str_val << "<ul>" << std::endl;
83  for (std::vector<MonitorElement *>::const_iterator it = meVec.begin();
84  it != meVec.end(); it++) {
85  MonitorElement* me = (*it);
86  if (!me) continue;
87  std::string name = (*it)->getName();
88  str_val << "<li> <span class=\"file\"><a href=\"javascript:RequestHistos.DrawSummaryHistogram('"
89  << currDir
90  << "')\">" << name << "</a></span></li>" << std::endl;
91  }
92 
93  std::string mtag ="Modules: ";
94  for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
95  ic != subDirVec.end(); ic++) {
96  dqm_store->cd(*ic);
97  std::string titl = (*ic);
98  if (titl.find("module_") == 0) {
99  titl = titl.substr(titl.find("module_")+7);
100  mtag += titl + " ";
101  }
102  printSummaryHistoList(dqm_store, str_val);
103  dqm_store->goUp();
104  }
105  if (mtag.size() > 10) {
106  // str_val << "<li class=\"note.gif\"><a href=\"#\">" << mtag << "</a></li>" << std::endl;
107  str_val << "<li> <span class=\"file\"><a href=\"#\">" << mtag << "</a></span></li>" << std::endl;
108  }
109  str_val << "</ul> "<< std::endl;
110  str_val << "</li> "<< std::endl;
111 }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1722
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:700
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1800
void printSummaryHistoList(DQMStore *dqm_store, std::ostringstream &str_val)
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:734
const std::string & pwd(void) const
Definition: DQMStore.cc:695
void SiStripInformationExtractor::readConfiguration ( )
private

Definition at line 44 of file SiStripInformationExtractor.cc.

References contentValuesFiles::fullPath, SiStripLayoutParser::getAllLayouts(), DQMParserBase::getDocument(), layoutMap, layoutParser_, AlCaHLTBitMon_QueryRunRegistry::string, and subdetVec.

Referenced by SiStripInformationExtractor().

44  {
45  std::string localPath = std::string("DQM/SiStripMonitorClient/data/sistrip_plot_layout.xml");
46  if (layoutParser_ == 0) {
49  }
51  edm::LogInfo("SiStripInformationExtractor") <<
52  " Layouts correctly readout " << "\n" ;
53  } else edm::LogInfo("SiStripInformationExtractor") <<
54  " Problem in reading Layout " << "\n" ;
55  if (layoutParser_) delete layoutParser_;
56 
57  subdetVec.push_back("SiStrip/MechanicalView/TIB");
58  subdetVec.push_back("SiStrip/MechanicalView/TOB");
59  subdetVec.push_back("SiStrip/MechanicalView/TID/PLUS");
60  subdetVec.push_back("SiStrip/MechanicalView/TID/MINUS");
61  subdetVec.push_back("SiStrip/MechanicalView/TEC/PLUS");
62  subdetVec.push_back("SiStrip/MechanicalView/TEC/MINUS");
63 
64 }
void getDocument(std::string configFile, bool UseDB=false)
Methor that parses the xml file configFile.
std::vector< std::string > subdetVec
std::map< std::string, std::vector< std::string > > layoutMap
bool getAllLayouts(std::map< std::string, std::vector< std::string > > &me_names)
void SiStripInformationExtractor::selectColor ( std::string &  col,
int  status 
)
private

Definition at line 629 of file SiStripInformationExtractor.cc.

References dqm::qstatus::ERROR, dqm::qstatus::OTHER, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

Referenced by selectColor().

629  {
630  if (status == dqm::qstatus::STATUS_OK) col = "#00ff00";
631  else if (status == dqm::qstatus::WARNING) col = "#ffff00";
632  else if (status == dqm::qstatus::ERROR) col = "#ff0000";
633  else if (status == dqm::qstatus::OTHER) col = "#ffa500";
634  else col = "#0000ff";
635 }
static const int OTHER
static const int WARNING
static const int STATUS_OK
int col
Definition: cuy.py:1008
static const int ERROR
tuple status
Definition: mps_update.py:57
void SiStripInformationExtractor::selectColor ( std::string &  col,
std::vector< QReport * > &  reports 
)
private

Definition at line 639 of file SiStripInformationExtractor.cc.

References selectColor(), and mps_update::status.

639  {
640  int istat = 999;
641  int status = 0;
642  for (std::vector<QReport*>::const_iterator it = reports.begin(); it != reports.end();
643  it++) {
644  status = (*it)->getStatus();
645  if (status > istat) istat = status;
646  }
647  selectColor(col, status);
648 }
void selectColor(std::string &col, int status)
int col
Definition: cuy.py:1008
tuple status
Definition: mps_update.py:57
void SiStripInformationExtractor::selectImage ( std::string &  name,
int  status 
)
private

Definition at line 652 of file SiStripInformationExtractor.cc.

References dqm::qstatus::ERROR, dqm::qstatus::OTHER, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

Referenced by printAlarmList(), and selectImage().

652  {
653  if (status == dqm::qstatus::STATUS_OK) name="images/LI_green.gif";
654  else if (status == dqm::qstatus::WARNING) name="images/LI_yellow.gif";
655  else if (status == dqm::qstatus::ERROR) name="images/LI_red.gif";
656  else if (status == dqm::qstatus::OTHER) name="images/LI_orange.gif";
657  else name="images/LI_blue.gif";
658 }
static const int OTHER
static const int WARNING
static const int STATUS_OK
static const int ERROR
tuple status
Definition: mps_update.py:57
void SiStripInformationExtractor::selectImage ( std::string &  name,
std::vector< QReport * > &  reports 
)
private

Definition at line 662 of file SiStripInformationExtractor.cc.

References selectImage(), and mps_update::status.

662  {
663  int istat = 999;
664  int status = 0;
665  for (std::vector<QReport*>::const_iterator it = reports.begin(); it != reports.end();
666  it++) {
667  status = (*it)->getStatus();
668  if (status > istat) istat = status;
669  }
670  selectImage(name, status);
671 }
void selectImage(std::string &name, int status)
tuple status
Definition: mps_update.py:57

Member Data Documentation

SiStripHistoPlotter* SiStripInformationExtractor::histoPlotter_
private
std::map<std::string, std::vector< std::string > > SiStripInformationExtractor::layoutMap
private
SiStripLayoutParser* SiStripInformationExtractor::layoutParser_
private
bool SiStripInformationExtractor::readReference_
private

Definition at line 88 of file SiStripInformationExtractor.h.

std::vector<std::string> SiStripInformationExtractor::subdetVec
private

Definition at line 87 of file SiStripInformationExtractor.h.

Referenced by readConfiguration().