CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
SiStripActionExecutor Class Reference

#include <SiStripActionExecutor.h>

Public Types

typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 

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_ {nullptr}
 
const edm::ParameterSet pSet_
 
std::unique_ptr< SiStripQualityCheckerqualityChecker_ {nullptr}
 
std::unique_ptr< SiStripSummaryCreatorsummaryCreator_ {nullptr}
 
std::unique_ptr< SiStripTrackerMapCreatortkMapCreator_ {nullptr}
 
std::vector< std::string > tkMapMENames {}
 

Detailed Description

Definition at line 24 of file SiStripActionExecutor.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 27 of file SiStripActionExecutor.h.

◆ MonitorElement

Definition at line 26 of file SiStripActionExecutor.h.

Constructor & Destructor Documentation

◆ SiStripActionExecutor()

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

Definition at line 19 of file SiStripActionExecutor.cc.

19  : pSet_{ps} {
20  edm::LogInfo("SiStripActionExecutor") << " Creating SiStripActionExecutor "
21  << "\n";
22 }

◆ ~SiStripActionExecutor()

SiStripActionExecutor::~SiStripActionExecutor ( )
virtual

Definition at line 24 of file SiStripActionExecutor.cc.

24  {
25  edm::LogInfo("SiStripActionExecutor") << " Deleting SiStripActionExecutor "
26  << "\n";
27 }

Member Function Documentation

◆ createDummyShiftReport()

void SiStripActionExecutor::createDummyShiftReport ( )

Definition at line 124 of file SiStripActionExecutor.cc.

124  {
125  std::ofstream report_file;
126  report_file.open("sistrip_shift_report.txt", std::ios::out);
127  report_file << " Nothing to report!!" << std::endl;
128  report_file.close();
129 }

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

Referenced by SiStripAnalyser::analyze().

◆ createFaultyModuleMEs()

void SiStripActionExecutor::createFaultyModuleMEs ( DQMStore dqm_store)

◆ createOfflineTkMap()

void SiStripActionExecutor::createOfflineTkMap ( const edm::ParameterSet tkmapPset,
DQMStore dqm_store,
std::string &  map_type,
const edm::EventSetup eSetup 
)

Definition at line 86 of file SiStripActionExecutor.cc.

89  {
90  if (tkMapCreator_)
91  tkMapCreator_->createForOffline(tkmapPset, dqm_store, map_type, eSetup);
92 }

References tkMapCreator_.

Referenced by SiStripOfflineDQM::endRun().

◆ createShiftReport()

void SiStripActionExecutor::createShiftReport ( DQMStore dqm_store)

Definition at line 131 of file SiStripActionExecutor.cc.

131  {
132  // Read layout configuration
133  std::string const localPath{"DQM/SiStripMonitorClient/data/sistrip_plot_layout.xml"};
134  SiStripLayoutParser layout_parser;
135  layout_parser.getDocument(edm::FileInPath(localPath).fullPath());
136 
137  std::map<std::string, std::vector<std::string>> layout_map;
138  if (!layout_parser.getAllLayouts(layout_map))
139  return;
140 
141  std::ostringstream shift_summary;
142  configWriter_ = std::make_unique<SiStripConfigWriter>();
143  configWriter_->init("ShiftReport");
144 
145  // Print Report Summary Content
146  shift_summary << " Report Summary Content :\n"
147  << " =========================" << std::endl;
148  configWriter_->createElement("ReportSummary");
149 
150  MonitorElement* me{nullptr};
151  std::string report_path;
152  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TECB";
153  me = dqm_store.get(report_path);
154  printReportSummary(me, shift_summary, "TECB");
155 
156  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TECF";
157  me = dqm_store.get(report_path);
158  printReportSummary(me, shift_summary, "TECF");
159 
160  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIB";
161  me = dqm_store.get(report_path);
162  printReportSummary(me, shift_summary, "TIB");
163 
164  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIDB";
165  me = dqm_store.get(report_path);
166  printReportSummary(me, shift_summary, "TIDB");
167 
168  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TIDF";
169  me = dqm_store.get(report_path);
170  printReportSummary(me, shift_summary, "TIDF");
171 
172  report_path = "SiStrip/EventInfo/reportSummaryContents/SiStrip_DetFraction_TOB";
173  me = dqm_store.get(report_path);
174  printReportSummary(me, shift_summary, "TOB");
175 
176  shift_summary << std::endl;
177  printShiftHistoParameters(dqm_store, layout_map, shift_summary);
178 
179  std::ofstream report_file;
180  report_file.open("sistrip_shift_report.txt", std::ios::out);
181  report_file << shift_summary.str() << std::endl;
182  report_file.close();
183  configWriter_->write("sistrip_shift_report.xml");
184  configWriter_.reset();
185 }

