CMS 3D CMS Logo

Public Member Functions

SummaryGeneratorReadoutView Class Reference

Fills "summary histograms" in FED or "readout" view. More...

#include <SummaryGeneratorReadoutView.h>

Inheritance diagram for SummaryGeneratorReadoutView:
SummaryGenerator

List of all members.

Public Member Functions

void fill (const std::string &directory_level, const sistrip::Granularity &, const uint32_t &key, const float &value, const float &error)
 SummaryGeneratorReadoutView ()
virtual ~SummaryGeneratorReadoutView ()

Detailed Description

Fills "summary histograms" in FED or "readout" view.

Author:
M.Wingham, R.Bainbridge

Definition at line 12 of file SummaryGeneratorReadoutView.h.


Constructor & Destructor Documentation

SummaryGeneratorReadoutView::SummaryGeneratorReadoutView ( )

Definition at line 15 of file SummaryGeneratorReadoutView.cc.

                                                         :
  SummaryGenerator("SummaryGeneratorReadoutView") {;}
virtual SummaryGeneratorReadoutView::~SummaryGeneratorReadoutView ( ) [inline, virtual]

Definition at line 18 of file SummaryGeneratorReadoutView.h.

{;}

Member Function Documentation

void SummaryGeneratorReadoutView::fill ( const std::string &  directory_level,
const sistrip::Granularity granularity,
const uint32_t &  key,
const float &  value,
const float &  error 
) [virtual]

Reimplemented from SummaryGenerator.

Definition at line 20 of file SummaryGeneratorReadoutView.cc.

References sistrip::APV, newFWLiteAna::bin, sistrip::dir_, SummaryGenerator::entries_, sistrip::FE_CHAN, sistrip::FE_DRIVER, sistrip::FE_UNIT, SiStripFedKey::feChan(), SiStripFedKey::fedApv(), SiStripFedKey::fedId(), SiStripFedKey::feUnit(), SiStripEnumsAndStrings::granularity(), sistrip::invalid_, SiStripFedKey::isValid(), SummaryGenerator::map_, sistrip::mlSummaryPlots_, getHLTPrescaleColumns::path, SiStripKey::path(), pos, alignCSCRings::pwd, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, sistrip::UNDEFINED_GRAN, sistrip::UNKNOWN_GRAN, and relativeConstraints::value.

                                                             {
  
  // Check granularity is recognised
  std::string gran = SiStripEnumsAndStrings::granularity( granularity );
  
  if ( granularity != sistrip::UNDEFINED_GRAN &&
       granularity != sistrip::FE_DRIVER &&
       granularity != sistrip::FE_UNIT &&
       granularity != sistrip::FE_CHAN &&
       granularity != sistrip::APV ) {
    std::string temp = SiStripEnumsAndStrings::granularity( sistrip::FE_CHAN );
    edm::LogWarning(mlSummaryPlots_) 
      << "[SummaryGeneratorReadoutView::" << __func__ << "]"
      << " Unexpected granularity requested: " << gran;
    return;
  }
  
  // Create key representing "top level" directory 
  SiStripFedKey top( top_level_dir );
  
  // Path and std::string for "present working directory" as defined by device key
  SiStripFedKey path( device_key );
  std::string pwd = path.path();
  
  // Check path is "within" top-level directory structure 
  if ( top.isValid() &&
       path.isValid() &&
       ( path.fedId() == top.fedId() || !top.fedId() ) && 
       ( path.feUnit() == top.feUnit() || !top.feUnit() ) && 
       ( path.feChan() == top.feChan() || !top.feChan() ) ) {
    
    // Extract path and std::string corresponding to "top-level down to granularity" 
    std::string sub_dir = pwd;
    size_t pos = pwd.find( gran );
    if ( pos != std::string::npos ) {
      sub_dir = pwd.substr( 0, pwd.find(sistrip::dir_,pos) );
    } else if ( granularity == sistrip::UNKNOWN_GRAN ) {
      sub_dir = pwd;
    }
    
    SiStripFedKey sub_path( sub_dir );

//     LogTrace(mlTest_)
//       << "TEST " 
//       << "sub_path " << sub_path; 
    
    // Construct bin label
    std::stringstream bin;
    if ( sub_path.fedId()  && sub_path.fedId()  != sistrip::invalid_ ) { bin << std::setw(3) << std::setfill('0') << sub_path.fedId(); }
    if ( sub_path.feUnit() && sub_path.feUnit() != sistrip::invalid_ ) { bin << sistrip::dir_ << std::setw(1) << std::setfill('0') << sub_path.feUnit(); }
    if ( sub_path.feChan() && sub_path.feChan() != sistrip::invalid_ ) { bin << sistrip::dir_ << std::setw(2) << std::setfill('0') << sub_path.feChan(); }
    if ( sub_path.fedApv() && sub_path.fedApv() != sistrip::invalid_ ) { bin << sistrip::dir_ << std::setw(1) << std::setfill('0') << sub_path.fedApv(); }
//     if ( granularity == sistrip::APV &&
//       path.fedApv() != sistrip::invalid_ ) { bin << sistrip::dot_ << path.fedApv(); }
    
    // Store "value" in appropriate std::vector within std::map (key is bin label)
    map_[bin.str()].push_back( Data(value,error) );
    entries_ += value;
//     LogTrace(mlTest_)
//       << "TEST " 
//       << " filling " << bin.str() 
//       << " " << value 
//       << " " << error;
    
    
  } else {
//     std::stringstream ss;
//     ss << "[SummaryGeneratorReadoutView::" << __func__ << "]"
//        << " Path for 'pwd' is not within top-level directory!" << std::endl
//        << "Top-level: " << top << std::endl
//        << "Path: " << path << std::endl;
//     edm::LogWarning(mlSummaryPlots_) << ss.str();
  }
  
}