Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DQM/SiStripCommissioningSummary/interface/CalibrationScanSummaryFactory.h"
0002 #include "CondFormats/SiStripObjects/interface/CalibrationScanAnalysis.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 CalibrationScanSummaryFactory::extract(Iterator iter) {
0013   CalibrationScanAnalysis* anal = dynamic_cast<CalibrationScanAnalysis*>(iter->second);
0014   if (!anal) {
0015     return;
0016   }
0017 
0018   SiStripFecKey lldKey = SiStripFecKey(iter->first);
0019 
0020   uint32_t key1 = SiStripFecKey(lldKey.fecCrate(),
0021                                 lldKey.fecSlot(),
0022                                 lldKey.fecRing(),
0023                                 lldKey.ccuAddr(),
0024                                 lldKey.ccuChan(),
0025                                 lldKey.lldChan(),
0026                                 lldKey.i2cAddr(lldKey.lldChan(), true))
0027                       .key();
0028 
0029   uint32_t key2 = SiStripFecKey(lldKey.fecCrate(),
0030                                 lldKey.fecSlot(),
0031                                 lldKey.fecRing(),
0032                                 lldKey.ccuAddr(),
0033                                 lldKey.ccuChan(),
0034                                 lldKey.lldChan(),
0035                                 lldKey.i2cAddr(lldKey.lldChan(), false))
0036                       .key();
0037 
0038   std::vector<float> value(2, 1 * sistrip::invalid_);
0039 
0040   // search for the best isha and VFS values cose to the optimal ones
0041   if (mon_ == sistrip::CALIBRATION_AMPLITUDE_TUNED) {
0042     value[0] = anal->tunedAmplitude()[0];
0043     value[1] = anal->tunedAmplitude()[1];
0044   } else if (mon_ == sistrip::CALIBRATION_BASELINE_TUNED) {
0045     value[0] = anal->tunedBaseline()[0];
0046     value[1] = anal->tunedBaseline()[1];
0047   } else if (mon_ == sistrip::CALIBRATION_TURNON_TUNED) {
0048     value[0] = anal->tunedTurnOn()[0];
0049     value[1] = anal->tunedTurnOn()[1];
0050   } else if (mon_ == sistrip::CALIBRATION_RISETIME_TUNED) {
0051     value[0] = anal->tunedRiseTime()[0];
0052     value[1] = anal->tunedRiseTime()[1];
0053   } else if (mon_ == sistrip::CALIBRATION_DECAYTIME_TUNED) {
0054     value[0] = anal->tunedDecayTime()[0];
0055     value[1] = anal->tunedDecayTime()[1];
0056   } else if (mon_ == sistrip::CALIBRATION_PEAKTIME_TUNED) {
0057     value[0] = anal->tunedPeakTime()[0];
0058     value[1] = anal->tunedPeakTime()[1];
0059   } else if (mon_ == sistrip::CALIBRATION_UNDERSHOOT_TUNED) {
0060     value[0] = anal->tunedUndershoot()[0];
0061     value[1] = anal->tunedUndershoot()[1];
0062   } else if (mon_ == sistrip::CALIBRATION_TAIL_TUNED) {
0063     value[0] = anal->tunedTail()[0];
0064     value[1] = anal->tunedTail()[1];
0065   } else if (mon_ == sistrip::CALIBRATION_SMEARING_TUNED) {
0066     value[0] = anal->tunedSmearing()[0];
0067     value[1] = anal->tunedSmearing()[1];
0068   } else if (mon_ == sistrip::CALIBRATION_CHI2_TUNED) {
0069     value[0] = anal->tunedChi2()[0];
0070     value[1] = anal->tunedChi2()[1];
0071   } else if (mon_ == sistrip::CALIBRATION_ISHA_TUNED) {
0072     value[0] = anal->tunedISHA()[0];
0073     value[1] = anal->tunedISHA()[1];
0074   } else if (mon_ == sistrip::CALIBRATION_VFS_TUNED) {
0075     value[0] = anal->tunedVFS()[0];
0076     value[1] = anal->tunedVFS()[1];
0077   } else if (mon_ == sistrip::CALIBRATION_ISHA_BEST) {
0078     value[0] = anal->bestISHA()[0];
0079     value[1] = anal->bestISHA()[1];
0080   } else if (mon_ == sistrip::CALIBRATION_VFS_BEST) {
0081     value[0] = anal->bestVFS()[0];
0082     value[1] = anal->bestVFS()[1];
0083   } else {
0084     edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]"
0085                                      << " Unexpected monitorable: "
0086                                      << SiStripEnumsAndStrings::monitorable(SummaryPlotFactoryBase::mon_);
0087     return;
0088   }
0089 
0090   SummaryPlotFactoryBase::generator_->fillMap(
0091       SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, key1, value[0]);
0092 
0093   SummaryPlotFactoryBase::generator_->fillMap(
0094       SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, key2, value[1]);
0095 
0096   // set the x-axis
0097   format();
0098 }
0099 
0100 //------------------------------------------------------------------------------
0101 //
0102 void CalibrationScanSummaryFactory::format() {
0103   // Histogram formatting
0104   if (mon_ == sistrip::CALIBRATION_AMPLITUDE_TUNED)
0105     generator_->axisLabel("Amplitude (ADC)");
0106 
0107   else if (mon_ == sistrip::CALIBRATION_BASELINE_TUNED)
0108     generator_->axisLabel("Baseline (ADC)");
0109 
0110   else if (mon_ == sistrip::CALIBRATION_TURNON_TUNED)
0111     generator_->axisLabel("Turn-On (ns)");
0112 
0113   else if (mon_ == sistrip::CALIBRATION_TAIL_TUNED)
0114     generator_->axisLabel("Tail (%)");
0115 
0116   else if (mon_ == sistrip::CALIBRATION_RISETIME_TUNED)
0117     generator_->axisLabel("Rise Time (ns)");
0118 
0119   else if (mon_ == sistrip::CALIBRATION_PEAKTIME_TUNED)
0120     generator_->axisLabel("Peak Time (ns)");
0121 
0122   else if (mon_ == sistrip::CALIBRATION_DECAYTIME_TUNED)
0123     generator_->axisLabel("Decay Time (ns)");
0124 
0125   else if (mon_ == sistrip::CALIBRATION_SMEARING_TUNED)
0126     generator_->axisLabel("Smearing (ns)");
0127 
0128   else if (mon_ == sistrip::CALIBRATION_CHI2_TUNED)
0129     generator_->axisLabel("Chi2/ndf");
0130 
0131   else if (mon_ == sistrip::CALIBRATION_VFS_TUNED or mon_ == sistrip::CALIBRATION_VFS_BEST)
0132     generator_->axisLabel("VFS");
0133 
0134   else if (mon_ == sistrip::CALIBRATION_ISHA_TUNED or mon_ == sistrip::CALIBRATION_ISHA_BEST)
0135     generator_->axisLabel("ISHA");
0136   else {
0137     edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]"
0138                                      << " Unexpected SummaryHisto value:"
0139                                      << SiStripEnumsAndStrings::monitorable(SummaryPlotFactoryBase::mon_);
0140   }
0141 }