CMS 3D CMS Logo

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, const edm::EventSetup &eSetup)
 
void createShiftReport (DQMStore *dqm_store)
 
void createStatus (DQMStore *dqm_store)
 
void createSummary (DQMStore *dqm_store)
 
void createSummaryOffline (DQMStore *dqm_store)
 
void createTkInfoFile (std::vector< std::string > tkhmap_names, TTree *tkinfo_tree, DQMStore *dqm_store)
 
void createTkMap (const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &map_type, const edm::EventSetup &eSetup)
 
void fillDummyStatus ()
 
void fillStatus (DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &fedcabling, const edm::EventSetup &eSetup)
 
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 (const edm::EventSetup &eSetup)
 
void saveMEs (DQMStore *dqm_store, std::string fname)
 
 SiStripActionExecutor (edm::ParameterSet const &ps)
 
virtual ~SiStripActionExecutor ()
 

Private Attributes

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

Detailed Description

Definition at line 27 of file SiStripActionExecutor.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file SiStripActionExecutor.cc.

References configWriter_, detInfoFileReader_, qualityChecker_, summaryCreator_, and tkMapCreator_.

25  :pSet_(ps) {
26  edm::LogInfo("SiStripActionExecutor") <<
27  " Creating SiStripActionExecutor " << "\n" ;
28  summaryCreator_ = nullptr;
29  tkMapCreator_ = nullptr;
30  qualityChecker_ = nullptr;
31  configWriter_ = nullptr;
32  detInfoFileReader_ = nullptr;
33 }
SiStripDetInfoFileReader * detInfoFileReader_
SiStripSummaryCreator * summaryCreator_
SiStripConfigWriter * configWriter_
SiStripTrackerMapCreator * tkMapCreator_
SiStripQualityChecker * qualityChecker_
SiStripActionExecutor::~SiStripActionExecutor ( )
virtual

Definition at line 37 of file SiStripActionExecutor.cc.

References detInfoFileReader_, qualityChecker_, summaryCreator_, and tkMapCreator_.

37  {
38  edm::LogInfo("SiStripActionExecutor") <<
39  " Deleting SiStripActionExecutor " << "\n" ;
40  if (summaryCreator_) delete summaryCreator_;
41  if (tkMapCreator_) delete tkMapCreator_;
42  if (qualityChecker_) delete qualityChecker_;
44 }
SiStripDetInfoFileReader * detInfoFileReader_
SiStripSummaryCreator * summaryCreator_
SiStripTrackerMapCreator * tkMapCreator_
SiStripQualityChecker * qualityChecker_

Member Function Documentation

void SiStripActionExecutor::createDummyShiftReport ( )

Definition at line 156 of file SiStripActionExecutor.cc.

References MillePedeFileConverter_cfg::out.

Referenced by SiStripAnalyser::analyze().

156  {
157  std::ofstream report_file;
158  report_file.open("sistrip_shift_report.txt", std::ios::out);
159  report_file << " Nothing to report!!" << std::endl;
160  report_file.close();
161 }
void SiStripActionExecutor::createFaultyModuleMEs ( DQMStore dqm_store)
void SiStripActionExecutor::createOfflineTkMap ( const edm::ParameterSet tkmapPset,
DQMStore dqm_store,
std::string &  map_type,
const edm::EventSetup eSetup 
)

Definition at line 113 of file SiStripActionExecutor.cc.

References SiStripTrackerMapCreator::createForOffline(), and tkMapCreator_.

Referenced by SiStripOfflineDQM::endRun().

115  {
116  if (tkMapCreator_) tkMapCreator_->createForOffline(tkmapPset, dqm_store, map_type, eSetup);
117 }
SiStripTrackerMapCreator * tkMapCreator_
void createForOffline(const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &htype, const edm::EventSetup &eSetup)
void SiStripActionExecutor::createShiftReport ( DQMStore dqm_store)

Definition at line 165 of file SiStripActionExecutor.cc.

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

Referenced by SiStripAnalyser::analyze().

