CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
CommissioningHistograms Class Reference

#include <CommissioningHistograms.h>

Inheritance diagram for CommissioningHistograms:
ApvTimingHistograms CalibrationHistograms CommissioningHistosUsingDb DaqScopeModeHistograms FastFedCablingHistograms FedCablingHistograms FedTimingHistograms NoiseHistograms OptoScanHistograms PedestalsHistograms PedsFullNoiseHistograms PedsOnlyHistograms SamplingHistograms VpspScanHistograms

Classes

class  Histo
 

Public Types

typedef std::map< uint32_t,
CommissioningAnalysis * > 
Analyses
 
typedef Analyses::iterator Analysis
 
typedef SummaryPlotFactory
< CommissioningAnalysis * > 
Factory
 
typedef std::map< uint32_t,
uint32_t > 
FedToFecMap
 
typedef std::vector< Histo * > Histos
 
typedef std::map< uint32_t,
Histos
HistosMap
 

Public Member Functions

 CommissioningHistograms (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
 CommissioningHistograms ()
 
virtual void configure (const edm::ParameterSet &, const edm::EventSetup &)
 
void createCollations (const std::vector< std::string > &)
 
virtual void createSummaryHisto (const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &)
 
void extractHistograms (const std::vector< std::string > &)
 
virtual void histoAnalysis (bool debug)
 
virtual void printAnalyses ()
 
virtual void printSummary ()
 
void remove (std::string pattern="")
 
void save (std::string &filename, uint32_t run_number=0)
 
virtual ~CommissioningHistograms ()
 

Static Public Member Functions

static void copyCustomInformation (DQMStore *const, const std::vector< std::string > &)
 
static void getContents (DQMStore *const, std::vector< std::string > &)
 
static uint32_t runNumber (DQMStore *const, const std::vector< std::string > &)
 
static sistrip::RunType runType (DQMStore *const, const std::vector< std::string > &)
 

Protected Member Functions

DQMStore *const bei () const
 
void clearHistosMap ()
 
Analysesdata ()
 
Factory *const factory ()
 
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 HistosMaphistos () const
 
const FedToFecMapmapping () const
 
void printHistosMap ()
 
const edm::ParameterSetpset () const
 
const sistrip::RunTypetask () const
 

Protected Attributes

std::auto_ptr< Factoryfactory_
 

Private Attributes

DQMStorebei_
 
Analyses data_
 
HistosMap histos_
 
FedToFecMap mapping_
 
edm::ParameterSet pset_
 
sistrip::RunType task_
 

Detailed Description

Definition at line 25 of file CommissioningHistograms.h.

Member Typedef Documentation

Definition at line 59 of file CommissioningHistograms.h.

typedef Analyses::iterator CommissioningHistograms::Analysis

Definition at line 61 of file CommissioningHistograms.h.

Definition at line 63 of file CommissioningHistograms.h.

typedef std::map<uint32_t,uint32_t> CommissioningHistograms::FedToFecMap

Definition at line 69 of file CommissioningHistograms.h.

typedef std::vector<Histo*> CommissioningHistograms::Histos

Definition at line 65 of file CommissioningHistograms.h.

typedef std::map<uint32_t,Histos> CommissioningHistograms::HistosMap

Definition at line 67 of file CommissioningHistograms.h.

Constructor & Destructor Documentation

CommissioningHistograms::CommissioningHistograms ( const edm::ParameterSet pset,
DQMStore * const  bei,
const sistrip::RunType task 
)

Definition at line 17 of file CommissioningHistograms.cc.

References bei_, clearHistosMap(), LogTrace, and sistrip::mlDqmClient_.

20  : factory_(0),
21  task_(task),
22  bei_(bei),
23  data_(),
24  histos_(),
25  pset_(pset)
26 {
28  << "[" << __PRETTY_FUNCTION__ << "]"
29  << " Constructing object...";
30 
31  // DQMStore
32  if ( !bei_ ) {
34  << "[CommissioningHistograms::" << __func__ << "]"
35  << " NULL pointer to DQMStore!";
36  }
37 
39 }
const sistrip::RunType & task() const
static const char mlDqmClient_[]
#define LogTrace(id)
std::auto_ptr< Factory > factory_
DQMStore *const bei() const
CommissioningHistograms::CommissioningHistograms ( )

Definition at line 43 of file CommissioningHistograms.cc.

References LogTrace, and sistrip::mlDqmClient_.

44  : factory_(0),
46  bei_(0),
47  data_(),
48  histos_()
49 {
51  << "[" << __PRETTY_FUNCTION__ << "]"
52  << " Constructing object...";
53 }
static const char mlDqmClient_[]
#define LogTrace(id)
std::auto_ptr< Factory > factory_
CommissioningHistograms::~CommissioningHistograms ( )
virtual

Definition at line 57 of file CommissioningHistograms.cc.

References clearHistosMap(), LogTrace, and sistrip::mlDqmClient_.

57  {
59  << "[" << __PRETTY_FUNCTION__ << "]"
60  << " Destructing object...";
62  //@@ do not delete BEI ptrs!
63 }
static const char mlDqmClient_[]
#define LogTrace(id)

Member Function Documentation

DQMStore *const CommissioningHistograms::bei ( ) const
inlineprotected

Definition at line 163 of file CommissioningHistograms.h.

References bei_.

163 { return bei_; }
void CommissioningHistograms::clearHistosMap ( )
protected

Definition at line 555 of file CommissioningHistograms.cc.

References histos_, LogTrace, and sistrip::mlDqmClient_.

Referenced by CommissioningHistograms(), and ~CommissioningHistograms().

555  {
557  << "[CommissioningHistograms::" << __func__ << "]"
558  << " Clearing histogram map...";
559  HistosMap::iterator ihistos = histos_.begin();
560  for ( ; ihistos != histos_.end(); ihistos++ ) {
561  Histos::iterator ihisto = ihistos->second.begin();
562  for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
563  if ( *ihisto ) { delete *ihisto; }
564  }
565  ihistos->second.clear();
566  }
567  histos_.clear();
568 }
static const char mlDqmClient_[]
#define LogTrace(id)
virtual void CommissioningHistograms::configure ( const edm::ParameterSet ,
const edm::EventSetup  
)
inlinevirtual
void CommissioningHistograms::copyCustomInformation ( DQMStore * const  bei,
const std::vector< std::string > &  contents 
)
static

