CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackingActionExecutor.cc
Go to the documentation of this file.
1 
3 
5 
9 
15 
17 
18 
19 #include <iomanip>
20 //
21 // -- Constructor
22 //
24  edm::LogInfo("TrackingActionExecutor") << " Creating TrackingActionExecutor " << "\n" ;
27 }
28 //
29 // -- Destructor
30 //
32  // std::cout << "[TrackingActionExecutor::~TrackingActionExecutor] .. starting" << std::endl;
33  edm::LogInfo("TrackingActionExecutor") << " Deleting TrackingActionExecutor " << "\n" ;
34  if (qualityChecker_) delete qualityChecker_;
35 }
36 
37 //
38 // -- Create Status Monitor Elements
39 //
42  qualityChecker_->bookGlobalStatus(ibooker,igetter);
43 }
44 
47  qualityChecker_->bookLSStatus(ibooker,igetter);
48 }
49 
50 //
51 // -- Fill Dummy Status
52 //
55 }
56 
59 }
60 
61 //
62 // -- Fill Status
63 //
65  qualityChecker_->fillGlobalStatus(ibooker,igetter);
66 }
67 //
68 // -- Fill Lumi Status
69 //
71  qualityChecker_->fillLSStatus(ibooker,igetter);
72 }
73 //
74 // --
75 //
77  // std::cout << "[TrackingActionExecutor::createDummyShiftReport]" << std::endl;
78  std::ofstream report_file;
79  report_file.open("tracking_shift_report.txt", std::ios::out);
80  report_file << " Nothing to report!!" << std::endl;
81  report_file.close();
82 }
83 //
84 // -- Create Shift Report
85 //
87 
88  // std::cout << "[TrackingActionExecutor::createShiftReport]" << std::endl;
89 
90  // Read layout configuration
91  std::string localPath = std::string("DQM/TrackingMonitorClient/data/tracking_plot_layout.xml");
92  SiStripLayoutParser layout_parser;
93  layout_parser.getDocument(edm::FileInPath(localPath).fullPath());
94 
95  std::map<std::string, std::vector<std::string> > layout_map;
96  if (!layout_parser.getAllLayouts(layout_map)) return;
97 
98 
99  std::ostringstream shift_summary;
100  if (configWriter_) delete configWriter_;
102  configWriter_->init("ShiftReport");
103 
104 
105  // Print Report Summary Content
106  shift_summary << " Report Summary Content :" << std::endl;
107  shift_summary << " =========================" << std::endl;
108  configWriter_->createElement("ReportSummary");
109 
110  shift_summary << std::endl;
111  printShiftHistoParameters(ibooker,igetter, layout_map, shift_summary);
112 
113  std::ofstream report_file;
114  report_file.open("tracking_shift_report.txt", std::ios::out);
115  report_file << shift_summary.str() << std::endl;
116  report_file.close();
117  configWriter_->write("tracking_shift_report.xml");
118  delete configWriter_;
119  configWriter_ = 0;
120 }
121 //
122 // -- Print Report Summary
123 //
125  std::ostringstream& str_val, std::string name) {
126 
127  // std::cout << "[TrackingActionExecutor::printReportSummary]" << std::endl;
128  str_val <<" " << name << " : ";
130  SiStripUtility::getMEValue(me, value);
131  configWriter_->createChildElement("MonitorElement", name, "value", value);
132  float fvalue = atof(value.c_str());
133  if (fvalue == -1.0) str_val <<" Dummy Value "<<std::endl;
134  else str_val << fvalue << std::endl;
135 }
136 //
137 // -- Print Shift Histogram Properties
138 //
139 void TrackingActionExecutor::printShiftHistoParameters(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, std::map<std::string, std::vector<std::string> >& layout_map, std::ostringstream& str_val) {
140 
141  // std::cout << "[TrackingActionExecutor::printShiftHistoParameters]" << std::endl;
142  str_val << std::endl;
143  for (std::map<std::string, std::vector< std::string > >::iterator it = layout_map.begin() ; it != layout_map.end(); it++) {
144  std::string set_name = it->first;
145  if (set_name.find("Summary") != std::string::npos) continue;
146  configWriter_->createElement(set_name);
147 
148  str_val << " " << set_name << " : " << std::endl;
149  str_val << " ===================================="<< std::endl;
150 
151  str_val << std::setprecision(2);
152  str_val << setiosflags(std::ios::fixed);
153  for (std::vector<std::string>::iterator im = it->second.begin();
154  im != it->second.end(); im++) {
155  std::string path_name = (*im);
156  if (path_name.size() == 0) continue;
157  MonitorElement* me = igetter.get(path_name);
158  std::ostringstream entry_str, mean_str, rms_str;
159  entry_str << std::setprecision(2);
160  entry_str << setiosflags(std::ios::fixed);
161  mean_str << std::setprecision(2);
162  mean_str << setiosflags(std::ios::fixed);
163  rms_str << std::setprecision(2);
164  rms_str << setiosflags(std::ios::fixed);
165  entry_str << std::setw(7) << me->getEntries();
166  mean_str << std::setw(7) << me->getMean();
167  rms_str << std::setw(7) << me->getRMS();
168  configWriter_->createChildElement("MonitorElement", me->getName(),
169  "entries",entry_str.str(),"mean",mean_str.str(),"rms",rms_str.str());
170 
171  if (me) str_val << " "<< me->getName() <<" : entries = "<< std::setw(7)
172  << me->getEntries() << " mean = "<< me->getMean()
173  <<" : rms = "<< me->getRMS()<< std::endl;
174  }
175  str_val << std::endl;
176  }
177 }
const std::string & getName(void) const
get name of ME
void createChildElement(std::string tag, std::string name)
void fillGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
static void getMEValue(MonitorElement *me, std::string &val)
void getDocument(std::string configFile, bool UseDB=false)
Methor that parses the xml file configFile.
void fillStatusAtLumi(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
void createLSStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
#define NULL
Definition: scimark2.h:8
double getEntries(void) const
get # of entries
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
TrackingQualityChecker * qualityChecker_
void createShiftReport(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
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)
tuple out
Definition: dbtoconf.py:99
void bookLSStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void bookGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
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)