CMS 3D CMS Logo

TrackingActionExecutor.cc
Go to the documentation of this file.
1 
3 
5 
7 
13 
15 
16 #include <iomanip>
17 //
18 // -- Constructor
19 //
21  edm::LogInfo("TrackingActionExecutor") << " Creating TrackingActionExecutor "
22  << "\n";
23  qualityChecker_ = nullptr;
24  configWriter_ = nullptr;
25 }
26 //
27 // -- Destructor
28 //
30  // std::cout << "[TrackingActionExecutor::~TrackingActionExecutor] .. starting" << std::endl;
31  edm::LogInfo("TrackingActionExecutor") << " Deleting TrackingActionExecutor "
32  << "\n";
33  if (qualityChecker_)
34  delete qualityChecker_;
35 }
36 
37 //
38 // -- Create Status Monitor Elements
39 //
41  if (!qualityChecker_)
43  qualityChecker_->bookGlobalStatus(ibooker, igetter);
44 }
45 
47  if (!qualityChecker_)
49  qualityChecker_->bookLSStatus(ibooker, igetter);
50 }
51 
52 //
53 // -- Fill Dummy Status
54 //
56 
58 
59 //
60 // -- Fill Status
61 //
63  qualityChecker_->fillGlobalStatus(ibooker, igetter);
64 }
65 //
66 // -- Fill Lumi Status
67 //
69  qualityChecker_->fillLSStatus(ibooker, igetter);
70 }
71 //
72 // --
73 //
75  // std::cout << "[TrackingActionExecutor::createDummyShiftReport]" << std::endl;
76  std::ofstream report_file;
77  report_file.open("tracking_shift_report.txt", std::ios::out);
78  report_file << " Nothing to report!!" << std::endl;
79  report_file.close();
80 }
81 //
82 // -- Create Shift Report
83 //
85  // std::cout << "[TrackingActionExecutor::createShiftReport]" << std::endl;
86 
87  // Read layout configuration
88  std::string localPath = std::string("DQM/TrackingMonitorClient/data/tracking_plot_layout.xml");
89  SiStripLayoutParser layout_parser;
90  layout_parser.getDocument(edm::FileInPath(localPath).fullPath());
91 
92  std::map<std::string, std::vector<std::string> > layout_map;
93  if (!layout_parser.getAllLayouts(layout_map))
94  return;
95 
96  std::ostringstream shift_summary;
97  if (configWriter_)
98  delete configWriter_;
100  configWriter_->init("ShiftReport");
101 
102  // Print Report Summary Content
103  shift_summary << " Report Summary Content :" << std::endl;
104  shift_summary << " =========================" << std::endl;
105  configWriter_->createElement("ReportSummary");
106 
107  shift_summary << std::endl;
108  printShiftHistoParameters(ibooker, igetter, layout_map, shift_summary);
109 
110  std::ofstream report_file;
111  report_file.open("tracking_shift_report.txt", std::ios::out);
112  report_file << shift_summary.str() << std::endl;
113  report_file.close();
114  configWriter_->write("tracking_shift_report.xml");
115  delete configWriter_;
116  configWriter_ = nullptr;
117 }
118 //
119 // -- Print Report Summary
120 //
122  // std::cout << "[TrackingActionExecutor::printReportSummary]" << std::endl;
123  str_val << " " << name << " : ";
126  configWriter_->createChildElement("MonitorElement", name, "value", value);
127  float fvalue = atof(value.c_str());
128  if (fvalue == -1.0)
129  str_val << " Dummy Value " << std::endl;
130  else
131  str_val << fvalue << std::endl;
132 }
133 //
134 // -- Print Shift Histogram Properties
135 //
137  DQMStore::IGetter& igetter,
138  std::map<std::string, std::vector<std::string> >& layout_map,
139  std::ostringstream& str_val) {
140  // std::cout << "[TrackingActionExecutor::printShiftHistoParameters]" << std::endl;
141  str_val << std::endl;
142  for (std::map<std::string, std::vector<std::string> >::iterator it = layout_map.begin(); it != layout_map.end();
143  it++) {
144  std::string set_name = it->first;
145  if (set_name.find("Summary") != std::string::npos)
146  continue;
147  configWriter_->createElement(set_name);
148 
149  str_val << " " << set_name << " : " << std::endl;
150  str_val << " ====================================" << std::endl;
151 
152  str_val << std::setprecision(2);
153  str_val << setiosflags(std::ios::fixed);
154  for (std::vector<std::string>::iterator im = it->second.begin(); im != it->second.end(); im++) {
155  std::string path_name = (*im);
156  if (path_name.empty())
157  continue;
158  MonitorElement* me = igetter.get(path_name);
159  std::ostringstream entry_str, mean_str, rms_str;
160  entry_str << std::setprecision(2);
161  entry_str << setiosflags(std::ios::fixed);
162  mean_str << std::setprecision(2);
163  mean_str << setiosflags(std::ios::fixed);
164  rms_str << std::setprecision(2);
165  rms_str << setiosflags(std::ios::fixed);
166  entry_str << std::setw(7) << me->getEntries();
167  mean_str << std::setw(7) << me->getMean();
168  rms_str << std::setw(7) << me->getRMS();
170  "MonitorElement", me->getName(), "entries", entry_str.str(), "mean", mean_str.str(), "rms", rms_str.str());
171 
172  if (me)
173  str_val << " " << me->getName() << " : entries = " << std::setw(7) << me->getEntries()
174  << " mean = " << me->getMean() << " : rms = " << me->getRMS() << std::endl;
175  }
176  str_val << std::endl;
177  }
178 }
void createChildElement(std::string tag, std::string name)
void fillGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void fillStatusAtLumi(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void createLSStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
TrackingQualityChecker * qualityChecker_
void createShiftReport(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
static void getMEValue(MonitorElement const *me, std::string &val)
void createElement(std::string tag)
TrackingActionExecutor(edm::ParameterSet const &ps)
bool init(std::string main)
Write XML file.
void fillGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void printShiftHistoParameters(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::map< std::string, std::vector< std::string > > &layout_map, std::ostringstream &str_val)
void fillLSStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
Definition: value.py:1
Log< level::Info, false > LogInfo
void bookLSStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:690
void bookGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
SiStripConfigWriter * configWriter_
void write(std::string fname)
void createGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void printReportSummary(MonitorElement *me, std::ostringstream &str_val, std::string name)
bool getAllLayouts(std::map< std::string, std::vector< std::string > > &me_names)
void getDocument(std::string filepath)