Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:39

0001 #include "CondFormats/SiStripObjects/interface/FedTimingAnalysis.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 <iomanip>
0007 #include <cmath>
0008 
0009 using namespace sistrip;
0010 
0011 // ----------------------------------------------------------------------------
0012 //
0013 FedTimingAnalysis::FedTimingAnalysis(const uint32_t& key)
0014     : CommissioningAnalysis(key, "FedTimingAnalysis"),
0015       time_(sistrip::invalid_),
0016       max_(sistrip::invalid_),
0017       delay_(sistrip::invalid_),
0018       error_(sistrip::invalid_),
0019       base_(sistrip::invalid_),
0020       peak_(sistrip::invalid_),
0021       height_(sistrip::invalid_),
0022       optimumSamplingPoint_(15.) {
0023   ;
0024 }
0025 
0026 // ----------------------------------------------------------------------------
0027 //
0028 FedTimingAnalysis::FedTimingAnalysis()
0029     : CommissioningAnalysis("FedTimingAnalysis"),
0030       time_(sistrip::invalid_),
0031       max_(sistrip::invalid_),
0032       delay_(sistrip::invalid_),
0033       error_(sistrip::invalid_),
0034       base_(sistrip::invalid_),
0035       peak_(sistrip::invalid_),
0036       height_(sistrip::invalid_),
0037       optimumSamplingPoint_(15.) {
0038   ;
0039 }
0040 
0041 // ----------------------------------------------------------------------------
0042 //
0043 void FedTimingAnalysis::reset() {
0044   time_ = sistrip::invalid_;
0045   max_ = sistrip::invalid_;
0046   delay_ = sistrip::invalid_;
0047   error_ = sistrip::invalid_;
0048   base_ = sistrip::invalid_;
0049   peak_ = sistrip::invalid_;
0050   height_ = sistrip::invalid_;
0051 }
0052 
0053 // ----------------------------------------------------------------------------
0054 //
0055 void FedTimingAnalysis::print(std::stringstream& ss, uint32_t not_used) {
0056   header(ss);
0057   ss << " Time of tick rising edge [ns]      : " << time_ << "\n"
0058      << " Maximum time (sampling point) [ns] : " << max_ << "\n"
0059      << " Delay required wrt max time [ns]   : " << delay_ << "\n"
0060      << " Error on delay [ns]                : " << error_ << "\n"
0061      << " Baseline [adc]                     : " << base_ << "\n"
0062      << " Tick peak [adc]                    : " << peak_ << "\n"
0063      << " Tick height [adc]                  : " << height_ << "\n";
0064 }
0065 
0066 // ----------------------------------------------------------------------------
0067 //
0068 void FedTimingAnalysis::max(const float& max) {
0069   max_ = max;
0070   if (time_ > sistrip::maximum_) {
0071     return;
0072   }
0073   int32_t adjustment = 25 - static_cast<int32_t>(rint(max_ + optimumSamplingPoint_)) % 25;
0074   max_ += adjustment;
0075   delay_ = max_ - time_;
0076 }