CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQM/SiStripCommissioningSummary/src/PedsFullNoiseSummaryFactory.cc

Go to the documentation of this file.
00001 #include "DQM/SiStripCommissioningSummary/interface/PedsFullNoiseSummaryFactory.h"
00002 #include "CondFormats/SiStripObjects/interface/PedsFullNoiseAnalysis.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 PedsFullNoiseSummaryFactory::extract( Iterator iter ) {
00013   
00014   PedsFullNoiseAnalysis* anal = dynamic_cast<PedsFullNoiseAnalysis*>( 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   std::vector< std::vector<float> > ks( 2, temp );
00022   std::vector< std::vector<float> > noiseG( 2, temp );
00023   std::vector< std::vector<float> > bin84( 2, temp );
00024   std::vector< std::vector<float> > chi2( 2, temp );
00025   std::vector< std::vector<float> > signif( 2, temp );
00026   std::vector< std::vector<float> > rms( 2, temp );
00027   peds[0]       = anal->peds()[0];
00028   peds[1]       = anal->peds()[1];
00029   noise[0]      = anal->noise()[0];
00030   noise[1]      = anal->noise()[1];
00031   ks[0]         = anal->ksProb()[0]; // dummy values //replaced with ksProb now, wing
00032   ks[1]         = anal->ksProb()[1]; // dummy values
00033   noiseG[0]     = anal->noiseGaus()[0];
00034   noiseG[1]     = anal->noiseGaus()[1];
00035   bin84[0]      = anal->noiseBin84()[0];
00036   bin84[1]      = anal->noiseBin84()[1];
00037   rms[0]        = anal->noiseRMS()[0];
00038   rms[1]        = anal->noiseRMS()[1];
00039   chi2[0]     = anal->chi2Prob()[0];
00040   chi2[1]     = anal->chi2Prob()[1];
00041   signif[0]     = anal->noiseSignif()[0];
00042   signif[1]     = anal->noiseSignif()[1];
00043   bool all_strips = false;
00044   if ( mon_ == sistrip::PEDESTALS_ALL_STRIPS ) {
00045     all_strips = true;
00046     uint16_t bins = peds[0].size();
00047     if ( peds[0].size() < peds[1].size() ) { bins = peds[1].size(); }
00048     for ( uint16_t iped = 0; iped < bins; iped++ ) {
00049       value[0][iped] = peds[0][iped]; 
00050       value[1][iped] = peds[1][iped];  
00051     }
00052   } else if ( mon_ == sistrip::PEDESTALS_MEAN ) {
00053     value[0][0] = anal->pedsMean()[0];
00054     value[1][0] = anal->pedsMean()[1];
00055   } else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { 
00056     value[0][0] = anal->pedsSpread()[0];
00057     value[1][0] = anal->pedsSpread()[1]; 
00058   } else if ( mon_ == sistrip::PEDESTALS_MAX ) { 
00059     value[0][0] = anal->pedsMax()[0]; 
00060     value[1][0] = anal->pedsMax()[1];
00061   } else if ( mon_ == sistrip::PEDESTALS_MIN ) { 
00062     value[0][0] = anal->pedsMin()[0]; 
00063     value[1][0] = anal->pedsMin()[1]; 
00064   } else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) {
00065     all_strips = true;
00066     uint16_t bins = noise[0].size();
00067     if ( noise[0].size() < noise[1].size() ) { bins = noise[1].size(); }
00068     for ( uint16_t inoise = 0; inoise < bins; inoise++ ) {
00069       value[0][inoise] = noise[0][inoise]; 
00070       value[1][inoise] = noise[1][inoise]; 
00071     }
00072   } else if ( mon_ == sistrip::NOISE_KS_ALL_STRIPS ) {
00073     all_strips = true;
00074     uint16_t bins = ks[0].size();
00075     if ( ks[0].size() < ks[1].size() ) { bins = ks[1].size(); }
00076     for ( uint16_t iks = 0; iks < bins; iks++ ) {
00077       value[0][iks] = ks[0][iks];
00078       value[1][iks] = ks[1][iks];
00079     }
00080   } else if ( mon_ == sistrip::NOISE_CHI2_ALL_STRIPS ) {
00081     all_strips = true;
00082     uint16_t bins = chi2[0].size();
00083     if ( ks[0].size() < chi2[1].size() ) { bins = chi2[1].size(); }
00084     for ( uint16_t iks = 0; iks < bins; iks++ ) {
00085       value[0][iks] = chi2[0][iks];
00086       value[1][iks] = chi2[1][iks];
00087     }
00088   } else if ( mon_ == sistrip::NOISE_GAUS_ALL_STRIPS ) {
00089     all_strips = true;
00090     uint16_t bins = noiseG[0].size();
00091         if ( noiseG[0].size() < noiseG[1].size() ) { bins = noiseG[1].size(); }
00092     for ( uint16_t iks = 0; iks < bins; iks++ ) {
00093       value[0][iks] = noiseG[0][iks];
00094       value[1][iks] = noiseG[1][iks];     
00095         }
00096   } else if ( mon_ == sistrip::NOISE_BIN_84_ALL_STRIPS ) {
00097     all_strips = true;
00098     uint16_t bins = bin84[0].size();
00099         if ( bin84[0].size() < bin84[1].size() ) { bins = bin84[1].size(); }
00100     for ( uint16_t iks = 0; iks < bins; iks++ ) {
00101       value[0][iks] = bin84[0][iks];
00102       value[1][iks] = bin84[1][iks];     
00103         }
00104   }     else if ( mon_ == sistrip::NOISE_RMS_ALL_STRIPS ) {
00105     all_strips = true;
00106     uint16_t bins = rms[0].size();
00107         if ( rms[0].size() < rms[1].size() ) { bins = rms[1].size(); }
00108     for ( uint16_t iks = 0; iks < bins; iks++ ) {
00109       value[0][iks] = rms[0][iks];
00110       value[1][iks] = rms[1][iks];     
00111         }
00112   } else if ( mon_ == sistrip::NOISE_SIGNIF_ALL_STRIPS ) {
00113     all_strips = true;
00114     uint16_t bins = signif[0].size();
00115         if ( signif[0].size() < signif[1].size() ) { bins = signif[1].size(); }
00116     for ( uint16_t iks = 0; iks < bins; iks++ ) {
00117       value[0][iks] = signif[0][iks];
00118       value[1][iks] = signif[1][iks];     
00119         }
00120   } else if ( mon_ == sistrip::NOISE_MEAN ) {
00121     value[0][0] = anal->noiseMean()[0];
00122     value[1][0] = anal->noiseMean()[1];
00123   } else if ( mon_ == sistrip::NOISE_SPREAD ) { 
00124     value[0][0] = anal->noiseSpread()[0]; 
00125     value[1][0] = anal->noiseSpread()[1];
00126   } else if ( mon_ == sistrip::NOISE_MAX ) { 
00127     value[0][0] = anal->noiseMax()[0]; 
00128     value[1][0] = anal->noiseMax()[1]; 
00129   } else if ( mon_ == sistrip::NOISE_MIN ) { 
00130     value[0][0] = anal->noiseMin()[0]; 
00131     value[1][0] = anal->noiseMin()[1]; 
00132   } else if ( mon_ == sistrip::NUM_OF_DEAD ) { 
00133     value[0][0] = 1. * anal->dead()[0].size(); 
00134     value[1][0] = 1. * anal->dead()[1].size();
00135   } else if ( mon_ == sistrip::NUM_OF_NOISY ) { 
00136     value[0][0] = 1. * anal->noisy()[0].size(); 
00137     value[1][0] = 1. * anal->noisy()[1].size();
00138   } else { 
00139     edm::LogWarning(mlSummaryPlots_)
00140       << "[SummaryPlotFactory::" << __func__ << "]" 
00141       << " Unexpected monitorable: "
00142       << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ );
00143     return; 
00144   }
00145 
00146   if ( !all_strips ) {
00147 
00148     SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, 
00149                                                  SummaryPlotFactoryBase::gran_, 
00150                                                  iter->first, 
00151                                                  value[0][0] );
00152     
00153     SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, 
00154                                                  SummaryPlotFactoryBase::gran_, 
00155                                                  iter->first, 
00156                                                  value[1][0] );
00157 
00158   } 
00159   else {
00160 
00161     for ( uint16_t istr = 0; istr < value[0].size(); istr++ ) {
00162       SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, 
00163                                                    SummaryPlotFactoryBase::gran_, 
00164                                                    iter->first, 
00165                                                    value[0][istr] );
00166     }
00167     
00168     for ( uint16_t istr = 0; istr < value[1].size(); istr++ ) {
00169       SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, 
00170                                                    SummaryPlotFactoryBase::gran_, 
00171                                                    iter->first, 
00172                                                    value[1][istr] );
00173     }
00174   }
00175 }
00176 
00177 // -----------------------------------------------------------------------------
00178 //
00179 void PedsFullNoiseSummaryFactory::format() {
00180   
00181   if ( mon_ == sistrip::PEDESTALS_ALL_STRIPS ) {
00182     generator_->axisLabel( "Pedestal value [adc]" );
00183   } else if ( mon_ == sistrip::PEDESTALS_MEAN ) {
00184   } else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { 
00185   } else if ( mon_ == sistrip::PEDESTALS_MAX ) { 
00186   } else if ( mon_ == sistrip::PEDESTALS_MIN ) { 
00187   } else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) {
00188     generator_->axisLabel( "Noise [adc]" );
00189   } else if ( mon_ == sistrip::NOISE_MEAN ) {
00190   } else if ( mon_ == sistrip::NOISE_SPREAD ) { 
00191   } else if ( mon_ == sistrip::NOISE_MAX ) { 
00192   } else if ( mon_ == sistrip::NOISE_MIN ) { 
00193   } else if ( mon_ == sistrip::NUM_OF_DEAD ) { 
00194   } else if ( mon_ == sistrip::NUM_OF_NOISY ) { 
00195   } else if ( mon_ == sistrip::NOISE_KS_ALL_STRIPS ) { 
00196     generator_->axisLabel( "KS Prob." );
00197   } else if ( mon_ == sistrip::NOISE_GAUS_ALL_STRIPS ) { 
00198     generator_->axisLabel( "Noise Gaus." );
00199   } else if ( mon_ == sistrip::NOISE_BIN_84_ALL_STRIPS ) { 
00200     generator_->axisLabel( "Noise Bin 84." );
00201   }     else if ( mon_ == sistrip::NOISE_RMS_ALL_STRIPS ) { 
00202     generator_->axisLabel( "Noise RMS." );
00203   } else if ( mon_ == sistrip::NOISE_CHI2_ALL_STRIPS ) { 
00204     generator_->axisLabel( "Chi2 Prob." );
00205   }  else { 
00206     edm::LogWarning(mlSummaryPlots_)
00207       << "[SummaryPlotFactory::" << __func__ << "]" 
00208       << " Unexpected SummaryHisto value:"
00209       << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ );
00210   } 
00211 
00212 }