Extracts custom information from list of MonitorElements.

Definition at line 247 of file CommissioningHistograms.cc.

References sistrip::dir_, MonitorElement::DQM_KIND_INT, HcalObjRepresent::Fill(), sistrip::mlDqmClient_, SiStripKey::path(), cmsHarvester::path, pickleFileParser::slash, AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, and relativeConstraints::value.

Referenced by SiStripCommissioningOfflineClient::beginRun().

248  {
249 
250  // Check if histograms present
251  if ( contents.empty() ) {
253  << "[CommissioningHistograms::" << __func__ << "]"
254  << " Found no histograms!";
255  return;
256  }
257 
258  // Iterate through added contents
259  std::vector<std::string>::const_iterator istr = contents.begin();
260  while ( istr != contents.end() ) {
261 
262  // Extract source directory path
263  std::string source_dir = istr->substr( 0, istr->find(":") );
264 
265  // Generate corresponding client path (removing trailing "/")
266  SiStripFecKey path( source_dir );
267  std::string client_dir = path.path();
268  std::string slash = client_dir.substr( client_dir.size()-1, 1 );
269  if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
270 
271  // Iterate though MonitorElements from source directory
272  std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
273  std::vector<MonitorElement*>::iterator ime = me_list.begin();
274  for ( ; ime != me_list.end(); ime++ ) {
275 
276  if ( !(*ime) ) {
278  << "[CommissioningHistograms::" << __func__ << "]"
279  << " NULL pointer to MonitorElement!";
280  continue;
281  }
282  // Search for calchan, isha or vfs
283  if((*ime)->kind()==MonitorElement::DQM_KIND_INT) {
284  std::string title = (*ime)->getName();
285  std::string::size_type pos = title.find("calchan");
286  if( pos == std::string::npos ) pos = title.find("isha");
287  if( pos == std::string::npos ) pos = title.find("vfs");
288  if( pos != std::string::npos ) {
289  int value = (*ime)->getIntValue();
290  if ( value>=0 ) {
292  << "[CommissioningHistograms::" << __func__ << "]"
293  << " Found \"" << title.substr(pos,std::string::npos)
294  << "\" with value \"" << value << "\"";
295  if ( !(bei->get(client_dir+"/"+title.substr(pos,std::string::npos))) ) {
296  bei->setCurrentFolder(client_dir);
297  bei->bookInt( title.substr(pos,std::string::npos))->Fill(value);
299  << "[CommissioningHistograms::" << __func__ << "]"
300  << " Booked \"" << title.substr(pos,std::string::npos)
301  << "\" in directory \"" << client_dir << "\"";
302  }
303  }
304  }
305  }
306  }
307  istr++;
308  }
309 }
static const char dir_[]
static const char mlDqmClient_[]
uint16_t size_type
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
tuple path
else: Piece not in the list, fine.
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
DQMStore *const bei() const
void CommissioningHistograms::createCollations ( const std::vector< std::string > &  )
void CommissioningHistograms::createSummaryHisto ( const sistrip::Monitorable mon,
const sistrip::Presentation pres,
const std::string &  top_level_dir,
const sistrip::Granularity gran 
)
virtual

Reimplemented in FedCablingHistograms, DaqScopeModeHistograms, and FedTimingHistograms.

Definition at line 572 of file CommissioningHistograms.cc.

References data(), relativeConstraints::empty, factory(), sistrip::FED_ADC_RANGE, SummaryPlotFactory< CommissioningAnalysis * >::fill(), sistrip::HISTO_1D, histoAnalysis(), histogram(), SummaryPlotFactory< CommissioningAnalysis * >::init(), LogTrace, sistrip::mlDqmClient_, edmLumisInFiles::summary, sistrip::UNKNOWN_VIEW, SiStripEnumsAndStrings::view(), and fw3dlego::xbins.

Referenced by SiStripCommissioningOfflineClient::beginRun().

