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 Attributes
SiStripActionExecutor Class Reference

#include <SiStripActionExecutor.h>

Public Member Functions

void createDummyShiftReport ()
 
void createFaultyModuleMEs (DQMStore *dqm_store)
 
void createOfflineTkMap (const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &map_type)
 
void createShiftReport (DQMStore *dqm_store)
 
void createStatus (DQMStore *dqm_store)
 
void createSummary (DQMStore *dqm_store)
 
void createSummaryOffline (DQMStore *dqm_store)
 
void createTkMap (const edm::ParameterSet &tkmapPset, const edm::ESHandle< SiStripFedCabling > &fedcabling, DQMStore *dqm_store, std::string &map_type)
 
void fillDummyStatus ()
 
void fillStatus (DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &fedcabling)
 
void fillStatusAtLumi (DQMStore *dqm_store)
 
void printFaultyModuleList (DQMStore *dqm_store, std::ostringstream &str_val)
 
void printReportSummary (MonitorElement *me, std::ostringstream &str_val, std::string name)
 
void printShiftHistoParameters (DQMStore *dqm_store, std::map< std::string, std::vector< std::string > > &layout_map, std::ostringstream &str_val)
 
bool readConfiguration ()
 
bool readTkMapConfiguration ()
 
void saveMEs (DQMStore *dqm_store, std::string fname)
 
 SiStripActionExecutor (edm::ParameterSet const &ps)
 
virtual ~SiStripActionExecutor ()
 

Private Attributes

SiStripConfigWriterconfigWriter_
 
edm::ParameterSet pSet_
 
SiStripQualityCheckerqualityChecker_
 
SiStripSummaryCreatorsummaryCreator_
 
SiStripTrackerMapCreatortkMapCreator_
 
std::vector< std::string > tkMapMENames
 

Detailed Description

Definition at line 24 of file SiStripActionExecutor.h.

Constructor & Destructor Documentation

SiStripActionExecutor::SiStripActionExecutor ( edm::ParameterSet const &  ps)

Definition at line 29 of file SiStripActionExecutor.cc.

References configWriter_, qualityChecker_, summaryCreator_, and tkMapCreator_.

29  :pSet_(ps) {
30  edm::LogInfo("SiStripActionExecutor") <<
31  " Creating SiStripActionExecutor " << "\n" ;
32  summaryCreator_ = 0;
33  tkMapCreator_ = 0;
34  qualityChecker_ = 0;
35  configWriter_ = 0;
36 }
SiStripSummaryCreator * summaryCreator_
SiStripConfigWriter * configWriter_
SiStripTrackerMapCreator * tkMapCreator_
SiStripQualityChecker * qualityChecker_
SiStripActionExecutor::~SiStripActionExecutor ( )
virtual

Definition at line 40 of file SiStripActionExecutor.cc.

References qualityChecker_, summaryCreator_, and tkMapCreator_.

40  {
41  edm::LogInfo("SiStripActionExecutor") <<
42  " Deleting SiStripActionExecutor " << "\n" ;
43  if (summaryCreator_) delete summaryCreator_;
44  if (tkMapCreator_) delete tkMapCreator_;
45  if (qualityChecker_) delete qualityChecker_;
46 }
SiStripSummaryCreator * summaryCreator_
SiStripTrackerMapCreator * tkMapCreator_
SiStripQualityChecker * qualityChecker_

Member Function Documentation

void SiStripActionExecutor::createDummyShiftReport ( )

Definition at line 138 of file SiStripActionExecutor.cc.

References dbtoconf::out.

Referenced by SiStripAnalyser::analyze().

138  {
139  ofstream report_file;
140  report_file.open("sistrip_shift_report.txt", std::ios::out);
141  report_file << " Nothing to report!!" << std::endl;
142  report_file.close();
143 }
tuple out
Definition: dbtoconf.py:99
void SiStripActionExecutor::createFaultyModuleMEs ( DQMStore dqm_store)
void SiStripActionExecutor::createOfflineTkMap ( const edm::ParameterSet tkmapPset,
DQMStore dqm_store,
std::string &  map_type 
)

Definition at line 105 of file SiStripActionExecutor.cc.