References configWriter_, contentValuesFiles::fullPath, dqm::implementation::IGetter::get(), SiStripLayoutParser::getAllLayouts(), SiStripLayoutParser::getDocument(), hlt_dqm_clientPB-live_cfg::me, MillePedeFileConverter_cfg::out, printReportSummary(), printShiftHistoParameters(), postprocess-scan-build::report_file, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by SiStripAnalyser::analyze().

◆ createStatus()

void SiStripActionExecutor::createStatus ( DQMStore dqm_store)

Definition at line 107 of file SiStripActionExecutor.cc.

107  {
108  if (qualityChecker_.get() == nullptr) {
109  qualityChecker_ = std::make_unique<SiStripQualityChecker>(pSet_);
110  }
111  qualityChecker_->bookStatus(dqm_store);
112 }

References pSet_, and qualityChecker_.

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

◆ createSummary()

void SiStripActionExecutor::createSummary ( DQMStore dqm_store)

Definition at line 48 of file SiStripActionExecutor.cc.

48  {
49  if (!summaryCreator_)
50  return;
51 
52  dqm_store.cd();
53  std::string dname = "SiStrip/MechanicalView";
54  if (dqm_store.dirExists(dname)) {
55  dqm_store.cd(dname);
56  summaryCreator_->createSummary(dqm_store);
57  }
58 }

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

Referenced by SiStripAnalyser::endLuminosityBlock().

◆ createSummaryOffline()

void SiStripActionExecutor::createSummaryOffline ( DQMStore dqm_store)

Definition at line 62 of file SiStripActionExecutor.cc.

62  {
63  if (!summaryCreator_)
64  return;
65 
66  dqm_store.cd();
67  std::string dname = "MechanicalView";
68  if (SiStripUtility::goToDir(dqm_store, dname)) {
69  summaryCreator_->createSummary(dqm_store);
70  }
71  dqm_store.cd();
72 }

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

Referenced by SiStripOfflineDQM::endRun().

◆ createTkInfoFile()

void SiStripActionExecutor::createTkInfoFile ( std::vector< std::string >  tkhmap_names,
TTree *  tkinfo_tree,
DQMStore dqm_store 
)

Definition at line 96 of file SiStripActionExecutor.cc.

98  {
99  if (!tkMapCreator_)
100  return;
101 
102  tkMapCreator_->createInfoFile(map_names, tkinfo_tree, dqm_store);
103 }

References tkMapCreator_.

Referenced by SiStripOfflineDQM::endRun().

◆ createTkMap()

void SiStripActionExecutor::createTkMap ( const edm::ParameterSet tkmapPset,
DQMStore dqm_store,
std::string &  map_type,
const edm::EventSetup eSetup 
)

Definition at line 76 of file SiStripActionExecutor.cc.

79  {
80  if (tkMapCreator_)
81  tkMapCreator_->create(tkmapPset, dqm_store, map_type, eSetup);
82 }

References tkMapCreator_.

◆ fillDummyStatus()