575  {
577  << "[CommissioningHistograms::" << __func__ << "]";
578 
579  // Check view
581  if ( view == sistrip::UNKNOWN_VIEW ) { return; }
582 
583  // Analyze histograms
584  if ( data().empty() ) { histoAnalysis( false ); }
585 
586  // Check
587  if ( data().empty() ) {
589  << "[CommissioningHistograms::" << __func__ << "]"
590  << " No analyses generated!";
591  return;
592  }
593 
594  // Extract data to be histogrammed
595  uint32_t xbins = factory()->init( mon, pres, view, dir, gran, data() );
596 
597  // Only create histograms if entries are found!
598  if ( !xbins ) { return; }
599 
600  // Create summary histogram (if it doesn't already exist)
601  TH1* summary = 0;
602  if ( pres != sistrip::HISTO_1D ) { summary = histogram( mon, pres, view, dir, xbins ); }
603  else { summary = histogram( mon, pres, view, dir, sistrip::FED_ADC_RANGE, 0., sistrip::FED_ADC_RANGE*1. ); }
604 
605  // Fill histogram with data
606  factory()->fill( *summary );
607 
608 }
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[]
static const char mlDqmClient_[]
static const uint16_t FED_ADC_RANGE
static std::string view(const sistrip::View &)
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)
#define LogTrace(id)
dbl *** dir
Definition: mlp_gen.cc:35
virtual void histoAnalysis(bool debug)
CommissioningHistograms::Analyses & CommissioningHistograms::data ( )
inlineprotected

Definition at line 164 of file CommissioningHistograms.h.

References data_.

Referenced by cuy.FindIssue::__init__(), FastFedCablingHistosUsingDb::addDcuDetIds(), CommissioningHistosUsingDb::addDcuDetIds(), FineDelayHistosUsingDb::computeDelays(), FastFedCablingHistosUsingDb::connections(), CommissioningHistosUsingDb::createAnalyses(), createSummaryHisto(), NoiseHistograms::histoAnalysis(), PedsFullNoiseHistograms::histoAnalysis(), PedsOnlyHistograms::histoAnalysis(), VpspScanHistograms::histoAnalysis(), ApvTimingHistograms::histoAnalysis(), OptoScanHistograms::histoAnalysis(), PedestalsHistograms::histoAnalysis(), FastFedCablingHistograms::histoAnalysis(), SamplingHistograms::histoAnalysis(), CalibrationHistograms::histoAnalysis(), FastFedCablingHistograms::printAnalyses(), PedsFullNoiseHistograms::printAnalyses(), PedsOnlyHistograms::printAnalyses(), NoiseHistograms::printAnalyses(), VpspScanHistograms::printAnalyses(), OptoScanHistograms::printAnalyses(), PedestalsHistograms::printAnalyses(), CalibrationHistograms::printAnalyses(), printAnalyses(), FastFedCablingHistograms::printSummary(), printSummary(), NoiseHistosUsingDb::update(), PedsFullNoiseHistosUsingDb::update(), VpspScanHistosUsingDb::update(), ApvTimingHistosUsingDb::update(), OptoScanHistosUsingDb::update(), PedsOnlyHistosUsingDb::update(), PedestalsHistosUsingDb::update(), FastFedCablingHistosUsingDb::update(), and LatencyHistosUsingDb::update().

164 { return data_; }
void CommissioningHistograms::extractHistograms ( const std::vector< std::string > &  contents)

Definition at line 314 of file CommissioningHistograms.cc.

References sistrip::APV, bei_, sistrip::collate_, sistrip::CONTROL_VIEW, sistrip::DETECTOR_VIEW, sistrip::dir_, SiStripKey::granularity(), timingPdfMaker::histo, histos_, sistrip::invalid32_, sistrip::invalid_, combine::key, SiStripKey::key(), SiStripFecKey::lldChan(), LogTrace, mapping_, CommissioningHistograms::Histo::me_, sistrip::mlDqmClient_, cmsHarvester::path, sistrip::READOUT_VIEW, edm::second(), pickleFileParser::slash, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, indexGen::title, CommissioningHistograms::Histo::title_, sistrip::UNDEFINED_GRAN, sistrip::undefinedView_, sistrip::UNKNOWN_GRAN, and SiStripEnumsAndStrings::view().

Referenced by SiStripCommissioningOfflineClient::beginRun().

