Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "CondFormats/SiStripObjects/interface/CalibrationAnalysis.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 CalibrationAnalysis::minAmplitudeThreshold_ = 50;
0013 const float CalibrationAnalysis::minBaselineThreshold_ = -50;
0014 const float CalibrationAnalysis::maxBaselineThreshold_ = 50;
0015 const float CalibrationAnalysis::maxChi2Threshold_ = 3;
0016 const float CalibrationAnalysis::minDecayTimeThreshold_ = 30;
0017 const float CalibrationAnalysis::maxDecayTimeThreshold_ = 250;
0018 const float CalibrationAnalysis::minPeakTimeThreshold_ = 40;
0019 const float CalibrationAnalysis::maxPeakTimeThreshold_ = 130;
0020 const float CalibrationAnalysis::minRiseTimeThreshold_ = 10;
0021 const float CalibrationAnalysis::maxRiseTimeThreshold_ = 100;
0022 const float CalibrationAnalysis::minTurnOnThreshold_ = 5;
0023 const float CalibrationAnalysis::maxTurnOnThreshold_ = 40;
0024 
0025 const float CalibrationAnalysis::minDecayTimeThresholdDeco_ = 10;
0026 const float CalibrationAnalysis::maxDecayTimeThresholdDeco_ = 100;
0027 const float CalibrationAnalysis::minPeakTimeThresholdDeco_ = 40;
0028 const float CalibrationAnalysis::maxPeakTimeThresholdDeco_ = 130;
0029 const float CalibrationAnalysis::minRiseTimeThresholdDeco_ = 10;
0030 const float CalibrationAnalysis::maxRiseTimeThresholdDeco_ = 100;
0031 const float CalibrationAnalysis::minTurnOnThresholdDeco_ = 10;
0032 const float CalibrationAnalysis::maxTurnOnThresholdDeco_ = 80;
0033 
0034 CalibrationAnalysis::CalibrationAnalysis(const uint32_t& key, const bool& deconv)
0035     : CommissioningAnalysis(key, "CalibrationAnalysis"),
0036       amplitude_(2, VFloat(128, sistrip::invalid_)),
0037       tail_(2, VFloat(128, sistrip::invalid_)),
0038       riseTime_(2, VFloat(128, sistrip::invalid_)),
0039       decayTime_(2, VFloat(128, sistrip::invalid_)),
0040       turnOn_(2, VFloat(128, sistrip::invalid_)),
0041       peakTime_(2, VFloat(128, sistrip::invalid_)),
0042       undershoot_(2, VFloat(128, sistrip::invalid_)),
0043       baseline_(2, VFloat(128, sistrip::invalid_)),
0044       smearing_(2, VFloat(128, sistrip::invalid_)),
0045       chi2_(2, VFloat(128, sistrip::invalid_)),
0046       isvalid_(2, VBool(128, sistrip::invalid_)),
0047       mean_amplitude_(2, sistrip::invalid_),
0048       mean_tail_(2, sistrip::invalid_),
0049       mean_riseTime_(2, sistrip::invalid_),
0050       mean_decayTime_(2, sistrip::invalid_),
0051       mean_turnOn_(2, sistrip::invalid_),
0052       mean_peakTime_(2, sistrip::invalid_),
0053       mean_undershoot_(2, sistrip::invalid_),
0054       mean_baseline_(2, sistrip::invalid_),
0055       mean_smearing_(2, sistrip::invalid_),
0056       mean_chi2_(2, sistrip::invalid_),
0057       min_amplitude_(2, sistrip::invalid_),
0058       min_tail_(2, sistrip::invalid_),
0059       min_riseTime_(2, sistrip::invalid_),
0060       min_decayTime_(2, sistrip::invalid_),
0061       min_turnOn_(2, sistrip::invalid_),
0062       min_peakTime_(2, sistrip::invalid_),
0063       min_undershoot_(2, sistrip::invalid_),
0064       min_baseline_(2, sistrip::invalid_),
0065       min_smearing_(2, sistrip::invalid_),
0066       min_chi2_(2, sistrip::invalid_),
0067       max_amplitude_(2, sistrip::invalid_),
0068       max_tail_(2, sistrip::invalid_),
0069       max_riseTime_(2, sistrip::invalid_),
0070       max_decayTime_(2, sistrip::invalid_),
0071       max_turnOn_(2, sistrip::invalid_),
0072       max_peakTime_(2, sistrip::invalid_),
0073       max_undershoot_(2, sistrip::invalid_),
0074       max_baseline_(2, sistrip::invalid_),
0075       max_smearing_(2, sistrip::invalid_),
0076       max_chi2_(2, sistrip::invalid_),
0077       spread_amplitude_(2, sistrip::invalid_),
0078       spread_tail_(2, sistrip::invalid_),
0079       spread_riseTime_(2, sistrip::invalid_),
0080       spread_decayTime_(2, sistrip::invalid_),
0081       spread_turnOn_(2, sistrip::invalid_),
0082       spread_peakTime_(2, sistrip::invalid_),
0083       spread_undershoot_(2, sistrip::invalid_),
0084       spread_baseline_(2, sistrip::invalid_),
0085       spread_smearing_(2, sistrip::invalid_),
0086       spread_chi2_(2, sistrip::invalid_),
0087       deconv_(deconv),
0088       calChan_(0) {
0089   ;
0090 }
0091 
0092 // ----------------------------------------------------------------------------
0093 //
0094 CalibrationAnalysis::CalibrationAnalysis(const bool& deconv)
0095     : CommissioningAnalysis("CalibrationAnalysis"),
0096       amplitude_(2, VFloat(128, sistrip::invalid_)),
0097       tail_(2, VFloat(128, sistrip::invalid_)),
0098       riseTime_(2, VFloat(128, sistrip::invalid_)),
0099       decayTime_(2, VFloat(128, sistrip::invalid_)),
0100       turnOn_(2, VFloat(128, sistrip::invalid_)),
0101       peakTime_(2, VFloat(128, sistrip::invalid_)),
0102       undershoot_(2, VFloat(128, sistrip::invalid_)),
0103       baseline_(2, VFloat(128, sistrip::invalid_)),
0104       smearing_(2, VFloat(128, sistrip::invalid_)),
0105       chi2_(2, VFloat(128, sistrip::invalid_)),
0106       isvalid_(2, VBool(128, sistrip::invalid_)),
0107       mean_amplitude_(2, sistrip::invalid_),
0108       mean_tail_(2, sistrip::invalid_),
0109       mean_riseTime_(2, sistrip::invalid_),
0110       mean_decayTime_(2, sistrip::invalid_),
0111       mean_turnOn_(2, sistrip::invalid_),
0112       mean_peakTime_(2, sistrip::invalid_),
0113       mean_undershoot_(2, sistrip::invalid_),
0114       mean_baseline_(2, sistrip::invalid_),
0115       mean_smearing_(2, sistrip::invalid_),
0116       mean_chi2_(2, sistrip::invalid_),
0117       min_amplitude_(2, sistrip::invalid_),
0118       min_tail_(2, sistrip::invalid_),
0119       min_riseTime_(2, sistrip::invalid_),
0120       min_decayTime_(2, sistrip::invalid_),
0121       min_turnOn_(2, sistrip::invalid_),
0122       min_peakTime_(2, sistrip::invalid_),
0123       min_undershoot_(2, sistrip::invalid_),
0124       min_baseline_(2, sistrip::invalid_),
0125       min_smearing_(2, sistrip::invalid_),
0126       min_chi2_(2, sistrip::invalid_),
0127       max_amplitude_(2, sistrip::invalid_),
0128       max_tail_(2, sistrip::invalid_),
0129       max_riseTime_(2, sistrip::invalid_),
0130       max_decayTime_(2, sistrip::invalid_),
0131       max_turnOn_(2, sistrip::invalid_),
0132       max_peakTime_(2, sistrip::invalid_),
0133       max_undershoot_(2, sistrip::invalid_),
0134       max_baseline_(2, sistrip::invalid_),
0135       max_smearing_(2, sistrip::invalid_),
0136       max_chi2_(2, sistrip::invalid_),
0137       spread_amplitude_(2, sistrip::invalid_),
0138       spread_tail_(2, sistrip::invalid_),
0139       spread_riseTime_(2, sistrip::invalid_),
0140       spread_decayTime_(2, sistrip::invalid_),
0141       spread_turnOn_(2, sistrip::invalid_),
0142       spread_peakTime_(2, sistrip::invalid_),
0143       spread_undershoot_(2, sistrip::invalid_),
0144       spread_baseline_(2, sistrip::invalid_),
0145       spread_smearing_(2, sistrip::invalid_),
0146       spread_chi2_(2, sistrip::invalid_),
0147       deconv_(deconv),
0148       calChan_(0) {
0149   ;
0150 }
0151 
0152 // ----------------------------------------------------------------------------
0153 //
0154 void CalibrationAnalysis::reset() {
0155   calChan_ = 0;
0156 
0157   amplitude_ = VVFloat(2, VFloat(128, sistrip::invalid_));
0158   tail_ = VVFloat(2, VFloat(128, sistrip::invalid_));
0159   riseTime_ = VVFloat(2, VFloat(128, sistrip::invalid_));
0160   decayTime_ = VVFloat(2, VFloat(128, sistrip::invalid_));
0161   turnOn_ = VVFloat(2, VFloat(128, sistrip::invalid_));
0162   peakTime_ = VVFloat(2, VFloat(128, sistrip::invalid_));
0163   undershoot_ = VVFloat(2, VFloat(128, sistrip::invalid_));
0164   baseline_ = VVFloat(2, VFloat(128, sistrip::invalid_));
0165   smearing_ = VVFloat(2, VFloat(128, sistrip::invalid_));
0166   chi2_ = VVFloat(2, VFloat(128, sistrip::invalid_));
0167   isvalid_ = VVBool(2, VBool(128, sistrip::invalid_));
0168 
0169   mean_amplitude_ = VFloat(2, sistrip::invalid_);
0170   mean_tail_ = VFloat(2, sistrip::invalid_);
0171   mean_riseTime_ = VFloat(2, sistrip::invalid_);
0172   mean_decayTime_ = VFloat(2, sistrip::invalid_);
0173   mean_turnOn_ = VFloat(2, sistrip::invalid_);
0174   mean_peakTime_ = VFloat(2, sistrip::invalid_);
0175   mean_undershoot_ = VFloat(2, sistrip::invalid_);
0176   mean_baseline_ = VFloat(2, sistrip::invalid_);
0177   mean_smearing_ = VFloat(2, sistrip::invalid_);
0178   mean_chi2_ = VFloat(2, sistrip::invalid_);
0179 
0180   min_amplitude_ = VFloat(2, sistrip::invalid_);
0181   min_tail_ = VFloat(2, sistrip::invalid_);
0182   min_riseTime_ = VFloat(2, sistrip::invalid_);
0183   min_decayTime_ = VFloat(2, sistrip::invalid_);
0184   min_turnOn_ = VFloat(2, sistrip::invalid_);
0185   min_peakTime_ = VFloat(2, sistrip::invalid_);
0186   min_undershoot_ = VFloat(2, sistrip::invalid_);
0187   min_baseline_ = VFloat(2, sistrip::invalid_);
0188   min_smearing_ = VFloat(2, sistrip::invalid_);
0189   min_chi2_ = VFloat(2, sistrip::invalid_);
0190 
0191   max_amplitude_ = VFloat(2, sistrip::invalid_);
0192   max_tail_ = VFloat(2, sistrip::invalid_);
0193   max_riseTime_ = VFloat(2, sistrip::invalid_);
0194   max_decayTime_ = VFloat(2, sistrip::invalid_);
0195   max_turnOn_ = VFloat(2, sistrip::invalid_);
0196   max_peakTime_ = VFloat(2, sistrip::invalid_);
0197   max_undershoot_ = VFloat(2, sistrip::invalid_);
0198   max_baseline_ = VFloat(2, sistrip::invalid_);
0199   max_smearing_ = VFloat(2, sistrip::invalid_);
0200   max_chi2_ = VFloat(2, sistrip::invalid_);
0201 
0202   spread_amplitude_ = VFloat(2, sistrip::invalid_);
0203   spread_tail_ = VFloat(2, sistrip::invalid_);
0204   spread_riseTime_ = VFloat(2, sistrip::invalid_);
0205   spread_decayTime_ = VFloat(2, sistrip::invalid_);
0206   spread_turnOn_ = VFloat(2, sistrip::invalid_);
0207   spread_peakTime_ = VFloat(2, sistrip::invalid_);
0208   spread_undershoot_ = VFloat(2, sistrip::invalid_);
0209   spread_baseline_ = VFloat(2, sistrip::invalid_);
0210   spread_smearing_ = VFloat(2, sistrip::invalid_);
0211   spread_chi2_ = VFloat(2, sistrip::invalid_);
0212 }
0213 
0214 // ----------------------------------------------------------------------------
0215 //
0216 void CalibrationAnalysis::print(std::stringstream& ss, uint32_t iapv) {
0217   header(ss);
0218   ss << " Monitorables for APV number     : " << iapv;
0219   if (iapv == 0) {
0220     ss << " (first of pair)";
0221   } else if (iapv == 1) {
0222     ss << " (second of pair)";
0223   }
0224   ss << std::endl;
0225   ss << " Mean Amplitude of the pulse : " << mean_amplitude_[iapv] << std::endl
0226      << " Mean Tail amplitude after 150ns : " << mean_tail_[iapv] << std::endl
0227      << " Mean Rise time : " << mean_riseTime_[iapv] << std::endl
0228      << " Mean Time constant : " << mean_decayTime_[iapv] << std::endl
0229      << " Mean Turn on time  : " << mean_turnOn_[iapv] << std::endl
0230      << " Mean peak time : " << mean_peakTime_[iapv] << std::endl
0231      << " Mean undershoot amplitude : " << mean_undershoot_[iapv] << std::endl
0232      << " Mean baseline amplitude : " << mean_baseline_[iapv] << std::endl
0233      << " Mean Smearing parameter : " << mean_smearing_[iapv] << std::endl
0234      << " Mean Chi2 of the fit : " << mean_chi2_[iapv] << std::endl;
0235   if (deconvMode()) {
0236     ss << "Data obtained in deconvolution mode." << std::endl;
0237   } else {
0238     ss << "Data obtained in peak mode." << std::endl;
0239   }
0240 }
0241 
0242 bool CalibrationAnalysis::isValid() const { return true; }