CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/CondFormats/SiStripObjects/src/VpspScanAnalysis.cc

Go to the documentation of this file.
00001 #include "CondFormats/SiStripObjects/interface/VpspScanAnalysis.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 VpspScanAnalysis::VpspScanAnalysis( const uint32_t& key )
00015   : CommissioningAnalysis(key,"VpspScanAnalysis"),
00016     vpsp_(2,sistrip::invalid_), 
00017     adcLevel_(2,sistrip::invalid_),
00018     fraction_(2,sistrip::invalid_),
00019     topEdge_(2,sistrip::invalid_),
00020     bottomEdge_(2,sistrip::invalid_),
00021     topLevel_(2,sistrip::invalid_),
00022     bottomLevel_(2,sistrip::invalid_)
00023 {;}
00024 
00025 // -----------------------------------------------------------------------------
00026 //
00027 VpspScanAnalysis::VpspScanAnalysis()
00028   : CommissioningAnalysis("VpspScanAnalysis"),
00029     vpsp_(2,sistrip::invalid_), 
00030     adcLevel_(2,sistrip::invalid_),
00031     fraction_(2,sistrip::invalid_),
00032     topEdge_(2,sistrip::invalid_),
00033     bottomEdge_(2,sistrip::invalid_),
00034     topLevel_(2,sistrip::invalid_),
00035     bottomLevel_(2,sistrip::invalid_)
00036 {;}
00037 
00038 // -----------------------------------------------------------------------------
00039 //
00040 void VpspScanAnalysis::reset() {
00041   vpsp_ = VInt(2,sistrip::invalid_);
00042 }
00043 
00044 // ----------------------------------------------------------------------------
00045 // 
00046 bool VpspScanAnalysis::isValid() const {
00047   return ( vpsp_[0] < 1. * sistrip::valid_ &&
00048            vpsp_[1] < 1. * sistrip::valid_ &&
00049            adcLevel_[0] < 1. * sistrip::valid_ &&
00050            adcLevel_[1] < 1. * sistrip::valid_ &&
00051            topLevel_[0] < 1. * sistrip::valid_ &&
00052            topLevel_[1] < 1. * sistrip::valid_ &&
00053            bottomLevel_[0] < 1. * sistrip::valid_ &&
00054            bottomLevel_[1] < 1. * sistrip::valid_ &&
00055            getErrorCodes().empty() );
00056 } 
00057 
00058 // ----------------------------------------------------------------------------
00059 // 
00060 void VpspScanAnalysis::summary( std::stringstream& ss ) const { 
00061 
00062   SiStripFecKey fec_key( fecKey() );
00063   SiStripFedKey fed_key( fedKey() );
00064   
00065   sistrip::RunType type = SiStripEnumsAndStrings::runType( myName() );
00066   
00067   std::stringstream extra1,extra2;
00068   extra1 << sistrip::apv_ << "0";
00069   extra2 << sistrip::apv_ << "1";
00070   
00071   std::string title1 = SiStripHistoTitle( sistrip::EXPERT_HISTO, 
00072                                           type,
00073                                           sistrip::FED_KEY, 
00074                                           fed_key.key(),
00075                                           sistrip::LLD_CHAN, 
00076                                           fec_key.lldChan(),
00077                                           extra1.str() ).title();
00078   std::string title2 = SiStripHistoTitle( sistrip::EXPERT_HISTO, 
00079                                           type,
00080                                           sistrip::FED_KEY, 
00081                                           fed_key.key(),
00082                                           sistrip::LLD_CHAN, 
00083                                           fec_key.lldChan(),
00084                                           extra2.str() ).title();
00085   
00086   ss << " Summary"
00087      << ":"
00088      << ( isValid() ? "Valid" : "Invalid" )
00089      << ":"
00090      << sistrip::controlView_ << ":"
00091      << fec_key.fecCrate() << "/" 
00092      << fec_key.fecSlot() << "/" 
00093      << fec_key.fecRing() << "/" 
00094      << fec_key.ccuAddr() << "/" 
00095      << fec_key.ccuChan() 
00096      << ":"
00097      << sistrip::dqmRoot_ << sistrip::dir_ 
00098      << "Collate" << sistrip::dir_ 
00099      << SiStripFecKey( fec_key.fecCrate(),
00100                        fec_key.fecSlot(), 
00101                        fec_key.fecRing(), 
00102                        fec_key.ccuAddr(), 
00103                        fec_key.ccuChan() ).path()
00104      << ":"
00105      << title1 << ";" << title2
00106      << std::endl;
00107   
00108 }
00109 
00110 // ----------------------------------------------------------------------------
00111 // 
00112 void VpspScanAnalysis::print( std::stringstream& ss, uint32_t iapv ) { 
00113   if ( iapv == 1 || iapv == 2 ) { iapv--; }
00114   else { iapv = 0; }
00115   header( ss );
00116   ss << " Monitorables for APV : " << iapv;
00117   if ( iapv == 0 ) { ss << " (first of pair)"; }
00118   else if ( iapv == 1 ) { ss << " (second of pair)"; } 
00119   ss << std::endl;
00120   ss <<  std::fixed << std::setprecision(2)
00121      << " VPSP setting         : " << vpsp_[iapv] << std::endl 
00122      << " Signal level   [ADC] : " << adcLevel_[iapv] << std::endl
00123      << " Fraction         [%] : " << "(N/A)" /*fraction_[iapv]*/ << std::endl
00124      << " Top edge       [bin] : " << topEdge_[iapv] << std::endl
00125      << " Bottom edge    [bin] : " << bottomEdge_[iapv] << std::endl
00126      << " Top level      [ADC] : " << topLevel_[iapv] << std::endl
00127      << " Bottom level   [ADC] : " << bottomLevel_[iapv] << std::endl
00128      << std::boolalpha 
00129      << " isValid              : " << isValid()  << std::endl
00130      << std::noboolalpha
00131      << " Error codes (found "  
00132      << std::setw(2) << std::setfill(' ') << getErrorCodes().size() 
00133      << "): ";
00134   if ( getErrorCodes().empty() ) { ss << "(none)"; }
00135   else { 
00136     VString::const_iterator istr = getErrorCodes().begin();
00137     VString::const_iterator jstr = getErrorCodes().end();
00138     for ( ; istr != jstr; ++istr ) { ss << *istr << " "; }
00139   }
00140   ss << std::endl;
00141 }
00142 
00143 
00144 
00145 
00146 
00147