314  {
316  << "[CommissioningHistograms::" << __func__ << "]"
317  << " Extracting available histograms...";
318 
319  // Check pointer
320  if ( !bei_ ) {
322  << "[CommissioningHistograms::" << __func__ << "]"
323  << " NULL pointer to DQMStore!";
324  return;
325  }
326 
327  // Check list of histograms
328  if ( contents.empty() ) {
330  << "[CommissioningHistograms::" << __func__ << "]"
331  << " Empty contents vector!";
332  return;
333  }
334 
335  // Iterate through list of histograms
336  std::vector<std::string>::const_iterator idir;
337  for ( idir = contents.begin(); idir != contents.end(); idir++ ) {
338 
339  // Ignore "DQM source" directories if looking in client file
340  if ( idir->find(sistrip::collate_) == std::string::npos ) { continue; }
341 
342  // Extract source directory path
343  std::string source_dir = idir->substr( 0, idir->find(":") );
344 
345  // Extract view and create key
346  sistrip::View view = SiStripEnumsAndStrings::view( source_dir );
348  if ( view == sistrip::CONTROL_VIEW ) { path = SiStripFecKey( source_dir ); }
349  else if ( view == sistrip::READOUT_VIEW ) { path = SiStripFedKey( source_dir ); }
350  else if ( view == sistrip::DETECTOR_VIEW ) { path = SiStripDetKey( source_dir ); }
351  else { path = SiStripKey(); }
352 
353  // Check path is valid
354  if ( path.granularity() == sistrip::UNKNOWN_GRAN ||
355  path.granularity() == sistrip::UNDEFINED_GRAN ) {
356  continue;
357  }
358 
359  // Generate corresponding client path (removing trailing "/")
361  if ( view == sistrip::CONTROL_VIEW ) { client_dir = SiStripFecKey( path.key() ).path(); }
362  else if ( view == sistrip::READOUT_VIEW ) { client_dir = SiStripFedKey( path.key() ).path(); }
363  else if ( view == sistrip::DETECTOR_VIEW ) { client_dir = SiStripDetKey( path.key() ).path(); }
364  else { client_dir = SiStripKey( path.key() ).path(); }
365  std::string slash = client_dir.substr( client_dir.size()-1, 1 );
366  if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
367  client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
368 
369  // Retrieve MonitorElements from source directory
370  std::vector<MonitorElement*> me_list = bei_->getContents( source_dir );
371 
372  // Iterate though MonitorElements and create CMEs
373  std::vector<MonitorElement*>::iterator ime = me_list.begin();
374  for ( ; ime != me_list.end(); ime++ ) {
375 
376  // Retrieve histogram title
377  SiStripHistoTitle title( (*ime)->getName() );
378 
379  // Check histogram type
380  //if ( title.histoType() != sistrip::EXPERT_HISTO ) { continue; }
381 
382  // Check granularity
383  uint16_t channel = sistrip::invalid_;
384  if ( title.granularity() == sistrip::APV ) {
385  channel = SiStripFecKey::lldChan( title.channel() );
386  } else if ( title.granularity() == sistrip::UNKNOWN_GRAN ||
387  title.granularity() == sistrip::UNDEFINED_GRAN ) {
388  std::stringstream ss;
389  ss << "[CommissioningHistograms::" << __func__ << "]"
390  << " Unexpected granularity for histogram title: "
391  << std::endl << title
392  << " found in path "
393  << std::endl << path;
394  edm::LogError(mlDqmClient_) << ss.str();
395  } else {
396  channel = title.channel();
397  }
398 
399  // Build key
400  uint32_t key = sistrip::invalid32_;
401 
402  if ( view == sistrip::CONTROL_VIEW ) {
403 
404  // for all runs except cabling
405  SiStripFecKey temp( path.key() );
406  key = SiStripFecKey( temp.fecCrate(),
407  temp.fecSlot(),
408  temp.fecRing(),
409  temp.ccuAddr(),
410  temp.ccuChan(),
411  channel ).key();
412  mapping_[title.keyValue()] = key;
413 
414  } else if ( view == sistrip::READOUT_VIEW ) {
415 
416  // for cabling run
417  key = SiStripFedKey( path.key() ).key();
423  channel ).key(); // just record lld channel
424  mapping_[title.keyValue()] = temp;
425 
426  } else if ( view == sistrip::DETECTOR_VIEW ) {
427 
428  SiStripDetKey temp( path.key() );
429  key = SiStripDetKey( temp.partition() ).key();
430  mapping_[title.keyValue()] = key;
431 
432  } else { key = SiStripKey( path.key() ).key(); }
433 
434  // Find CME in histos map
435  Histo* histo = 0;
436  HistosMap::iterator ihistos = histos_.find( key );
437  if ( ihistos != histos_.end() ) {
438  Histos::iterator ihis = ihistos->second.begin();
439  while ( !histo && ihis < ihistos->second.end() ) {
440  if ( (*ime)->getName() == (*ihis)->title_ ) { histo = *ihis; }
441  ihis++;
442  }
443  }
444 
445  // Create CollateME if it doesn't exist
446  if ( !histo ) {
447 
448  histos_[key].push_back( new Histo() );
449  histo = histos_[key].back();
450  histo->title_ = (*ime)->getName();
451 
452  // If histogram present in client directory, add to map
453  if ( source_dir.find(sistrip::collate_) != std::string::npos ) {
454  histo->me_ = bei_->get( client_dir +"/"+(*ime)->getName() );
455  if ( !histo->me_ ) {
457  << "[CommissioningHistograms::" << __func__ << "]"
458  << " NULL pointer to MonitorElement!";
459  }
460  }
461 
462  }
463 
464  }
465 
466  }
467 
468  //printHistosMap();
469 
471  << "[CommissioningHistograms::" << __func__ << "]"
472  << " Found histograms for " << histos_.size()
473  << " structures in cached histogram map!";
474 
475 }
static const char dir_[]
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
static const char mlDqmClient_[]
const uint16_t & lldChan() const
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 &)
tuple path
else: Piece not in the list, fine.
Base utility class that identifies a position within a logical structure of the strip tracker...
Definition: SiStripKey.h:23
#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
static const uint16_t invalid_
Definition: Constants.h:16
list key
Definition: combine.py:13
static const char collate_[]
CommissioningHistograms::Factory *const CommissioningHistograms::factory ( )
inlineprotected