void SiStripActionExecutor::fillDummyStatus ( )

Definition at line 114 of file SiStripActionExecutor.cc.

114 { qualityChecker_->fillDummyStatus(); }

References qualityChecker_.

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

◆ fillStatus()

void SiStripActionExecutor::fillStatus ( DQMStore dqm_store,
edm::ESHandle< SiStripDetCabling > const &  fedcabling,
edm::EventSetup const &  eSetup 
)

Definition at line 116 of file SiStripActionExecutor.cc.

118  {
119  qualityChecker_->fillStatus(dqm_store, detcabling, eSetup);
120 }

References qualityChecker_.

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

◆ fillStatusAtLumi()

void SiStripActionExecutor::fillStatusAtLumi ( DQMStore dqm_store)

Definition at line 122 of file SiStripActionExecutor.cc.

122 { qualityChecker_->fillStatusAtLumi(dqm_store); }

References qualityChecker_.

Referenced by SiStripOfflineDQM::endLuminosityBlock().

◆ printFaultyModuleList()

void SiStripActionExecutor::printFaultyModuleList ( DQMStore dqm_store,
std::ostringstream &  str_val 
)

Definition at line 241 of file SiStripActionExecutor.cc.

241  {
242  dqm_store.cd();
243 
244  std::string mdir = "MechanicalView";
245  if (!SiStripUtility::goToDir(dqm_store, mdir))
246  return;
247  std::string mechanicalview_dir = dqm_store.pwd();
248 
249  std::vector<std::string> subdet_folder;
250  subdet_folder.push_back("TIB");
251  subdet_folder.push_back("TOB");
252  subdet_folder.push_back("TEC/MINUS");
253  subdet_folder.push_back("TEC/PLUS");
254  subdet_folder.push_back("TID/MINUS");
255  subdet_folder.push_back("TID/PLUS");
256 
257  int nDetsTotal = 0;
258  int nDetsWithErrorTotal = 0;
259  for (auto const& sd : subdet_folder) {
260  std::string dname = mechanicalview_dir + "/" + sd;
261  if (!dqm_store.dirExists(dname))
262  continue;
263  str_val << "============\n" << sd << '\n' << "============\n" << std::endl;
264 
265  dqm_store.cd(dname);
266  std::vector<std::string> module_folders;
267  SiStripUtility::getModuleFolderList(dqm_store, module_folders);
268  int nDets = module_folders.size();
269  dqm_store.cd();
270 
271  int nDetsWithError = 0;
272  std::string bad_module_folder = dname + "/" + "BadModuleList";
273  if (dqm_store.dirExists(bad_module_folder)) {
274  auto const meVec = dqm_store.getContents(bad_module_folder);
275  for (auto me : meVec) {
276  nDetsWithError++;
277  uint16_t flag = me->getIntValue();
278  std::string message;
280  str_val << me->getName() << " flag : " << me->getIntValue() << " " << message << std::endl;
281  }
282  }
283  str_val << "---------------------------------------------------------------"
284  "-----\n"
285  << " Detectors : Total " << nDets << " with Error " << nDetsWithError << '\n'
286  << "---------------------------------------------------------------"
287  "-----\n";
288  nDetsTotal += nDets;
289  nDetsWithErrorTotal += nDetsWithError;
290  }
291  dqm_store.cd();
292  str_val << "--------------------------------------------------------------------\n"
293  << " Total Number of Connected Detectors : " << nDetsTotal << '\n'
294  << " Total Number of Detectors with Error : " << nDetsWithErrorTotal << '\n'
295  << "--------------------------------------------------------------------" << std::endl;
296 }

References dqm::implementation::DQMStore::cd(), dqm::implementation::IGetter::dirExists(), RefreshWebPage::dname, RemoveAddSevLevel::flag, SiStripUtility::getBadModuleStatus(), dqm::implementation::IGetter::getContents(), SiStripUtility::getModuleFolderList(), SiStripUtility::goToDir(), hlt_dqm_clientPB-live_cfg::me, dqm::implementation::DQMStore::pwd(), sd, and AlCaHLTBitMon_QueryRunRegistry::string.

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