References SiStripTrackerMapCreator::createForOffline(), and tkMapCreator_.

Referenced by SiStripOfflineDQM::endRun().

106  {
107  if (tkMapCreator_) tkMapCreator_->createForOffline(tkmapPset, dqm_store, map_type);
108 }
SiStripTrackerMapCreator * tkMapCreator_
void createForOffline(const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &htype)
void SiStripActionExecutor::createShiftReport ( DQMStore dqm_store)

Definition at line 147 of file SiStripActionExecutor.cc.

References configWriter_, SiStripConfigWriter::createElement(), DQMStore::get(), SiStripLayoutParser::getAllLayouts(), DQMParserBase::getDocument(), SiStripConfigWriter::init(), dbtoconf::out, printReportSummary(), printShiftHistoParameters(), and SiStripConfigWriter::write().

Referenced by SiStripAnalyser::analyze().

147  {
148 
149  // Read layout configuration
150  std::string localPath = std::string("DQM/SiStripMonitorClient/data/sistrip_plot_layout.xml");
151  SiStripLayoutParser* layout_parser = new SiStripLayoutParser();
152  layout_parser->getDocument(edm::FileInPath(localPath).fullPath());
153 
154  std::map<std::string, std::vector<std::string> > layout_map;
155  if (!layout_parser->getAllLayouts(layout_map)) return;
156  delete layout_parser;
157 
158 
159  std::ostringstream shift_summary;
160  if (configWriter_) delete configWriter_;
162  configWriter_->init("ShiftReport");
163 
164 
165  // Print Report Summary Content
166  shift_summary << " Report Summary Content :" << std::endl;
167  shift_summary << " =========================" << std::endl;
168  configWriter_->createElement("ReportSummary");
169 
170  MonitorElement* me;
171  std::string report_path;
172  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TECB";
173  me = dqm_store->get(report_path);
174  printReportSummary(me, shift_summary, "TECB");
175 
176  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TECF";
177  me = dqm_store->get(report_path);
178  printReportSummary(me, shift_summary, "TECF");
179 
180  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIB";
181  me = dqm_store->get(report_path);
182  printReportSummary(me, shift_summary, "TIB");
183 
184  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIDB";
185  me = dqm_store->get(report_path);
186  printReportSummary(me, shift_summary, "TIDB");
187 
188  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIDF";
189  me = dqm_store->get(report_path);
190  printReportSummary(me, shift_summary, "TIDF");
191 
192  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TOB";
193  me = dqm_store->get(report_path);
194  printReportSummary(me, shift_summary, "TOB");
195 
196  shift_summary << std::endl;
197  printShiftHistoParameters(dqm_store, layout_map, shift_summary);
198 
199  ofstream report_file;
200  report_file.open("sistrip_shift_report.txt", std::ios::out);
201  report_file << shift_summary.str() << std::endl;
202  report_file.close();
203  configWriter_->write("sistrip_shift_report.xml");
204  delete configWriter_;
205  configWriter_ = 0;
206 }
void getDocument(std::string configFile, bool UseDB=false)
Methor that parses the xml file configFile.
void createElement(std::string tag)
bool init(std::string main)
Write XML file.
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1270
SiStripConfigWriter * configWriter_
tuple out
Definition: dbtoconf.py:99
void printShiftHistoParameters(DQMStore *dqm_store, std::map< std::string, std::vector< std::string > > &layout_map, std::ostringstream &str_val)
void write(std::string fname)
bool getAllLayouts(std::map< std::string, std::vector< std::string > > &me_names)
void printReportSummary(MonitorElement *me, std::ostringstream &str_val, std::string name)
void SiStripActionExecutor::createStatus ( DQMStore dqm_store)
void SiStripActionExecutor::createSummary ( DQMStore dqm_store)

Definition at line 72 of file SiStripActionExecutor.cc.

References DQMStore::cd(), SiStripSummaryCreator::createSummary(), DQMStore::dirExists(), and summaryCreator_.

Referenced by SiStripAnalyser::endLuminosityBlock().

