Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:11:40

0001 #include "DQM/SiStripCommissioningSummary/interface/DaqScopeModeSummaryFactory.h"
0002 #include "CondFormats/SiStripObjects/interface/DaqScopeModeAnalysis.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 DaqScopeModeSummaryFactory::extract(Iterator iter) {
0013   DaqScopeModeAnalysis* anal = dynamic_cast<DaqScopeModeAnalysis*>(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->noise()[0];
0025   noise[1] = anal->noise()[1];
0026   float valueAlt = 1. * sistrip::invalid_;
0027 
0028   bool all_strips = false;
0029   if (mon_ == sistrip::PEDESTALS_ALL_STRIPS) {
0030     all_strips = true;
0031     uint16_t bins = peds[0].size();
0032     if (peds[0].size() < peds[1].size()) {
0033       bins = peds[1].size();
0034     }
0035     for (uint16_t iped = 0; iped < bins; iped++) {
0036       value[0][iped] = peds[0][iped];
0037       value[1][iped] = peds[1][iped];
0038     }
0039   } else if (mon_ == sistrip::PEDESTALS_MEAN) {
0040     value[0][0] = anal->pedsMean()[0];
0041     value[1][0] = anal->pedsMean()[1];
0042   } else if (mon_ == sistrip::PEDESTALS_SPREAD) {
0043     value[0][0] = anal->pedsSpread()[0];
0044     value[1][0] = anal->pedsSpread()[1];
0045   } else if (mon_ == sistrip::PEDESTALS_MAX) {
0046     value[0][0] = anal->pedsMax()[0];
0047     value[1][0] = anal->pedsMax()[1];
0048   } else if (mon_ == sistrip::PEDESTALS_MIN) {
0049     value[0][0] = anal->pedsMin()[0];
0050     value[1][0] = anal->pedsMin()[1];
0051   } else if (mon_ == sistrip::NOISE_ALL_STRIPS) {
0052     all_strips = true;
0053     uint16_t bins = noise[0].size();
0054     if (noise[0].size() < noise[1].size()) {
0055       bins = noise[1].size();
0056     }
0057     for (uint16_t inoise = 0; inoise < bins; inoise++) {
0058       value[0][inoise] = noise[0][inoise];
0059       value[1][inoise] = noise[1][inoise];
0060     }
0061   } else if (mon_ == sistrip::NOISE_MEAN) {
0062     value[0][0] = anal->noiseMean()[0];
0063     value[1][0] = anal->noiseMean()[1];
0064   } else if (mon_ == sistrip::NOISE_SPREAD) {
0065     value[0][0] = anal->noiseSpread()[0];
0066     value[1][0] = anal->noiseSpread()[1];
0067   } else if (mon_ == sistrip::NOISE_MAX) {
0068     value[0][0] = anal->noiseMax()[0];
0069     value[1][0] = anal->noiseMax()[1];
0070   } else if (mon_ == sistrip::NOISE_MIN) {
0071     value[0][0] = anal->noiseMin()[0];
0072     value[1][0] = anal->noiseMin()[1];
0073   } else if (mon_ == sistrip::NUM_OF_DEAD) {
0074     value[0][0] = 1. * anal->dead()[0].size();
0075     value[1][0] = 1. * anal->dead()[1].size();
0076   } else if (mon_ == sistrip::NUM_OF_NOISY) {
0077     value[0][0] = 1. * anal->noisy()[0].size();
0078     value[1][0] = 1. * anal->noisy()[1].size();
0079   } else if (mon_ == sistrip::APV_TIMING_BASE) {
0080     valueAlt = anal->base();
0081   } else if (mon_ == sistrip::APV_TIMING_PEAK) {
0082     valueAlt = anal->peak();
0083   } else if (mon_ == sistrip::APV_TIMING_HEIGHT) {
0084     valueAlt = anal->height();
0085   } else {
0086     edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]"
0087                                      << " Unexpected monitorable: "
0088                                      << SiStripEnumsAndStrings::monitorable(SummaryPlotFactoryBase::mon_);
0089     return;
0090   }
0091 
0092   if (!all_strips) {
0093     SummaryPlotFactoryBase::generator_->fillMap(
0094         SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, iter->first, value[0][0]);
0095 
0096     SummaryPlotFactoryBase::generator_->fillMap(
0097         SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, iter->first, value[1][0]);
0098 
0099     SummaryPlotFactoryBase::generator_->fillMap(
0100         SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, iter->first, valueAlt);
0101 
0102   } else {
0103     for (uint16_t istr = 0; istr < value[0].size(); istr++) {
0104       SummaryPlotFactoryBase::generator_->fillMap(
0105           SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, iter->first, value[0][istr]);
0106     }
0107 
0108     for (uint16_t istr = 0; istr < value[1].size(); istr++) {
0109       SummaryPlotFactoryBase::generator_->fillMap(
0110           SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, iter->first, value[1][istr]);
0111     }
0112   }
0113 }
0114 
0115 // -----------------------------------------------------------------------------
0116 //
0117 void DaqScopeModeSummaryFactory::format() {
0118   if (mon_ == sistrip::PEDESTALS_ALL_STRIPS) {
0119     generator_->axisLabel("Pedestal value [adc]");
0120   } else if (mon_ == sistrip::PEDESTALS_MEAN) {
0121   } else if (mon_ == sistrip::PEDESTALS_SPREAD) {
0122   } else if (mon_ == sistrip::PEDESTALS_MAX) {
0123   } else if (mon_ == sistrip::PEDESTALS_MIN) {
0124   } else if (mon_ == sistrip::NOISE_ALL_STRIPS) {
0125     generator_->axisLabel("Noise [adc]");
0126   } else if (mon_ == sistrip::NOISE_MEAN) {
0127   } else if (mon_ == sistrip::NOISE_SPREAD) {
0128   } else if (mon_ == sistrip::NOISE_MAX) {
0129   } else if (mon_ == sistrip::NOISE_MIN) {
0130   } else if (mon_ == sistrip::NUM_OF_DEAD) {
0131   } else if (mon_ == sistrip::NUM_OF_NOISY) {
0132   } else if (SummaryPlotFactoryBase::mon_ == sistrip::APV_TIMING_TIME) {
0133     SummaryPlotFactoryBase::generator_->axisLabel("Timing delay [ns]");
0134   } else if (SummaryPlotFactoryBase::mon_ == sistrip::APV_TIMING_MAX_TIME) {
0135   } else if (SummaryPlotFactoryBase::mon_ == sistrip::APV_TIMING_DELAY) {
0136   } else if (SummaryPlotFactoryBase::mon_ == sistrip::APV_TIMING_ERROR) {
0137   } else if (SummaryPlotFactoryBase::mon_ == sistrip::APV_TIMING_BASE) {
0138   } else if (SummaryPlotFactoryBase::mon_ == sistrip::APV_TIMING_PEAK) {
0139   } else if (SummaryPlotFactoryBase::mon_ == sistrip::APV_TIMING_HEIGHT) {
0140   } else {
0141     edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]"
0142                                      << " Unexpected SummaryHisto value:"
0143                                      << SiStripEnumsAndStrings::monitorable(SummaryPlotFactoryBase::mon_);
0144   }
0145 }