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 SiStripQuality *stripQuality)
 
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, const GeometricDet *geomDet)
 
void createTkMap (const edm::ParameterSet &tkmapPset, DQMStore &dqm_store, const std::string &map_type)
 
void fillDummyStatus ()
 
void fillStatus (DQMStore &dqm_store, const SiStripDetCabling *cabling, const TkDetMap *tkDetMap, const TrackerTopology *tTopo)
 
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 SiStripDetCabling *detCabling, const TkDetMap *tkDetMap, const TrackerTopology *tTopo)
 
void saveMEs (DQMStore &dqm_store, std::string fname)
 
 SiStripActionExecutor (edm::ParameterSet const &ps)
 
virtual ~SiStripActionExecutor ()
 

Private Attributes

std::unique_ptr< SiStripConfigWriterconfigWriter_ {nullptr}
 
edm::ParameterSet const 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 22 of file SiStripActionExecutor.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 25 of file SiStripActionExecutor.h.

◆ MonitorElement

Definition at line 24 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 }
edm::ParameterSet const pSet_
Log< level::Info, false > LogInfo

◆ ~SiStripActionExecutor()

SiStripActionExecutor::~SiStripActionExecutor ( )
virtual

Definition at line 24 of file SiStripActionExecutor.cc.

24  {
25  edm::LogInfo("SiStripActionExecutor") << " Deleting SiStripActionExecutor "
26  << "\n";
27 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ createDummyShiftReport()

void SiStripActionExecutor::createDummyShiftReport ( )

Definition at line 127 of file SiStripActionExecutor.cc.

References MillePedeFileConverter_cfg::out.

Referenced by SiStripAnalyser::analyze().

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

◆ createFaultyModuleMEs()

void SiStripActionExecutor::createFaultyModuleMEs ( DQMStore dqm_store)

◆ createOfflineTkMap()

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

Definition at line 87 of file SiStripActionExecutor.cc.

References tkMapCreator_.

Referenced by SiStripOfflineDQM::endRun().

90  {
91  if (tkMapCreator_)
92  tkMapCreator_->createForOffline(tkmapPset, dqm_store, map_type, stripQuality);
93 }
std::unique_ptr< SiStripTrackerMapCreator > tkMapCreator_

◆ createShiftReport()

void SiStripActionExecutor::createShiftReport ( DQMStore dqm_store)

Definition at line 134 of file SiStripActionExecutor.cc.

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

Referenced by SiStripAnalyser::analyze().

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

◆ createStatus()

void SiStripActionExecutor::createStatus ( DQMStore dqm_store)

Definition at line 109 of file SiStripActionExecutor.cc.

References pSet_, and qualityChecker_.

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

109  {
110  if (qualityChecker_.get() == nullptr) {
111  qualityChecker_ = std::make_unique<SiStripQualityChecker>(pSet_);
112  }
113  qualityChecker_->bookStatus(dqm_store);
114 }
std::unique_ptr< SiStripQualityChecker > qualityChecker_
edm::ParameterSet const pSet_

◆ createSummary()

void SiStripActionExecutor::createSummary ( DQMStore dqm_store)

Definition at line 50 of file SiStripActionExecutor.cc.

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

Referenced by SiStripAnalyser::endLuminosityBlock().

50  {
51  if (!summaryCreator_)
52  return;
53 
54  dqm_store.cd();
55  std::string dname = "SiStrip/MechanicalView";
56  if (dqm_store.dirExists(dname)) {
57  dqm_store.cd(dname);
58  summaryCreator_->createSummary(dqm_store);
59  }
60 }
std::unique_ptr< SiStripSummaryCreator > summaryCreator_
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:769

◆ createSummaryOffline()

void SiStripActionExecutor::createSummaryOffline ( DQMStore dqm_store)

Definition at line 64 of file SiStripActionExecutor.cc.

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

Referenced by SiStripOfflineDQM::endRun().

64  {
65  if (!summaryCreator_)
66  return;
67 
68  dqm_store.cd();
69  std::string dname = "MechanicalView";
70  if (SiStripUtility::goToDir(dqm_store, dname)) {
71  summaryCreator_->createSummary(dqm_store);
72  }
73  dqm_store.cd();
74 }
std::unique_ptr< SiStripSummaryCreator > summaryCreator_
static bool goToDir(DQMStore &dqm_store, std::string const &name)

◆ createTkInfoFile()

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

Definition at line 97 of file SiStripActionExecutor.cc.

References tkMapCreator_.

Referenced by SiStripOfflineDQM::endRun().

100  {
101  if (!tkMapCreator_)
102  return;
103 
104  tkMapCreator_->createInfoFile(map_names, tkinfo_tree, dqm_store, geomDet);
105 }
std::unique_ptr< SiStripTrackerMapCreator > tkMapCreator_

◆ createTkMap()

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

Definition at line 78 of file SiStripActionExecutor.cc.

References tkMapCreator_.

80  {
81  if (tkMapCreator_)
82  tkMapCreator_->create(tkmapPset, dqm_store, map_type);
83 }
std::unique_ptr< SiStripTrackerMapCreator > tkMapCreator_

◆ fillDummyStatus()

void SiStripActionExecutor::fillDummyStatus ( )

Definition at line 116 of file SiStripActionExecutor.cc.

References qualityChecker_.

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

116 { qualityChecker_->fillDummyStatus(); }
std::unique_ptr< SiStripQualityChecker > qualityChecker_

◆ fillStatus()

void SiStripActionExecutor::fillStatus ( DQMStore dqm_store,
const SiStripDetCabling cabling,
const TkDetMap tkDetMap,
const TrackerTopology tTopo 
)

Definition at line 118 of file SiStripActionExecutor.cc.

References qualityChecker_.

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

121  {
122  qualityChecker_->fillStatus(dqm_store, detcabling, tkDetMap, tTopo);
123 }
std::unique_ptr< SiStripQualityChecker > qualityChecker_

◆ fillStatusAtLumi()

void SiStripActionExecutor::fillStatusAtLumi ( DQMStore dqm_store)

Definition at line 125 of file SiStripActionExecutor.cc.

References qualityChecker_.

Referenced by SiStripOfflineDQM::endLuminosityBlock().

125 { qualityChecker_->fillStatusAtLumi(dqm_store); }
std::unique_ptr< SiStripQualityChecker > qualityChecker_

◆ printFaultyModuleList()

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

Definition at line 244 of file SiStripActionExecutor.cc.

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(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

◆ printReportSummary()

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

Definition at line 190 of file SiStripActionExecutor.cc.

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

Referenced by createShiftReport().

190  {
191  str_val << " " << name << " : ";
194  configWriter_->createChildElement("MonitorElement", name, "value", value);
195  float fvalue = atof(value.c_str());
196  if (fvalue == -1.0)
197  str_val << " Dummy Value " << std::endl;
198  else
199  str_val << fvalue << std::endl;
200 }
static void getMEValue(MonitorElement const *me, std::string &val)
Definition: value.py:1
std::unique_ptr< SiStripConfigWriter > configWriter_

◆ 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 202 of file SiStripActionExecutor.cc.

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

Referenced by createShiftReport().

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

◆ readConfiguration()

bool SiStripActionExecutor::readConfiguration ( )

Definition at line 29 of file SiStripActionExecutor.cc.

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

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

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 }
std::unique_ptr< SiStripSummaryCreator > summaryCreator_
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet const pSet_

◆ readTkMapConfiguration()

bool SiStripActionExecutor::readTkMapConfiguration ( const SiStripDetCabling detCabling,
const TkDetMap tkDetMap,
const TrackerTopology tTopo 
)

Definition at line 41 of file SiStripActionExecutor.cc.

References tkMapCreator_.

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

43  {
44  tkMapCreator_ = std::make_unique<SiStripTrackerMapCreator>(detCabling, tkDetMap, tTopo);
45  return tkMapCreator_.get() != nullptr;
46 }
std::unique_ptr< SiStripTrackerMapCreator > tkMapCreator_

◆ saveMEs()

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

Member Data Documentation

◆ configWriter_

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

◆ pSet_

edm::ParameterSet const SiStripActionExecutor::pSet_
private

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