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 
4 
6 
10 
16 
18 
19 
20 #include <iomanip>
21 //
22 // -- Constructor
23 //
25  edm::LogInfo("TrackingActionExecutor") << " Creating TrackingActionExecutor " << "\n" ;
28 }
29 //
30 // -- Destructor
31 //
33  // std::cout << "[TrackingActionExecutor::~TrackingActionExecutor] .. starting" << std::endl;
34  edm::LogInfo("TrackingActionExecutor") << " Deleting TrackingActionExecutor " << "\n" ;
35  // if (qualityChecker_) delete qualityChecker_;
36 }
37 
38 //
39 // -- Create Status Monitor Elements
40 //
44 }
45 
48  qualityChecker_->bookLSStatus(dqm_store);
49 }
50 
51 //
52 // -- Fill Dummy Status
53 //
56 }
57 
60 }
61 
62 //
63 // -- Fill Status
64 //
67 }
68 //
69 // -- Fill Lumi Status
70 //
72  qualityChecker_->fillLSStatus(dqm_store);
73 }
74 //
75 // --
76 //
78  // std::cout << "[TrackingActionExecutor::createDummyShiftReport]" << std::endl;
79  std::ofstream report_file;
80  report_file.open("tracking_shift_report.txt", std::ios::out);
81  report_file << " Nothing to report!!" << std::endl;
82  report_file.close();
83 }
84 //
85 // -- Create Shift Report
86 //
88 
89  // std::cout << "[TrackingActionExecutor::createShiftReport]" << std::endl;
90 
91  // Read layout configuration
92  std::string localPath = std::string("DQM/TrackingMonitorClient/data/tracking_plot_layout.xml");
93  SiStripLayoutParser layout_parser;
94  layout_parser.getDocument(edm::FileInPath(localPath).fullPath());
95 
96  std::map<std::string, std::vector<std::string> > layout_map;
97  if (!layout_parser.getAllLayouts(layout_map)) return;
98 
99 
100  std::ostringstream shift_summary;
101  if (configWriter_) delete configWriter_;
103  configWriter_->init("ShiftReport");
104 
105 
106  // Print Report Summary Content
107  shift_summary << " Report Summary Content :" << std::endl;
108  shift_summary << " =========================" << std::endl;
109  configWriter_->createElement("ReportSummary");
110 
111  shift_summary << std::endl;
112  printShiftHistoParameters(dqm_store, layout_map, shift_summary);
113 
114  std::ofstream report_file;
115  report_file.open("tracking_shift_report.txt", std::ios::out);
116  report_file << shift_summary.str() << std::endl;
117  report_file.close();
118  configWriter_->write("tracking_shift_report.xml");
119  delete configWriter_;
120  configWriter_ = 0;
121 }
122 //
123 // -- Print Report Summary
124 //
126  std::ostringstream& str_val, std::string name) {
127 
128  // std::cout << "[TrackingActionExecutor::printReportSummary]" << std::endl;
129  str_val <<" " << name << " : ";
131  SiStripUtility::getMEValue(me, value);
132  configWriter_->createChildElement("MonitorElement", name, "value", value);
133  float fvalue = atof(value.c_str());
134  if (fvalue == -1.0) str_val <<" Dummy Value "<<std::endl;
135  else str_val << fvalue << std::endl;
136 }
137 //
138 // -- Print Shift Histogram Properties
139 //
140 void TrackingActionExecutor::printShiftHistoParameters(DQMStore * dqm_store, std::map<std::string, std::vector<std::string> >& layout_map, std::ostringstream& str_val) {
141 
142  // std::cout << "[TrackingActionExecutor::printShiftHistoParameters]" << std::endl;
143  str_val << std::endl;
144  for (std::map<std::string, std::vector< std::string > >::iterator it = layout_map.begin() ; it != layout_map.end(); it++) {
145  std::string set_name = it->first;
146  if (set_name.find("Summary") != std::string::npos) 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();
155  im != it->second.end(); im++) {
156  std::string path_name = (*im);
157  if (path_name.size() == 0) continue;
158  MonitorElement* me = dqm_store->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();
169  configWriter_->createChildElement("MonitorElement", me->getName(),
170  "entries",entry_str.str(),"mean",mean_str.str(),"rms",rms_str.str());
171 
172  if (me) str_val << " "<< me->getName() <<" : entries = "<< std::setw(7)
173  << me->getEntries() << " mean = "<< me->getMean()
174  <<" : rms = "<< me->getRMS()<< std::endl;
175  }
176  str_val << std::endl;
177  }
178 }
const std::string & getName(void) const
get name of ME
void createChildElement(std::string tag, std::string name)
static void getMEValue(MonitorElement *me, std::string &val)
void fillGlobalStatus(DQMStore *dqm_store)
void getDocument(std::string configFile, bool UseDB=false)
Methor that parses the xml file configFile.
void createLSStatus(DQMStore *dqm_store)
void bookLSStatus(DQMStore *dqm_store)
#define NULL
Definition: scimark2.h:8
void createShiftReport(DQMStore *dqm_store)
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 createElement(std::string tag)
TrackingActionExecutor(edm::ParameterSet const &ps)
bool init(std::string main)
Write XML file.
void printShiftHistoParameters(DQMStore *dqm_store, std::map< std::string, std::vector< std::string > > &layout_map, std::ostringstream &str_val)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
tuple out
Definition: dbtoconf.py:99
void bookGlobalStatus(DQMStore *dqm_store)
void fillStatusAtLumi(DQMStore *dqm_store)
void createGlobalStatus(DQMStore *dqm_store)
void fillGlobalStatus(DQMStore *dqm_store)
void fillLSStatus(DQMStore *dqm_store)
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 printReportSummary(MonitorElement *me, std::ostringstream &str_val, std::string name)
bool getAllLayouts(std::map< std::string, std::vector< std::string > > &me_names)