165  {
166 
167  // Read layout configuration
168  std::string localPath = std::string("DQM/SiStripMonitorClient/data/sistrip_plot_layout.xml");
169  SiStripLayoutParser layout_parser;
170  layout_parser.getDocument(edm::FileInPath(localPath).fullPath());
171 
172  std::map<std::string, std::vector<std::string> > layout_map;
173  if (!layout_parser.getAllLayouts(layout_map)) return;
174 
175 
176  std::ostringstream shift_summary;
177  if (configWriter_) delete configWriter_;
179  configWriter_->init("ShiftReport");
180 
181 
182  // Print Report Summary Content
183  shift_summary << " Report Summary Content :" << std::endl;
184  shift_summary << " =========================" << std::endl;
185  configWriter_->createElement("ReportSummary");
186 
187  MonitorElement* me;
188  std::string report_path;
189  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TECB";
190  me = dqm_store->get(report_path);
191  printReportSummary(me, shift_summary, "TECB");
192 
193  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TECF";
194  me = dqm_store->get(report_path);
195  printReportSummary(me, shift_summary, "TECF");
196 
197  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIB";
198  me = dqm_store->get(report_path);
199  printReportSummary(me, shift_summary, "TIB");
200 
201  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIDB";
202  me = dqm_store->get(report_path);
203  printReportSummary(me, shift_summary, "TIDB");
204 
205  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIDF";
206  me = dqm_store->get(report_path);
207  printReportSummary(me, shift_summary, "TIDF");
208 
209  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TOB";
210  me = dqm_store->get(report_path);
211  printReportSummary(me, shift_summary, "TOB");
212 
213  shift_summary << std::endl;
214  printShiftHistoParameters(dqm_store, layout_map, shift_summary);
215 
216  std::ofstream report_file;
217  report_file.open("sistrip_shift_report.txt", std::ios::out);
218  report_file << shift_summary.str() << std::endl;
219  report_file.close();
220  configWriter_->write("sistrip_shift_report.xml");
221  delete configWriter_;
222  configWriter_ = nullptr;
223 }
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. "my/long/dir/my_histo")
Definition: DQMStore.cc:1610
SiStripConfigWriter * configWriter_
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 79 of file SiStripActionExecutor.cc.

References DQMStore::cd(), SiStripSummaryCreator::createSummary(), DQMStore::dirExists(), RefreshWebPage::dname, AlCaHLTBitMon_QueryRunRegistry::string, and summaryCreator_.

Referenced by SiStripAnalyser::endLuminosityBlock().

79  {
80  if (summaryCreator_) {
81  dqm_store->cd();
82  std::string dname = "SiStrip/MechanicalView";
83  if (dqm_store->dirExists(dname)) {
84  dqm_store->cd(dname);
85  summaryCreator_->createSummary(dqm_store);
86  }
87  }
88 }
SiStripSummaryCreator * summaryCreator_
void createSummary(DQMStore *dqm_store)
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:610
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:522
void SiStripActionExecutor::createSummaryOffline ( DQMStore dqm_store)

Definition at line 92 of file SiStripActionExecutor.cc.

References DQMStore::cd(), SiStripSummaryCreator::createSummary(), RefreshWebPage::dname, SiStripUtility::goToDir(), AlCaHLTBitMon_QueryRunRegistry::string, and summaryCreator_.

Referenced by SiStripOfflineDQM::endRun().

92  {
93  if (summaryCreator_) {
94  dqm_store->cd();
95  std::string dname = "MechanicalView";
96  if (SiStripUtility::goToDir(dqm_store, dname)) {
97  summaryCreator_->createSummary(dqm_store);
98  }
99  dqm_store->cd();
100  }
101 }
SiStripSummaryCreator * summaryCreator_
void createSummary(DQMStore *dqm_store)
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:522
static bool goToDir(DQMStore *dqm_store, std::string name)
void SiStripActionExecutor::createTkInfoFile ( std::vector< std::string >  tkhmap_names,
TTree *  tkinfo_tree,
DQMStore dqm_store 
)

Definition at line 121 of file SiStripActionExecutor.cc.

References SiStripTrackerMapCreator::createInfoFile(), detInfoFileReader_, SiStripDetInfoFileReader::getAllDetIds(), Utilities::operator, and tkMapCreator_.

Referenced by SiStripOfflineDQM::endRun().

121  {
122  if (tkMapCreator_) {
124  std::vector<uint32_t> detidList = detInfoFileReader_->getAllDetIds();
125  tkMapCreator_->createInfoFile(map_names, tkinfo_tree, dqm_store, detidList);
126  }
127 }
SiStripDetInfoFileReader * detInfoFileReader_
const std::vector< uint32_t > & getAllDetIds() const
SiStripTrackerMapCreator * tkMapCreator_
void createInfoFile(std::vector< std::string > map_names, TTree *tkinfo_tree, DQMStore *dqm_store, std::vector< uint32_t > detidList)
void SiStripActionExecutor::createTkMap ( const edm::ParameterSet tkmapPset,
DQMStore dqm_store,
std::string &  map_type,
const edm::EventSetup eSetup 
)