◆ printReportSummary()

void SiStripActionExecutor::printReportSummary ( MonitorElement me,
std::ostringstream &  str_val,
std::string  name 
)

Definition at line 187 of file SiStripActionExecutor.cc.

187  {
188  str_val << " " << name << " : ";
191  configWriter_->createChildElement("MonitorElement", name, "value", value);
192  float fvalue = atof(value.c_str());
193  if (fvalue == -1.0)
194  str_val << " Dummy Value " << std::endl;
195  else
196  str_val << fvalue << std::endl;
197 }

References configWriter_, SiStripUtility::getMEValue(), hlt_dqm_clientPB-live_cfg::me, Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

Referenced by createShiftReport().

◆ printShiftHistoParameters()

void SiStripActionExecutor::printShiftHistoParameters ( DQMStore dqm_store,
std::map< std::string, std::vector< std::string >> const &  layout_map,
std::ostringstream &  str_val 
)

Definition at line 199 of file SiStripActionExecutor.cc.

201  {
202  str_val << std::endl;
203  for (auto const& [set_name, path_names] : layout_map) {
204  if (set_name.find("Summary") != std::string::npos)
205  continue;
206  configWriter_->createElement(set_name);
207 
208  str_val << " " << set_name << " : " << std::endl;
209  str_val << " ====================================" << std::endl;
210 
211  str_val << std::setprecision(2);
212  str_val << setiosflags(std::ios::fixed);
213  for (auto const& path_name : path_names) {
214  if (path_name.empty())
215  continue;
216  MonitorElement* me = dqm_store.get(path_name);
217  std::ostringstream entry_str, mean_str, rms_str;
218  entry_str << std::setprecision(2);
219  entry_str << setiosflags(std::ios::fixed);
220  mean_str << std::setprecision(2);
221  mean_str << setiosflags(std::ios::fixed);
222  rms_str << std::setprecision(2);
223  rms_str << setiosflags(std::ios::fixed);
224  entry_str << std::setw(7) << me->getEntries();
225  mean_str << std::setw(7) << me->getMean();
226  rms_str << std::setw(7) << me->getRMS();
227  configWriter_->createChildElement(
228  "MonitorElement", me->getName(), "entries", entry_str.str(), "mean", mean_str.str(), "rms", rms_str.str());
229 
230  if (me)
231  str_val << " " << me->getName() << " : entries = " << std::setw(7) << me->getEntries()
232  << " mean = " << me->getMean() << " : rms = " << me->getRMS() << '\n';
233  }
234  str_val << std::endl;
235  }
236 }

References configWriter_, alignBH_cfg::fixed, dqm::implementation::IGetter::get(), and hlt_dqm_clientPB-live_cfg::me.

Referenced by createShiftReport().

◆ readConfiguration()

bool SiStripActionExecutor::readConfiguration ( )

Definition at line 29 of file SiStripActionExecutor.cc.

29  {
30  if (!summaryCreator_) {
31  summaryCreator_ = std::make_unique<SiStripSummaryCreator>();
32  }
33  auto const fpath = pSet_.getUntrackedParameter<std::string>(
34  "SummaryConfigPath", "DQM/SiStripMonitorClient/data/sistrip_monitorelement_config.xml");
35  return summaryCreator_->readConfiguration(fpath);
36 }

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

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

◆ readTkMapConfiguration()

bool SiStripActionExecutor::readTkMapConfiguration ( const edm::EventSetup eSetup)

Definition at line 41 of file SiStripActionExecutor.cc.

41  {
42  tkMapCreator_ = std::make_unique<SiStripTrackerMapCreator>(eSetup);
43  return tkMapCreator_.get() != nullptr;
44 }

