00001 #include "CondFormats/SiStripObjects/interface/FedTimingAnalysis.h"
00002 #include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h"
00003 #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 #include <iostream>
00006 #include <iomanip>
00007 #include <cmath>
00008
00009 using namespace sistrip;
00010
00011
00012
00013 FedTimingAnalysis::FedTimingAnalysis( const uint32_t& key )
00014 : CommissioningAnalysis(key,"FedTimingAnalysis"),
00015 time_(sistrip::invalid_),
00016 max_(sistrip::invalid_),
00017 delay_(sistrip::invalid_),
00018 error_(sistrip::invalid_),
00019 base_(sistrip::invalid_),
00020 peak_(sistrip::invalid_),
00021 height_(sistrip::invalid_),
00022 optimumSamplingPoint_(15.)
00023 {;}
00024
00025
00026
00027 FedTimingAnalysis::FedTimingAnalysis()
00028 : CommissioningAnalysis("FedTimingAnalysis"),
00029 time_(sistrip::invalid_),
00030 max_(sistrip::invalid_),
00031 delay_(sistrip::invalid_),
00032 error_(sistrip::invalid_),
00033 base_(sistrip::invalid_),
00034 peak_(sistrip::invalid_),
00035 height_(sistrip::invalid_),
00036 optimumSamplingPoint_(15.)
00037 {;}
00038
00039
00040
00041 void FedTimingAnalysis::reset() {
00042 time_ = sistrip::invalid_;
00043 max_ = sistrip::invalid_;
00044 delay_ = sistrip::invalid_;
00045 error_ = sistrip::invalid_;
00046 base_ = sistrip::invalid_;
00047 peak_ = sistrip::invalid_;
00048 height_ = sistrip::invalid_;
00049 }
00050
00051
00052
00053 void FedTimingAnalysis::print( std::stringstream& ss, uint32_t not_used ) {
00054 header( ss );
00055 ss << " Time of tick rising edge [ns] : " << time_ << "\n"
00056 << " Maximum time (sampling point) [ns] : " << max_ << "\n"
00057 << " Delay required wrt max time [ns] : " << delay_ << "\n"
00058 << " Error on delay [ns] : " << error_ << "\n"
00059 << " Baseline [adc] : " << base_ << "\n"
00060 << " Tick peak [adc] : " << peak_ << "\n"
00061 << " Tick height [adc] : " << height_ << "\n";
00062 }
00063
00064
00065
00066 void FedTimingAnalysis::max( const float& max ) {
00067 max_ = max;
00068 if ( time_ > sistrip::maximum_ ) { return; }
00069 int32_t adjustment = 25 - static_cast<int32_t>( rint( max_ + optimumSamplingPoint_ ) ) % 25;
00070 max_ += adjustment;
00071 delay_ = max_ - time_;
00072 }