Definition at line 105 of file SiStripActionExecutor.cc.

References SiStripTrackerMapCreator::create(), and tkMapCreator_.

107  {
108  if (tkMapCreator_) tkMapCreator_->create(tkmapPset, dqm_store, map_type, eSetup);
109 }
SiStripTrackerMapCreator * tkMapCreator_
void create(const edm::ParameterSet &tkmapPset, DQMStore *dqm_store, std::string &htype, const edm::EventSetup &eSetup)
void SiStripActionExecutor::fillDummyStatus ( )
void SiStripActionExecutor::fillStatus ( DQMStore dqm_store,
const edm::ESHandle< SiStripDetCabling > &  fedcabling,
const edm::EventSetup eSetup 
)

Definition at line 144 of file SiStripActionExecutor.cc.

References SiStripQualityChecker::fillStatus(), and qualityChecker_.

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

144  {
145  qualityChecker_->fillStatus(dqm_store, detcabling, eSetup);
146 }
void fillStatus(DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &cabling, const edm::EventSetup &eSetup)
SiStripQualityChecker * qualityChecker_
void SiStripActionExecutor::fillStatusAtLumi ( DQMStore dqm_store)

Definition at line 150 of file SiStripActionExecutor.cc.

References SiStripQualityChecker::fillStatusAtLumi(), and qualityChecker_.

Referenced by SiStripOfflineDQM::endLuminosityBlock().

150  {
151  qualityChecker_->fillStatusAtLumi(dqm_store);
152 }
void fillStatusAtLumi(DQMStore *dqm_store)
SiStripQualityChecker * qualityChecker_
void SiStripActionExecutor::printFaultyModuleList ( DQMStore dqm_store,
std::ostringstream &  str_val 
)

Definition at line 281 of file SiStripActionExecutor.cc.