Definition at line 165 of file CommissioningHistograms.h.

References factory_.

Referenced by createSummaryHisto().

165 { return factory_.get(); }
std::auto_ptr< Factory > factory_
void CommissioningHistograms::getContents ( DQMStore * const  bei,
std::vector< std::string > &  contents 
)
static

Retrieves list of histograms in form of strings.

Definition at line 241 of file CommissioningHistograms.cc.

242  {
243 }
void CommissioningHistograms::histoAnalysis ( bool  debug)
virtual

Reimplemented in FedCablingHistograms, DaqScopeModeHistograms, FedTimingHistograms, CalibrationHistograms, SamplingHistograms, ApvTimingHistograms, FastFedCablingHistograms, NoiseHistograms, OptoScanHistograms, PedestalsHistograms, PedsFullNoiseHistograms, PedsOnlyHistograms, and VpspScanHistograms.

Definition at line 480 of file CommissioningHistograms.cc.

References LogTrace, and sistrip::mlDqmClient_.

Referenced by SiStripCommissioningOfflineClient::beginRun(), and createSummaryHisto().

480  {
482  << "[CommissioningHistograms::" << __func__ << "]"
483  << " (Derived) implementation to come...";
484 }
static const char mlDqmClient_[]
#define LogTrace(id)
TH1 * CommissioningHistograms::histogram ( const sistrip::Monitorable mon,
const sistrip::Presentation pres,
const sistrip::View view,
const std::string &  directory,
const uint32_t &  xbins,
const float &  xlow = 1. * sistrip::invalid_,
const float &  xhigh = 1. * sistrip::invalid_ 
)
protected

Definition at line 717 of file CommissioningHistograms.cc.

References bei_, sistrip::collate_, sistrip::dir_, extract(), sistrip::FED_ADC_RANGE, MonitorElement::getName(), sistrip::HISTO_1D, sistrip::HISTO_2D_SCATTER, sistrip::HISTO_2D_SUM, LogTrace, sistrip::mlDqmClient_, SummaryGenerator::name(), mergeVDriftHistosByStation::name, SiStripEnumsAndStrings::presentation(), sistrip::PROFILE_1D, alignCSCRings::pwd, AlCaHLTBitMon_QueryRunRegistry::string, edmLumisInFiles::summary, task_, sistrip::valid_, and fw3dlego::xbins.

Referenced by FedTimingHistograms::createSummaryHisto(), DaqScopeModeHistograms::createSummaryHisto(), FedCablingHistograms::createSummaryHisto(), and createSummaryHisto().

