11 edm::LogInfo(
"SiStripSummaryCreator") <<
" Creating SiStripSummaryCreator " 16 edm::LogInfo(
"SiStripSummaryCreator") <<
" Deleting SiStripSummaryCreator " 27 std::cout <<
"SiStripSummaryCreator::readConfiguration: Failed to read Summary configuration parameters!! ";
32 std::cout <<
"SiStripSummaryCreator::readConfiguration: Failed to read Summary configuration parameters!! ";
40 std::map<std::string, std::string>& me_names)
43 for (std::map<std::string, std::string>::const_iterator
isum =
45 isum != me_names.end();
48 std::pair<std::string, std::string>(
isum->first,
isum->second));
60 std::vector<std::string> subdirs = dqm_store.
getSubdirs();
62 for (std::vector<std::string>::const_iterator it = subdirs.begin();
63 it != subdirs.end(); it++) {
64 if ( (*it).find(
"module_") == std::string::npos)
continue;
70 for (std::vector<std::string>::const_iterator it = subdirs.begin();
71 it != subdirs.end(); it++) {
86 std::map<std::string, MonitorElement*> MEMap;
87 std::vector<std::string> subdirs = dqm_store.
getSubdirs();
88 if (subdirs.empty())
return;
90 for (std::map<std::string, std::string>::const_iterator
isum =
98 for (std::vector<std::string>::const_iterator it = subdirs.begin();
101 if ( (*it).find(
"module_") == std::string::npos)
continue;
104 std::vector<MonitorElement*>
contents =
107 for (std::vector<MonitorElement *>::const_iterator im = contents.begin();
108 im != contents.end(); im++) {
112 if (name_i.find(name) == std::string::npos)
continue;
113 std::map<std::string, MonitorElement*>::iterator iPos =
117 if (iPos == MEMap.end()) {
119 MEMap.insert(std::pair<std::string, MonitorElement*>(name, me));
137 std::map<std::string, MonitorElement*> MEMap;
140 if ((dir_name.find(
"SiStrip") == 0) ||
141 (dir_name.find(
"Collector") == 0) ||
142 (dir_name.find(
"MechanicalView") == 0) ||
143 (dir_name.find(
"FU") == 0) )
return;
144 std::vector<std::string> subdirs = dqm_store.
getSubdirs();
145 if (subdirs.empty())
return;;
146 for (std::map<std::string, std::string>::const_iterator
isum =
152 if (
isum->second ==
"sum" ||
isum->second ==
"sum")
153 summary_name =
"Summary_" +
isum->first;
155 summary_name =
"Summary_Mean" +
isum->first;
158 for (std::vector<std::string>::const_iterator it = subdirs.begin();
162 std::vector<MonitorElement*>
contents =
165 for (std::vector<MonitorElement *>::const_iterator im = contents.begin();
166 im != contents.end(); im++) {
170 if (name_i.find((summary_name)) != std::string::npos) {
172 std::map<std::string, MonitorElement*>::iterator iPos =
175 if (iPos == MEMap.end()) {
176 if (htype ==
"sum" || htype ==
"Sum") {
181 MEMap.insert(std::pair<std::string, MonitorElement*>(name, me));
182 }
else me = iPos->second;
183 if (htype ==
"sum" || htype ==
"Sum") {
186 fillHistos(0, ibinStep,
"bin-by-bin", me_i, me);
206 if (dname.find(
"_") != std::string::npos) dname.insert(dname.find(
"_"),
"_");
207 if (htype ==
"sum" && htype ==
"Sum") {
208 sum_name =
"Summary" + name +
"__" +
dname;
209 tag_name =
"Summary" +
name;
211 sum_name =
"Summary_Mean" + name +
"__" +
dname;
212 tag_name =
"Summary_Mean" +
name;
216 for (std::vector<MonitorElement *>::const_iterator im = contents.begin();
217 im != contents.end(); im++) {
221 if (me_name.find(sum_name) == 0) {
225 TH1* hist1 = me->
getTH1();
233 std::map<int, std::string> tags;
236 std::vector<std::string> subdirs = dqm_store.
getSubdirs();
238 if (htype ==
"mean" || htype ==
"Mean" ) {
239 nBins = subdirs.size();
240 me = dqm_store.
book1D(sum_name, sum_name, nBins, 0.5, nBins + 0.5);
242 for (
auto const& subdir : subdirs) {
243 std::string subdir_name = subdir.substr(subdir.find_last_of(
"/") + 1);
245 tags.emplace(ibin, subdir_name);
247 }
else if (htype ==
"bin-by-bin" || htype ==
"Bin-by-Bin") {
248 for (
auto const& subdir : subdirs) {
249 dqm_store.
cd(subdir);
250 std::string subdir_name = subdir.substr(subdir.find_last_of(
"/") + 1);
252 for (
auto const* s_me : s_contents) {
255 if (s_me_name.find(name) == 0 || s_me_name.find(tag_name) == 0) {
256 int ibin = s_me->getNbinsX();
258 tags.emplace(nBins - ibin / 2, subdir_name);
264 me = dqm_store.
book1D(sum_name, sum_name, nBins, 0.5, nBins + 0.5);
265 }
else if (htype ==
"sum" || htype ==
"Sum") {
266 for (
auto const& subdir : subdirs) {
267 dqm_store.
cd(subdir);
270 for (
auto* s_me : s_contents) {
273 if (s_me_name.find(name) == std::string::npos)
continue;
275 TH1F* hist1 = s_me->getTH1F();
277 nBins = s_me->getNbinsX();
278 me = dqm_store.
book1D(sum_name,
281 hist1->GetXaxis()->GetXmin(),
282 hist1->GetXaxis()->GetXmax());
292 (htype !=
"sum" || htype !=
"Sum")) {
295 if (name.find(
"NoisyStrips") != std::string::npos) hist->GetYaxis()->SetTitle(
"Noisy Strips (%)");
296 else hist->GetYaxis()->SetTitle(name.c_str());
298 for (
auto const& [
bin,
label] : tags) {
299 hist->GetXaxis()->SetBinLabel(
bin,
label.c_str());
301 hist->LabelsOption(
"uv");
315 TH1F* hist1 =
nullptr;
316 TH2F* hist2 =
nullptr;
322 if (htype ==
"mean" || htype ==
"Mean" ) {
323 if (hist2 && name.find(
"NoisyStrips") != std::string::npos) {
327 float binEntry = entries /
nbins;
328 for (
int k = 1;
k < nbins + 1;
k++) {
333 if (noisy >= binEntry * 0.5 || dead >= binEntry * 0.5) bad++;
335 bad = bad * 100.0 /
nbins;
339 }
else if (htype ==
"bin-by-bin" || htype ==
"Bin-by-Bin") {
340 for (
int k=1;
k<nbins+1;
k++) {
343 }
else if (htype ==
"sum" || htype ==
"Sum") {
345 for (
int k = 1;
k < nbins + 1;
k++) {
bool getFrequencyForSummary(int &u_freq)
void setBinContent(int binx, double content)
set content of bin (1-D)
std::vector< MonitorElement * > getContents(std::string const &path) const
void getDocument(std::string configFile, bool UseDB=false)
Methor that parses the xml file configFile.
const std::string & getName() const
get name of ME
void setSummaryMENames(std::map< std::string, std::string > &me_names)
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * book1D(char_string const &name, char_string const &title, int const nchX, double const lowX, double const highX)
Book 1D histogram.
bool readConfiguration(std::string const &file_path)
void fillSummaryHistos(DQMStore &dqm_store)
std::vector< std::string > getSubdirs() const
std::string const & pwd() const
bin
set the eta bin as selection string.
MonitorElement * getSummaryME(DQMStore &dqm_store, std::string &name, std::string htype)
std::map< std::string, std::string > summaryMEs_
virtual ~SiStripSummaryCreator()
double getEntries() const
get # of entries
void cd()
go to top directory (ie. root)
void fillHistos(int ival, int istep, std::string htype, MonitorElement *me_src, MonitorElement *me)
double getBinContent(int binx) const
get content of bin (1-D)
bool getMENamesForSummary(std::map< std::string, std::string > &me_names)
int getNbinsX() const
get # of bins in X-axis
void fillGrandSummaryHistos(DQMStore &dqm_store)
void goUp()
equivalent to "cd .."
void createSummary(DQMStore &dqm_store)
Kind kind() const
Get the type of the monitor element.