CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/DQM/SiStripCommissioningSummary/src/PedsOnlySummaryFactory.cc

Go to the documentation of this file.
00001 #include "DQM/SiStripCommissioningSummary/interface/PedsOnlySummaryFactory.h"
00002 #include "CondFormats/SiStripObjects/interface/PedsOnlyAnalysis.h"
00003 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 #include <iostream>
00006 #include <sstream>
00007 
00008 using namespace sistrip;
00009 
00010 // -----------------------------------------------------------------------------
00011 //
00012 void PedsOnlySummaryFactory::extract( Iterator iter ) {
00013   
00014   PedsOnlyAnalysis* anal = dynamic_cast<PedsOnlyAnalysis*>( iter->second );
00015   if ( !anal ) { return; }
00016     
00017   std::vector<float> temp(128, 1. * sistrip::invalid_ );
00018   std::vector< std::vector<float> > value( 2, temp );
00019   std::vector< std::vector<float> > peds( 2, temp );
00020   std::vector< std::vector<float> > noise( 2, temp );
00021   peds[0] = anal->peds()[0];
00022   peds[1] = anal->peds()[1];
00023   noise[0] = anal->raw()[0]; //@@ raw noise
00024   noise[1] = anal->raw()[1]; //@@ raw noise
00025 
00026   bool all_strips = false;
00027   if ( mon_ == sistrip::PEDESTALS_ALL_STRIPS ) {
00028     all_strips = true;
00029     uint16_t bins = peds[0].size();
00030     if ( peds[0].size() < peds[1].size() ) { bins = peds[1].size(); }
00031     for ( uint16_t iped = 0; iped < bins; iped++ ) {
00032       value[0][iped] = peds[0][iped]; 
00033       value[1][iped] = peds[1][iped];  
00034     }
00035   } else if ( mon_ == sistrip::PEDESTALS_MEAN ) {
00036     value[0][0] = anal->pedsMean()[0];
00037     value[1][0] = anal->pedsMean()[1];
00038   } else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { 
00039     value[0][0] = anal->pedsSpread()[0]; 
00040     value[1][0] = anal->pedsSpread()[1]; 
00041   } else if ( mon_ == sistrip::PEDESTALS_MAX ) { 
00042     value[0][0] = anal->pedsMax()[0]; 
00043     value[1][0] = anal->pedsMax()[1];
00044   } else if ( mon_ == sistrip::PEDESTALS_MIN ) { 
00045     value[0][0] = anal->pedsMin()[0]; 
00046     value[1][0] = anal->pedsMin()[1]; 
00047   } else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) {
00048     all_strips = true;
00049     uint16_t bins = noise[0].size();
00050     if ( noise[0].size() < noise[1].size() ) { bins = noise[1].size(); }
00051     for ( uint16_t inoise = 0; inoise < bins; inoise++ ) {
00052       value[0][inoise] = noise[0][inoise]; 
00053       value[1][inoise] = noise[1][inoise]; 
00054     }
00055   } else if ( mon_ == sistrip::NOISE_MEAN ) {
00056     value[0][0] = anal->rawMean()[0];
00057     value[1][0] = anal->rawMean()[1];
00058   } else if ( mon_ == sistrip::NOISE_SPREAD ) { 
00059     value[0][0] = anal->rawSpread()[0]; 
00060     value[1][0] = anal->rawSpread()[1]; 
00061   } else if ( mon_ == sistrip::NOISE_MAX ) { 
00062     value[0][0] = anal->rawMax()[0]; 
00063     value[1][0] = anal->rawMax()[1]; 
00064   } else if ( mon_ == sistrip::NOISE_MIN ) { 
00065     value[0][0] = anal->rawMin()[0]; 
00066     value[1][0] = anal->rawMin()[1]; 
00067   } else { 
00068     edm::LogWarning(mlSummaryPlots_)
00069       << "[SummaryPlotFactory::" << __func__ << "]" 
00070       << " Unexpected monitorable: "
00071       << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ );
00072     return; 
00073   }
00074 
00075   if ( !all_strips ) {
00076 
00077     SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, 
00078                                                  SummaryPlotFactoryBase::gran_, 
00079                                                  iter->first, 
00080                                                  value[0][0] );
00081     
00082     SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, 
00083                                                  SummaryPlotFactoryBase::gran_, 
00084                                                  iter->first, 
00085                                                  value[1][0] );
00086 
00087   } else {
00088 
00089     for ( uint16_t istr = 0; istr < value[0].size(); istr++ ) {
00090       SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, 
00091                                                    SummaryPlotFactoryBase::gran_, 
00092                                                    iter->first, 
00093                                                    value[0][istr] );
00094     }
00095     
00096     for ( uint16_t istr = 0; istr < value[1].size(); istr++ ) {
00097       SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, 
00098                                                    SummaryPlotFactoryBase::gran_, 
00099                                                    iter->first, 
00100                                                    value[1][istr] );
00101     }
00102 
00103   }
00104 
00105 }
00106 
00107 // -----------------------------------------------------------------------------
00108 //
00109 void PedsOnlySummaryFactory::format() {
00110   
00111   if ( mon_ == sistrip::PEDESTALS_ALL_STRIPS ) {
00112     generator_->axisLabel( "Pedestal value [adc]" );
00113   } else if ( mon_ == sistrip::PEDESTALS_MEAN ) {
00114   } else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { 
00115   } else if ( mon_ == sistrip::PEDESTALS_MAX ) { 
00116   } else if ( mon_ == sistrip::PEDESTALS_MIN ) { 
00117   } else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) {
00118     generator_->axisLabel( "Noise [adc]" );
00119   } else if ( mon_ == sistrip::NOISE_MEAN ) {
00120   } else if ( mon_ == sistrip::NOISE_SPREAD ) { 
00121   } else if ( mon_ == sistrip::NOISE_MAX ) { 
00122   } else if ( mon_ == sistrip::NOISE_MIN ) { 
00123   } else if ( mon_ == sistrip::NUM_OF_DEAD ) { 
00124   } else if ( mon_ == sistrip::NUM_OF_NOISY ) { 
00125   } else { 
00126     edm::LogWarning(mlSummaryPlots_)
00127       << "[SummaryPlotFactory::" << __func__ << "]" 
00128       << " Unexpected SummaryHisto value:"
00129       << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ );
00130   } 
00131 
00132 }