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 //
254  const std::vector<std::string>& contents ) {
255 
256  // Check if histograms present
257  if ( contents.empty() ) {
259  << "[CommissioningHistograms::" << __func__ << "]"
260  << " Found no histograms!";
261  return;
262  }
263 
264  // Iterate through added contents
265  std::vector<std::string>::const_iterator istr = contents.begin();
266  while ( istr != contents.end() ) {
267 
268  // Extract source directory path
269  std::string source_dir = istr->substr( 0, istr->find(":") );
270 
271  // Generate corresponding client path (removing trailing "/")
272  SiStripFecKey path( source_dir );
273  std::string client_dir = path.path();
274  std::string slash = client_dir.substr( client_dir.size()-1, 1 );
275  if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
276 
277  // Iterate though MonitorElements from source directory
278  std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
279  std::vector<MonitorElement*>::iterator ime = me_list.begin();
280  for ( ; ime != me_list.end(); ime++ ) {
281 
282  if ( !(*ime) ) {
284  << "[CommissioningHistograms::" << __func__ << "]"
285  << " NULL pointer to MonitorElement!";
286  continue;
287  }
288  // Search for calchan, isha or vfs
289  if((*ime)->kind()==MonitorElement::DQM_KIND_INT) {
290  std::string title = (*ime)->getName();
291  std::string::size_type pos = title.find("calchan");
292  if( pos == std::string::npos ) pos = title.find("isha");
293  if( pos == std::string::npos ) pos = title.find("vfs");
294  if( pos != std::string::npos ) {
295  int value = (*ime)->getIntValue();
296  if ( value>=0 ) {
298  << "[CommissioningHistograms::" << __func__ << "]"
299  << " Found \"" << title.substr(pos,std::string::npos)
300  << "\" with value \"" << value << "\"";
301  if ( !(bei->get(client_dir+"/"+title.substr(pos,std::string::npos))) ) {
302  bei->setCurrentFolder(client_dir);
303  bei->bookInt( title.substr(pos,std::string::npos))->Fill(value);
305  << "[CommissioningHistograms::" << __func__ << "]"
306  << " Booked \"" << title.substr(pos,std::string::npos)
307  << "\" in directory \"" << client_dir << "\"";
308  }
309  }
310  }
311  }
312  }
313  istr++;
314  }
315 }
316 
317 // -----------------------------------------------------------------------------
318 
320 void CommissioningHistograms::extractHistograms( const std::vector<std::string>& contents ) {
322  << "[CommissioningHistograms::" << __func__ << "]"
323  << " Extracting available histograms...";
324 
325  // Check pointer
326  if ( !bei_ ) {
328  << "[CommissioningHistograms::" << __func__ << "]"
329  << " NULL pointer to DQMStore!";
330  return;
331  }
332 
333  // Check list of histograms
334  if ( contents.empty() ) {
336  << "[CommissioningHistograms::" << __func__ << "]"
337  << " Empty contents vector!";
338  return;
339  }
340 
341  // Iterate through list of histograms
342  std::vector<std::string>::const_iterator idir;
343  for ( idir = contents.begin(); idir != contents.end(); idir++ ) {
344 
345  // Ignore "DQM source" directories if looking in client file
346  if ( idir->find(sistrip::collate_) == std::string::npos ) { continue; }
347 
348  // Extract source directory path
349  std::string source_dir = idir->substr( 0, idir->find(":") );
350 
351  // Extract view and create key
352  sistrip::View view = SiStripEnumsAndStrings::view( source_dir );
354  if ( view == sistrip::CONTROL_VIEW ) { path = SiStripFecKey( source_dir ); }
355  else if ( view == sistrip::READOUT_VIEW ) { path = SiStripFedKey( source_dir ); }
356  else if ( view == sistrip::DETECTOR_VIEW ) { path = SiStripDetKey( source_dir ); }
357  else { path = SiStripKey(); }
358 
359  // Check path is valid
360  if ( path.granularity() == sistrip::UNKNOWN_GRAN ||
361  path.granularity() == sistrip::UNDEFINED_GRAN ) {
362  continue;
363  }
364 
365  // Generate corresponding client path (removing trailing "/")
367  if ( view == sistrip::CONTROL_VIEW ) { client_dir = SiStripFecKey( path.key() ).path(); }
368  else if ( view == sistrip::READOUT_VIEW ) { client_dir = SiStripFedKey( path.key() ).path(); }
369  else if ( view == sistrip::DETECTOR_VIEW ) { client_dir = SiStripDetKey( path.key() ).path(); }
370  else { client_dir = SiStripKey( path.key() ).path(); }
371  std::string slash = client_dir.substr( client_dir.size()-1, 1 );
372  if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
373  client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
374 
375  // Retrieve MonitorElements from source directory
376  std::vector<MonitorElement*> me_list = bei_->getContents( source_dir );
377 
378  // Iterate though MonitorElements and create CMEs
379  std::vector<MonitorElement*>::iterator ime = me_list.begin();
380  for ( ; ime != me_list.end(); ime++ ) {
381 
382  // Retrieve histogram title
383  SiStripHistoTitle title( (*ime)->getName() );
384 
385  // Check histogram type
386  //if ( title.histoType() != sistrip::EXPERT_HISTO ) { continue; }
387 
388  // Check granularity
389  uint16_t channel = sistrip::invalid_;
390  if ( title.granularity() == sistrip::APV ) {
391  channel = SiStripFecKey::lldChan( title.channel() );
392  } else if ( title.granularity() == sistrip::UNKNOWN_GRAN ||
393  title.granularity() == sistrip::UNDEFINED_GRAN ) {
394  std::stringstream ss;
395  ss << "[CommissioningHistograms::" << __func__ << "]"
396  << " Unexpected granularity for histogram title: "
397  << std::endl << title
398  << " found in path "
399  << std::endl << path;
400  edm::LogError(mlDqmClient_) << ss.str();
401  } else {
402  channel = title.channel();
403  }
404 
405  // Build key
406  uint32_t key = sistrip::invalid32_;
407 
408  if ( view == sistrip::CONTROL_VIEW ) {
409 
410  // for all runs except cabling
411  SiStripFecKey temp( path.key() );
412  key = SiStripFecKey( temp.fecCrate(),
413  temp.fecSlot(),
414  temp.fecRing(),
415  temp.ccuAddr(),
416  temp.ccuChan(),
417  channel ).key();
418  mapping_[title.keyValue()] = key;
419 
420  } else if ( view == sistrip::READOUT_VIEW ) {
421 
422  // for cabling run
423  key = SiStripFedKey( path.key() ).key();
429  channel ).key(); // just record lld channel
430  mapping_[title.keyValue()] = temp;
431 
432  } else if ( view == sistrip::DETECTOR_VIEW ) {
433 
434  SiStripDetKey temp( path.key() );
435  key = SiStripDetKey( temp.partition() ).key();
436  mapping_[title.keyValue()] = key;
437 
438  } else { key = SiStripKey( path.key() ).key(); }
439 
440  // Find CME in histos map
441  Histo* histo = nullptr;
442  HistosMap::iterator ihistos = histos_.find( key );
443  if ( ihistos != histos_.end() ) {
444  Histos::iterator ihis = ihistos->second.begin();
445  while ( !histo && ihis < ihistos->second.end() ) {
446  if ( (*ime)->getName() == (*ihis)->title_ ) { histo = *ihis; }
447  ihis++;
448  }
449  }
450 
451  // Create CollateME if it doesn't exist
452  if ( !histo ) {
453 
454  histos_[key].push_back( new Histo() );
455  histo = histos_[key].back();
456  histo->title_ = (*ime)->getName();
457 
458  // If histogram present in client directory, add to map
459  if ( source_dir.find(sistrip::collate_) != std::string::npos ) {
460  histo->me_ = bei_->get( client_dir +"/"+(*ime)->getName() );
461  if ( !histo->me_ ) {
463  << "[CommissioningHistograms::" << __func__ << "]"
464  << " NULL pointer to MonitorElement!";
465  }
466  }
467 
468  }
469 
470  }
471 
472  }
473 
474  //printHistosMap();
475 
477  << "[CommissioningHistograms::" << __func__ << "]"
478  << " Found histograms for " << histos_.size()
479  << " structures in cached histogram map!";
480 
481 }
482 
483 
484 // -----------------------------------------------------------------------------
488  << "[CommissioningHistograms::" << __func__ << "]"
489  << " (Derived) implementation to come...";
490 }
491 
492 // -----------------------------------------------------------------------------
495  Analyses::iterator ianal = data().begin();
496  Analyses::iterator janal = data().end();
497  for ( ; ianal != janal; ++ianal ) {
498  if ( ianal->second ) {
499  std::stringstream ss;
500  ianal->second->print( ss );
501  if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str();
502  } else { edm::LogWarning(mlDqmClient_) << ss.str(); }
503  }
504  }
505 }
506 
507 // -----------------------------------------------------------------------------
510 
511  std::stringstream good;
512  std::stringstream bad;
513 
514  Analyses::iterator ianal = data().begin();
515  Analyses::iterator janal = data().end();
516  for ( ; ianal != janal; ++ianal ) {
517  if ( ianal->second ) {
518  if ( ianal->second->isValid() ) { ianal->second->summary( good ); }
519  else { ianal->second->summary( bad ); }
520  }
521  }
522 
523  if ( good.str().empty() ) { good << "None found!"; }
525  << "[CommissioningHistograms::" << __func__ << "]"
526  << " Printing summary of good analyses:" << "\n"
527  << good.str();
528 
529  if ( bad.str().empty() ) { return; } //@@ bad << "None found!"; }
531  << "[CommissioningHistograms::" << __func__ << "]"
532  << " Printing summary of bad analyses:" << "\n"
533  << bad.str();
534 
535 }
536 
537 // -----------------------------------------------------------------------------
541  << "[CommissioningHistograms::" << __func__ << "]"
542  << " Printing histogram map, which has "
543  << histos_.size() << " entries...";
544  HistosMap::const_iterator ihistos = histos_.begin();
545  for ( ; ihistos != histos_.end(); ihistos++ ) {
546  std::stringstream ss;
547  ss << " Found " << ihistos->second.size()
548  << " histogram(s) for key: " << std::endl
549  << SiStripFedKey(ihistos->first) << std::endl;
550  Histos::const_iterator ihisto = ihistos->second.begin();
551  for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
552  if ( *ihisto ) { (*ihisto)->print(ss); }
553  else { ss << " NULL pointer to Histo object!"; }
554  }
555  LogTrace(mlDqmClient_) << ss.str();
556  }
557 }
558 
559 // -----------------------------------------------------------------------------
563  << "[CommissioningHistograms::" << __func__ << "]"
564  << " Clearing histogram map...";
565  HistosMap::iterator ihistos = histos_.begin();
566  for ( ; ihistos != histos_.end(); ihistos++ ) {
567  Histos::iterator ihisto = ihistos->second.begin();
568  for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
569  if ( *ihisto ) { delete *ihisto; }
570  }
571  ihistos->second.clear();
572  }
573  histos_.clear();
574 }
575 
576 // -----------------------------------------------------------------------------
579  const sistrip::Presentation& pres,
580  const std::string& dir,
581  const sistrip::Granularity& gran ) {
583  << "[CommissioningHistograms::" << __func__ << "]";
584 
585  // Check view
587  if ( view == sistrip::UNKNOWN_VIEW ) { return; }
588 
589  // Analyze histograms
590  if ( data().empty() ) { histoAnalysis( false ); }
591 
592  // Check
593  if ( data().empty() ) {
595  << "[CommissioningHistograms::" << __func__ << "]"
596  << " No analyses generated!";
597  return;
598  }
599 
600  // Extract data to be histogrammed
601  uint32_t xbins = factory()->init( mon, pres, view, dir, gran, data() );
602 
603  // Only create histograms if entries are found!
604  if ( !xbins ) { return; }
605 
606  // Create summary histogram (if it doesn't already exist)
607  TH1* summary = nullptr;
608  if ( pres != sistrip::HISTO_1D ) { summary = histogram( mon, pres, view, dir, xbins ); }
609  else { summary = histogram( mon, pres, view, dir, sistrip::FED_ADC_RANGE, 0., sistrip::FED_ADC_RANGE*1. ); }
610 
611  // Fill histogram with data
612  factory()->fill( *summary );
613 
614 }
615 
616 // -----------------------------------------------------------------------------
619 
620  if ( !bei_ ) {
622  << "[CommissioningHistograms::" << __func__ << "]"
623  << " NULL pointer to DQMStore!";
624  return;
625  }
626 
627  bei_->setVerbose(0);
628 
630  << "[CommissioningHistograms::" << __func__ << "]"
631  << " Removing histograms...";
632 
633  if ( !pattern.empty() ) {
634 
635  if ( bei_->dirExists(pattern) ) {
636  bei_->rmdir(pattern);
637  }
638 
640  << "[CommissioningHistograms::" << __func__ << "]"
641  << " Removing directories (and MonitorElements"
642  << " therein) that match the pattern \""
643  << pattern << "\"";
644 
645  } else {
646 
647  bei_->cd();
648  bei_->removeContents();
649 
650  if( bei_->dirExists("Collector") ) {
651  bei_->rmdir("Collector");
652  }
653  if( bei_->dirExists("EvF") ) {
654  bei_->rmdir("EvF");
655  }
656  if( bei_->dirExists("SiStrip") ) {
657  bei_->rmdir("SiStrip");
658  }
659 
661  << "[CommissioningHistograms::" << __func__ << "]"
662  << " Removing \"DQM source\" directories (and MonitorElements therein)";
663 
664  }
665 
667  << "[CommissioningHistograms::" << __func__ << "]"
668  << " Removed histograms!";
669 
670  bei_->setVerbose(1);
671 
672 }
673 
674 // -----------------------------------------------------------------------------
677  uint32_t run_number,
678  std::string partitionName) {
679 
680  // Construct path and filename
681  std::stringstream ss;
682 
683  if ( !path.empty() ) {
684 
685  ss << path;
686  if ( ss.str().find(".root") == std::string::npos ) { ss << ".root"; }
687 
688  } else {
689 
690  // Retrieve SCRATCH directory
691  std::string scratch = "SCRATCH";
692  std::string dir = "";
693  if ( getenv(scratch.c_str()) != nullptr ) {
694  dir = getenv(scratch.c_str());
695  }
696 
697  // Add directory path
698  if ( !dir.empty() ) { ss << dir << "/"; }
699  else { ss << "/tmp/"; }
700 
701  // Add filename with run number and ".root" extension
702  if(partitionName.empty())
703  ss << sistrip::dqmClientFileName_ << "_"
704  << std::setfill('0') << std::setw(8) << run_number
705  << ".root";
706  else
707  ss << sistrip::dqmClientFileName_ << "_" << partitionName << "_"
708  << std::setfill('0') << std::setw(8) << run_number
709  << ".root";
710 
711  }
712 
713  // Save file with appropriate filename
715  << "[CommissioningHistograms::" << __func__ << "]"
716  << " Saving histograms to root file"
717  << " (This may take some time!)";
718  path = ss.str();
719  bei_->save( path, sistrip::collate_ );
721  << "[CommissioningHistograms::" << __func__ << "]"
722  << " Saved histograms to root file \""
723  << ss.str() << "\"!";
724 
725 }
726 
727 // -----------------------------------------------------------------------------
728 //
730  const sistrip::Presentation& pres,
731  const sistrip::View& view,
732  const std::string& directory,
733  const uint32_t& xbins,
734  const float& xlow,
735  const float& xhigh ) {
736 
737  // Remember pwd
738  std::string pwd = bei_->pwd();
739  bei_->setCurrentFolder( std::string(sistrip::collate_) + sistrip::dir_ + directory );
740 
741  // Construct histogram name
742  std::string name = SummaryGenerator::name( task_, mon, pres, view, directory );
743 
744  // Check if summary plot already exists and remove
745  MonitorElement* me = bei_->get( bei_->pwd() + "/" + name );
746  if ( me ) {
747  bei_->removeElement( name );
748  me = nullptr;
749  }
750 
751  // Create summary plot
752  float high = static_cast<float>( xbins );
753  if ( pres == sistrip::HISTO_1D ) {
754  if ( xlow < 1. * sistrip::valid_ &&
755  xhigh < 1. * sistrip::valid_ ) {
756  me = bei_->book1D( name, name, xbins, xlow, xhigh );
757  } else {
758  me = bei_->book1D( name, name, xbins, 0., high );
759  }
760  } else if ( pres == sistrip::HISTO_2D_SUM ) {
761  me = bei_->book1D( name, name,
762  xbins, 0., high );
763  } else if ( pres == sistrip::HISTO_2D_SCATTER ) {
764  me = bei_->book2D( name, name, xbins, 0., high,
766  0.,
768  } else if ( pres == sistrip::PROFILE_1D ) {
769  me = bei_->bookProfile( name, name, xbins, 0., high,
771  0.,
773  } else {
774  me = nullptr;
776  << "[CommissioningHistograms::" << __func__ << "]"
777  << " Unexpected presentation \""
779  << "\" Unable to create summary plot!";
780  }
781 
782  // Check pointer
783  if ( me ) {
785  << "[CommissioningHistograms::" << __func__ << "]"
786  << " Created summary plot with name \"" << me->getName()
787  << "\" in directory \""
788  << bei_->pwd() << "\"!";
789  } else {
791  << "[CommissioningHistograms::" << __func__ << "]"
792  << " NULL pointer to MonitorElement!"
793  << " Unable to create summary plot!";
794  }
795 
796  // Extract root object
797  TH1* summary = ExtractTObject<TH1>().extract( me );
798  if ( !summary ) {
800  << "[CommissioningHistograms::" << __func__ << "]"
801  << " Unable to extract root object!"
802  << " Returning NULL pointer!";
803  }
804 
805  // Return to pwd
806  bei_->setCurrentFolder( pwd );
807 
808  return summary;
809 
810 }
811 
813  if (!getMaskedData) return data_;
814  else {
816  else {
817  Analyses::iterator ianal = data_.begin();
818  Analyses::iterator janal = data_.end();
819  for ( ; ianal != janal; ++ianal ) {
820  CommissioningAnalysis* anal = ianal->second;
821  SiStripFedKey fedkey = anal->fedKey();
822  SiStripFecKey feckey = anal->fecKey();
823  bool maskThisAnal_ = false;
824  for (std::size_t i = 0; i < fedMaskVector_.size(); i++) {
825  if (fedkey.fedId() == fedMaskVector_[i]) maskThisAnal_ = true;
826  }
827  for (std::size_t i = 0; i < fecMaskVector_.size(); i++) {
828  if (fecMaskVector_.size() != ringVector_.size() || fecMaskVector_.size() != ccuVector_.size() || fecMaskVector_.size() != i2cChanVector_.size() || fecMaskVector_.size() != lldChanVector_.size()) {
829  continue;
830  }
831  if (feckey.fecSlot() == fecMaskVector_[i] &&
832  feckey.fecRing() == ringVector_[i] &&
833  feckey.ccuAddr() == ccuVector_[i] &&
834  feckey.ccuChan() == i2cChanVector_[i] &&
835  feckey.lldChan() == lldChanVector_[i]) {
836  maskThisAnal_ = true;
837  }
838  }
839  if (mask_ && !maskThisAnal_) dataWithMask_[ianal->first] = ianal->second;
840  else if (!mask_ && maskThisAnal_) dataWithMask_[ianal->first] = ianal->second;
841  }
842  dataWithMaskCached_ = true;
843  return dataWithMask_;
844  }
845  }
846 }
847 
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_[]
#define nullptr
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
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 &)
std::unique_ptr< Factory > factory_
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:16
std::map< uint32_t, CommissioningAnalysis * > Analyses
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)