723  {
724 
725  // Remember pwd
726  std::string pwd = bei_->pwd();
727  bei_->setCurrentFolder( std::string(sistrip::collate_) + sistrip::dir_ + directory );
728 
729  // Construct histogram name
731 
732  // Check if summary plot already exists and remove
733  MonitorElement* me = bei_->get( bei_->pwd() + "/" + name );
734  if ( me ) {
735  bei_->removeElement( name );
736  me = 0;
737  }
738 
739  // Create summary plot
740  float high = static_cast<float>( xbins );
741  if ( pres == sistrip::HISTO_1D ) {
742  if ( xlow < 1. * sistrip::valid_ &&
743  xhigh < 1. * sistrip::valid_ ) {
744  me = bei_->book1D( name, name, xbins, xlow, xhigh );
745  } else {
746  me = bei_->book1D( name, name, xbins, 0., high );
747  }
748  } else if ( pres == sistrip::HISTO_2D_SUM ) {
749  me = bei_->book1D( name, name,
750  xbins, 0., high );
751  } else if ( pres == sistrip::HISTO_2D_SCATTER ) {
752  me = bei_->book2D( name, name, xbins, 0., high,
754  0.,
756  } else if ( pres == sistrip::PROFILE_1D ) {
757  me = bei_->bookProfile( name, name, xbins, 0., high,
759  0.,
761  } else {
762  me = 0;
764  << "[CommissioningHistograms::" << __func__ << "]"
765  << " Unexpected presentation \""
767  << "\" Unable to create summary plot!";
768  }
769 
770  // Check pointer
771  if ( me ) {
773  << "[CommissioningHistograms::" << __func__ << "]"
774  << " Created summary plot with name \"" << me->getName()
775  << "\" in directory \""
776  << bei_->pwd() << "\"!";
777  } else {
779  << "[CommissioningHistograms::" << __func__ << "]"
780  << " NULL pointer to MonitorElement!"
781  << " Unable to create summary plot!";
782  }
783 
784  // Extract root object
785  TH1* summary = ExtractTObject<TH1>().extract( me );
786  if ( !summary ) {
788  << "[CommissioningHistograms::" << __func__ << "]"
789  << " Unable to extract root object!"
790  << " Returning NULL pointer!";
791  }
792 
793  // Return to pwd
794  bei_->setCurrentFolder( pwd );
795 
796  return summary;
797 
798 }
static std::string name(const sistrip::RunType &, const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory)
const std::string & getName(void) const
get name of ME
const double xbins[]
static const char dir_[]
static const char mlDqmClient_[]
static const uint16_t FED_ADC_RANGE
static const uint16_t valid_
Definition: Constants.h:17
#define LogTrace(id)
int extract(std::vector< int > *output, const std::string &dati)
static std::string presentation(const sistrip::Presentation &)
static const char collate_[]
const CommissioningHistograms::HistosMap & CommissioningHistograms::histos ( ) const
inlineprotected
const CommissioningHistograms::FedToFecMap & CommissioningHistograms::mapping ( ) const
inlineprotected

Definition at line 167 of file CommissioningHistograms.h.

References mapping_.

Referenced by FastFedCablingHistograms::histoAnalysis().

167 { return mapping_; }
void CommissioningHistograms::printAnalyses ( )
virtual

Reimplemented in FedCablingHistograms, CalibrationHistograms, FastFedCablingHistograms, NoiseHistograms, OptoScanHistograms, PedestalsHistograms, PedsFullNoiseHistograms, PedsOnlyHistograms, and VpspScanHistograms.

Definition at line 488 of file CommissioningHistograms.cc.

References data(), LogTrace, sistrip::mlDqmClient_, and contentValuesCheck::ss.

Referenced by SiStripCommissioningOfflineClient::beginRun().

488  {
489  Analyses::iterator ianal = data().begin();
490  Analyses::iterator janal = data().end();
491  for ( ; ianal != janal; ++ianal ) {
492  if ( ianal->second ) {
493  std::stringstream ss;
494  ianal->second->print( ss );
495  if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str();
496  } else { edm::LogWarning(mlDqmClient_) << ss.str(); }
497  }
498  }
499 }
static const char mlDqmClient_[]
#define LogTrace(id)
void CommissioningHistograms::printHistosMap ( )
protected

Definition at line 533 of file CommissioningHistograms.cc.

References histos_, LogTrace, sistrip::mlDqmClient_, SiStripFedKey::print(), and contentValuesCheck::ss.

533  {
535  << "[CommissioningHistograms::" << __func__ << "]"
536  << " Printing histogram map, which has "
537  << histos_.size() << " entries...";
538  HistosMap::const_iterator ihistos = histos_.begin();
539  for ( ; ihistos != histos_.end(); ihistos++ ) {
540  std::stringstream ss;
541  ss << " Found " << ihistos->second.size()
542  << " histogram(s) for key: " << std::endl
543  << SiStripFedKey(ihistos->first) << std::endl;
544  Histos::const_iterator ihisto = ihistos->second.begin();
545  for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
546  if ( *ihisto ) { (*ihisto)->print(ss); }
547  else { ss << " NULL pointer to Histo object!"; }
548  }
549  LogTrace(mlDqmClient_) << ss.str();
550  }
551 }
virtual void print(std::stringstream &ss) const
A container class for generic run and event-related info, information required by the commissioning a...
Definition: SiStripFedKey.h:56
static const char mlDqmClient_[]
#define LogTrace(id)
void CommissioningHistograms::printSummary ( )
virtual

Reimplemented in FastFedCablingHistograms.

Definition at line 503 of file CommissioningHistograms.cc.

References cond::ecalcond::bad(), data(), LogTrace, and sistrip::mlDqmClient_.

Referenced by SiStripCommissioningOfflineClient::beginRun().

503  {
504 
505  std::stringstream good;
506  std::stringstream bad;
507 
508  Analyses::iterator ianal = data().begin();
509  Analyses::iterator janal = data().end();
510  for ( ; ianal != janal; ++ianal ) {
511  if ( ianal->second ) {
512  if ( ianal->second->isValid() ) { ianal->second->summary( good ); }
513  else { ianal->second->summary( bad ); }
514  }
515  }
516 
517  if ( good.str().empty() ) { good << "None found!"; }
519  << "[CommissioningHistograms::" << __func__ << "]"
520  << " Printing summary of good analyses:" << "\n"
521  << good.str();
522 
523  if ( bad.str().empty() ) { return; } //@@ bad << "None found!"; }
525  << "[CommissioningHistograms::" << __func__ << "]"
526  << " Printing summary of bad analyses:" << "\n"
527  << bad.str();
528 
529 }
static const char mlDqmClient_[]
int bad(Items const &cont)
#define LogTrace(id)
const edm::ParameterSet & CommissioningHistograms::pset ( ) const
inlineprotected
void CommissioningHistograms::remove ( std::string  pattern = "")

Definition at line 612 of file CommissioningHistograms.cc.

References bei_, LogTrace, and sistrip::mlDqmClient_.

Referenced by SiStripCommissioningOfflineClient::beginRun().

