00001 #include "DQM/SiStripCommissioningSources/interface/DaqScopeModeTask.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
00007 using namespace sistrip;
00008
00009
00010
00011 DaqScopeModeTask::DaqScopeModeTask( DQMStore* dqm,
00012 const FedChannelConnection& conn ) :
00013 CommissioningTask( dqm, conn, "DaqScopeModeTask" ),
00014 scope_(),
00015 nBins_(256)
00016 {}
00017
00018
00019
00020 DaqScopeModeTask::~DaqScopeModeTask() {
00021 }
00022
00023
00024
00025 void DaqScopeModeTask::book() {
00026 LogTrace(mlDqmSource_) << "[CommissioningTask::" << __func__ << "]";
00027
00028 std::string title = SiStripHistoTitle( sistrip::EXPERT_HISTO,
00029 sistrip::DAQ_SCOPE_MODE,
00030 sistrip::FED_KEY,
00031 fedKey(),
00032 sistrip::LLD_CHAN,
00033 connection().lldChannel() ).title();
00034
00035 scope_.histo( dqm()->book1D( title, title,
00036 nBins_, -0.5, nBins_-0.5 ) );
00037
00038 scope_.vNumOfEntries_.resize(nBins_,0);
00039 scope_.vSumOfContents_.resize(nBins_,0);
00040 scope_.vSumOfSquares_.resize(nBins_,0);
00041 scope_.isProfile_ = false;
00042
00043 }
00044
00045
00046
00047 void DaqScopeModeTask::fill( const SiStripEventSummary& summary,
00048 const edm::DetSet<SiStripRawDigi>& digis ) {
00049
00050
00051 if ( !updateFreq() || fillCntr()%updateFreq() ) { return; }
00052
00053 if ( digis.data.size() != nBins_ ) {
00054 edm::LogWarning(mlDqmSource_)
00055 << "[DaqScopeModeTask::" << __func__ << "]"
00056 << " Unexpected number of digis ("
00057 << digis.data.size()
00058 << ") wrt number of histogram bins ("
00059 << nBins_ << ")!";
00060 }
00061
00062 uint16_t bins = digis.data.size() < nBins_ ? digis.data.size() : nBins_;
00063 for ( uint16_t ibin = 0; ibin < bins; ibin++ ) {
00064 updateHistoSet( scope_, ibin, digis.data[ibin].adc() );
00065 }
00066
00067 }
00068
00069
00070
00071 void DaqScopeModeTask::update() {
00072 updateHistoSet( scope_ );
00073 }
00074
00075