72  {
73  if (summaryCreator_) {
74  dqm_store->cd();
75  std::string dname = "SiStrip/MechanicalView";
76  if (dqm_store->dirExists(dname)) {
77  dqm_store->cd(dname);
78  summaryCreator_->createSummary(dqm_store);
79  }
80  }
81 }
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:214
SiStripSummaryCreator * summaryCreator_
void createSummary(DQMStore *dqm_store)
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:301
void SiStripActionExecutor::createSummaryOffline ( DQMStore dqm_store)

Definition at line 85 of file SiStripActionExecutor.cc.

References DQMStore::cd(), SiStripSummaryCreator::createSummary(), SiStripUtility::goToDir(), and summaryCreator_.

Referenced by SiStripOfflineDQM::endRun().

85  {
86  if (summaryCreator_) {
87  dqm_store->cd();
88  std::string dname = "MechanicalView";
89  if (SiStripUtility::goToDir(dqm_store, dname)) {
90  summaryCreator_->createSummary(dqm_store);
91  }
92  dqm_store->cd();
93  }
94 }
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:214
SiStripSummaryCreator * summaryCreator_
void createSummary(DQMStore *dqm_store)
static bool goToDir(DQMStore *dqm_store, std::string name)
void SiStripActionExecutor::createTkMap ( const edm::ParameterSet tkmapPset,
const edm::ESHandle< SiStripFedCabling > &  fedcabling,
DQMStore dqm_store,
std::string &  map_type 
)

Definition at line 98 of file SiStripActionExecutor.cc.

References SiStripTrackerMapCreator::create(), and tkMapCreator_.

Referenced by SiStripAnalyser::endLuminosityBlock().

99  {
100  if (tkMapCreator_) tkMapCreator_->create(tkmapPset, fedcabling, dqm_store, map_type);
101 }
SiStripTrackerMapCreator * tkMapCreator_
void create(const edm::ParameterSet &tkmapPset, const edm::ESHandle< SiStripFedCabling > &fedcabling, DQMStore *dqm_store, std::string &htype)
void SiStripActionExecutor::fillDummyStatus ( )
void SiStripActionExecutor::fillStatus ( DQMStore dqm_store,
const edm::ESHandle< SiStripDetCabling > &  fedcabling 
)

Definition at line 126 of file SiStripActionExecutor.cc.

References SiStripQualityChecker::fillStatus(), and qualityChecker_.

Referenced by SiStripAnalyser::analyze(), SiStripAnalyser::endLuminosityBlock(), and SiStripOfflineDQM::endRun().

126  {
127  qualityChecker_->fillStatus(dqm_store, detcabling);
128 }
void fillStatus(DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &cabling)
SiStripQualityChecker * qualityChecker_
void SiStripActionExecutor::fillStatusAtLumi ( DQMStore dqm_store)

Definition at line 132 of file SiStripActionExecutor.cc.

References SiStripQualityChecker::fillStatusAtLumi(), and qualityChecker_.

Referenced by SiStripOfflineDQM::endLuminosityBlock().

132  {
133  qualityChecker_->fillStatusAtLumi(dqm_store);
134 }
void fillStatusAtLumi(DQMStore *dqm_store)
SiStripQualityChecker * qualityChecker_
void SiStripActionExecutor::printFaultyModuleList ( DQMStore dqm_store,
std::ostringstream &  str_val 
)

Definition at line 264 of file SiStripActionExecutor.cc.

References DQMStore::cd(), DQMStore::dirExists(), SiStripUtility::getBadModuleStatus(), DQMStore::getContents(), SiStripUtility::getModuleFolderList(), SiStripUtility::goToDir(), argparse::message, and DQMStore::pwd().

Referenced by SiStripAnalyser::endJob(), and SiStripOfflineDQM::endJob().