References tkMapCreator_.

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

◆ saveMEs()

void SiStripActionExecutor::saveMEs ( DQMStore dqm_store,
std::string  fname 
)

Member Data Documentation

◆ configWriter_

std::unique_ptr<SiStripConfigWriter> SiStripActionExecutor::configWriter_ {nullptr}
private

◆ pSet_

const edm::ParameterSet SiStripActionExecutor::pSet_
private

Definition at line 72 of file SiStripActionExecutor.h.

Referenced by createStatus(), and readConfiguration().

◆ qualityChecker_

std::unique_ptr<SiStripQualityChecker> SiStripActionExecutor::qualityChecker_ {nullptr}
private

◆ summaryCreator_

std::unique_ptr<SiStripSummaryCreator> SiStripActionExecutor::summaryCreator_ {nullptr}
private

Definition at line 67 of file SiStripActionExecutor.h.

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

◆ tkMapCreator_

std::unique_ptr<SiStripTrackerMapCreator> SiStripActionExecutor::tkMapCreator_ {nullptr}
private

◆ tkMapMENames

std::vector<std::string> SiStripActionExecutor::tkMapMENames {}
private

Definition at line 65 of file SiStripActionExecutor.h.

alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
SiStripUtility::getModuleFolderList
static void getModuleFolderList(DQMStore &dqm_store, std::vector< std::string > &m_ids)
Definition: SiStripUtility.cc:187
SiStripActionExecutor::summaryCreator_
std::unique_ptr< SiStripSummaryCreator > summaryCreator_
Definition: SiStripActionExecutor.h:67
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
edm::LogInfo
Definition: MessageLogger.h:254
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SiStripActionExecutor::printReportSummary
void printReportSummary(MonitorElement *me, std::ostringstream &str_val, std::string name)
Definition: SiStripActionExecutor.cc:187
postprocess-scan-build.report_file
report_file
Definition: postprocess-scan-build.py:19
edm::FileInPath
Definition: FileInPath.h:64
SiStripLayoutParser
Definition: SiStripLayoutParser.h:16
SiStripUtility::getBadModuleStatus
static void getBadModuleStatus(uint16_t flag, std::string &message)
Definition: SiStripUtility.cc:343
SiStripUtility::getMEValue
static void getMEValue(MonitorElement const *me, std::string &val)
Definition: SiStripUtility.cc:239
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripActionExecutor::configWriter_
std::unique_ptr< SiStripConfigWriter > configWriter_
Definition: SiStripActionExecutor.h:70
SiStripActionExecutor::printShiftHistoParameters
void printShiftHistoParameters(DQMStore &dqm_store, std::map< std::string, std::vector< std::string >> const &layout_map, std::ostringstream &str_val)
Definition: SiStripActionExecutor.cc:199
SiStripUtility::goToDir
static bool goToDir(DQMStore &dqm_store, std::string const &name)
Definition: SiStripUtility.cc:252
SiStripLayoutParser::getAllLayouts
bool getAllLayouts(std::map< std::string, std::vector< std::string > > &me_names)
Definition: SiStripLayoutParser.cc:20
value
Definition: value.py:1
SiStripActionExecutor::tkMapCreator_
std::unique_ptr< SiStripTrackerMapCreator > tkMapCreator_
Definition: SiStripActionExecutor.h:68
SiStripActionExecutor::pSet_
const edm::ParameterSet pSet_
Definition: SiStripActionExecutor.h:72
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
RefreshWebPage.dname
dname
Definition: RefreshWebPage.py:56
sd
double sd
Definition: CascadeWrapper.h:113
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
SiStripLayoutParser::getDocument
void getDocument(std::string filepath)
Definition: SiStripLayoutParser.cc:13
SiStripActionExecutor::qualityChecker_
std::unique_ptr< SiStripQualityChecker > qualityChecker_
Definition: SiStripActionExecutor.h:69