Go to the documentation of this file.00001 #include "DQM/SiStripCommissioningSummary/interface/NoiseSummaryFactory.h"
00002 #include "CondFormats/SiStripObjects/interface/NoiseAnalysis.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 NoiseSummaryFactory::extract( Iterator iter ) {
00013
00014 NoiseAnalysis* anal = dynamic_cast<NoiseAnalysis*>( 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->noise()[0];
00024 noise[1] = anal->noise()[1];
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->noiseMean()[0];
00057 value[1][0] = anal->noiseMean()[1];
00058 } else if ( mon_ == sistrip::NOISE_SPREAD ) {
00059 value[0][0] = anal->noiseSpread()[0];
00060 value[1][0] = anal->noiseSpread()[1];
00061 } else if ( mon_ == sistrip::NOISE_MAX ) {
00062 value[0][0] = anal->noiseMax()[0];
00063 value[1][0] = anal->noiseMax()[1];
00064 } else if ( mon_ == sistrip::NOISE_MIN ) {
00065 value[0][0] = anal->noiseMin()[0];
00066 value[1][0] = anal->noiseMin()[1];
00067 } else if ( mon_ == sistrip::NUM_OF_DEAD ) {
00068 value[0][0] = 1. * anal->dead()[0].size();
00069 value[1][0] = 1. * anal->dead()[1].size();
00070 } else if ( mon_ == sistrip::NUM_OF_NOISY ) {
00071 value[0][0] = 1. * anal->noisy()[0].size();
00072 value[1][0] = 1. * anal->noisy()[1].size();
00073 } else {
00074 edm::LogWarning(mlSummaryPlots_)
00075 << "[SummaryPlotFactory::" << __func__ << "]"
00076 << " Unexpected monitorable: "
00077 << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ );
00078 return;
00079 }
00080
00081 if ( !all_strips ) {
00082
00083 SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_,
00084 SummaryPlotFactoryBase::gran_,
00085 iter->first,
00086 value[0][0] );
00087
00088 SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_,
00089 SummaryPlotFactoryBase::gran_,
00090 iter->first,
00091 value[1][0] );
00092
00093 } else {
00094
00095 for ( uint16_t istr = 0; istr < value[0].size(); istr++ ) {
00096 SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_,
00097 SummaryPlotFactoryBase::gran_,
00098 iter->first,
00099 value[0][istr] );
00100 }
00101
00102 for ( uint16_t istr = 0; istr < value[1].size(); istr++ ) {
00103 SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_,
00104 SummaryPlotFactoryBase::gran_,
00105 iter->first,
00106 value[1][istr] );
00107 }
00108
00109 }
00110
00111 }
00112
00113
00114
00115 void NoiseSummaryFactory::format() {
00116
00117 if ( mon_ == sistrip::PEDESTALS_ALL_STRIPS ) {
00118 generator_->axisLabel( "Pedestal value [adc]" );
00119 } else if ( mon_ == sistrip::PEDESTALS_MEAN ) {
00120 } else if ( mon_ == sistrip::PEDESTALS_SPREAD ) {
00121 } else if ( mon_ == sistrip::PEDESTALS_MAX ) {
00122 } else if ( mon_ == sistrip::PEDESTALS_MIN ) {
00123 } else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) {
00124 generator_->axisLabel( "Noise [adc]" );
00125 } else if ( mon_ == sistrip::NOISE_MEAN ) {
00126 } else if ( mon_ == sistrip::NOISE_SPREAD ) {
00127 } else if ( mon_ == sistrip::NOISE_MAX ) {
00128 } else if ( mon_ == sistrip::NOISE_MIN ) {
00129 } else if ( mon_ == sistrip::NUM_OF_DEAD ) {
00130 } else if ( mon_ == sistrip::NUM_OF_NOISY ) {
00131 } else {
00132 edm::LogWarning(mlSummaryPlots_)
00133 << "[SummaryPlotFactory::" << __func__ << "]"
00134 << " Unexpected SummaryHisto value:"
00135 << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ );
00136 }
00137
00138 }