264  {
265  dqm_store->cd();
266 
267  std::string mdir = "MechanicalView";
268  if (!SiStripUtility::goToDir(dqm_store, mdir)) return;
269  std::string mechanicalview_dir = dqm_store->pwd();
270 
271  std::vector<std::string> subdet_folder;
272  subdet_folder.push_back("TIB");
273  subdet_folder.push_back("TOB");
274  subdet_folder.push_back("TEC/side_1");
275  subdet_folder.push_back("TEC/side_2");
276  subdet_folder.push_back("TID/side_1");
277  subdet_folder.push_back("TID/side_2");
278 
279  int nDetsTotal = 0;
280  int nDetsWithErrorTotal = 0;
281  for (std::vector<std::string>::const_iterator im = subdet_folder.begin(); im != subdet_folder.end(); im++) {
282  std::string dname = mechanicalview_dir + "/" + (*im);
283  if (!dqm_store->dirExists(dname)) continue;
284  str_val << "============"<< std::endl;
285  str_val << (*im) << std::endl;
286  str_val << "============"<< std::endl;
287  str_val << std::endl;
288 
289  dqm_store->cd(dname);
290  std::vector<std::string> module_folders;
291  SiStripUtility::getModuleFolderList(dqm_store, module_folders);
292  int nDets = module_folders.size();
293  dqm_store->cd();
294 
295  int nDetsWithError = 0;
296  std::string bad_module_folder = dname + "/" + "BadModuleList";
297  if (dqm_store->dirExists(bad_module_folder)) {
298  std::vector<MonitorElement *> meVec = dqm_store->getContents(bad_module_folder);
299  for (std::vector<MonitorElement *>::const_iterator it = meVec.begin();
300  it != meVec.end(); it++) {
301  nDetsWithError++;
302  uint16_t flag = (*it)->getIntValue();
303  std::string message;
304  SiStripUtility::getBadModuleStatus(flag, message);
305  str_val << (*it)->getName() << " flag : " << (*it)->getIntValue() << " " << message << std::endl;
306  }
307  }
308  str_val << "--------------------------------------------------------------------"<< std::endl;
309  str_val << " Detectors : Total "<< nDets
310  << " with Error " << nDetsWithError<< std::endl;
311  str_val << "--------------------------------------------------------------------"<< std::endl;
312  nDetsTotal += nDets;
313  nDetsWithErrorTotal += nDetsWithError;
314  }
315  dqm_store->cd();
316  str_val << "--------------------------------------------------------------------"<< std::endl;
317  str_val << " Total Number of Connected Detectors : " << nDetsTotal << std::endl;
318  str_val << " Total Number of Detectors with Error : " << nDetsWithErrorTotal << std::endl;
319  str_val << "--------------------------------------------------------------------"<< std::endl;
320 
321 }
long int flag
Definition: mlp_lapack.h:47
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:214
static void getBadModuleStatus(uint16_t flag, std::string &message)
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1299
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:301
string message
Definition: argparse.py:126
static void getModuleFolderList(DQMStore *dqm_store, std::vector< std::string > &m_ids)
static bool goToDir(DQMStore *dqm_store, std::string name)
const std::string & pwd(void) const
Definition: DQMStore.cc:209
void SiStripActionExecutor::printReportSummary ( MonitorElement me,
std::ostringstream &  str_val,
std::string  name 
)

Definition at line 210 of file SiStripActionExecutor.cc.

References configWriter_, SiStripConfigWriter::createChildElement(), SiStripUtility::getMEValue(), and relativeConstraints::value.

Referenced by createShiftReport().

211  {
212  str_val <<" " << name << " : ";
213  std::string value;
214  SiStripUtility::getMEValue(me, value);
215  configWriter_->createChildElement("MonitorElement", name, "value", value);
216  float fvalue = atof(value.c_str());
217  if (fvalue == -1.0) str_val <<" Dummy Value "<<std::endl;
218  else str_val << fvalue << std::endl;
219 }
void createChildElement(std::string tag, std::string name)
static void getMEValue(MonitorElement *me, std::string &val)
SiStripConfigWriter * configWriter_
void SiStripActionExecutor::printShiftHistoParameters ( DQMStore dqm_store,
std::map< std::string, std::vector< std::string > > &  layout_map,
std::ostringstream &  str_val 
)

Definition at line 223 of file SiStripActionExecutor.cc.

References configWriter_, SiStripConfigWriter::createChildElement(), SiStripConfigWriter::createElement(), DQMStore::get(), MonitorElement::getEntries(), MonitorElement::getMean(), MonitorElement::getName(), MonitorElement::getRMS(), and Association::map.

Referenced by createShiftReport().

