Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:39

0001 #include "CondFormats/SiStripObjects/interface/CalibrationScanAnalysis.h"
0002 #include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h"
0003 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include <iostream>
0006 #include <sstream>
0007 #include <iomanip>
0008 #include <cmath>
0009 
0010 using namespace sistrip;
0011 
0012 const float CalibrationScanAnalysis::minAmplitudeThreshold_ = 50;
0013 const float CalibrationScanAnalysis::minBaselineThreshold_ = -50;
0014 const float CalibrationScanAnalysis::maxBaselineThreshold_ = 50;
0015 const float CalibrationScanAnalysis::maxChi2Threshold_ = 3;
0016 const float CalibrationScanAnalysis::minDecayTimeThreshold_ = 30;
0017 const float CalibrationScanAnalysis::maxDecayTimeThreshold_ = 250;
0018 const float CalibrationScanAnalysis::minPeakTimeThreshold_ = 40;
0019 const float CalibrationScanAnalysis::maxPeakTimeThreshold_ = 130;
0020 const float CalibrationScanAnalysis::minRiseTimeThreshold_ = 10;
0021 const float CalibrationScanAnalysis::maxRiseTimeThreshold_ = 100;
0022 const float CalibrationScanAnalysis::minTurnOnThreshold_ = 5;
0023 const float CalibrationScanAnalysis::maxTurnOnThreshold_ = 40;
0024 const float CalibrationScanAnalysis::minISHAforVFSTune_ = 30;
0025 const float CalibrationScanAnalysis::maxISHAforVFSTune_ = 110;
0026 const float CalibrationScanAnalysis::VFSrange_ = 20;
0027 
0028 CalibrationScanAnalysis::CalibrationScanAnalysis(const uint32_t& key, const bool& deconv)
0029     : CommissioningAnalysis(key, "CalibrationScanAnalysis"), deconv_(deconv) {
0030   isha_ = VInt(2, sistrip::invalid_);
0031   vfs_ = VInt(2, sistrip::invalid_);
0032   tunedAmplitude_ = VFloat(2, sistrip::invalid_);
0033   tunedTail_ = VFloat(2, sistrip::invalid_);
0034   tunedRiseTime_ = VFloat(2, sistrip::invalid_);
0035   tunedDecayTime_ = VFloat(2, sistrip::invalid_);
0036   tunedTurnOn_ = VFloat(2, sistrip::invalid_);
0037   tunedPeakTime_ = VFloat(2, sistrip::invalid_);
0038   tunedUndershoot_ = VFloat(2, sistrip::invalid_);
0039   tunedBaseline_ = VFloat(2, sistrip::invalid_);
0040   tunedSmearing_ = VFloat(2, sistrip::invalid_);
0041   tunedChi2_ = VFloat(2, sistrip::invalid_);
0042   tunedISHA_ = VInt(2, sistrip::invalid_);
0043   tunedVFS_ = VInt(2, sistrip::invalid_);
0044 }
0045 
0046 // ----------------------------------------------------------------------------
0047 //
0048 CalibrationScanAnalysis::CalibrationScanAnalysis(const bool& deconv)
0049     : CommissioningAnalysis("CalibrationScanAnalysis"), deconv_(deconv) {
0050   isha_ = VInt(2, sistrip::invalid_);
0051   vfs_ = VInt(2, sistrip::invalid_);
0052 
0053   tunedAmplitude_ = VFloat(2, sistrip::invalid_);
0054   tunedTail_ = VFloat(2, sistrip::invalid_);
0055   tunedRiseTime_ = VFloat(2, sistrip::invalid_);
0056   tunedDecayTime_ = VFloat(2, sistrip::invalid_);
0057   tunedTurnOn_ = VFloat(2, sistrip::invalid_);
0058   tunedPeakTime_ = VFloat(2, sistrip::invalid_);
0059   tunedUndershoot_ = VFloat(2, sistrip::invalid_);
0060   tunedBaseline_ = VFloat(2, sistrip::invalid_);
0061   tunedSmearing_ = VFloat(2, sistrip::invalid_);
0062   tunedChi2_ = VFloat(2, sistrip::invalid_);
0063   tunedISHA_ = VInt(2, sistrip::invalid_);
0064   tunedVFS_ = VInt(2, sistrip::invalid_);
0065 }
0066 // ----------------------------------------------------------------------------
0067 //
0068 void CalibrationScanAnalysis::addOneCalibrationPoint(const std::string& key)  // key of form isha_%d_vfs_%d
0069 {
0070   amplitude_[key] = VFloat(2, sistrip::invalid_);
0071   tail_[key] = VFloat(2, sistrip::invalid_);
0072   riseTime_[key] = VFloat(2, sistrip::invalid_);
0073   turnOn_[key] = VFloat(2, sistrip::invalid_);
0074   peakTime_[key] = VFloat(2, sistrip::invalid_);
0075   undershoot_[key] = VFloat(2, sistrip::invalid_);
0076   baseline_[key] = VFloat(2, sistrip::invalid_);
0077   smearing_[key] = VFloat(2, sistrip::invalid_);
0078   chi2_[key] = VFloat(2, sistrip::invalid_);
0079   decayTime_[key] = VFloat(2, sistrip::invalid_);
0080   isvalid_[key] = VBool(2, sistrip::invalid_);
0081 }
0082 
0083 // ----------------------------------------------------------------------------
0084 //
0085 void CalibrationScanAnalysis::reset() {
0086   isha_ = VInt(2, sistrip::invalid_);
0087   vfs_ = VInt(2, sistrip::invalid_);
0088   tunedAmplitude_ = VFloat(2, sistrip::invalid_);
0089   tunedTail_ = VFloat(2, sistrip::invalid_);
0090   tunedRiseTime_ = VFloat(2, sistrip::invalid_);
0091   tunedDecayTime_ = VFloat(2, sistrip::invalid_);
0092   tunedTurnOn_ = VFloat(2, sistrip::invalid_);
0093   tunedPeakTime_ = VFloat(2, sistrip::invalid_);
0094   tunedUndershoot_ = VFloat(2, sistrip::invalid_);
0095   tunedBaseline_ = VFloat(2, sistrip::invalid_);
0096   tunedSmearing_ = VFloat(2, sistrip::invalid_);
0097   tunedChi2_ = VFloat(2, sistrip::invalid_);
0098   tunedISHA_ = VInt(2, sistrip::invalid_);
0099   tunedVFS_ = VInt(2, sistrip::invalid_);
0100 
0101   for (const auto& key : amplitude_) {
0102     amplitude_[key.first] = VFloat(2, sistrip::invalid_);
0103     tail_[key.first] = VFloat(2, sistrip::invalid_);
0104     riseTime_[key.first] = VFloat(2, sistrip::invalid_);
0105     turnOn_[key.first] = VFloat(2, sistrip::invalid_);
0106     peakTime_[key.first] = VFloat(2, sistrip::invalid_);
0107     undershoot_[key.first] = VFloat(2, sistrip::invalid_);
0108     baseline_[key.first] = VFloat(2, sistrip::invalid_);
0109     smearing_[key.first] = VFloat(2, sistrip::invalid_);
0110     chi2_[key.first] = VFloat(2, sistrip::invalid_);
0111     decayTime_[key.first] = VFloat(2, sistrip::invalid_);
0112   }
0113 }
0114 
0115 // ----------------------------------------------------------------------------
0116 //
0117 void CalibrationScanAnalysis::print(std::stringstream& ss, uint32_t iapv) {
0118   header(ss);
0119   ss << " Monitorables for APV number     : " << iapv;
0120   if (iapv == 0) {
0121     ss << " (first of pair)";
0122   } else if (iapv == 1) {
0123     ss << " (second of pair)";
0124   }
0125   ss << std::endl;
0126   ss << " Looking at key " << amplitude_.begin()->first << std::endl;
0127   ss << " Amplitude of the pulse : " << amplitude_[amplitude_.begin()->first][iapv] << std::endl
0128      << " Baseline : " << baseline_[amplitude_.begin()->first][iapv] << std::endl
0129      << " Rise time : " << riseTime_[amplitude_.begin()->first][iapv] << std::endl
0130      << " Turn-on time : " << turnOn_[amplitude_.begin()->first][iapv] << std::endl
0131      << " Peak time : " << peakTime_[amplitude_.begin()->first][iapv] << std::endl
0132      << " Undershoot : " << undershoot_[amplitude_.begin()->first][iapv] << std::endl
0133      << " Time constant : " << decayTime_[amplitude_.begin()->first][iapv] << std::endl
0134      << " Smearing : " << smearing_[amplitude_.begin()->first][iapv] << std::endl
0135      << " Chi2 : " << chi2_[amplitude_.begin()->first][iapv] << std::endl;
0136   if (deconvMode()) {
0137     ss << "Data obtained in deconvolution mode." << std::endl;
0138   } else {
0139     ss << "Data obtained in peak mode." << std::endl;
0140   }
0141 }
0142 
0143 bool CalibrationScanAnalysis::isValid() const { return true; }