Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "CondFormats/SiStripObjects/interface/FedCablingAnalysis.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 // ----------------------------------------------------------------------------
0013 //
0014 const float FedCablingAnalysis::threshold_ = 100.;  // [ADC]
0015 
0016 // ----------------------------------------------------------------------------
0017 //
0018 FedCablingAnalysis::FedCablingAnalysis(const uint32_t& key)
0019     : CommissioningAnalysis(key, sistrip::fedCablingAnalysis_),
0020       fedId_(sistrip::invalid_),
0021       fedCh_(sistrip::invalid_),
0022       adcLevel_(1. * sistrip::invalid_),
0023       candidates_() {
0024   ;
0025 }
0026 
0027 // ----------------------------------------------------------------------------
0028 //
0029 FedCablingAnalysis::FedCablingAnalysis()
0030     : CommissioningAnalysis(sistrip::fedCablingAnalysis_),
0031       fedId_(sistrip::invalid_),
0032       fedCh_(sistrip::invalid_),
0033       adcLevel_(1. * sistrip::invalid_),
0034       candidates_() {
0035   ;
0036 }
0037 
0038 // ----------------------------------------------------------------------------
0039 //
0040 void FedCablingAnalysis::reset() {
0041   fedId_ = sistrip::invalid_;
0042   fedCh_ = sistrip::invalid_;
0043   adcLevel_ = 1. * sistrip::invalid_;
0044   candidates_.clear();
0045 }
0046 
0047 // ----------------------------------------------------------------------------
0048 //
0049 bool FedCablingAnalysis::isValid() const {
0050   return (fedId_ < sistrip::maximum_ && fedCh_ < sistrip::maximum_ && adcLevel_ < 1 + sistrip::maximum_ &&
0051           !candidates_.empty() && getErrorCodes().empty());
0052 }
0053 
0054 // ----------------------------------------------------------------------------
0055 //
0056 void FedCablingAnalysis::print(std::stringstream& ss, uint32_t not_used) {
0057   header(ss);
0058   ss << std::fixed << std::setprecision(2) << " Connected FED id               : " << fedId_ << std::endl
0059      << " Connected FED channel          : " << fedCh_ << std::endl
0060      << " Signal level             [ADC] : " << adcLevel_ << std::endl;
0061   ss << " nCandidates                    : " << candidates_.size() << std::endl << " FedId/FedChannel/ADC) : ";
0062   if (candidates_.empty()) {
0063     ss << "(none)";
0064   } else {
0065     Candidates::const_iterator iter;
0066     for (iter = candidates_.begin(); iter != candidates_.end(); iter++) {
0067       SiStripFedKey path(iter->first);
0068       ss << path.fedId() << "/" << path.fedChannel() << "/" << iter->second << " ";
0069     }
0070   }
0071   ss << std::endl;
0072   ss << std::boolalpha << " isValid                : " << isValid() << std::endl
0073      << std::noboolalpha << " Error codes (found " << std::setw(2) << std::setfill(' ') << getErrorCodes().size()
0074      << ") : ";
0075   if (getErrorCodes().empty()) {
0076     ss << "(none)";
0077   } else {
0078     VString::const_iterator istr = getErrorCodes().begin();
0079     VString::const_iterator jstr = getErrorCodes().end();
0080     for (; istr != jstr; ++istr) {
0081       ss << *istr << " ";
0082     }
0083   }
0084   ss << std::endl;
0085 }