Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:38

0001 #include "DQM/SiStripCommissioningSummary/interface/PedsOnlySummaryFactory.h"
0002 #include "CondFormats/SiStripObjects/interface/PedsOnlyAnalysis.h"
0003 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include <iostream>
0006 #include <sstream>
0007 
0008 using namespace sistrip;
0009 
0010 // -----------------------------------------------------------------------------
0011 //
0012 void PedsOnlySummaryFactory::extract(Iterator iter) {
0013   PedsOnlyAnalysis* anal = dynamic_cast<PedsOnlyAnalysis*>(iter->second);
0014   if (!anal) {
0015     return;
0016   }
0017 
0018   std::vector<float> temp(128, 1. * sistrip::invalid_);
0019   std::vector<std::vector<float> > value(2, temp);
0020   std::vector<std::vector<float> > peds(2, temp);
0021   std::vector<std::vector<float> > noise(2, temp);
0022   peds[0] = anal->peds()[0];
0023   peds[1] = anal->peds()[1];
0024   noise[0] = anal->raw()[0];  //@@ raw noise
0025   noise[1] = anal->raw()[1];  //@@ raw noise
0026 
0027   bool all_strips = false;
0028   if (mon_ == sistrip::PEDESTALS_ALL_STRIPS) {
0029     all_strips = true;
0030     uint16_t bins = peds[0].size();
0031     if (peds[0].size() < peds[1].size()) {
0032       bins = peds[1].size();
0033     }
0034     for (uint16_t iped = 0; iped < bins; iped++) {
0035       value[0][iped] = peds[0][iped];
0036       value[1][iped] = peds[1][iped];
0037     }
0038   } else if (mon_ == sistrip::PEDESTALS_MEAN) {
0039     value[0][0] = anal->pedsMean()[0];
0040     value[1][0] = anal->pedsMean()[1];
0041   } else if (mon_ == sistrip::PEDESTALS_SPREAD) {
0042     value[0][0] = anal->pedsSpread()[0];
0043     value[1][0] = anal->pedsSpread()[1];
0044   } else if (mon_ == sistrip::PEDESTALS_MAX) {
0045     value[0][0] = anal->pedsMax()[0];
0046     value[1][0] = anal->pedsMax()[1];
0047   } else if (mon_ == sistrip::PEDESTALS_MIN) {
0048     value[0][0] = anal->pedsMin()[0];
0049     value[1][0] = anal->pedsMin()[1];
0050   } else if (mon_ == sistrip::NOISE_ALL_STRIPS) {
0051     all_strips = true;
0052     uint16_t bins = noise[0].size();
0053     if (noise[0].size() < noise[1].size()) {
0054       bins = noise[1].size();
0055     }
0056     for (uint16_t inoise = 0; inoise < bins; inoise++) {
0057       value[0][inoise] = noise[0][inoise];
0058       value[1][inoise] = noise[1][inoise];
0059     }
0060   } else if (mon_ == sistrip::NOISE_MEAN) {
0061     value[0][0] = anal->rawMean()[0];
0062     value[1][0] = anal->rawMean()[1];
0063   } else if (mon_ == sistrip::NOISE_SPREAD) {
0064     value[0][0] = anal->rawSpread()[0];
0065     value[1][0] = anal->rawSpread()[1];
0066   } else if (mon_ == sistrip::NOISE_MAX) {
0067     value[0][0] = anal->rawMax()[0];
0068     value[1][0] = anal->rawMax()[1];
0069   } else if (mon_ == sistrip::NOISE_MIN) {
0070     value[0][0] = anal->rawMin()[0];
0071     value[1][0] = anal->rawMin()[1];
0072   } else {
0073     edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]"
0074                                      << " Unexpected monitorable: "
0075                                      << SiStripEnumsAndStrings::monitorable(SummaryPlotFactoryBase::mon_);
0076     return;
0077   }
0078 
0079   if (!all_strips) {
0080     SummaryPlotFactoryBase::generator_->fillMap(
0081         SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, iter->first, value[0][0]);
0082 
0083     SummaryPlotFactoryBase::generator_->fillMap(
0084         SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, iter->first, value[1][0]);
0085 
0086   } else {
0087     for (uint16_t istr = 0; istr < value[0].size(); istr++) {
0088       SummaryPlotFactoryBase::generator_->fillMap(
0089           SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, iter->first, value[0][istr]);
0090     }
0091 
0092     for (uint16_t istr = 0; istr < value[1].size(); istr++) {
0093       SummaryPlotFactoryBase::generator_->fillMap(
0094           SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, iter->first, value[1][istr]);
0095     }
0096   }
0097 }
0098 
0099 // -----------------------------------------------------------------------------
0100 //
0101 void PedsOnlySummaryFactory::format() {
0102   if (mon_ == sistrip::PEDESTALS_ALL_STRIPS) {
0103     generator_->axisLabel("Pedestal value [adc]");
0104   } else if (mon_ == sistrip::PEDESTALS_MEAN) {
0105   } else if (mon_ == sistrip::PEDESTALS_SPREAD) {
0106   } else if (mon_ == sistrip::PEDESTALS_MAX) {
0107   } else if (mon_ == sistrip::PEDESTALS_MIN) {
0108   } else if (mon_ == sistrip::NOISE_ALL_STRIPS) {
0109     generator_->axisLabel("Noise [adc]");
0110   } else if (mon_ == sistrip::NOISE_MEAN) {
0111   } else if (mon_ == sistrip::NOISE_SPREAD) {
0112   } else if (mon_ == sistrip::NOISE_MAX) {
0113   } else if (mon_ == sistrip::NOISE_MIN) {
0114   } else if (mon_ == sistrip::NUM_OF_DEAD) {
0115   } else if (mon_ == sistrip::NUM_OF_NOISY) {
0116   } else {
0117     edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]"
0118                                      << " Unexpected SummaryHisto value:"
0119                                      << SiStripEnumsAndStrings::monitorable(SummaryPlotFactoryBase::mon_);
0120   }
0121 }