CMS 3D CMS Logo

CommissioningHistograms.cc
Go to the documentation of this file.
9 #include <iomanip>
10 
11 using namespace std;
12 using namespace sistrip;
13 
14 
15 // -----------------------------------------------------------------------------
18  DQMStore* bei,
19  const sistrip::RunType& task )
20  : factory_(nullptr),
21  task_(task),
22  bei_(bei),
23  data_(),
24  histos_(),
25  pset_(pset),
26  mask_(pset.existsAs<bool>("vetoModules")?pset.getParameter<bool>("vetoModules"):true),
27  fedMaskVector_(pset.existsAs<std::vector<uint32_t> >("fedMaskVector")?pset.getParameter<std::vector<uint32_t> >("fedMaskVector"):std::vector<uint32_t>()),
28  fecMaskVector_(pset.existsAs<std::vector<uint32_t> >("fecMaskVector")?pset.getParameter<std::vector<uint32_t> >("fecMaskVector"):std::vector<uint32_t>()),
29  ringVector_(pset.existsAs<std::vector<uint32_t> >("ringVector")?pset.getParameter<std::vector<uint32_t> >("ringVector"):std::vector<uint32_t>()),
30  ccuVector_(pset.existsAs<std::vector<uint32_t> >("ccuVector")?pset.getParameter<std::vector<uint32_t> >("ccuVector"):std::vector<uint32_t>()),
31  i2cChanVector_(pset.existsAs<std::vector<uint32_t> >("i2cChanVector")?pset.getParameter<std::vector<uint32_t> >("i2cChanVector"):std::vector<uint32_t>()),
32  lldChanVector_(pset.existsAs<std::vector<uint32_t> >("lldChanVector")?pset.getParameter<std::vector<uint32_t> >("lldChanVector"):std::vector<uint32_t>()),
33  dataWithMask_(),
34  dataWithMaskCached_(false)
35 {
37  << "[" << __PRETTY_FUNCTION__ << "]"
38  << " Constructing object...";
39 
40  // DQMStore
41  if ( !bei_ ) {
43  << "[CommissioningHistograms::" << __func__ << "]"
44  << " NULL pointer to DQMStore!";
45  }
46 
48 }
49 
50 // -----------------------------------------------------------------------------
53  : factory_(nullptr),
55  bei_(nullptr),
56  data_(),
57  histos_(),
58  mask_(true),
59  dataWithMask_(),
61 
63  << "[" << __PRETTY_FUNCTION__ << "]"
64  << " Constructing object...";
65 }
66 
67 // -----------------------------------------------------------------------------
71  << "[" << __PRETTY_FUNCTION__ << "]"
72  << " Destructing object...";
74  //@@ do not delete BEI ptrs!
75 }
76 
77 // -----------------------------------------------------------------------------
79 void CommissioningHistograms::Histo::print( std::stringstream& ss ) const {
80  ss << " [Histo::" << __func__ << "]" << std::endl
81  << " Histogram title : " << title_ << std::endl
82  << " MonitorElement* : 0x"
83  << std::hex
84  << std::setw(8) << std::setfill('0') << me_ << std::endl
85  << std::dec
86  << " CollateME* : 0x"
87  << std::hex
88  << std::setw(8) << std::setfill('0') << cme_ << std::endl
89  << std::dec;
90 }
91 
92 // -----------------------------------------------------------------------------
93 //
95  const std::vector<std::string>& contents ) {
96 
97  // Check if histograms present
98  if ( contents.empty() ) {
100  << "[CommissioningHistograms::" << __func__ << "]"
101  << " Found no histograms!";
102  return 0;
103  }
104 
105  // Iterate through added contents
106  std::vector<std::string>::const_iterator istr = contents.begin();
107  while ( istr != contents.end() ) {
108 
109  // Extract source directory path
110  std::string source_dir = istr->substr( 0, istr->find(":") );
111 
112  // Generate corresponding client path (removing trailing "/")
113  SiStripFecKey path( source_dir );
114  std::string client_dir = path.path();
115  std::string slash = client_dir.substr( client_dir.size()-1, 1 );
116  if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
117  client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
118 
119  // Iterate though MonitorElements from source directory
120  std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
121  std::vector<MonitorElement*>::iterator ime = me_list.begin();
122  for ( ; ime != me_list.end(); ime++ ) {
123 
124  if ( !(*ime) ) {
126  << "[CommissioningHistograms::" << __func__ << "]"
127  << " NULL pointer to MonitorElement!";
128  continue;
129  }
130 
131  // Search for run type in string
132  std::string title = (*ime)->getName();
134 
135  // Extract run number from string
136  if ( pos != std::string::npos ) {
137  std::string value = title.substr( pos+sizeof(sistrip::runNumber_) , std::string::npos );
138  if ( !value.empty() ) {
140  << "[CommissioningHistograms::" << __func__ << "]"
141  << " Found string \"" << title.substr(pos,std::string::npos)
142  << "\" with value \"" << value << "\"";
143  if ( !(bei->get(client_dir+"/"+title.substr(pos,std::string::npos))) ) {
144  bei->setCurrentFolder(client_dir);
145  bei->bookString( title.substr(pos,std::string::npos), value );
147  << "[CommissioningHistograms::" << __func__ << "]"
148  << " Booked string \"" << title.substr(pos,std::string::npos)
149  << "\" in directory \"" << client_dir << "\"";
150  }
151  uint32_t run;
152  std::stringstream ss;
153  ss << value;
154  ss >> std::dec >> run;
155  return run;
156  }
157  }
158 
159  }
160 
161  istr++;
162 
163  }
164  return 0;
165 }
166 
167 // -----------------------------------------------------------------------------
170  const std::vector<std::string>& contents ) {
171 
172  // Check if histograms present
173  if ( contents.empty() ) {
175  << "[CommissioningHistograms::" << __func__ << "]"
176  << " Found no histograms!";
178  }
179 
180  // Iterate through added contents
181  std::vector<std::string>::const_iterator istr = contents.begin();
182  while ( istr != contents.end() ) {
183 
184  // Extract source directory path
185  std::string source_dir = istr->substr( 0, istr->find(":") );
186 
187  // Generate corresponding client path (removing trailing "/")
188  SiStripFecKey path( source_dir );
189  std::string client_dir = path.path();
190  std::string slash = client_dir.substr( client_dir.size()-1, 1 );
191  if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
192  client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
193 
194  // Iterate though MonitorElements from source directory
195  std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
196 
197  if ( me_list.empty() ) {
199  << "[CommissioningHistograms::" << __func__ << "]"
200  << " No MonitorElements found in dir " << source_dir;
202  }
203 
204  std::vector<MonitorElement*>::iterator ime = me_list.begin();
205  for ( ; ime != me_list.end(); ime++ ) {
206 
207  if ( !(*ime) ) {
209  << "[CommissioningHistograms::" << __func__ << "]"
210  << " NULL pointer to MonitorElement!";
211  continue;
212  }
213 
214  // Search for run type in string
215  std::string title = (*ime)->getName();
217 
218  // Extract commissioning task from string
219  if ( pos != std::string::npos ) {
220  std::string value = title.substr( pos+sizeof(sistrip::taskId_) , std::string::npos );
221  if ( !value.empty() ) {
223  << "[CommissioningHistograms::" << __func__ << "]"
224  << " Found string \"" << title.substr(pos,std::string::npos)
225  << "\" with value \"" << value << "\"";
226  if ( !(bei->get(client_dir+sistrip::dir_+title.substr(pos,std::string::npos))) ) {
227  bei->setCurrentFolder(client_dir);
228  bei->bookString( title.substr(pos,std::string::npos), value );
230  << "[CommissioningHistograms::" << __func__ << "]"
231  << " Booked string \"" << title.substr(pos,std::string::npos)
232  << "\" in directory \"" << client_dir << "\"";
233  }
234  return SiStripEnumsAndStrings::runType( value );
235  }
236  }
237 
238  }
239 
240  istr++;
241 
242  }
243 
245  << "[CommissioningHistograms::" << __func__ << "]"
246  << " Unable to extract RunType!";
248 
249 }
250 
251 // -----------------------------------------------------------------------------
252 // Temporary fix: builds a list of histogram directories
254  std::vector<std::string>& contents ) {
255 }
256 
257 // -----------------------------------------------------------------------------
258 //
260  const std::vector<std::string>& contents ) {
261 
262  // Check if histograms present
263  if ( contents.empty() ) {
265  << "[CommissioningHistograms::" << __func__ << "]"
266  << " Found no histograms!";
267  return;
268  }
269 
270  // Iterate through added contents
271  std::vector<std::string>::const_iterator istr = contents.begin();
272  while ( istr != contents.end() ) {
273 
274  // Extract source directory path
275  std::string source_dir = istr->substr( 0, istr->find(":") );
276 
277  // Generate corresponding client path (removing trailing "/")
278  SiStripFecKey path( source_dir );
279  std::string client_dir = path.path();
280  std::string slash = client_dir.substr( client_dir.size()-1, 1 );
281  if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
282 
283  // Iterate though MonitorElements from source directory
284  std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
285  std::vector<MonitorElement*>::iterator ime = me_list.begin();
286  for ( ; ime != me_list.end(); ime++ ) {
287 
288  if ( !(*ime) ) {
290  << "[CommissioningHistograms::" << __func__ << "]"
291  << " NULL pointer to MonitorElement!";
292  continue;
293  }
294  // Search for calchan, isha or vfs
295  if((*ime)->kind()==MonitorElement::DQM_KIND_INT) {
296  std::string title = (*ime)->getName();
297  std::string::size_type pos = title.find("calchan");
298  if( pos == std::string::npos ) pos = title.find("isha");
299  if( pos == std::string::npos ) pos = title.find("vfs");
300  if( pos != std::string::npos ) {
301  int value = (*ime)->getIntValue();
302  if ( value>=0 ) {
304  << "[CommissioningHistograms::" << __func__ << "]"
305  << " Found \"" << title.substr(pos,std::string::npos)
306  << "\" with value \"" << value << "\"";
307  if ( !(bei->get(client_dir+"/"+title.substr(pos,std::string::npos))) ) {
308  bei->setCurrentFolder(client_dir);
309  bei->bookInt( title.substr(pos,std::string::npos))->Fill(value);
311  << "[CommissioningHistograms::" << __func__ << "]"
312  << " Booked \"" << title.substr(pos,std::string::npos)
313  << "\" in directory \"" << client_dir << "\"";
314  }
315  }
316  }
317  }
318  }
319  istr++;
320  }
321 }
322 
323 // -----------------------------------------------------------------------------
324 
326 void CommissioningHistograms::extractHistograms( const std::vector<std::string>& contents ) {
328  << "[CommissioningHistograms::" << __func__ << "]"
329  << " Extracting available histograms...";
330 
331  // Check pointer
332  if ( !bei_ ) {
334  << "[CommissioningHistograms::" << __func__ << "]"
335  << " NULL pointer to DQMStore!";
336  return;
337  }
338 
339  // Check list of histograms
340  if ( contents.empty() ) {
342  << "[CommissioningHistograms::" << __func__ << "]"
343  << " Empty contents vector!";
344  return;
345  }
346 
347  // Iterate through list of histograms
348  std::vector<std::string>::const_iterator idir;
349  for ( idir = contents.begin(); idir != contents.end(); idir++ ) {
350 
351  // Ignore "DQM source" directories if looking in client file
352  if ( idir->find(sistrip::collate_) == std::string::npos ) { continue; }
353 
354  // Extract source directory path
355  std::string source_dir = idir->substr( 0, idir->find(":") );
356 
357  // Extract view and create key
358  sistrip::View view = SiStripEnumsAndStrings::view( source_dir );
360  if ( view == sistrip::CONTROL_VIEW ) { path = SiStripFecKey( source_dir ); }
361  else if ( view == sistrip::READOUT_VIEW ) { path = SiStripFedKey( source_dir ); }
362  else if ( view == sistrip::DETECTOR_VIEW ) { path = SiStripDetKey( source_dir ); }
363  else { path = SiStripKey(); }
364 
365  // Check path is valid
366  if ( path.granularity() == sistrip::UNKNOWN_GRAN ||
367  path.granularity() == sistrip::UNDEFINED_GRAN ) {
368  continue;
369  }
370 
371  // Generate corresponding client path (removing trailing "/")
373  if ( view == sistrip::CONTROL_VIEW ) { client_dir = SiStripFecKey( path.key() ).path(); }
374  else if ( view == sistrip::READOUT_VIEW ) { client_dir = SiStripFedKey( path.key() ).path(); }
375  else if ( view == sistrip::DETECTOR_VIEW ) { client_dir = SiStripDetKey( path.key() ).path(); }
376  else { client_dir = SiStripKey( path.key() ).path(); }
377  std::string slash = client_dir.substr( client_dir.size()-1, 1 );
378  if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
379  client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
380 
381  // Retrieve MonitorElements from source directory
382  std::vector<MonitorElement*> me_list = bei_->getContents( source_dir );
383 
384  // Iterate though MonitorElements and create CMEs
385  std::vector<MonitorElement*>::iterator ime = me_list.begin();
386  for ( ; ime != me_list.end(); ime++ ) {
387 
388  // Retrieve histogram title
389  SiStripHistoTitle title( (*ime)->getName() );
390 
391  // Check histogram type
392  //if ( title.histoType() != sistrip::EXPERT_HISTO ) { continue; }
393 
394  // Check granularity
395  uint16_t channel = sistrip::invalid_;
396  if ( title.granularity() == sistrip::APV ) {
397  channel = SiStripFecKey::lldChan( title.channel() );
398  } else if ( title.granularity() == sistrip::UNKNOWN_GRAN ||
399  title.granularity() == sistrip::UNDEFINED_GRAN ) {
400  std::stringstream ss;
401  ss << "[CommissioningHistograms::" << __func__ << "]"
402  << " Unexpected granularity for histogram title: "
403  << std::endl << title
404  << " found in path "
405  << std::endl << path;
406  edm::LogError(mlDqmClient_) << ss.str();
407  } else {
408  channel = title.channel();
409  }
410 
411  // Build key
412  uint32_t key = sistrip::invalid32_;
413 
414  if ( view == sistrip::CONTROL_VIEW ) {
415 
416  // for all runs except cabling
417  SiStripFecKey temp( path.key() );
418  key = SiStripFecKey( temp.fecCrate(),
419  temp.fecSlot(),
420  temp.fecRing(),
421  temp.ccuAddr(),
422  temp.ccuChan(),
423  channel ).key();
424  mapping_[title.keyValue()] = key;
425 
426  } else if ( view == sistrip::READOUT_VIEW ) {
427 
428  // for cabling run
429  key = SiStripFedKey( path.key() ).key();
435  channel ).key(); // just record lld channel
436  mapping_[title.keyValue()] = temp;
437 
438  } else if ( view == sistrip::DETECTOR_VIEW ) {
439 
440  SiStripDetKey temp( path.key() );
441  key = SiStripDetKey( temp.partition() ).key();
442  mapping_[title.keyValue()] = key;
443 
444  } else { key = SiStripKey( path.key() ).key(); }
445 
446  // Find CME in histos map
447  Histo* histo = nullptr;
448  HistosMap::iterator ihistos = histos_.find( key );
449  if ( ihistos != histos_.end() ) {
450  Histos::iterator ihis = ihistos->second.begin();
451  while ( !histo && ihis < ihistos->second.end() ) {
452  if ( (*ime)->getName() == (*ihis)->title_ ) { histo = *ihis; }
453  ihis++;
454  }
455  }
456 
457  // Create CollateME if it doesn't exist
458  if ( !histo ) {
459 
460  histos_[key].push_back( new Histo() );
461  histo = histos_[key].back();
462  histo->title_ = (*ime)->getName();
463 
464  // If histogram present in client directory, add to map
465  if ( source_dir.find(sistrip::collate_) != std::string::npos ) {
466  histo->me_ = bei_->get( client_dir +"/"+(*ime)->getName() );
467  if ( !histo->me_ ) {
469  << "[CommissioningHistograms::" << __func__ << "]"
470  << " NULL pointer to MonitorElement!";
471  }
472  }
473 
474  }
475 
476  }
477 
478  }
479 
480  //printHistosMap();
481 
483  << "[CommissioningHistograms::" << __func__ << "]"
484  << " Found histograms for " << histos_.size()
485  << " structures in cached histogram map!";
486 
487 }
488 
489 
490 // -----------------------------------------------------------------------------
494  << "[CommissioningHistograms::" << __func__ << "]"
495  << " (Derived) implementation to come...";
496 }
497 
498 // -----------------------------------------------------------------------------
501  Analyses::iterator ianal = data().begin();
502  Analyses::iterator janal = data().end();
503  for ( ; ianal != janal; ++ianal ) {
504  if ( ianal->second ) {
505  std::stringstream ss;
506  ianal->second->print( ss );
507  if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str();
508  } else { edm::LogWarning(mlDqmClient_) << ss.str(); }
509  }
510  }
511 }
512 
513 // -----------------------------------------------------------------------------
516 
517  std::stringstream good;
518  std::stringstream bad;
519 
520  Analyses::iterator ianal = data().begin();
521  Analyses::iterator janal = data().end();
522  for ( ; ianal != janal; ++ianal ) {
523  if ( ianal->second ) {
524  if ( ianal->second->isValid() ) { ianal->second->summary( good ); }
525  else { ianal->second->summary( bad ); }
526  }
527  }
528 
529  if ( good.str().empty() ) { good << "None found!"; }
531  << "[CommissioningHistograms::" << __func__ << "]"
532  << " Printing summary of good analyses:" << "\n"
533  << good.str();
534 
535  if ( bad.str().empty() ) { return; } //@@ bad << "None found!"; }
537  << "[CommissioningHistograms::" << __func__ << "]"
538  << " Printing summary of bad analyses:" << "\n"
539  << bad.str();
540 
541 }
542 
543 // -----------------------------------------------------------------------------
547  << "[CommissioningHistograms::" << __func__ << "]"
548  << " Printing histogram map, which has "
549  << histos_.size() << " entries...";
550  HistosMap::const_iterator ihistos = histos_.begin();
551  for ( ; ihistos != histos_.end(); ihistos++ ) {
552  std::stringstream ss;
553  ss << " Found " << ihistos->second.size()
554  << " histogram(s) for key: " << std::endl
555  << SiStripFedKey(ihistos->first) << std::endl;
556  Histos::const_iterator ihisto = ihistos->second.begin();
557  for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
558  if ( *ihisto ) { (*ihisto)->print(ss); }
559  else { ss << " NULL pointer to Histo object!"; }
560  }
561  LogTrace(mlDqmClient_) << ss.str();
562  }
563 }
564 
565 // -----------------------------------------------------------------------------
569  << "[CommissioningHistograms::" << __func__ << "]"
570  << " Clearing histogram map...";
571  HistosMap::iterator ihistos = histos_.begin();
572  for ( ; ihistos != histos_.end(); ihistos++ ) {
573  Histos::iterator ihisto = ihistos->second.begin();
574  for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
575  if ( *ihisto ) { delete *ihisto; }
576  }
577  ihistos->second.clear();
578  }
579  histos_.clear();
580 }
581 
582 // -----------------------------------------------------------------------------
585  const sistrip::Presentation& pres,
586  const std::string& dir,
587  const sistrip::Granularity& gran ) {
589  << "[CommissioningHistograms::" << __func__ << "]";
590 
591  // Check view
593  if ( view == sistrip::UNKNOWN_VIEW ) { return; }
594 
595  // Analyze histograms
596  if ( data().empty() ) { histoAnalysis( false ); }
597 
598  // Check
599  if ( data().empty() ) {
601  << "[CommissioningHistograms::" << __func__ << "]"
602  << " No analyses generated!";
603  return;
604  }
605 
606  // Extract data to be histogrammed
607  uint32_t xbins = factory()->init( mon, pres, view, dir, gran, data() );
608 
609  // Only create histograms if entries are found!
610  if ( !xbins ) { return; }
611 
612  // Create summary histogram (if it doesn't already exist)
613  TH1* summary = nullptr;
614  if ( pres != sistrip::HISTO_1D ) { summary = histogram( mon, pres, view, dir, xbins ); }
615  else { summary = histogram( mon, pres, view, dir, sistrip::FED_ADC_RANGE, 0., sistrip::FED_ADC_RANGE*1. ); }
616 
617  // Fill histogram with data
618  factory()->fill( *summary );
619 
620 }
621 
622 // -----------------------------------------------------------------------------
625 
626  if ( !bei_ ) {
628  << "[CommissioningHistograms::" << __func__ << "]"
629  << " NULL pointer to DQMStore!";
630  return;
631  }
632 
633  bei_->setVerbose(0);
634 
636  << "[CommissioningHistograms::" << __func__ << "]"
637  << " Removing histograms...";
638 
639  if ( !pattern.empty() ) {
640 
641  if ( bei_->dirExists(pattern) ) {
642  bei_->rmdir(pattern);
643  }
644 
646  << "[CommissioningHistograms::" << __func__ << "]"
647  << " Removing directories (and MonitorElements"
648  << " therein) that match the pattern \""
649  << pattern << "\"";
650 
651  } else {
652 
653  bei_->cd();
654  bei_->removeContents();
655 
656  if( bei_->dirExists("Collector") ) {
657  bei_->rmdir("Collector");
658  }
659  if( bei_->dirExists("EvF") ) {
660  bei_->rmdir("EvF");
661  }
662  if( bei_->dirExists("SiStrip") ) {
663  bei_->rmdir("SiStrip");
664  }
665 
667  << "[CommissioningHistograms::" << __func__ << "]"
668  << " Removing \"DQM source\" directories (and MonitorElements therein)";
669 
670  }
671 
673  << "[CommissioningHistograms::" << __func__ << "]"
674  << " Removed histograms!";
675 
676  bei_->setVerbose(1);
677 
678 }
679 
680 // -----------------------------------------------------------------------------
683  uint32_t run_number,
684  std::string partitionName) {
685 
686  // Construct path and filename
687  std::stringstream ss;
688 
689  if ( !path.empty() ) {
690 
691  ss << path;
692  if ( ss.str().find(".root") == std::string::npos ) { ss << ".root"; }
693 
694  } else {
695 
696  // Retrieve SCRATCH directory
697  std::string scratch = "SCRATCH";
698  std::string dir = "";
699  if ( getenv(scratch.c_str()) != nullptr ) {
700  dir = getenv(scratch.c_str());
701  }
702 
703  // Add directory path
704  if ( !dir.empty() ) { ss << dir << "/"; }
705  else { ss << "/tmp/"; }
706 
707  // Add filename with run number and ".root" extension
708  if(partitionName.empty())
709  ss << sistrip::dqmClientFileName_ << "_"
710  << std::setfill('0') << std::setw(8) << run_number
711  << ".root";
712  else
713  ss << sistrip::dqmClientFileName_ << "_" << partitionName << "_"
714  << std::setfill('0') << std::setw(8) << run_number
715  << ".root";
716 
717  }
718 
719  // Save file with appropriate filename
721  << "[CommissioningHistograms::" << __func__ << "]"
722  << " Saving histograms to root file"
723  << " (This may take some time!)";
724  path = ss.str();
725  bei_->save( path, sistrip::collate_ );
727  << "[CommissioningHistograms::" << __func__ << "]"
728  << " Saved histograms to root file \""
729  << ss.str() << "\"!";
730 
731 }
732 
733 // -----------------------------------------------------------------------------
734 //
736  const sistrip::Presentation& pres,
737  const sistrip::View& view,
738  const std::string& directory,
739  const uint32_t& xbins,
740  const float& xlow,
741  const float& xhigh ) {
742 
743  // Remember pwd
744  std::string pwd = bei_->pwd();
745  bei_->setCurrentFolder( std::string(sistrip::collate_) + sistrip::dir_ + directory );
746 
747  // Construct histogram name
748  std::string name = SummaryGenerator::name( task_, mon, pres, view, directory );
749 
750  // Check if summary plot already exists and remove
751  MonitorElement* me = bei_->get( bei_->pwd() + "/" + name );
752  if ( me ) {
753  bei_->removeElement( name );
754  me = nullptr;
755  }
756 
757  // Create summary plot
758  float high = static_cast<float>( xbins );
759  if ( pres == sistrip::HISTO_1D ) {
760  if ( xlow < 1. * sistrip::valid_ &&
761  xhigh < 1. * sistrip::valid_ ) {
762  me = bei_->book1D( name, name, xbins, xlow, xhigh );
763  } else {
764  me = bei_->book1D( name, name, xbins, 0., high );
765  }
766  } else if ( pres == sistrip::HISTO_2D_SUM ) {
767  me = bei_->book1D( name, name,
768  xbins, 0., high );
769  } else if ( pres == sistrip::HISTO_2D_SCATTER ) {
770  me = bei_->book2D( name, name, xbins, 0., high,
772  0.,
774  } else if ( pres == sistrip::PROFILE_1D ) {
775  me = bei_->bookProfile( name, name, xbins, 0., high,
777  0.,
779  } else {
780  me = nullptr;
782  << "[CommissioningHistograms::" << __func__ << "]"
783  << " Unexpected presentation \""
785  << "\" Unable to create summary plot!";
786  }
787 
788  // Check pointer
789  if ( me ) {
791  << "[CommissioningHistograms::" << __func__ << "]"
792  << " Created summary plot with name \"" << me->getName()
793  << "\" in directory \""
794  << bei_->pwd() << "\"!";
795  } else {
797  << "[CommissioningHistograms::" << __func__ << "]"
798  << " NULL pointer to MonitorElement!"
799  << " Unable to create summary plot!";
800  }
801 
802  // Extract root object
803  TH1* summary = ExtractTObject<TH1>().extract( me );
804  if ( !summary ) {
806  << "[CommissioningHistograms::" << __func__ << "]"
807  << " Unable to extract root object!"
808  << " Returning NULL pointer!";
809  }
810 
811  // Return to pwd
812  bei_->setCurrentFolder( pwd );
813 
814  return summary;
815 
816 }
817 
819  if (!getMaskedData) return data_;
820  else {
822  else {
823  Analyses::iterator ianal = data_.begin();
824  Analyses::iterator janal = data_.end();
825  for ( ; ianal != janal; ++ianal ) {
826  CommissioningAnalysis* anal = ianal->second;
827  SiStripFedKey fedkey = anal->fedKey();
828  SiStripFecKey feckey = anal->fecKey();
829  bool maskThisAnal_ = false;
830  for (std::size_t i = 0; i < fedMaskVector_.size(); i++) {
831  if (fedkey.fedId() == fedMaskVector_[i]) maskThisAnal_ = true;
832  }
833  for (std::size_t i = 0; i < fecMaskVector_.size(); i++) {
834  if (fecMaskVector_.size() != ringVector_.size() || fecMaskVector_.size() != ccuVector_.size() || fecMaskVector_.size() != i2cChanVector_.size() || fecMaskVector_.size() != lldChanVector_.size()) {
835  continue;
836  }
837  if (feckey.fecSlot() == fecMaskVector_[i] &&
838  feckey.fecRing() == ringVector_[i] &&
839  feckey.ccuAddr() == ccuVector_[i] &&
840  feckey.ccuChan() == i2cChanVector_[i] &&
841  feckey.lldChan() == lldChanVector_[i]) {
842  maskThisAnal_ = true;
843  }
844  }
845  if (mask_ && !maskThisAnal_) dataWithMask_[ianal->first] = ianal->second;
846  else if (!mask_ && maskThisAnal_) dataWithMask_[ianal->first] = ianal->second;
847  }
848  dataWithMaskCached_ = true;
849  return dataWithMask_;
850  }
851  }
852 }
853 
static std::string name(const sistrip::RunType &, const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory)
static const char runNumber_[]
void save(std::string &filename, uint32_t run_number=0, std::string partitionName="")
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
std::vector< uint32_t > fecMaskVector_
static const char dqmClientFileName_[]
static void getContents(DQMStore *const, std::vector< std::string > &)
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
const uint16_t & fecSlot() const
static const uint16_t valid_
Definition: Constants.h:17
#define nullptr
void print(std::stringstream &ss) const override
uint16_t size_type
sistrip classes
const uint32_t & key() const
Definition: SiStripKey.h:125
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:127
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 > &)
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_[]
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)
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:126
static uint32_t runNumber(DQMStore *const, const std::vector< std::string > &)
Definition: value.py:1
#define LogTrace(id)
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
static std::string presentation(const sistrip::Presentation &)
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:16
std::map< uint32_t, CommissioningAnalysis * > Analyses
std::auto_ptr< Factory > factory_
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 > &)
const uint16_t & ccuChan() const
DQMStore *const bei() const
const uint16_t & fedId() const
Abstract base for derived classes that provide analysis of commissioning histograms.
dbl *** dir
Definition: mlp_gen.cc:35
static const char collate_[]
void remove(std::string pattern="")
std::vector< uint32_t > ringVector_
virtual void histoAnalysis(bool debug)