References DQMStore::cd(), DQMStore::dirExists(), RefreshWebPage::dname, RemoveAddSevLevel::flag, SiStripUtility::getBadModuleStatus(), DQMStore::getContents(), SiStripUtility::getModuleFolderList(), SiStripUtility::goToDir(), DQMStore::pwd(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

281  {
282  dqm_store->cd();
283 
284  std::string mdir = "MechanicalView";
285  if (!SiStripUtility::goToDir(dqm_store, mdir)) return;
286  std::string mechanicalview_dir = dqm_store->pwd();
287 
288  std::vector<std::string> subdet_folder;
289  subdet_folder.push_back("TIB");
290  subdet_folder.push_back("TOB");
291  subdet_folder.push_back("TEC/MINUS");
292  subdet_folder.push_back("TEC/PLUS");
293  subdet_folder.push_back("TID/MINUS");
294  subdet_folder.push_back("TID/PLUS");
295 
296  int nDetsTotal = 0;
297  int nDetsWithErrorTotal = 0;
298  for (std::vector<std::string>::const_iterator im = subdet_folder.begin(); im != subdet_folder.end(); im++) {
299  std::string dname = mechanicalview_dir + "/" + (*im);
300  if (!dqm_store->dirExists(dname)) continue;
301  str_val << "============"<< std::endl;
302  str_val << (*im) << std::endl;
303  str_val << "============"<< std::endl;
304  str_val << std::endl;
305 
306  dqm_store->cd(dname);
307  std::vector<std::string> module_folders;
308  SiStripUtility::getModuleFolderList(dqm_store, module_folders);
309  int nDets = module_folders.size();
310  dqm_store->cd();
311 
312  int nDetsWithError = 0;
313  std::string bad_module_folder = dname + "/" + "BadModuleList";
314  if (dqm_store->dirExists(bad_module_folder)) {
315  std::vector<MonitorElement *> meVec = dqm_store->getContents(bad_module_folder);
316  for (std::vector<MonitorElement *>::const_iterator it = meVec.begin();
317  it != meVec.end(); it++) {
318  nDetsWithError++;
319  uint16_t flag = (*it)->getIntValue();
320  std::string message;
321  SiStripUtility::getBadModuleStatus(flag, message);
322  str_val << (*it)->getName() << " flag : " << (*it)->getIntValue() << " " << message << std::endl;
323  }
324  }
325  str_val << "--------------------------------------------------------------------"<< std::endl;
326  str_val << " Detectors : Total "<< nDets
327  << " with Error " << nDetsWithError<< std::endl;
328  str_val << "--------------------------------------------------------------------"<< std::endl;
329  nDetsTotal += nDets;
330  nDetsWithErrorTotal += nDetsWithError;
331  }
332  dqm_store->cd();
333  str_val << "--------------------------------------------------------------------"<< std::endl;
334  str_val << " Total Number of Connected Detectors : " << nDetsTotal << std::endl;
335  str_val << " Total Number of Detectors with Error : " << nDetsWithErrorTotal << std::endl;
336  str_val << "--------------------------------------------------------------------"<< std::endl;
337 
338 }
const std::string & pwd() const
Definition: DQMStore.cc:517
static void getBadModuleStatus(uint16_t flag, std::string &message)
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1638
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:610
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:522
static void getModuleFolderList(DQMStore *dqm_store, std::vector< std::string > &m_ids)
static bool goToDir(DQMStore *dqm_store, std::string name)
void SiStripActionExecutor::printReportSummary ( MonitorElement me,
std::ostringstream &  str_val,
std::string  name 
)

Definition at line 227 of file SiStripActionExecutor.cc.

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

Referenced by createShiftReport().

228  {
229  str_val <<" " << name << " : ";
231  SiStripUtility::getMEValue(me, value);
232  configWriter_->createChildElement("MonitorElement", name, "value", value);
233  float fvalue = atof(value.c_str());
234  if (fvalue == -1.0) str_val <<" Dummy Value "<<std::endl;
235  else str_val << fvalue << std::endl;
236 }
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 240 of file SiStripActionExecutor.cc.

References configWriter_, SiStripConfigWriter::createChildElement(), SiStripConfigWriter::createElement(), alignBH_cfg::fixed, DQMStore::get(), MonitorElement::getEntries(), MonitorElement::getMean(), MonitorElement::getName(), MonitorElement::getRMS(), genParticles_cff::map, create_public_lumi_plots::path_name, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by createShiftReport().

240  {
241 
242  str_val << std::endl;
243  for (std::map<std::string, std::vector< std::string > >::iterator it = layout_map.begin() ; it != layout_map.end(); it++) {
244  std::string set_name = it->first;
245  if (set_name.find("Summary") != std::string::npos) continue;
246  configWriter_->createElement(set_name);
247 
248  str_val << " " << set_name << " : " << std::endl;
249  str_val << " ===================================="<< std::endl;
250 
251  str_val << std::setprecision(2);
252  str_val << setiosflags(std::ios::fixed);
253  for (std::vector<std::string>::iterator im = it->second.begin();
254  im != it->second.end(); im++) {
255  std::string path_name = (*im);
256  if (path_name.empty()) continue;
257  MonitorElement* me = dqm_store->get(path_name);
258  std::ostringstream entry_str, mean_str, rms_str;
259  entry_str << std::setprecision(2);
260  entry_str << setiosflags(std::ios::fixed);
261  mean_str << std::setprecision(2);
262  mean_str << setiosflags(std::ios::fixed);
263  rms_str << std::setprecision(2);
264  rms_str << setiosflags(std::ios::fixed);
265  entry_str << std::setw(7) << me->getEntries();
266  mean_str << std::setw(7) << me->getMean();
267  rms_str << std::setw(7) << me->getRMS();
268  configWriter_->createChildElement("MonitorElement", me->getName(),
269  "entries",entry_str.str(),"mean",mean_str.str(),"rms",rms_str.str());
270 
271  if (me) str_val << " "<< me->getName() <<" : entries = "<< std::setw(7)
272  << me->getEntries() << " mean = "<< me->getMean()
273  <<" : rms = "<< me->getRMS()<< std::endl;
274  }
275  str_val << std::endl;
276  }
277 }
void createChildElement(std::string tag, std::string name)
const std::string & getName() const
get name of ME
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. "my/long/dir/my_histo")
Definition: DQMStore.cc:1610
SiStripConfigWriter * configWriter_
double getEntries() const
get # of entries
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 48 of file SiStripActionExecutor.cc.

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

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

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

Definition at line 69 of file SiStripActionExecutor.cc.

References tkMapCreator_.

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

69  {
70 
71  if (tkMapCreator_) delete tkMapCreator_;
73  if (tkMapCreator_) return true;
74  else return false;
75 }
SiStripTrackerMapCreator * tkMapCreator_
void SiStripActionExecutor::saveMEs ( DQMStore dqm_store,
std::string  fname 
)

Member Data Documentation

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

Definition at line 73 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 63 of file SiStripActionExecutor.h.