CMS 3D CMS Logo

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

List of all members.

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

Reimplemented in FedCablingHistograms.

Definition at line 59 of file CommissioningHistograms.h.

typedef Analyses::iterator CommissioningHistograms::Analysis

Definition at line 61 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_.

  : factory_(0),
    task_(task),
    bei_(bei),
    data_(),
    histos_(),
    pset_(pset)
{
  LogTrace(mlDqmClient_)
    << "[" << __PRETTY_FUNCTION__ << "]"
    << " Constructing object...";

  // DQMStore
  if ( !bei_ ) {
    edm::LogError(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " NULL pointer to DQMStore!";
  }
  
  clearHistosMap();
}
CommissioningHistograms::CommissioningHistograms ( )

Definition at line 43 of file CommissioningHistograms.cc.

References LogTrace, and sistrip::mlDqmClient_.

  : factory_(0),
    task_(sistrip::UNDEFINED_RUN_TYPE),
    bei_(0),
    data_(),
    histos_()
{
  LogTrace(mlDqmClient_)
    << "[" << __PRETTY_FUNCTION__ << "]"
    << " Constructing object...";
}
CommissioningHistograms::~CommissioningHistograms ( ) [virtual]

Definition at line 57 of file CommissioningHistograms.cc.

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

                                                  {
  LogTrace(mlDqmClient_)
    << "[" << __PRETTY_FUNCTION__ << "]"
    << " Destructing object...";
  clearHistosMap();
  //@@ do not delete BEI ptrs!
}

Member Function Documentation

DQMStore *const CommissioningHistograms::bei ( ) const [inline, protected]

Definition at line 163 of file CommissioningHistograms.h.

References bei_.

{ 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().

                                             {
  LogTrace(mlDqmClient_)
    << "[CommissioningHistograms::" << __func__ << "]"
    << " Clearing histogram map...";
  HistosMap::iterator ihistos = histos_.begin();
  for ( ; ihistos != histos_.end(); ihistos++ ) {
    Histos::iterator ihisto = ihistos->second.begin();
    for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
      if ( *ihisto ) { delete *ihisto; }
    }
    ihistos->second.clear();
  }
  histos_.clear();
}
virtual void CommissioningHistograms::configure ( const edm::ParameterSet ,
const edm::EventSetup  
) [inline, virtual]
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 DQMStore::bookInt(), sistrip::dir_, MonitorElement::DQM_KIND_INT, HcalObjRepresent::Fill(), DQMStore::get(), DQMStore::getContents(), sistrip::mlDqmClient_, getHLTPrescaleColumns::path, SiStripKey::path(), pos, DQMStore::setCurrentFolder(), cmsCodeRules::pickleFileParser::slash, indexGen::title, and relativeConstraints::value.

Referenced by SiStripCommissioningOfflineClient::beginRun().

                                                                                            {
  
  // Check if histograms present
  if ( contents.empty() ) {
    edm::LogWarning(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__  << "]"
      << " Found no histograms!";
    return;
  }
  
  // Iterate through added contents
  std::vector<std::string>::const_iterator istr = contents.begin();
  while ( istr != contents.end() ) {

    // Extract source directory path
    std::string source_dir = istr->substr( 0, istr->find(":") );

    // Generate corresponding client path (removing trailing "/")
    SiStripFecKey path( source_dir );
    std::string client_dir = path.path();
    std::string slash = client_dir.substr( client_dir.size()-1, 1 );
    if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }

    // Iterate though MonitorElements from source directory
    std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
    std::vector<MonitorElement*>::iterator ime = me_list.begin();
    for ( ; ime != me_list.end(); ime++ ) {

      if ( !(*ime) ) {
        edm::LogWarning(mlDqmClient_)
          << "[CommissioningHistograms::" << __func__ << "]"
          << " NULL pointer to MonitorElement!";
        continue;
      }
      // Search for calchan, isha or vfs
      if((*ime)->kind()==MonitorElement::DQM_KIND_INT) {
        std::string title = (*ime)->getName();
        std::string::size_type pos = title.find("calchan");
        if( pos == std::string::npos ) pos = title.find("isha");
        if( pos == std::string::npos ) pos = title.find("vfs");
        if( pos != std::string::npos ) {
          int value = (*ime)->getIntValue();
          if ( value>=0 ) {
            edm::LogVerbatim(mlDqmClient_)
              << "[CommissioningHistograms::" << __func__ << "]"
              << " Found \"" << title.substr(pos,std::string::npos)
              << "\" with value \"" << value << "\"";
            if ( !(bei->get(client_dir+"/"+title.substr(pos,std::string::npos))) ) {
              bei->setCurrentFolder(client_dir);
              bei->bookInt( title.substr(pos,std::string::npos))->Fill(value);
              edm::LogVerbatim(mlDqmClient_)
                << "[CommissioningHistograms::" << __func__ << "]"
                << " Booked \"" << title.substr(pos,std::string::npos)
                << "\" in directory \"" << client_dir << "\"";
            }
          }
        }
      }
    }
    istr++;
  }
}
void CommissioningHistograms::createCollations ( const std::vector< std::string > &  )
void CommissioningHistograms::createSummaryHisto ( const sistrip::Monitorable mon,
const sistrip::Presentation pres,
const std::string &  dir,
const sistrip::Granularity gran 
) [virtual]

Reimplemented in DaqScopeModeHistograms, FedCablingHistograms, 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_, summarizeEdmComparisonLogfiles::summary, sistrip::UNKNOWN_VIEW, SiStripEnumsAndStrings::view(), and fw3dlego::xbins.

Referenced by SiStripCommissioningOfflineClient::beginRun().

                                                                                   {
  LogTrace(mlDqmClient_)
    << "[CommissioningHistograms::" << __func__ << "]";
  
  // Check view 
  sistrip::View view = SiStripEnumsAndStrings::view(dir);
  if ( view == sistrip::UNKNOWN_VIEW ) { return; }
  
  // Analyze histograms
  if ( data().empty() ) { histoAnalysis( false ); }

  // Check
  if ( data().empty() ) { 
    edm::LogError(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " No analyses generated!";
    return;
  }
  
  // Extract data to be histogrammed
  uint32_t xbins = factory()->init( mon, pres, view, dir, gran, data() );
  
  // Only create histograms if entries are found!
  if ( !xbins ) { return; }
  
  // Create summary histogram (if it doesn't already exist)
  TH1* summary = 0;
  if ( pres != sistrip::HISTO_1D ) { summary = histogram( mon, pres, view, dir, xbins ); }
  else { summary = histogram( mon, pres, view, dir, sistrip::FED_ADC_RANGE, 0., sistrip::FED_ADC_RANGE*1. ); }
  
  // Fill histogram with data
  factory()->fill( *summary );
  
}
CommissioningHistograms::Analyses & CommissioningHistograms::data ( ) [inline, protected]
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_, DQMStore::get(), DQMStore::getContents(), SiStripKey::granularity(), timingPdfMaker::histo, histos_, sistrip::invalid32_, sistrip::invalid_, combine::key, SiStripKey::key(), SiStripFecKey::lldChan(), LogTrace, mapping_, CommissioningHistograms::Histo::me_, sistrip::mlDqmClient_, getHLTPrescaleColumns::path, sistrip::READOUT_VIEW, edm::second(), cmsCodeRules::pickleFileParser::slash, groupFilesInBlocks::temp, indexGen::title, CommissioningHistograms::Histo::title_, sistrip::UNDEFINED_GRAN, sistrip::undefinedView_, sistrip::UNKNOWN_GRAN, and SiStripEnumsAndStrings::view().

Referenced by SiStripCommissioningOfflineClient::beginRun().

                                                                                      {
  LogTrace(mlDqmClient_)
    << "[CommissioningHistograms::" << __func__ << "]"
    << " Extracting available histograms...";
  
  // Check pointer
  if ( !bei_ ) {
    edm::LogError(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " NULL pointer to DQMStore!";
    return;
  }
  
  // Check list of histograms
  if ( contents.empty() ) { 
    edm::LogError(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " Empty contents vector!";
    return; 
  }
  
  // Iterate through list of histograms
  std::vector<std::string>::const_iterator idir;
  for ( idir = contents.begin(); idir != contents.end(); idir++ ) {
    
    // Ignore "DQM source" directories if looking in client file
    if ( idir->find(sistrip::collate_) == std::string::npos ) { continue; }
    
    // Extract source directory path 
    std::string source_dir = idir->substr( 0, idir->find(":") );

    // Extract view and create key
    sistrip::View view = SiStripEnumsAndStrings::view( source_dir );
    SiStripKey path;
    if ( view == sistrip::CONTROL_VIEW ) { path = SiStripFecKey( source_dir ); }
    else if ( view == sistrip::READOUT_VIEW ) { path = SiStripFedKey( source_dir ); }
    else if ( view == sistrip::DETECTOR_VIEW ) { path = SiStripDetKey( source_dir ); }
    else { path = SiStripKey(); }
    
    // Check path is valid
    if ( path.granularity() == sistrip::UNKNOWN_GRAN ||
         path.granularity() == sistrip::UNDEFINED_GRAN ) { 
      continue; 
    }
    
    // Generate corresponding client path (removing trailing "/")
    std::string client_dir(sistrip::undefinedView_);
    if ( view == sistrip::CONTROL_VIEW ) { client_dir = SiStripFecKey( path.key() ).path(); }
    else if ( view == sistrip::READOUT_VIEW ) { client_dir = SiStripFedKey( path.key() ).path(); }
    else if ( view == sistrip::DETECTOR_VIEW ) { client_dir = SiStripDetKey( path.key() ).path(); }
    else { client_dir = SiStripKey( path.key() ).path(); }
    std::string slash = client_dir.substr( client_dir.size()-1, 1 ); 
    if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
    client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;

    // Retrieve MonitorElements from source directory
    std::vector<MonitorElement*> me_list = bei_->getContents( source_dir );

    // Iterate though MonitorElements and create CMEs
    std::vector<MonitorElement*>::iterator ime = me_list.begin(); 
    for ( ; ime != me_list.end(); ime++ ) {

      // Retrieve histogram title
      SiStripHistoTitle title( (*ime)->getName() );

      // Check histogram type
      //if ( title.histoType() != sistrip::EXPERT_HISTO ) { continue; }

      // Check granularity
      uint16_t channel = sistrip::invalid_;
      if ( title.granularity() == sistrip::APV ) {
        channel = SiStripFecKey::lldChan( title.channel() );
      } else if ( title.granularity() == sistrip::UNKNOWN_GRAN || 
                  title.granularity() == sistrip::UNDEFINED_GRAN ) {
        std::stringstream ss;
        ss << "[CommissioningHistograms::" << __func__ << "]"
           << " Unexpected granularity for histogram title: " 
           << std::endl << title 
           << " found in path " 
           << std::endl << path;
        edm::LogError(mlDqmClient_) << ss.str();
      } else {
        channel = title.channel();
      }

      // Build key 
      uint32_t key = sistrip::invalid32_;

      if ( view == sistrip::CONTROL_VIEW ) { 

        // for all runs except cabling
        SiStripFecKey temp( path.key() ); 
        key = SiStripFecKey( temp.fecCrate(),
                             temp.fecSlot(),
                             temp.fecRing(),
                             temp.ccuAddr(),
                             temp.ccuChan(),
                             channel ).key();
        mapping_[title.keyValue()] = key;

      } else if ( view == sistrip::READOUT_VIEW ) { 

        // for cabling run
        key = SiStripFedKey( path.key() ).key();
        uint32_t temp = SiStripFecKey( sistrip::invalid_,
                                       sistrip::invalid_,
                                       sistrip::invalid_,
                                       sistrip::invalid_,
                                       sistrip::invalid_,
                                       channel ).key(); // just record lld channel
        mapping_[title.keyValue()] = temp;

      } else if ( view == sistrip::DETECTOR_VIEW ) { 

        SiStripDetKey temp( path.key() ); 
        key = SiStripDetKey( temp.partition() ).key();
        mapping_[title.keyValue()] = key;

      } else { key = SiStripKey( path.key() ).key(); }
      
      // Find CME in histos map
      Histo* histo = 0;
      HistosMap::iterator ihistos = histos_.find( key );
      if ( ihistos != histos_.end() ) { 
        Histos::iterator ihis = ihistos->second.begin();
        while ( !histo && ihis < ihistos->second.end() ) {
          if ( (*ime)->getName() == (*ihis)->title_ ) { histo = *ihis; }
          ihis++;
        }
      }

      // Create CollateME if it doesn't exist
      if ( !histo ) {

        histos_[key].push_back( new Histo() );
        histo = histos_[key].back();
        histo->title_ = (*ime)->getName();

        // If histogram present in client directory, add to map
        if ( source_dir.find(sistrip::collate_) != std::string::npos ) { 
          histo->me_ = bei_->get( client_dir +"/"+(*ime)->getName() ); 
          if ( !histo->me_ ) { 
            edm::LogError(mlDqmClient_)
              << "[CommissioningHistograms::" << __func__ << "]"
              << " NULL pointer to MonitorElement!";
          }
        }

      }

    }
    
  }
  
  //printHistosMap();
  
  edm::LogVerbatim(mlDqmClient_)
    << "[CommissioningHistograms::" << __func__ << "]"
    << " Found histograms for " << histos_.size()
    << " structures in cached histogram map!";
  
}
CommissioningHistograms::Factory *const CommissioningHistograms::factory ( ) [inline, protected]

Definition at line 165 of file CommissioningHistograms.h.

References factory_.

Referenced by createSummaryHisto().

{ return factory_.get(); }
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.

                                                                            {  
}
void CommissioningHistograms::histoAnalysis ( bool  debug) [virtual]
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_, DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookProfile(), sistrip::collate_, sistrip::dir_, extract(), sistrip::FED_ADC_RANGE, DQMStore::get(), MonitorElement::getName(), sistrip::HISTO_1D, sistrip::HISTO_2D_SCATTER, sistrip::HISTO_2D_SUM, LogTrace, sistrip::mlDqmClient_, mergeVDriftHistosByStation::name, SiStripEnumsAndStrings::presentation(), sistrip::PROFILE_1D, DQMStore::pwd(), alignCSCRings::pwd, DQMStore::removeElement(), DQMStore::setCurrentFolder(), summarizeEdmComparisonLogfiles::summary, task_, sistrip::valid_, and fw3dlego::xbins.

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

                                                              {
  
  // Remember pwd 
  std::string pwd = bei_->pwd();
  bei_->setCurrentFolder( std::string(sistrip::collate_) + sistrip::dir_ + directory );
  
  // Construct histogram name 
  std::string name = SummaryGenerator::name( task_, mon, pres, view, directory );
  
  // Check if summary plot already exists and remove
  MonitorElement* me = bei_->get( bei_->pwd() + "/" + name );
  if ( me ) { 
    bei_->removeElement( name );
    me = 0;
  } 
  
  // Create summary plot
  float high = static_cast<float>( xbins );
  if ( pres == sistrip::HISTO_1D ) { 
    if ( xlow < 1. * sistrip::valid_ && 
         xhigh < 1. * sistrip::valid_ ) { 
      me = bei_->book1D( name, name, xbins, xlow, xhigh ); 
    } else {
      me = bei_->book1D( name, name, xbins, 0., high ); 
    }
  } else if ( pres == sistrip::HISTO_2D_SUM ) { 
    me = bei_->book1D( name, name, 
                                         xbins, 0., high ); 
  } else if ( pres == sistrip::HISTO_2D_SCATTER ) { 
    me = bei_->book2D( name, name, xbins, 0., high, 
                                         sistrip::FED_ADC_RANGE+1, 
                                         0., 
                                         sistrip::FED_ADC_RANGE*1. ); 
  } else if ( pres == sistrip::PROFILE_1D ) { 
    me = bei_->bookProfile( name, name, xbins, 0., high, 
                                              sistrip::FED_ADC_RANGE+1, 
                                              0., 
                                              sistrip::FED_ADC_RANGE*1. ); 
  } else { 
    me = 0; 
    edm::LogWarning(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " Unexpected presentation \"" 
      << SiStripEnumsAndStrings::presentation( pres )
      << "\" Unable to create summary plot!";
  }
  
  // Check pointer
  if ( me ) { 
    LogTrace(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " Created summary plot with name \"" << me->getName()
      << "\" in directory \""
      << bei_->pwd() << "\"!"; 
  } else {
    edm::LogWarning(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " NULL pointer to MonitorElement!"
      << " Unable to create summary plot!";
  }
  
  // Extract root object
  TH1* summary = ExtractTObject<TH1>().extract( me ); 
  if ( !summary ) {
    edm::LogWarning(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " Unable to extract root object!"
      << " Returning NULL pointer!"; 
  }
  
  // Return to pwd
  bei_->setCurrentFolder( pwd );
  
  return summary;
  
}
const CommissioningHistograms::HistosMap & CommissioningHistograms::histos ( ) const [inline, protected]
const CommissioningHistograms::FedToFecMap & CommissioningHistograms::mapping ( ) const [inline, protected]

Definition at line 167 of file CommissioningHistograms.h.

References mapping_.

Referenced by FastFedCablingHistograms::histoAnalysis().

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

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

Definition at line 488 of file CommissioningHistograms.cc.

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

Referenced by SiStripCommissioningOfflineClient::beginRun().

                                            {
  Analyses::iterator ianal = data().begin();
  Analyses::iterator janal = data().end();
  for ( ; ianal != janal; ++ianal ) { 
    if ( ianal->second ) { 
      std::stringstream ss;
      ianal->second->print( ss ); 
      if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str(); 
      } else { edm::LogWarning(mlDqmClient_) << ss.str(); }
    }
  }
}
void CommissioningHistograms::printHistosMap ( ) [protected]

Definition at line 533 of file CommissioningHistograms.cc.

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

                                             {
  LogTrace(mlDqmClient_)
    << "[CommissioningHistograms::" << __func__ << "]"
    << " Printing histogram map, which has "
    << histos_.size() << " entries...";
  HistosMap::const_iterator ihistos = histos_.begin();
  for ( ; ihistos != histos_.end(); ihistos++ ) {
    std::stringstream ss;
    ss << " Found " << ihistos->second.size()
       << " histogram(s) for key: " << std::endl
       << SiStripFedKey(ihistos->first) << std::endl;
    Histos::const_iterator ihisto = ihistos->second.begin();
    for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
      if ( *ihisto ) { (*ihisto)->print(ss); }
      else { ss << " NULL pointer to Histo object!"; }
    }
    LogTrace(mlDqmClient_) << ss.str();
  }
}
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().

                                           {

  std::stringstream good;
  std::stringstream bad;
  
  Analyses::iterator ianal = data().begin();
  Analyses::iterator janal = data().end();
  for ( ; ianal != janal; ++ianal ) { 
    if ( ianal->second ) { 
      if ( ianal->second->isValid() ) { ianal->second->summary( good ); }
      else { ianal->second->summary( bad ); }
    }
  }

  if ( good.str().empty() ) { good << "None found!"; }
  LogTrace(mlDqmClient_) 
    << "[CommissioningHistograms::" << __func__ << "]"
    << " Printing summary of good analyses:" << "\n"
    << good.str();
  
  if ( bad.str().empty() ) { return; } //@@ bad << "None found!"; }
  LogTrace(mlDqmClient_) 
    << "[CommissioningHistograms::" << __func__ << "]"
    << " Printing summary of bad analyses:" << "\n"
    << bad.str();
  
}
const edm::ParameterSet & CommissioningHistograms::pset ( ) const [inline, protected]
void CommissioningHistograms::remove ( std::string  pattern = "")

Definition at line 612 of file CommissioningHistograms.cc.

References bei_, DQMStore::cd(), DQMStore::dirExists(), LogTrace, sistrip::mlDqmClient_, DQMStore::removeContents(), DQMStore::rmdir(), and DQMStore::setVerbose().

Referenced by SiStripCommissioningOfflineClient::beginRun().

                                                        {
  
  if ( !bei_ ) { 
    edm::LogError(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " NULL pointer to DQMStore!"; 
    return;
  }
  
  bei_->setVerbose(0);

  LogTrace(mlDqmClient_)
    << "[CommissioningHistograms::" << __func__ << "]"
    << " Removing histograms...";
  
  if ( !pattern.empty() ) {
    
    if ( bei_->dirExists(pattern) ) {
      bei_->rmdir(pattern); 
    }
    
    LogTrace(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " Removing directories (and MonitorElements"
      << " therein) that match the pattern \""
      << pattern << "\"";
    
  } else {
    
    bei_->cd();
    bei_->removeContents(); 
    
    if( bei_->dirExists("Collector") ) {
      bei_->rmdir("Collector");
    }
    if( bei_->dirExists("EvF") ) {
      bei_->rmdir("EvF");
    }
    if( bei_->dirExists("SiStrip") ) {
      bei_->rmdir("SiStrip");
    }

    LogTrace(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " Removing \"DQM source\" directories (and MonitorElements therein)";
    
  }

  LogTrace(mlDqmClient_)
    << "[CommissioningHistograms::" << __func__ << "]"
    << " Removed histograms!";

  bei_->setVerbose(1);

}
uint32_t CommissioningHistograms::runNumber ( DQMStore * const  bei,
const std::vector< std::string > &  contents 
) [static]

Definition at line 82 of file CommissioningHistograms.cc.

References DQMStore::bookString(), sistrip::collate_, sistrip::dir_, DQMStore::get(), DQMStore::getContents(), LogTrace, sistrip::mlDqmClient_, getHLTPrescaleColumns::path, SiStripKey::path(), pos, DTTTrigCorrFirst::run, sistrip::runNumber_, DQMStore::setCurrentFolder(), cmsCodeRules::pickleFileParser::slash, indexGen::title, and relativeConstraints::value.

                                                                                    {
  
  // Check if histograms present
  if ( contents.empty() ) { 
    edm::LogError(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " Found no histograms!";
    return 0; 
  }
  
  // Iterate through added contents
  std::vector<std::string>::const_iterator istr = contents.begin();
  while ( istr != contents.end() ) {
    
    // Extract source directory path 
    std::string source_dir = istr->substr( 0, istr->find(":") );
    
    // Generate corresponding client path (removing trailing "/")
    SiStripFecKey path( source_dir );
    std::string client_dir = path.path();
    std::string slash = client_dir.substr( client_dir.size()-1, 1 ); 
    if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
    client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
    
    // Iterate though MonitorElements from source directory
    std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
    std::vector<MonitorElement*>::iterator ime = me_list.begin(); 
    for ( ; ime != me_list.end(); ime++ ) {
      
      if ( !(*ime) ) {
        edm::LogError(mlDqmClient_)
          << "[CommissioningHistograms::" << __func__ << "]"
          << " NULL pointer to MonitorElement!";
        continue;
      }

      // Search for run type in string
      std::string title = (*ime)->getName();
      std::string::size_type pos = title.find( sistrip::runNumber_ );
      
      // Extract run number from string 
      if ( pos != std::string::npos ) { 
        std::string value = title.substr( pos+sizeof(sistrip::runNumber_) , std::string::npos ); 
        if ( !value.empty() ) { 
          LogTrace(mlDqmClient_)
            << "[CommissioningHistograms::" << __func__ << "]"
            << " Found string \"" <<  title.substr(pos,std::string::npos)
            << "\" with value \"" << value << "\"";
          if ( !(bei->get(client_dir+"/"+title.substr(pos,std::string::npos))) ) { 
            bei->setCurrentFolder(client_dir);
            bei->bookString( title.substr(pos,std::string::npos), value ); 
            LogTrace(mlDqmClient_)
              << "[CommissioningHistograms::" << __func__ << "]"
              << " Booked string \"" << title.substr(pos,std::string::npos)
              << "\" in directory \"" << client_dir << "\"";
          }
          uint32_t run;
          std::stringstream ss;
          ss << value;
          ss >> std::dec >> run;
          return run; 
        }
      }

    }

    istr++;
    
  }
  return 0;
}
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 DQMStore::bookString(), sistrip::collate_, sistrip::dir_, DQMStore::get(), DQMStore::getContents(), LogTrace, sistrip::mlDqmClient_, getHLTPrescaleColumns::path, SiStripKey::path(), pos, DQMStore::setCurrentFolder(), cmsCodeRules::pickleFileParser::slash, sistrip::taskId_, indexGen::title, sistrip::UNKNOWN_RUN_TYPE, and relativeConstraints::value.

                                                                                          {
  
  // Check if histograms present
  if ( contents.empty() ) { 
    edm::LogError(mlDqmClient_)
      << "[CommissioningHistograms::" << __func__ << "]"
      << " Found no histograms!";
    return sistrip::UNKNOWN_RUN_TYPE; 
  }
  
  // Iterate through added contents
  std::vector<std::string>::const_iterator istr = contents.begin();
  while ( istr != contents.end() ) {

    // Extract source directory path 
    std::string source_dir = istr->substr( 0, istr->find(":") );

    // Generate corresponding client path (removing trailing "/")
    SiStripFecKey path( source_dir );
    std::string client_dir = path.path();
    std::string slash = client_dir.substr( client_dir.size()-1, 1 ); 
    if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); } 
    client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir;
    
    // Iterate though MonitorElements from source directory
    std::vector<MonitorElement*> me_list = bei->getContents( source_dir );

    if ( me_list.empty() ) {
      edm::LogError(mlDqmClient_)
        << "[CommissioningHistograms::" << __func__ << "]"
        << " No MonitorElements found in dir " << source_dir;
      return sistrip::UNKNOWN_RUN_TYPE;
    }

    std::vector<MonitorElement*>::iterator ime = me_list.begin(); 
    for ( ; ime != me_list.end(); ime++ ) {

      if ( !(*ime) ) {
        edm::LogError(mlDqmClient_)
          << "[CommissioningHistograms::" << __func__ << "]"
          << " NULL pointer to MonitorElement!";
        continue;
      }

      // Search for run type in string
      std::string title = (*ime)->getName();
      std::string::size_type pos = title.find( sistrip::taskId_ );

      // Extract commissioning task from string 
      if ( pos != std::string::npos ) { 
        std::string value = title.substr( pos+sizeof(sistrip::taskId_) , std::string::npos ); 
        if ( !value.empty() ) { 
          LogTrace(mlDqmClient_)
            << "[CommissioningHistograms::" << __func__ << "]"
            << " Found string \"" <<  title.substr(pos,std::string::npos)
            << "\" with value \"" << value << "\"";
          if ( !(bei->get(client_dir+sistrip::dir_+title.substr(pos,std::string::npos))) ) { 
            bei->setCurrentFolder(client_dir);
            bei->bookString( title.substr(pos,std::string::npos), value ); 
            LogTrace(mlDqmClient_)
              << "[CommissioningHistograms::" << __func__ << "]"
              << " Booked string \"" << title.substr(pos,std::string::npos)
              << "\" in directory \"" << client_dir << "\"";
          }
          return SiStripEnumsAndStrings::runType( value ); 
        }
      }

    }

    istr++;
    
  }

  edm::LogError(mlDqmClient_)
    << "[CommissioningHistograms::" << __func__ << "]"
    << " Unable to extract RunType!";
  return sistrip::UNKNOWN_RUN_TYPE;

}
void CommissioningHistograms::save ( std::string &  path,
uint32_t  run_number = 0 
)

Definition at line 670 of file CommissioningHistograms.cc.

References bei_, sistrip::collate_, dir, sistrip::dqmClientFileName_, LogTrace, sistrip::mlDqmClient_, NULL, getHLTPrescaleColumns::path, and DQMStore::save().

Referenced by SiStripCommissioningOfflineClient::beginRun().

                                                          {
  
  // Construct path and filename
  std::stringstream ss; 

  if ( !path.empty() ) { 

    ss << path; 
    if ( ss.str().find(".root") == std::string::npos ) { ss << ".root"; }

  } else {

    // Retrieve SCRATCH directory
    std::string scratch = "SCRATCH";
    std::string dir = "";
    if ( getenv(scratch.c_str()) != NULL ) { 
      dir = getenv(scratch.c_str()); 
    }
    
    // Add directory path 
    if ( !dir.empty() ) { ss << dir << "/"; }
    else { ss << "/tmp/"; }
    
    // Add filename with run number and ".root" extension
    ss << sistrip::dqmClientFileName_ << "_" 
       << std::setfill('0') << std::setw(8) << run_number
       << ".root";
    
  }
  
  // Save file with appropriate filename
  LogTrace(mlDqmClient_)
    << "[CommissioningHistograms::" << __func__ << "]"
    << " Saving histograms to root file"
    << " (This may take some time!)";
  path = ss.str();
  bei_->save( path, sistrip::collate_ ); 
  edm::LogVerbatim(mlDqmClient_)
    << "[CommissioningHistograms::" << __func__ << "]"
    << " Saved histograms to root file \""
    << ss.str() << "\"!";
  
}
const sistrip::RunType & CommissioningHistograms::task ( ) const [inline, protected]

Definition at line 162 of file CommissioningHistograms.h.

References task_.

Referenced by CalibrationHistograms::histoAnalysis().

{ return task_; }

Member Data Documentation

Reimplemented in DaqScopeModeHistograms, FedCablingHistograms, and FedTimingHistograms.

Definition at line 150 of file CommissioningHistograms.h.

Referenced by data().

std::auto_ptr<Factory> CommissioningHistograms::factory_ [protected]

Definition at line 154 of file CommissioningHistograms.h.

Referenced by extractHistograms(), and mapping().

Definition at line 156 of file CommissioningHistograms.h.

Referenced by pset().

Definition at line 146 of file CommissioningHistograms.h.

Referenced by histogram(), and task().