612  {
613 
614  if ( !bei_ ) {
616  << "[CommissioningHistograms::" << __func__ << "]"
617  << " NULL pointer to DQMStore!";
618  return;
619  }
620 
621  bei_->setVerbose(0);
622 
624  << "[CommissioningHistograms::" << __func__ << "]"
625  << " Removing histograms...";
626 
627  if ( !pattern.empty() ) {
628 
629  if ( bei_->dirExists(pattern) ) {
630  bei_->rmdir(pattern);
631  }
632 
634  << "[CommissioningHistograms::" << __func__ << "]"
635  << " Removing directories (and MonitorElements"
636  << " therein) that match the pattern \""
637  << pattern << "\"";
638 
639  } else {
640 
641  bei_->cd();
642  bei_->removeContents();
643 
644  if( bei_->dirExists("Collector") ) {
645  bei_->rmdir("Collector");
646  }
647  if( bei_->dirExists("EvF") ) {
648  bei_->rmdir("EvF");
649  }
650  if( bei_->dirExists("SiStrip") ) {
651  bei_->rmdir("SiStrip");
652  }
653 
655  << "[CommissioningHistograms::" << __func__ << "]"
656  << " Removing \"DQM source\" directories (and MonitorElements therein)";
657 
658  }
659 
661  << "[CommissioningHistograms::" << __func__ << "]"
662  << " Removed histograms!";
663 
664  bei_->setVerbose(1);
665 
666 }
static const char mlDqmClient_[]
list pattern
Definition: chain.py:104
#define LogTrace(id)
uint32_t CommissioningHistograms::runNumber ( DQMStore * const  bei,
const std::vector< std::string > &  contents 
)
static

Definition at line 82 of file CommissioningHistograms.cc.

References sistrip::collate_, TauDecayModes::dec, sistrip::dir_, LogTrace, sistrip::mlDqmClient_, SiStripKey::path(), cmsHarvester::path, DTTTrigCorrFirst::run, sistrip::runNumber_, pickleFileParser::slash, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, and relativeConstraints::value.

Referenced by SiStripCommissioningOfflineClient::beginRun().

83  {
84 
85  // Check if histograms present
86  if ( contents.empty() ) {
88  << "[CommissioningHistograms::" << __func__ << "]"
89  << " Found no histograms!";
90  return 0;
91  }
92 
93  // Iterate through added contents
94  std::vector<std::string>::const_iterator istr = contents.begin();
95  while ( istr != contents.end() ) {
96 
97  // Extract source directory path
98  std::string source_dir = istr->substr( 0, istr->find(":") );
99 
100  // Generate corresponding client path (removing trailing "/")
101  SiStripFecKey path( source_dir );
102  std::string client_dir = path.path();
103  std::string slash = client_dir.substr( client_dir.size()-1, 1 );
104  if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
105  client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
106 
107  // Iterate though MonitorElements from source directory
108  std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
109  std::vector<MonitorElement*>::iterator ime = me_list.begin();
110  for ( ; ime != me_list.end(); ime++ ) {
111 
112  if ( !(*ime) ) {
114  << "[CommissioningHistograms::" << __func__ << "]"
115  << " NULL pointer to MonitorElement!";
116  continue;
117  }
118 
119  // Search for run type in string
120  std::string title = (*ime)->getName();
121  std::string::size_type pos = title.find( sistrip::runNumber_ );
122 
123  // Extract run number from string
124  if ( pos != std::string::npos ) {
125  std::string value = title.substr( pos+sizeof(sistrip::runNumber_) , std::string::npos );
126  if ( !value.empty() ) {
128  << "[CommissioningHistograms::" << __func__ << "]"
129  << " Found string \"" << title.substr(pos,std::string::npos)
130  << "\" with value \"" << value << "\"";
131  if ( !(bei->get(client_dir+"/"+title.substr(pos,std::string::npos))) ) {
132  bei->setCurrentFolder(client_dir);
133  bei->bookString( title.substr(pos,std::string::npos), value );
135  << "[CommissioningHistograms::" << __func__ << "]"
136  << " Booked string \"" << title.substr(pos,std::string::npos)
137  << "\" in directory \"" << client_dir << "\"";
138  }
139  uint32_t run;
140  std::stringstream ss;
141  ss << value;
142  ss >> std::dec >> run;
143  return run;
144  }
145  }
146 
147  }
148 
149  istr++;
150 
151  }
152  return 0;
153 }
static const char runNumber_[]
static const char dir_[]
static const char mlDqmClient_[]
uint16_t size_type
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
tuple path
else: Piece not in the list, fine.
#define LogTrace(id)
DQMStore *const bei() const
static const char collate_[]
sistrip::RunType CommissioningHistograms::runType ( DQMStore * const  bei,
const std::vector< std::string > &  contents 
)
static

Extract run type string from "added contents".

Definition at line 157 of file CommissioningHistograms.cc.

References sistrip::collate_, sistrip::dir_, LogTrace, sistrip::mlDqmClient_, SiStripKey::path(), cmsHarvester::path, SiStripEnumsAndStrings::runType(), pickleFileParser::slash, AlCaHLTBitMon_QueryRunRegistry::string, sistrip::taskId_, indexGen::title, sistrip::UNKNOWN_RUN_TYPE, and relativeConstraints::value.

Referenced by SiStripCommissioningOfflineClient::beginRun().

