CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CommissioningHistograms.cc
Go to the documentation of this file.
9 #include <iomanip>
10 
11 using namespace std;
12 using namespace sistrip;
13 
14 // -----------------------------------------------------------------------------
17  DQMStore* bei,
18  const sistrip::RunType& task)
19  : factory_(nullptr),
20  task_(task),
21  bei_(bei),
22  data_(),
23  histos_(),
24  pset_(pset),
25  mask_(pset.existsAs<bool>("vetoModules") ? pset.getParameter<bool>("vetoModules") : true),
26  fedMaskVector_(pset.existsAs<std::vector<uint32_t> >("fedMaskVector")
27  ? pset.getParameter<std::vector<uint32_t> >("fedMaskVector")
28  : std::vector<uint32_t>()),
29  fecMaskVector_(pset.existsAs<std::vector<uint32_t> >("fecMaskVector")
30  ? pset.getParameter<std::vector<uint32_t> >("fecMaskVector")
31  : std::vector<uint32_t>()),
32  ringVector_(pset.existsAs<std::vector<uint32_t> >("ringVector")
33  ? pset.getParameter<std::vector<uint32_t> >("ringVector")
34  : std::vector<uint32_t>()),
35  ccuVector_(pset.existsAs<std::vector<uint32_t> >("ccuVector")
36  ? pset.getParameter<std::vector<uint32_t> >("ccuVector")
37  : std::vector<uint32_t>()),
38  i2cChanVector_(pset.existsAs<std::vector<uint32_t> >("i2cChanVector")
39  ? pset.getParameter<std::vector<uint32_t> >("i2cChanVector")
40  : std::vector<uint32_t>()),
41  lldChanVector_(pset.existsAs<std::vector<uint32_t> >("lldChanVector")
42  ? pset.getParameter<std::vector<uint32_t> >("lldChanVector")
43  : std::vector<uint32_t>()),
44  dataWithMask_(),
45  dataWithMaskCached_(false) {
46  LogTrace(mlDqmClient_) << "[" << __PRETTY_FUNCTION__ << "]"
47  << " Constructing object...";
48 
49  // DQMStore
50  if (!bei_) {
51  edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
52  << " NULL pointer to DQMStore!";
53  }
54 
56 }
57 
58 // -----------------------------------------------------------------------------
61  : factory_(nullptr),
62  task_(sistrip::UNDEFINED_RUN_TYPE),
63  bei_(nullptr),
64  data_(),
65  histos_(),
66  mask_(true),
67  dataWithMask_(),
68  dataWithMaskCached_(false) {
69  LogTrace(mlDqmClient_) << "[" << __PRETTY_FUNCTION__ << "]"
70  << " Constructing object...";
71 }
72 
73 // -----------------------------------------------------------------------------
76  LogTrace(mlDqmClient_) << "[" << __PRETTY_FUNCTION__ << "]"
77  << " Destructing object...";
79  //@@ do not delete BEI ptrs!
80 }
81 
82 // -----------------------------------------------------------------------------
84 void CommissioningHistograms::Histo::print(std::stringstream& ss) const {
85  ss << " [Histo::" << __func__ << "]" << std::endl
86  << " Histogram title : " << title_ << std::endl
87  << " MonitorElement* : 0x" << std::hex << std::setw(8) << std::setfill('0') << me_ << std::endl
88  << std::dec << " CollateME* : 0x" << std::hex << std::setw(8) << std::setfill('0') << cme_ << std::endl
89  << std::dec;
90 }
91 
92 // -----------------------------------------------------------------------------
93 //
94 uint32_t CommissioningHistograms::runNumber(DQMStore* const bei, const std::vector<std::string>& contents) {
95  // Check if histograms present
96  if (contents.empty()) {
97  edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
98  << " Found no histograms!";
99  return 0;
100  }
101 
102  // Iterate through added contents
103  std::vector<std::string>::const_iterator istr = contents.begin();
104  while (istr != contents.end()) {
105  // Extract source directory path
106  std::string source_dir = istr->substr(0, istr->find(":"));
107 
108  // Generate corresponding client path (removing trailing "/")
109  SiStripFecKey path(source_dir);
110  std::string client_dir = path.path();
111  std::string slash = client_dir.substr(client_dir.size() - 1, 1);
112  if (slash == sistrip::dir_) {
113  client_dir = client_dir.substr(0, client_dir.size() - 1);
114  }
115  client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
116 
117  // Iterate though MonitorElements from source directory
118  std::vector<MonitorElement*> me_list = bei->getContents(source_dir);
119  std::vector<MonitorElement*>::iterator ime = me_list.begin();
120  for (; ime != me_list.end(); ime++) {
121  if (!(*ime)) {
122  edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
123  << " NULL pointer to MonitorElement!";
124  continue;
125  }
126 
127  // Search for run type in string
128  std::string title = (*ime)->getName();
130 
131  // Extract run number from string
132  if (pos != std::string::npos) {
133  std::string value = title.substr(pos + sizeof(sistrip::runNumber_), std::string::npos);
134  if (!value.empty()) {
135  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
136  << " Found string \"" << title.substr(pos, std::string::npos) << "\" with value \""
137  << value << "\"";
138  if (!(bei->get(client_dir + "/" + title.substr(pos, std::string::npos)))) {
139  bei->setCurrentFolder(client_dir);
140  bei->bookString(title.substr(pos, std::string::npos), value);
141  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
142  << " Booked string \"" << title.substr(pos, std::string::npos)
143  << "\" in directory \"" << client_dir << "\"";
144  }
145  uint32_t run;
146  std::stringstream ss;
147  ss << value;
148  ss >> std::dec >> run;
149  return run;
150  }
151  }
152  }
153 
154  istr++;
155  }
156  return 0;
157 }
158 
159 // -----------------------------------------------------------------------------
161 sistrip::RunType CommissioningHistograms::runType(DQMStore* const bei, const std::vector<std::string>& contents) {
162  // Check if histograms present
163  if (contents.empty()) {
164  edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
165  << " Found no histograms!";
167  }
168 
169  // Iterate through added contents
170  std::vector<std::string>::const_iterator istr = contents.begin();
171  while (istr != contents.end()) {
172  // Extract source directory path
173  std::string source_dir = istr->substr(0, istr->find(":"));
174 
175  // Generate corresponding client path (removing trailing "/")
176  SiStripFecKey path(source_dir);
177  std::string client_dir = path.path();
178  std::string slash = client_dir.substr(client_dir.size() - 1, 1);
179  if (slash == sistrip::dir_) {
180  client_dir = client_dir.substr(0, client_dir.size() - 1);
181  }
182  client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
183 
184  // Iterate though MonitorElements from source directory
185  std::vector<MonitorElement*> me_list = bei->getContents(source_dir);
186 
187  if (me_list.empty()) {
188  edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
189  << " No MonitorElements found in dir " << source_dir;
191  }
192 
193  std::vector<MonitorElement*>::iterator ime = me_list.begin();
194  for (; ime != me_list.end(); ime++) {
195  if (!(*ime)) {
196  edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
197  << " NULL pointer to MonitorElement!";
198  continue;
199  }
200 
201  // Search for run type in string
202  std::string title = (*ime)->getName();
203  std::string::size_type pos = title.find(sistrip::taskId_);
204 
205  // Extract commissioning task from string
206  if (pos != std::string::npos) {
207  std::string value = title.substr(pos + sizeof(sistrip::taskId_), std::string::npos);
208  if (!value.empty()) {
209  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
210  << " Found string \"" << title.substr(pos, std::string::npos) << "\" with value \""
211  << value << "\"";
212  if (!(bei->get(client_dir + sistrip::dir_ + title.substr(pos, std::string::npos)))) {
213  bei->setCurrentFolder(client_dir);
214  bei->bookString(title.substr(pos, std::string::npos), value);
215  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
216  << " Booked string \"" << title.substr(pos, std::string::npos)
217  << "\" in directory \"" << client_dir << "\"";
218  }
219  return SiStripEnumsAndStrings::runType(value);
220  }
221  }
222  }
223 
224  istr++;
225  }
226 
227  edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
228  << " Unable to extract RunType!";
230 }
231 
232 // -----------------------------------------------------------------------------
233 //
234 void CommissioningHistograms::copyCustomInformation(DQMStore* const bei, const std::vector<std::string>& contents) {
235  // Check if histograms present
236  if (contents.empty()) {
237  edm::LogWarning(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
238  << " Found no histograms!";
239  return;
240  }
241 
242  // Iterate through added contents
243  std::vector<std::string>::const_iterator istr = contents.begin();
244  while (istr != contents.end()) {
245  // Extract source directory path
246  std::string source_dir = istr->substr(0, istr->find(":"));
247 
248  // Generate corresponding client path (removing trailing "/")
249  SiStripFecKey path(source_dir);
250  std::string client_dir = path.path();
251  std::string slash = client_dir.substr(client_dir.size() - 1, 1);
252  if (slash == sistrip::dir_) {
253  client_dir = client_dir.substr(0, client_dir.size() - 1);
254  }
255 
256  // Iterate though MonitorElements from source directory
257  std::vector<MonitorElement*> me_list = bei->getContents(source_dir);
258  std::vector<MonitorElement*>::iterator ime = me_list.begin();
259  for (; ime != me_list.end(); ime++) {
260  if (!(*ime)) {
261  edm::LogWarning(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
262  << " NULL pointer to MonitorElement!";
263  continue;
264  }
265  // Search for calchan, isha or vfs
266  if ((*ime)->kind() == MonitorElement::Kind::INT) {
267  std::string title = (*ime)->getName();
268  std::string::size_type pos = title.find("calchan");
269  if (pos == std::string::npos)
270  pos = title.find("isha");
271  if (pos == std::string::npos)
272  pos = title.find("vfs");
273  if (pos != std::string::npos) {
274  int value = (*ime)->getIntValue();
275  if (value >= 0) {
277  << "[CommissioningHistograms::" << __func__ << "]"
278  << " Found \"" << title.substr(pos, std::string::npos) << "\" with value \"" << value << "\"";
279  if (!(bei->get(client_dir + "/" + title.substr(pos, std::string::npos)))) {
280  bei->setCurrentFolder(client_dir);
281  bei->bookInt(title.substr(pos, std::string::npos))->Fill(value);
283  << "[CommissioningHistograms::" << __func__ << "]"
284  << " Booked \"" << title.substr(pos, std::string::npos) << "\" in directory \"" << client_dir << "\"";
285  }
286  }
287  }
288  }
289  }
290  istr++;
291  }
292 }
293 
294 // -----------------------------------------------------------------------------
295 
297 void CommissioningHistograms::extractHistograms(const std::vector<std::string>& contents) {
298  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
299  << " Extracting available histograms...";
300 
301  // Check pointer
302  if (!bei_) {
303  edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
304  << " NULL pointer to DQMStore!";
305  return;
306  }
307 
308  // Check list of histograms
309  if (contents.empty()) {
310  edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
311  << " Empty contents vector!";
312  return;
313  }
314 
315  // Iterate through list of histograms
316  std::vector<std::string>::const_iterator idir;
317  for (idir = contents.begin(); idir != contents.end(); idir++) {
318  // Ignore "DQM source" directories if looking in client file
319  if (idir->find(sistrip::collate_) == std::string::npos) {
320  continue;
321  }
322 
323  // Extract source directory path
324  std::string source_dir = idir->substr(0, idir->find(":"));
325 
326  // Extract view and create key
327  sistrip::View view = SiStripEnumsAndStrings::view(source_dir);
329  if (view == sistrip::CONTROL_VIEW) {
330  path = SiStripFecKey(source_dir);
331  } else if (view == sistrip::READOUT_VIEW) {
332  path = SiStripFedKey(source_dir);
333  } else if (view == sistrip::DETECTOR_VIEW) {
334  path = SiStripDetKey(source_dir);
335  } else {
336  path = SiStripKey();
337  }
338 
339  // Check path is valid
341  continue;
342  }
343 
344  // Generate corresponding client path (removing trailing "/")
346  if (view == sistrip::CONTROL_VIEW) {
347  client_dir = SiStripFecKey(path.key()).path();
348  } else if (view == sistrip::READOUT_VIEW) {
349  client_dir = SiStripFedKey(path.key()).path();
350  } else if (view == sistrip::DETECTOR_VIEW) {
351  client_dir = SiStripDetKey(path.key()).path();
352  } else {
353  client_dir = SiStripKey(path.key()).path();
354  }
355  std::string slash = client_dir.substr(client_dir.size() - 1, 1);
356  if (slash == sistrip::dir_) {
357  client_dir = client_dir.substr(0, client_dir.size() - 1);
358  }
359  client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
360 
361  // Retrieve MonitorElements from source directory
362  std::vector<MonitorElement*> me_list = bei_->getContents(source_dir);
363 
364  // Iterate though MonitorElements and create CMEs
365  std::vector<MonitorElement*>::iterator ime = me_list.begin();
366  for (; ime != me_list.end(); ime++) {
367  // Retrieve histogram title
368  SiStripHistoTitle title((*ime)->getName());
369 
370  // Check histogram type
371  //if ( title.histoType() != sistrip::EXPERT_HISTO ) { continue; }
372 
373  // Check granularity
374  uint16_t channel = sistrip::invalid_;
375  if (title.granularity() == sistrip::APV) {
376  channel = SiStripFecKey::lldChan(title.channel());
377  } else if (title.granularity() == sistrip::UNKNOWN_GRAN || title.granularity() == sistrip::UNDEFINED_GRAN) {
378  std::stringstream ss;
379  ss << "[CommissioningHistograms::" << __func__ << "]"
380  << " Unexpected granularity for histogram title: " << std::endl
381  << title << " found in path " << std::endl
382  << path;
383  edm::LogError(mlDqmClient_) << ss.str();
384  } else {
385  channel = title.channel();
386  }
387 
388  // Build key
389  uint32_t key = sistrip::invalid32_;
390 
391  if (view == sistrip::CONTROL_VIEW) {
392  // for all runs except cabling
393  SiStripFecKey temp(path.key());
394  key = SiStripFecKey(temp.fecCrate(), temp.fecSlot(), temp.fecRing(), temp.ccuAddr(), temp.ccuChan(), channel)
395  .key();
396  mapping_[title.keyValue()] = key;
397 
398  } else if (view == sistrip::READOUT_VIEW) {
399  // for cabling run
400  key = SiStripFedKey(path.key()).key();
406  channel)
407  .key(); // just record lld channel
408  mapping_[title.keyValue()] = temp;
409 
410  } else if (view == sistrip::DETECTOR_VIEW) {
411  SiStripDetKey temp(path.key());
412  key = SiStripDetKey(temp.partition()).key();
413  mapping_[title.keyValue()] = key;
414 
415  } else {
416  key = SiStripKey(path.key()).key();
417  }
418 
419  // Find CME in histos map
420  Histo* histo = nullptr;
421  HistosMap::iterator ihistos = histos_.find(key);
422  if (ihistos != histos_.end()) {
423  Histos::iterator ihis = ihistos->second.begin();
424  while (!histo && ihis < ihistos->second.end()) {
425  if ((*ime)->getName() == (*ihis)->title_) {
426  histo = *ihis;
427  }
428  ihis++;
429  }
430  }
431 
432  // Create CollateME if it doesn't exist
433  if (!histo) {
434  histos_[key].push_back(new Histo());
435  histo = histos_[key].back();
436  histo->title_ = (*ime)->getName();
437 
438  // If histogram present in client directory, add to map
439  if (source_dir.find(sistrip::collate_) != std::string::npos) {
440  histo->me_ = bei_->get(client_dir + "/" + (*ime)->getName());
441  if (!histo->me_) {
442  edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
443  << " NULL pointer to MonitorElement!";
444  }
445  }
446  }
447  }
448  }
449 
450  //printHistosMap();
451 
452  edm::LogVerbatim(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
453  << " Found histograms for " << histos_.size()
454  << " structures in cached histogram map!";
455 }
456 
457 // -----------------------------------------------------------------------------
460  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
461  << " (Derived) implementation to come...";
462 }
463 
464 // -----------------------------------------------------------------------------
467  Analyses::iterator ianal = data().begin();
468  Analyses::iterator janal = data().end();
469  for (; ianal != janal; ++ianal) {
470  if (ianal->second) {
471  std::stringstream ss;
472  ianal->second->print(ss);
473  if (ianal->second->isValid()) {
474  LogTrace(mlDqmClient_) << ss.str();
475  } else {
476  edm::LogWarning(mlDqmClient_) << ss.str();
477  }
478  }
479  }
480 }
481 
482 // -----------------------------------------------------------------------------
485  std::stringstream good;
486  std::stringstream bad;
487 
488  Analyses::iterator ianal = data().begin();
489  Analyses::iterator janal = data().end();
490  for (; ianal != janal; ++ianal) {
491  if (ianal->second) {
492  if (ianal->second->isValid()) {
493  ianal->second->summary(good);
494  } else {
495  ianal->second->summary(bad);
496  }
497  }
498  }
499 
500  if (good.str().empty()) {
501  good << "None found!";
502  }
503  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
504  << " Printing summary of good analyses:"
505  << "\n"
506  << good.str();
507 
508  if (bad.str().empty()) {
509  return;
510  } //@@ bad << "None found!"; }
511  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
512  << " Printing summary of bad analyses:"
513  << "\n"
514  << bad.str();
515 }
516 
517 // -----------------------------------------------------------------------------
520  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
521  << " Printing histogram map, which has " << histos_.size() << " entries...";
522  HistosMap::const_iterator ihistos = histos_.begin();
523  for (; ihistos != histos_.end(); ihistos++) {
524  std::stringstream ss;
525  ss << " Found " << ihistos->second.size() << " histogram(s) for key: " << std::endl
526  << SiStripFedKey(ihistos->first) << std::endl;
527  Histos::const_iterator ihisto = ihistos->second.begin();
528  for (; ihisto != ihistos->second.end(); ihisto++) {
529  if (*ihisto) {
530  (*ihisto)->print(ss);
531  } else {
532  ss << " NULL pointer to Histo object!";
533  }
534  }
535  LogTrace(mlDqmClient_) << ss.str();
536  }
537 }
538 
539 // -----------------------------------------------------------------------------
542  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
543  << " Clearing histogram map...";
544  HistosMap::iterator ihistos = histos_.begin();
545  for (; ihistos != histos_.end(); ihistos++) {
546  Histos::iterator ihisto = ihistos->second.begin();
547  for (; ihisto != ihistos->second.end(); ihisto++) {
548  if (*ihisto) {
549  delete *ihisto;
550  }
551  }
552  ihistos->second.clear();
553  }
554  histos_.clear();
555 }
556 
557 // -----------------------------------------------------------------------------
560  const sistrip::Presentation& pres,
561  const std::string& dir,
562  const sistrip::Granularity& gran) {
563  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]";
564 
565  // Check view
567  if (view == sistrip::UNKNOWN_VIEW) {
568  return;
569  }
570 
571  // Analyze histograms
572  if (data().empty()) {
573  histoAnalysis(false);
574  }
575 
576  // Check
577  if (data().empty()) {
578  edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
579  << " No analyses generated!";
580  return;
581  }
582 
583  // Extract data to be histogrammed
584  uint32_t xbins = factory()->init(mon, pres, view, dir, gran, data());
585 
586  // Only create histograms if entries are found!
587  if (!xbins) {
588  return;
589  }
590 
591  // Create summary histogram (if it doesn't already exist)
592  TH1* summary = nullptr;
593  if (pres != sistrip::HISTO_1D) {
594  summary = histogram(mon, pres, view, dir, xbins);
595  } else {
596  summary = histogram(mon, pres, view, dir, sistrip::FED_ADC_RANGE, 0., sistrip::FED_ADC_RANGE * 1.);
597  }
598 
599  // Fill histogram with data
600  factory()->fill(*summary);
601 }
602 
603 // -----------------------------------------------------------------------------
606  // TODO: remove no longer supported in DQMStore.
607 }
608 
609 // -----------------------------------------------------------------------------
612  // Construct path and filename
613  std::stringstream ss;
614 
615  if (!path.empty()) {
616  ss << path;
617  if (ss.str().find(".root") == std::string::npos) {
618  ss << ".root";
619  }
620 
621  } else {
622  // Retrieve SCRATCH directory
623  std::string scratch = "SCRATCH";
624  std::string dir = "";
625  if (std::getenv(scratch.c_str()) != nullptr) {
626  dir = std::getenv(scratch.c_str());
627  }
628 
629  // Add directory path
630  if (!dir.empty()) {
631  ss << dir << "/";
632  } else {
633  ss << "/tmp/";
634  }
635 
636  // Add filename with run number and ".root" extension
637  if (partitionName.empty())
638  ss << sistrip::dqmClientFileName_ << "_" << std::setfill('0') << std::setw(8) << run_number << ".root";
639  else
640  ss << sistrip::dqmClientFileName_ << "_" << partitionName << "_" << std::setfill('0') << std::setw(8)
641  << run_number << ".root";
642  }
643 
644  // Save file with appropriate filename
645  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
646  << " Saving histograms to root file"
647  << " (This may take some time!)";
648  path = ss.str();
649  bei_->save(path, sistrip::collate_);
650  edm::LogVerbatim(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
651  << " Saved histograms to root file \"" << ss.str() << "\"!";
652 }
653 
654 // -----------------------------------------------------------------------------
655 //
657  const sistrip::Presentation& pres,
658  const sistrip::View& view,
659  const std::string& directory,
660  const uint32_t& xbins,
661  const float& xlow,
662  const float& xhigh) {
663  // Remember pwd
664  std::string pwd = bei_->pwd();
666 
667  // Construct histogram name
668  std::string name = SummaryGenerator::name(task_, mon, pres, view, directory);
669 
670  MonitorElement* me = bei_->get(bei_->pwd() + "/" + name);
671 
672  // Create summary plot
673  float high = static_cast<float>(xbins);
674  if (pres == sistrip::HISTO_1D) {
675  if (xlow < 1. * sistrip::valid_ && xhigh < 1. * sistrip::valid_) {
676  me = bei_->book1D(name, name, xbins, xlow, xhigh);
677  } else {
678  me = bei_->book1D(name, name, xbins, 0., high);
679  }
680  } else if (pres == sistrip::HISTO_2D_SUM) {
681  me = bei_->book1D(name, name, xbins, 0., high);
682  } else if (pres == sistrip::HISTO_2D_SCATTER) {
683  me = bei_->book2D(name, name, xbins, 0., high, sistrip::FED_ADC_RANGE + 1, 0., sistrip::FED_ADC_RANGE * 1.);
684  } else if (pres == sistrip::PROFILE_1D) {
685  me = bei_->bookProfile(name, name, xbins, 0., high, sistrip::FED_ADC_RANGE + 1, 0., sistrip::FED_ADC_RANGE * 1.);
686  } else {
687  me = nullptr;
688  edm::LogWarning(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
689  << " Unexpected presentation \"" << SiStripEnumsAndStrings::presentation(pres)
690  << "\" Unable to create summary plot!";
691  }
692 
693  // Check pointer
694  if (me) {
695  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
696  << " Created summary plot with name \"" << me->getName() << "\" in directory \""
697  << bei_->pwd() << "\"!";
698  } else {
699  edm::LogWarning(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
700  << " NULL pointer to MonitorElement!"
701  << " Unable to create summary plot!";
702  }
703 
704  // Extract root object
705  TH1* summary = ExtractTObject<TH1>().extract(me);
706  if (!summary) {
707  edm::LogWarning(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
708  << " Unable to extract root object!"
709  << " Returning NULL pointer!";
710  }
711 
712  // Return to pwd
713  bei_->setCurrentFolder(pwd);
714 
715  return summary;
716 }
717 
719  if (!getMaskedData)
720  return data_;
721  else {
723  return dataWithMask_;
724  else {
725  Analyses::iterator ianal = data_.begin();
726  Analyses::iterator janal = data_.end();
727  for (; ianal != janal; ++ianal) {
728  CommissioningAnalysis* anal = ianal->second;
729  SiStripFedKey fedkey = anal->fedKey();
730  SiStripFecKey feckey = anal->fecKey();
731  bool maskThisAnal_ = false;
732  for (std::size_t i = 0; i < fedMaskVector_.size(); i++) {
733  if (fedkey.fedId() == fedMaskVector_[i])
734  maskThisAnal_ = true;
735  }
736  for (std::size_t i = 0; i < fecMaskVector_.size(); i++) {
737  if (fecMaskVector_.size() != ringVector_.size() || fecMaskVector_.size() != ccuVector_.size() ||
738  fecMaskVector_.size() != i2cChanVector_.size() || fecMaskVector_.size() != lldChanVector_.size()) {
739  continue;
740  }
741  if (feckey.fecSlot() == fecMaskVector_[i] && feckey.fecRing() == ringVector_[i] &&
742  feckey.ccuAddr() == ccuVector_[i] && feckey.ccuChan() == i2cChanVector_[i] &&
743  feckey.lldChan() == lldChanVector_[i]) {
744  maskThisAnal_ = true;
745  }
746  }
747  if (mask_ && !maskThisAnal_)
748  dataWithMask_[ianal->first] = ianal->second;
749  else if (!mask_ && maskThisAnal_)
750  dataWithMask_[ianal->first] = ianal->second;
751  }
752  dataWithMaskCached_ = true;
753  return dataWithMask_;
754  }
755  }
756 }
static std::string name(const sistrip::RunType &, const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory)
static const char runNumber_[]
Log< level::Info, true > LogVerbatim
void save(std::string &filename, uint32_t run_number=0, std::string partitionName="")
void print(std::stringstream &ss) const override
std::vector< uint32_t > lldChanVector_
const uint32_t & fedKey() const
TH1 * histogram(const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory, const uint32_t &xbins, const float &xlow=1.*sistrip::invalid_, const float &xhigh=1.*sistrip::invalid_)
const double xbins[]
Analyses & data(bool getMaskedData=false)
const uint16_t & fecRing() const
static const char dir_[]
void print(std::stringstream &) const
Utility class that holds histogram title.
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
static const uint32_t invalid32_
Definition: Constants.h:15
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
Definition: DQMStore.cc:593
std::vector< uint32_t > fecMaskVector_
static const char dqmClientFileName_[]
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
std::vector< uint32_t > ccuVector_
const std::string & getName() const
get name of ME
static const char mlDqmClient_[]
const uint16_t & lldChan() const
static const uint16_t FED_ADC_RANGE
std::string pwd() override
Definition: DQMStore.h:567
const uint16_t & fecSlot() const
Log< level::Error, false > LogError
static const uint16_t valid_
Definition: Constants.h:17
uint16_t size_type
#define LogTrace(id)
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
Definition: DQMStore.h:87
const uint32_t & key() const
Definition: SiStripKey.h:120
static const char undefinedView_[]
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:122
U second(std::pair< T, U > const &p)
static std::string view(const sistrip::View &)
static std::string runType(const sistrip::RunType &)
std::vector< uint32_t > i2cChanVector_
std::vector< uint32_t > fedMaskVector_
void extractHistograms(const std::vector< std::string > &)
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
static sistrip::RunType runType(DQMStore *const, const std::vector< std::string > &)
static const char taskId_[]
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
uint32_t init(const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &top_level_dir, const sistrip::Granularity &, const std::map< uint32_t, CommissioningAnalysis * > &data)
tuple key
prepare the HTCondor submission files and eventually submit them
DQMStore *const bei() const
Base utility class that identifies a position within a logical structure of the strip tracker...
Definition: SiStripKey.h:23
const uint32_t & fecKey() const
const std::string & path() const
Definition: SiStripKey.h:121
static uint32_t runNumber(DQMStore *const, const std::vector< std::string > &)
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
Definition: SiStripDetKey.h:28
int extract(std::vector< int > *output, const std::string &dati)
#define debug
Definition: HDRShower.cc:19
auto const good
min quality of good
static std::string presentation(const sistrip::Presentation &)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
const uint16_t & ccuAddr() const
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:73
static const uint16_t invalid_
Definition: Constants.h:16
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:784
virtual void createSummaryHisto(const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &)
static void copyCustomInformation(DQMStore *const, const std::vector< std::string > &)
std::map< uint32_t, CommissioningAnalysis * > Analyses
const uint16_t & ccuChan() const
const uint16_t & fedId() const
Abstract base for derived classes that provide analysis of commissioning histograms.
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
static const char collate_[]
void remove(std::string pattern="")
std::vector< uint32_t > ringVector_
virtual void histoAnalysis(bool debug)