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, edm::ESHandle< SiStripDetCabling > const &fedcabling, edm::EventSetup const &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 >> const &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

std::unique_ptr< SiStripConfigWriterconfigWriter_ { 0 }
 
edm::ParameterSet const pSet_
 
std::unique_ptr< SiStripQualityCheckerqualityChecker_ { 0 }
 
std::unique_ptr< SiStripSummaryCreatorsummaryCreator_ { 0 }
 
std::unique_ptr< SiStripTrackerMapCreatortkMapCreator_ { 0 }
 
std::vector< std::string > tkMapMENames {}
 

Detailed Description

Definition at line 25 of file SiStripActionExecutor.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file SiStripActionExecutor.cc.

21  : pSet_{ps}
22 {
23  edm::LogInfo("SiStripActionExecutor") << " Creating SiStripActionExecutor "
24  << "\n";
25 }
edm::ParameterSet const pSet_
SiStripActionExecutor::~SiStripActionExecutor ( )
virtual

Definition at line 27 of file SiStripActionExecutor.cc.

28 {
29  edm::LogInfo("SiStripActionExecutor") << " Deleting SiStripActionExecutor "
30  << "\n";
31 }

Member Function Documentation

void SiStripActionExecutor::createDummyShiftReport ( )

Definition at line 154 of file SiStripActionExecutor.cc.

References MillePedeFileConverter_cfg::out, and postprocess-scan-build::report_file.

Referenced by SiStripAnalyser::analyze().

155 {
156  std::ofstream report_file;
157  report_file.open("sistrip_shift_report.txt", std::ios::out);
158  report_file << " Nothing to report!!" << std::endl;
159  report_file.close();
160 }
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 99 of file SiStripActionExecutor.cc.

References tkMapCreator_.

Referenced by SiStripOfflineDQM::endRun().

103 {
104  if (tkMapCreator_) tkMapCreator_->createForOffline(tkmapPset, dqm_store, map_type, eSetup);
105 }
std::unique_ptr< SiStripTrackerMapCreator > tkMapCreator_
void SiStripActionExecutor::createShiftReport ( DQMStore dqm_store)

Definition at line 163 of file SiStripActionExecutor.cc.

References configWriter_, DQMStore::get(), SiStripLayoutParser::getAllLayouts(), DQMParserBase::getDocument(), MillePedeFileConverter_cfg::out, printReportSummary(), printShiftHistoParameters(), postprocess-scan-build::report_file, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by SiStripAnalyser::analyze().

