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;
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 
157 
158  std::ostringstream shift_summary;
159  if (configWriter_) delete configWriter_;
161  configWriter_->init("ShiftReport");
162 
163 
164  // Print Report Summary Content
165  shift_summary << " Report Summary Content :" << std::endl;
166  shift_summary << " =========================" << std::endl;
167  configWriter_->createElement("ReportSummary");
168 
169  MonitorElement* me;
170  std::string report_path;
171  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TECB";
172  me = dqm_store->get(report_path);
173  printReportSummary(me, shift_summary, "TECB");
174 
175  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TECF";
176  me = dqm_store->get(report_path);
177  printReportSummary(me, shift_summary, "TECF");
178 
179  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIB";
180  me = dqm_store->get(report_path);
181  printReportSummary(me, shift_summary, "TIB");
182 
183  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIDB";
184  me = dqm_store->get(report_path);
185  printReportSummary(me, shift_summary, "TIDB");
186 
187  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIDF";
188  me = dqm_store->get(report_path);
189  printReportSummary(me, shift_summary, "TIDF");
190 
191  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TOB";
192  me = dqm_store->get(report_path);
193  printReportSummary(me, shift_summary, "TOB");
194 
195  shift_summary << std::endl;
196  printShiftHistoParameters(dqm_store, layout_map, shift_summary);
197 
198  ofstream report_file;
199  report_file.open("sistrip_shift_report.txt", std::ios::out);
200  report_file << shift_summary.str() << std::endl;
201  report_file.close();
202  configWriter_->write("sistrip_shift_report.xml");
203  delete configWriter_;
204  configWriter_ = 0;
205 }
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:1265
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:209
SiStripSummaryCreator * summaryCreator_
void createSummary(DQMStore *dqm_store)
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:296
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:209
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 263 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().

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

Definition at line 209 of file SiStripActionExecutor.cc.

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

Referenced by createShiftReport().

210  {
211  str_val <<" " << name << " : ";
212  std::string value;
213  SiStripUtility::getMEValue(me, value);
214  configWriter_->createChildElement("MonitorElement", name, "value", value);
215  float fvalue = atof(value.c_str());
216  if (fvalue == -1.0) str_val <<" Dummy Value "<<std::endl;
217  else str_val << fvalue << std::endl;
218 }
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 222 of file SiStripActionExecutor.cc.

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

Referenced by createShiftReport().

222  {
223 
224  str_val << std::endl;
225  for (std::map<std::string, std::vector< std::string > >::iterator it = layout_map.begin() ; it != layout_map.end(); it++) {
226  std::string set_name = it->first;
227  if (set_name.find("Summary") != std::string::npos) continue;
228  configWriter_->createElement(set_name);
229 
230  str_val << " " << set_name << " : " << std::endl;
231  str_val << " ===================================="<< std::endl;
232 
233  str_val << std::setprecision(2);
234  str_val << setiosflags(std::ios::fixed);
235  for (std::vector<std::string>::iterator im = it->second.begin();
236  im != it->second.end(); im++) {
237  std::string path_name = (*im);
238  if (path_name.size() == 0) continue;
239  MonitorElement* me = dqm_store->get(path_name);
240  std::ostringstream entry_str, mean_str, rms_str;
241  entry_str << std::setprecision(2);
242  entry_str << setiosflags(std::ios::fixed);
243  mean_str << std::setprecision(2);
244  mean_str << setiosflags(std::ios::fixed);
245  rms_str << std::setprecision(2);
246  rms_str << setiosflags(std::ios::fixed);
247  entry_str << std::setw(7) << me->getEntries();
248  mean_str << std::setw(7) << me->getMean();
249  rms_str << std::setw(7) << me->getRMS();
250  configWriter_->createChildElement("MonitorElement", me->getName(),
251  "entries",entry_str.str(),"mean",mean_str.str(),"rms",rms_str.str());
252 
253  if (me) str_val << " "<< me->getName() <<" : entries = "<< std::setw(7)
254  << me->getEntries() << " mean = "<< me->getMean()
255  <<" : rms = "<< me->getRMS()<< std::endl;
256  }
257  str_val << std::endl;
258  }
259 }
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)
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:1265
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.