158  {
159 
160  // Check if histograms present
161  if ( contents.empty() ) {
163  << "[CommissioningHistograms::" << __func__ << "]"
164  << " Found no histograms!";
166  }
167 
168  // Iterate through added contents
169  std::vector<std::string>::const_iterator istr = contents.begin();
170  while ( istr != contents.end() ) {
171 
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_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
180  client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
181 
182  // Iterate though MonitorElements from source directory
183  std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
184 
185  if ( me_list.empty() ) {
187  << "[CommissioningHistograms::" << __func__ << "]"
188  << " No MonitorElements found in dir " << source_dir;
190  }
191 
192  std::vector<MonitorElement*>::iterator ime = me_list.begin();
193  for ( ; ime != me_list.end(); ime++ ) {
194 
195  if ( !(*ime) ) {
197  << "[CommissioningHistograms::" << __func__ << "]"
198  << " NULL pointer to MonitorElement!";
199  continue;
200  }
201 
202  // Search for run type in string
203  std::string title = (*ime)->getName();
204  std::string::size_type pos = title.find( sistrip::taskId_ );
205 
206  // Extract commissioning task from string
207  if ( pos != std::string::npos ) {
208  std::string value = title.substr( pos+sizeof(sistrip::taskId_) , std::string::npos );
209  if ( !value.empty() ) {
211  << "[CommissioningHistograms::" << __func__ << "]"
212  << " Found string \"" << title.substr(pos,std::string::npos)
213  << "\" with value \"" << value << "\"";
214  if ( !(bei->get(client_dir+sistrip::dir_+title.substr(pos,std::string::npos))) ) {
215  bei->setCurrentFolder(client_dir);
216  bei->bookString( title.substr(pos,std::string::npos), value );
218  << "[CommissioningHistograms::" << __func__ << "]"
219  << " Booked string \"" << title.substr(pos,std::string::npos)
220  << "\" in directory \"" << client_dir << "\"";
221  }
222  return SiStripEnumsAndStrings::runType( value );
223  }
224  }
225 
226  }
227 
228  istr++;
229 
230  }
231 
233  << "[CommissioningHistograms::" << __func__ << "]"
234  << " Unable to extract RunType!";
236 
237 }
static const char dir_[]
static const char mlDqmClient_[]
uint16_t size_type
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
static std::string runType(const sistrip::RunType &)
tuple path
else: Piece not in the list, fine.
static const char taskId_[]
#define LogTrace(id)
DQMStore *const bei() const
static const char collate_[]
void CommissioningHistograms::save ( std::string &  filename,
uint32_t  run_number = 0 
)

Definition at line 670 of file CommissioningHistograms.cc.

References bei_, sistrip::collate_, dir, sistrip::dqmClientFileName_, LogTrace, sistrip::mlDqmClient_, NULL, cmsHarvester::path, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by Vispa.Main.TabController.TabController::allowClose(), SiStripCommissioningOfflineClient::beginRun(), and Vispa.Main.TabController.TabController::checkModificationTimestamp().

671  {
672 
673  // Construct path and filename
674  std::stringstream ss;
675 
676  if ( !path.empty() ) {
677 
678  ss << path;
679  if ( ss.str().find(".root") == std::string::npos ) { ss << ".root"; }
680 
681  } else {
682 
683  // Retrieve SCRATCH directory
684  std::string scratch = "SCRATCH";
685  std::string dir = "";
686  if ( getenv(scratch.c_str()) != NULL ) {
687  dir = getenv(scratch.c_str());
688  }
689 
690  // Add directory path
691  if ( !dir.empty() ) { ss << dir << "/"; }
692  else { ss << "/tmp/"; }
693 
694  // Add filename with run number and ".root" extension
695  ss << sistrip::dqmClientFileName_ << "_"
696  << std::setfill('0') << std::setw(8) << run_number
697  << ".root";
698 
699  }
700 
701  // Save file with appropriate filename
703  << "[CommissioningHistograms::" << __func__ << "]"
704  << " Saving histograms to root file"
705  << " (This may take some time!)";
706  path = ss.str();
707  bei_->save( path, sistrip::collate_ );
709  << "[CommissioningHistograms::" << __func__ << "]"
710  << " Saved histograms to root file \""
711  << ss.str() << "\"!";
712 
713 }
static const char dqmClientFileName_[]
static const char mlDqmClient_[]
#define NULL
Definition: scimark2.h:8
tuple path
else: Piece not in the list, fine.
#define LogTrace(id)
dbl *** dir
Definition: mlp_gen.cc:35
static const char collate_[]
const sistrip::RunType & CommissioningHistograms::task ( ) const
inlineprotected

Definition at line 162 of file CommissioningHistograms.h.

References task_.

Referenced by CalibrationHistograms::histoAnalysis().

162 { return task_; }

Member Data Documentation

DQMStore* CommissioningHistograms::bei_
private
Analyses CommissioningHistograms::data_
private

Definition at line 150 of file CommissioningHistograms.h.

Referenced by data().

std::auto_ptr<Factory> CommissioningHistograms::factory_
protected
HistosMap CommissioningHistograms::histos_
private
FedToFecMap CommissioningHistograms::mapping_
private

Definition at line 154 of file CommissioningHistograms.h.

Referenced by extractHistograms(), and mapping().

edm::ParameterSet CommissioningHistograms::pset_
private

Definition at line 156 of file CommissioningHistograms.h.

Referenced by pset().

sistrip::RunType CommissioningHistograms::task_
private

Definition at line 146 of file CommissioningHistograms.h.

Referenced by histogram(), and task().