164 {
165  // Read layout configuration
166  std::string const localPath{
167  "DQM/SiStripMonitorClient/data/sistrip_plot_layout.xml"};
168  SiStripLayoutParser layout_parser;
169  layout_parser.getDocument(edm::FileInPath(localPath).fullPath());
170 
171  std::map<std::string, std::vector<std::string>> layout_map;
172  if (!layout_parser.getAllLayouts(layout_map)) return;
173 
174  std::ostringstream shift_summary;
175  configWriter_ = std::make_unique<SiStripConfigWriter>();
176  configWriter_->init("ShiftReport");
177 
178  // Print Report Summary Content
179  shift_summary << " Report Summary Content :\n"
180  << " =========================" << std::endl;
181  configWriter_->createElement("ReportSummary");
182 
183  MonitorElement* me{nullptr};
184  std::string report_path;
185  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TECB";
186  me = dqm_store.get(report_path);
187  printReportSummary(me, shift_summary, "TECB");
188 
189  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TECF";
190  me = dqm_store.get(report_path);
191  printReportSummary(me, shift_summary, "TECF");
192 
193  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIB";
194  me = dqm_store.get(report_path);
195  printReportSummary(me, shift_summary, "TIB");
196 
197  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIDB";
198  me = dqm_store.get(report_path);
199  printReportSummary(me, shift_summary, "TIDB");
200 
201  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIDF";
202  me = dqm_store.get(report_path);
203  printReportSummary(me, shift_summary, "TIDF");
204 
205  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TOB";
206  me = dqm_store.get(report_path);
207  printReportSummary(me, shift_summary, "TOB");
208 
209  shift_summary << std::endl;
210  printShiftHistoParameters(dqm_store, layout_map, shift_summary);
211 
212  std::ofstream report_file;
213  report_file.open("sistrip_shift_report.txt", std::ios::out);
214  report_file << shift_summary.str() << std::endl;
215  report_file.close();
216  configWriter_->write("sistrip_shift_report.xml");
217  configWriter_.reset();
218 }
void getDocument(std::string configFile, bool UseDB=false)
Methor that parses the xml file configFile.
MonitorElement * get(std::string const &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1613
std::unique_ptr< SiStripConfigWriter > configWriter_
bool getAllLayouts(std::map< std::string, std::vector< std::string > > &me_names)
void printReportSummary(MonitorElement *me, std::ostringstream &str_val, std::string name)
void printShiftHistoParameters(DQMStore &dqm_store, std::map< std::string, std::vector< std::string >> const &layout_map, std::ostringstream &str_val)
void SiStripActionExecutor::createStatus ( DQMStore dqm_store)

Definition at line 124 of file SiStripActionExecutor.cc.

References pSet_, and qualityChecker_.

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

125 {
126  if (qualityChecker_.get() == nullptr) {
127  qualityChecker_ = std::make_unique<SiStripQualityChecker>(pSet_);
128  }
129  qualityChecker_->bookStatus(dqm_store);
130 }
std::unique_ptr< SiStripQualityChecker > qualityChecker_
edm::ParameterSet const pSet_
void SiStripActionExecutor::createSummary ( DQMStore dqm_store)

Definition at line 58 of file SiStripActionExecutor.cc.

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

Referenced by SiStripAnalyser::endLuminosityBlock().

59 {
60  if (!summaryCreator_) return;
61 
62  dqm_store.cd();
63  std::string dname = "SiStrip/MechanicalView";
64  if (dqm_store.dirExists(dname)) {
65  dqm_store.cd(dname);
66  summaryCreator_->createSummary(dqm_store);
67  }
68 }
std::unique_ptr< SiStripSummaryCreator > summaryCreator_
bool dirExists(std::string const &path) const
true if directory exists
Definition: DQMStore.cc:635
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:546
void SiStripActionExecutor::createSummaryOffline ( DQMStore dqm_store)

Definition at line 73 of file SiStripActionExecutor.cc.

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

Referenced by SiStripOfflineDQM::endRun().

74 {
75  if (!summaryCreator_) return;
76 
77  dqm_store.cd();
78  std::string dname = "MechanicalView";
79  if (SiStripUtility::goToDir(dqm_store, dname)) {
80  summaryCreator_->createSummary(dqm_store);
81  }
82  dqm_store.cd();
83 }
std::unique_ptr< SiStripSummaryCreator > summaryCreator_
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:546
static bool goToDir(DQMStore &dqm_store, std::string const &name)
void SiStripActionExecutor::createTkInfoFile ( std::vector< std::string >  tkhmap_names,
TTree *  tkinfo_tree,
DQMStore dqm_store 
)

Definition at line 110 of file SiStripActionExecutor.cc.

References SiStripDetInfoFileReader::getAllDetIds(), and tkMapCreator_.

Referenced by SiStripOfflineDQM::endRun().

113 {
114  if (!tkMapCreator_) return;
115 
116  auto const& detidList = edm::Service<SiStripDetInfoFileReader> {}
117  ->getAllDetIds();
118  tkMapCreator_->createInfoFile(map_names, tkinfo_tree, dqm_store, detidList);
119 }
std::unique_ptr< SiStripTrackerMapCreator > tkMapCreator_
const std::vector< uint32_t > & getAllDetIds() const
void SiStripActionExecutor::createTkMap ( const edm::ParameterSet tkmapPset,
DQMStore dqm_store,
std::string &  map_type,
const edm::EventSetup eSetup 
)

Definition at line 88 of file SiStripActionExecutor.cc.

References tkMapCreator_.

92 {
93  if (tkMapCreator_) tkMapCreator_->create(tkmapPset, dqm_store, map_type, eSetup);
94 }
std::unique_ptr< SiStripTrackerMapCreator > tkMapCreator_
void SiStripActionExecutor::fillDummyStatus ( )

Definition at line 133 of file SiStripActionExecutor.cc.

References qualityChecker_.

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

134 {
135  qualityChecker_->fillDummyStatus();
136 }
std::unique_ptr< SiStripQualityChecker > qualityChecker_
void SiStripActionExecutor::fillStatus ( DQMStore dqm_store,
edm::ESHandle< SiStripDetCabling > const &  fedcabling,
edm::EventSetup const &  eSetup 
)

Definition at line 139 of file SiStripActionExecutor.cc.

References qualityChecker_.

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

143 {
144  qualityChecker_->fillStatus(dqm_store, detcabling, eSetup);
145 }
std::unique_ptr< SiStripQualityChecker > qualityChecker_
void SiStripActionExecutor::fillStatusAtLumi ( DQMStore dqm_store)

Definition at line 148 of file SiStripActionExecutor.cc.

References qualityChecker_.

Referenced by SiStripOfflineDQM::endLuminosityBlock().

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

Definition at line 287 of file SiStripActionExecutor.cc.

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

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

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

Definition at line 221 of file SiStripActionExecutor.cc.

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

Referenced by createShiftReport().

224 {
225  str_val <<" " << name << " : ";
227  SiStripUtility::getMEValue(me, value);
228  configWriter_->createChildElement("MonitorElement", name, "value", value);
229  float fvalue = atof(value.c_str());
230  if (fvalue == -1.0)
231  str_val << " Dummy Value " << std::endl;
232  else
233  str_val << fvalue << std::endl;
234 }
static void getMEValue(MonitorElement const *me, std::string &val)
std::unique_ptr< SiStripConfigWriter > configWriter_
void SiStripActionExecutor::printShiftHistoParameters ( DQMStore dqm_store,
std::map< std::string, std::vector< std::string >> const &  layout_map,
std::ostringstream &  str_val 
)

Definition at line 237 of file SiStripActionExecutor.cc.

References configWriter_, alignBH_cfg::fixed, DQMStore::get(), MonitorElement::getEntries(), MonitorElement::getMean(), MonitorElement::getName(), MonitorElement::getRMS(), and create_public_lumi_plots::path_name.

Referenced by createShiftReport().

241 {
242  str_val << std::endl;
243  for (auto const& [set_name, path_names] : layout_map) {
244  if (set_name.find("Summary") != std::string::npos) continue;
245  configWriter_->createElement(set_name);
246 
247  str_val << " " << set_name << " : " << std::endl;
248  str_val << " ===================================="<< std::endl;
249 
250  str_val << std::setprecision(2);
251  str_val << setiosflags(std::ios::fixed);
252  for (auto const& path_name : path_names) {
253  if (path_name.empty()) continue;
254  MonitorElement* me = dqm_store.get(path_name);
255  std::ostringstream entry_str, mean_str, rms_str;
256  entry_str << std::setprecision(2);
257  entry_str << setiosflags(std::ios::fixed);
258  mean_str << std::setprecision(2);
259  mean_str << setiosflags(std::ios::fixed);
260  rms_str << std::setprecision(2);
261  rms_str << setiosflags(std::ios::fixed);
262  entry_str << std::setw(7) << me->getEntries();
263  mean_str << std::setw(7) << me->getMean();
264  rms_str << std::setw(7) << me->getRMS();
265  configWriter_->createChildElement("MonitorElement",
266  me->getName(),
267  "entries",
268  entry_str.str(),
269  "mean",
270  mean_str.str(),
271  "rms",
272  rms_str.str());
273 
274  if (me)
275  str_val << " " << me->getName() << " : entries = " << std::setw(7)
276  << me->getEntries() << " mean = " << me->getMean()
277  << " : rms = " << me->getRMS() << '\n';
278  }
279  str_val << std::endl;
280  }
281 }
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)
MonitorElement * get(std::string const &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1613
std::unique_ptr< 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 34 of file SiStripActionExecutor.cc.

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

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

35 {
36  if (!summaryCreator_) {
37  summaryCreator_ = std::make_unique<SiStripSummaryCreator>();
38  }
39  auto const fpath = pSet_.getUntrackedParameter<std::string>(
40  "SummaryConfigPath",
41  "DQM/SiStripMonitorClient/data/sistrip_monitorelement_config.xml");
42  return summaryCreator_->readConfiguration(fpath);
43 }
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< SiStripSummaryCreator > summaryCreator_
edm::ParameterSet const pSet_
bool SiStripActionExecutor::readTkMapConfiguration ( const edm::EventSetup eSetup)

Definition at line 49 of file SiStripActionExecutor.cc.

References tkMapCreator_.

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

50 {
51  tkMapCreator_ = std::make_unique<SiStripTrackerMapCreator>(eSetup);
52  return tkMapCreator_.get() != nullptr;
53 }
std::unique_ptr< SiStripTrackerMapCreator > tkMapCreator_
void SiStripActionExecutor::saveMEs ( DQMStore dqm_store,
std::string  fname 
)

Member Data Documentation

std::unique_ptr<SiStripConfigWriter> SiStripActionExecutor::configWriter_ { 0 }
private
edm::ParameterSet const SiStripActionExecutor::pSet_
private

Definition at line 75 of file SiStripActionExecutor.h.

Referenced by createStatus(), and readConfiguration().

std::unique_ptr<SiStripQualityChecker> SiStripActionExecutor::qualityChecker_ { 0 }
private
std::unique_ptr<SiStripSummaryCreator> SiStripActionExecutor::summaryCreator_ { 0 }
private

Definition at line 70 of file SiStripActionExecutor.h.

Referenced by createSummary(), createSummaryOffline(), and readConfiguration().

std::unique_ptr<SiStripTrackerMapCreator> SiStripActionExecutor::tkMapCreator_ { 0 }
private
std::vector<std::string> SiStripActionExecutor::tkMapMENames {}
private

Definition at line 68 of file SiStripActionExecutor.h.