CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DQM/SiStripCommissioningSources/src/FedCablingTask.cc

Go to the documentation of this file.
00001 #include "DQM/SiStripCommissioningSources/interface/FedCablingTask.h"
00002 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
00003 #include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h"
00004 #include "DQMServices/Core/interface/DQMStore.h"
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 #include <algorithm>
00007 #include <sstream>
00008 #include <iomanip>
00009 
00010 using namespace sistrip;
00011 
00012 // -----------------------------------------------------------------------------
00013 //
00014 FedCablingTask::FedCablingTask( DQMStore* dqm,
00015                                 const FedChannelConnection& conn ) :
00016   CommissioningTask( dqm, conn, "FedCablingTask" ),
00017   histos_()
00018 {}
00019 
00020 // -----------------------------------------------------------------------------
00021 //
00022 FedCablingTask::~FedCablingTask() {
00023 }
00024 
00025 // -----------------------------------------------------------------------------
00026 //
00027 void FedCablingTask::book() {
00028   
00029   histos_.resize(2);
00030   
00031   std::string title;
00032   uint16_t nbins = 0;
00033   std::string extra_info = "";
00034   for ( uint16_t iter = 0; iter < 2; iter++ ) {
00035       
00036     // Define number of histo bins and title
00037     if ( iter == 0 )      { nbins = 1024; extra_info = sistrip::feDriver_; }
00038     else if ( iter == 1 ) { nbins = 96;   extra_info = sistrip::fedChannel_; }
00039     else {
00040       edm::LogWarning(mlDqmSource_)
00041         << "[FedCablingTask::" << __func__ << "]"
00042         << " Unexpected number of HistoSets: " << iter;
00043     }
00044       
00045     title = SiStripHistoTitle( sistrip::EXPERT_HISTO, 
00046                                sistrip::FED_CABLING,
00047                                sistrip::FED_KEY, 
00048                                fedKey(),
00049                                sistrip::LLD_CHAN, 
00050                                connection().lldChannel(),
00051                                extra_info ).title();
00052       
00053     histos_[iter].histo( dqm()->bookProfile( title, title, 
00054                                              nbins, -0.5, nbins*1.-0.5,
00055                                              1025, 0., 1025. ) );
00056       
00057     histos_[iter].vNumOfEntries_.resize(nbins,0);
00058     histos_[iter].vSumOfContents_.resize(nbins,0);
00059     histos_[iter].vSumOfSquares_.resize(nbins,0);
00060 
00061   }
00062 
00063 }
00064 
00065 // -----------------------------------------------------------------------------
00066 //
00067 void FedCablingTask::fill( const SiStripEventSummary& summary,
00068                            const uint16_t& fed_id,
00069                            const std::map<uint16_t,float>& fed_ch ) {
00070   
00071   if ( fed_ch.empty() ) { 
00072     edm::LogWarning(mlDqmSource_)  
00073       << "[FedCablingTask::" << __func__ << "]"
00074       << " No FED channels with high signal!";
00075     return; 
00076   } else {
00077     LogTrace(mlDqmSource_)  
00078       << "[FedCablingTask::" << __func__ << "]"
00079       << " Found " << fed_ch.size()
00080       << " FED channels with high signal!";
00081   }
00082   
00083   std::map<uint16_t,float>::const_iterator ichan = fed_ch.begin();
00084   for ( ; ichan != fed_ch.end(); ichan++ ) {
00085     updateHistoSet( histos_[0], fed_id, ichan->second );
00086     updateHistoSet( histos_[1], ichan->first, ichan->second );
00087   } 
00088   
00089 }
00090 
00091 // -----------------------------------------------------------------------------
00092 //
00093 void FedCablingTask::update() {
00094   for ( uint32_t iter = 0; iter < histos_.size(); iter++ ) {
00095     updateHistoSet( histos_[iter] );
00096   }
00097 }
00098 
00099 
00100