Go to the documentation of this file.00001 #include "CondFormats/SiStripObjects/interface/FastFedCablingAnalysis.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 <sstream>
00007 #include <iomanip>
00008 #include <cmath>
00009
00010 using namespace sistrip;
00011
00012
00013
00014 const float FastFedCablingAnalysis::threshold_ = 100.;
00015
00016
00017
00018 const float FastFedCablingAnalysis::dirtyThreshold_ = 800;
00019
00020
00021
00022 const float FastFedCablingAnalysis::trimDacThreshold_ = 10;
00023
00024
00025
00026 const uint16_t FastFedCablingAnalysis::nBitsForDcuId_ = 32;
00027
00028
00029
00030 const uint16_t FastFedCablingAnalysis::nBitsForLldCh_ = 2;
00031
00032
00033
00034 FastFedCablingAnalysis::FastFedCablingAnalysis( const uint32_t& key )
00035 : CommissioningAnalysis(key,sistrip::fastCablingAnalysis_),
00036 dcuHardId_(sistrip::invalid32_),
00037 lldCh_(sistrip::invalid_),
00038 highMedian_(1.*sistrip::invalid_),
00039 highMean_(1.*sistrip::invalid_),
00040 highRms_(1.*sistrip::invalid_),
00041 lowMedian_(1.*sistrip::invalid_),
00042 lowMean_(1.*sistrip::invalid_),
00043 lowRms_(1.*sistrip::invalid_),
00044 range_(1.*sistrip::invalid_),
00045 midRange_(1.*sistrip::invalid_),
00046 max_(1.*sistrip::invalid_),
00047 min_(1.*sistrip::invalid_)
00048 {
00049 fecKey( SiStripFecKey( sistrip::invalid_,
00050 sistrip::invalid_,
00051 sistrip::invalid_,
00052 sistrip::invalid_,
00053 sistrip::invalid_,
00054 sistrip::invalid_,
00055 sistrip::invalid_ ).key() );
00056 fedKey( key );
00057 }
00058
00059
00060
00061 FastFedCablingAnalysis::FastFedCablingAnalysis()
00062 : CommissioningAnalysis(sistrip::fastCablingAnalysis_),
00063 dcuHardId_(sistrip::invalid32_),
00064 lldCh_(sistrip::invalid_),
00065 highMedian_(1.*sistrip::invalid_),
00066 highMean_(1.*sistrip::invalid_),
00067 highRms_(1.*sistrip::invalid_),
00068 lowMedian_(1.*sistrip::invalid_),
00069 lowMean_(1.*sistrip::invalid_),
00070 lowRms_(1.*sistrip::invalid_),
00071 range_(1.*sistrip::invalid_),
00072 midRange_(1.*sistrip::invalid_),
00073 max_(1.*sistrip::invalid_),
00074 min_(1.*sistrip::invalid_)
00075 {;}
00076
00077
00078
00079 void FastFedCablingAnalysis::reset() {
00080 dcuHardId_ = sistrip::invalid32_;
00081 lldCh_ = sistrip::invalid_;
00082 highMedian_ = 1.*sistrip::invalid_;
00083 highMean_ = 1.*sistrip::invalid_;
00084 highRms_ = 1.*sistrip::invalid_;
00085 lowMedian_ = 1.*sistrip::invalid_;
00086 lowMean_ = 1.*sistrip::invalid_;
00087 lowRms_ = 1.*sistrip::invalid_;
00088 range_ = 1.*sistrip::invalid_;
00089 midRange_ = 1.*sistrip::invalid_;
00090 max_ = 1.*sistrip::invalid_;
00091 min_ = 1.*sistrip::invalid_;
00092 }
00093
00094
00095
00096 bool FastFedCablingAnalysis::isValid() const {
00097 return ( dcuHardId_ < sistrip::invalid32_ &&
00098 lldCh_ < sistrip::valid_ &&
00099 highMedian_ < sistrip::valid_ &&
00100 highMean_ < sistrip::valid_ &&
00101 highRms_ < sistrip::valid_ &&
00102 lowMedian_ < sistrip::valid_ &&
00103 lowMean_ < sistrip::valid_ &&
00104 lowRms_ < sistrip::valid_ &&
00105 range_ < sistrip::valid_ &&
00106 midRange_ < sistrip::valid_ &&
00107 max_ < sistrip::valid_ &&
00108 min_ < sistrip::valid_ &&
00109 getErrorCodes().empty() );
00110 }
00111
00112
00113
00114 bool FastFedCablingAnalysis::isDirty() const {
00115 return ( highMean_ < dirtyThreshold_ );
00116 }
00117
00118
00119
00120 bool FastFedCablingAnalysis::badTrimDac() const {
00121 return ( lowMean_ < trimDacThreshold_ );
00122 }
00123
00124
00125
00126 void FastFedCablingAnalysis::header( std::stringstream& ss ) const {
00127 ss << "[" << myName() << "] Monitorables (65535 means \"invalid\"):" << std::endl;
00128
00129
00130
00131 SiStripFecKey fec_key( fecKey() );
00132 if ( fec_key.isValid() ) {
00133 ss << " Crate/FEC/Ring/CCU/Mod/LLD : "
00134 << fec_key.fecCrate() << "/"
00135 << fec_key.fecSlot() << "/"
00136 << fec_key.fecRing() << "/"
00137 << fec_key.ccuAddr() << "/"
00138 << fec_key.ccuChan() << "/"
00139 << fec_key.lldChan()
00140 << std::endl;
00141 } else {
00142 ss << " Crate/FEC/Ring/CCU/Mod/LLD : (invalid)"
00143 << std::endl;
00144 }
00145
00146 SiStripFedKey fed_key( fedKey() );
00147 ss << " FedId/FeUnit/FeChan/FedChannel : "
00148 << fed_key.fedId() << "/"
00149 << fed_key.feUnit() << "/"
00150 << fed_key.feChan() << "/"
00151 << fed_key.fedChannel()
00152 << std::endl;
00153
00154
00155
00156
00157 ss << " FecKey/Fedkey (hex) : 0x"
00158 << std::hex
00159 << std::setw(8) << std::setfill('0') << fecKey()
00160 << " / 0x"
00161 << std::setw(8) << std::setfill('0') << fedKey()
00162 << std::dec
00163 << std::endl;
00164
00165 ss << " DcuId (hex/dec) : 0x"
00166 << std::hex
00167 << std::setw(8) << std::setfill('0') << dcuId()
00168 << " / "
00169 << std::dec
00170 << std::setw(10) << std::setfill(' ') << dcuId()
00171 << std::endl;
00172
00173 ss << " DetId (hex/dec) : 0x"
00174 << std::hex
00175 << std::setw(8) << std::setfill('0') << detId()
00176 << " / "
00177 << std::dec
00178 << std::setw(10) << std::setfill(' ') << detId()
00179 << std::endl;
00180
00181 }
00182
00183
00184
00185 void FastFedCablingAnalysis::summary( std::stringstream& ss ) const {
00186
00187 SiStripFecKey fec_key( fecKey() );
00188 SiStripFedKey fed_key( fedKey() );
00189
00190 sistrip::RunType type = SiStripEnumsAndStrings::runType( myName() );
00191 std::string title = SiStripHistoTitle( sistrip::EXPERT_HISTO,
00192 type,
00193 sistrip::FED_KEY,
00194 fed_key.key(),
00195 sistrip::LLD_CHAN,
00196 fec_key.lldChan() ).title();
00197
00198 ss << " Summary"
00199 << ":"
00200 << ( isValid() ? "Valid" : "Invalid" )
00201 << ":"
00202 << sistrip::readoutView_ << ":"
00203 << fed_key.fedId() << "/"
00204 << fed_key.feUnit() << "/"
00205 << fed_key.feChan()
00206 << ":"
00207 << sistrip::dqmRoot_ << sistrip::dir_
00208 << "Collate" << sistrip::dir_
00209 << fed_key.path()
00210 << ":"
00211 << title
00212 << std::endl;
00213
00214 }
00215
00216
00217
00218 void FastFedCablingAnalysis::print( std::stringstream& ss, uint32_t not_used ) {
00219 header( ss );
00220 ss << std::fixed << std::setprecision(2)
00221 << " DCU id extracted from histo : 0x"
00222 << std::hex
00223 << std::setw(8) << std::setfill('0') << dcuHardId_ << std::endl
00224 << std::dec
00225 << " LLD chan extracted from histo : " << ( lldCh_ > 3 ? sistrip::invalid_ : lldCh_ ) << std::endl
00226 << " \"High\" level (mean+/-rms) [ADC] : " << highMean_ << " +/- " << highRms_ << std::endl
00227 << " \"Low\" level (mean+/-rms) [ADC] : " << lowMean_ << " +/- " << lowRms_ << std::endl
00228 << " Median \"high\" level [ADC] : " << highMedian_ << std::endl
00229 << " Median \"low\" level [ADC] : " << lowMedian_ << std::endl
00230 << " Range [ADC] : " << range_ << std::endl
00231 << " Mid-range level [ADC] : " << midRange_ << std::endl
00232 << " Maximum level [ADC] : " << max_ << std::endl
00233 << " Minimum level [ADC] : " << min_ << std::endl;
00234 ss << std::boolalpha
00235 << " isValid : " << isValid() << std::endl
00236 << " isDirty : " << isDirty() << std::endl
00237 << " badTrimDac : " << badTrimDac() << std::endl
00238 << std::noboolalpha
00239 << " Error codes (found "
00240 << std::setw(2) << std::setfill(' ') << getErrorCodes().size()
00241 << ") : ";
00242 if ( getErrorCodes().empty() ) { ss << "(none)"; }
00243 else {
00244 VString::const_iterator istr = getErrorCodes().begin();
00245 VString::const_iterator jstr = getErrorCodes().end();
00246 for ( ; istr != jstr; ++istr ) { ss << *istr << " "; }
00247 }
00248 ss << std::endl;
00249 }