223  {
224 
225  str_val << std::endl;
226  for (std::map<std::string, std::vector< std::string > >::iterator it = layout_map.begin() ; it != layout_map.end(); it++) {
227  std::string set_name = it->first;
228  if (set_name.find("Summary") != std::string::npos) continue;
229  configWriter_->createElement(set_name);
230 
231  str_val << " " << set_name << " : " << std::endl;
232  str_val << " ===================================="<< std::endl;
233 
234  str_val << std::setprecision(2);
235  str_val << setiosflags(std::ios::fixed);
236  for (std::vector<std::string>::iterator im = it->second.begin();
237  im != it->second.end(); im++) {
238  std::string path_name = (*im);
239  if (path_name.size() == 0) continue;
240  MonitorElement* me = dqm_store->get(path_name);
241  std::ostringstream entry_str, mean_str, rms_str;
242  entry_str << std::setprecision(2);
243  entry_str << setiosflags(std::ios::fixed);
244  mean_str << std::setprecision(2);
245  mean_str << setiosflags(std::ios::fixed);
246  rms_str << std::setprecision(2);
247  rms_str << setiosflags(std::ios::fixed);
248  entry_str << std::setw(7) << me->getEntries();
249  mean_str << std::setw(7) << me->getMean();
250  rms_str << std::setw(7) << me->getRMS();
251  configWriter_->createChildElement("MonitorElement", me->getName(),
252  "entries",entry_str.str(),"mean",mean_str.str(),"rms",rms_str.str());
253 
254  if (me) str_val << " "<< me->getName() <<" : entries = "<< std::setw(7)
255  << me->getEntries() << " mean = "<< me->getMean()
256  <<" : rms = "<< me->getRMS()<< std::endl;
257  }
258  str_val << std::endl;
259  }
260 }
const std::string & getName(void) const
get name of ME
void createChildElement(std::string tag, std::string name)
double getEntries(void) const
get # of entries
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
dictionary map
Definition: Association.py:160
void createElement(std::string tag)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1270
SiStripConfigWriter * configWriter_
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
bool SiStripActionExecutor::readConfiguration ( )

Definition at line 50 of file SiStripActionExecutor.cc.

References edm::ParameterSet::getUntrackedParameter(), pSet_, SiStripSummaryCreator::readConfiguration(), and summaryCreator_.

Referenced by SiStripAnalyser::beginJob(), and SiStripOfflineDQM::beginJob().

50  {
51 
52  if (!summaryCreator_) {
54  }
55  std::string fpath = pSet_.getUntrackedParameter<std::string>("SummaryConfigPath","DQM/SiStripMonitorClient/data/sistrip_monitorelement_config.xml");
56  if (summaryCreator_->readConfiguration(fpath)) return true;
57  else return false;
58 }
T getUntrackedParameter(std::string const &, T const &) const
SiStripSummaryCreator * summaryCreator_
bool readConfiguration(std::string &file_path)
bool SiStripActionExecutor::readTkMapConfiguration ( )

Definition at line 62 of file SiStripActionExecutor.cc.

References tkMapCreator_.

Referenced by SiStripAnalyser::beginRun(), and SiStripOfflineDQM::endRun().

62  {
63 
64  if (tkMapCreator_) delete tkMapCreator_;
66  if (tkMapCreator_) return true;
67  else return false;
68 }
SiStripTrackerMapCreator * tkMapCreator_
void SiStripActionExecutor::saveMEs ( DQMStore dqm_store,
std::string  fname 
)

Member Data Documentation

SiStripConfigWriter* SiStripActionExecutor::configWriter_
private
edm::ParameterSet SiStripActionExecutor::pSet_
private

Definition at line 67 of file SiStripActionExecutor.h.

Referenced by createStatus(), and readConfiguration().

SiStripQualityChecker* SiStripActionExecutor::qualityChecker_
private
SiStripSummaryCreator* SiStripActionExecutor::summaryCreator_
private
SiStripTrackerMapCreator* SiStripActionExecutor::tkMapCreator_
private
std::vector<std::string> SiStripActionExecutor::tkMapMENames
private

Definition at line 59 of file SiStripActionExecutor.h.