CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/CondFormats/SiStripObjects/src/FedCablingAnalysis.cc

Go to the documentation of this file.
00001 #include "CondFormats/SiStripObjects/interface/FedCablingAnalysis.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 FedCablingAnalysis::threshold_ = 100.; // [ADC]
00015 
00016 // ----------------------------------------------------------------------------
00017 // 
00018 FedCablingAnalysis::FedCablingAnalysis( const uint32_t& key ) 
00019   : CommissioningAnalysis(key,sistrip::fedCablingAnalysis_),
00020     fedId_(sistrip::invalid_), 
00021     fedCh_(sistrip::invalid_),
00022     adcLevel_(1.*sistrip::invalid_),
00023     candidates_()
00024 {;}
00025 
00026 // ----------------------------------------------------------------------------
00027 // 
00028 FedCablingAnalysis::FedCablingAnalysis() 
00029   : CommissioningAnalysis(sistrip::fedCablingAnalysis_),
00030     fedId_(sistrip::invalid_), 
00031     fedCh_(sistrip::invalid_),
00032     adcLevel_(1.*sistrip::invalid_),
00033     candidates_()
00034 {;}
00035 
00036 // ----------------------------------------------------------------------------
00037 // 
00038 void FedCablingAnalysis::reset() {
00039     fedId_ = sistrip::invalid_; 
00040     fedCh_ = sistrip::invalid_;
00041     adcLevel_ = 1.*sistrip::invalid_;
00042     candidates_.clear();
00043 }
00044 
00045 // ----------------------------------------------------------------------------
00046 // 
00047 bool FedCablingAnalysis::isValid() const {
00048   return ( fedId_ < sistrip::maximum_ &&
00049            fedCh_ < sistrip::maximum_ &&
00050            adcLevel_ < 1+sistrip::maximum_ &&
00051            !candidates_.empty() &&
00052            getErrorCodes().empty() );
00053 } 
00054 
00055 // ----------------------------------------------------------------------------
00056 // 
00057 void FedCablingAnalysis::print( std::stringstream& ss, uint32_t not_used ) { 
00058   header( ss );
00059   ss <<  std::fixed << std::setprecision(2)
00060      << " Connected FED id               : " << fedId_ << std::endl 
00061      << " Connected FED channel          : " << fedCh_ << std::endl
00062      << " Signal level             [ADC] : " << adcLevel_ << std::endl;
00063   ss << " nCandidates                    : " << candidates_.size() << std::endl
00064      << " FedId/FedChannel/ADC) : ";
00065   if ( candidates_.empty() ) { ss << "(none)"; }
00066   else {
00067     Candidates::const_iterator iter;
00068     for ( iter = candidates_.begin(); iter != candidates_.end(); iter++ ) { 
00069       SiStripFedKey path( iter->first );
00070       ss << path.fedId() << "/" 
00071          << path.fedChannel() << "/" 
00072          << iter->second << " ";
00073     }
00074   }
00075   ss << std::endl;
00076   ss << std::boolalpha
00077      << " isValid                : " << isValid()  << std::endl
00078      << std::noboolalpha
00079      << " Error codes (found "  
00080      << std::setw(2) << std::setfill(' ') << getErrorCodes().size() 
00081      << ") : ";
00082   if ( getErrorCodes().empty() ) { ss << "(none)"; }
00083   else { 
00084     VString::const_iterator istr = getErrorCodes().begin();
00085     VString::const_iterator jstr = getErrorCodes().end();
00086     for ( ; istr != jstr; ++istr ) { ss << *istr << " "; }
00087   }
00088   ss << std::endl;
00089 }