CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/DQM/SiStripCommissioningSources/src/ApvTimingTask.cc

Go to the documentation of this file.
00001 #include "DQM/SiStripCommissioningSources/interface/ApvTimingTask.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 //@@ nBins_ should be number of scope mode samples from trigger fed data???
00011 ApvTimingTask::ApvTimingTask( DQMStore* dqm,
00012                               const FedChannelConnection& conn ) :
00013   CommissioningTask( dqm, conn, "ApvTimingTask" ),
00014   timing_(),
00015   nSamples_(40),
00016   nFineDelays_(24),
00017   nBins_(40) 
00018 {}
00019 
00020 // -----------------------------------------------------------------------------
00021 //
00022 ApvTimingTask::~ApvTimingTask() {
00023 }
00024 
00025 // -----------------------------------------------------------------------------
00026 //
00027 void ApvTimingTask::book() {
00028   
00029   uint16_t nbins = 24 * nBins_;
00030   
00031   std::string title = SiStripHistoTitle( sistrip::EXPERT_HISTO, 
00032                                          sistrip::APV_TIMING, 
00033                                          sistrip::FED_KEY, 
00034                                          fedKey(),
00035                                          sistrip::LLD_CHAN, 
00036                                          connection().lldChannel() ).title();
00037   
00038   timing_.histo( dqm()->bookProfile( title, title, 
00039                                      nbins, -0.5, nBins_*25.-0.5, 
00040                                      1025, 0., 1025. ) );
00041                  
00042   timing_.vNumOfEntries_.resize(nbins,0);
00043   timing_.vSumOfContents_.resize(nbins,0);
00044   timing_.vSumOfSquares_.resize(nbins,0);
00045   
00046 }
00047 
00048 // -----------------------------------------------------------------------------
00049 //
00050 /*
00051   Some notes: 
00052   - use all samples 
00053   - extract number of samples from trigger fed
00054   - need to book histos in event loop?
00055   - why only use fine skew setting when filling histos? should use coarse setting as well?
00056   - why do different settings every 100 events - change more freq? 
00057 */
00058 void ApvTimingTask::fill( const SiStripEventSummary& summary,
00059                           const edm::DetSet<SiStripRawDigi>& digis ) {
00060   
00061   if ( digis.data.size() < nBins_ ) { //@@ check scope mode length?
00062     edm::LogWarning(mlDqmSource_)
00063       << "[ApvTimingTask::" << __func__ << "]"
00064       << " Unexpected number of digis! " 
00065       << digis.data.size(); 
00066     return;
00067   }
00068   
00069   uint32_t pll_fine = summary.pllFine();
00070   for ( uint16_t coarse = 0; coarse < nBins_/*digis.data.size()*/; coarse++ ) {
00071     uint16_t fine = (coarse+1)*24 - (pll_fine+1);
00072     updateHistoSet( timing_, fine, digis.data[coarse].adc() );
00073   }
00074   
00075 }
00076 
00077 // -----------------------------------------------------------------------------
00078 //
00079 void ApvTimingTask::update() {
00080   updateHistoSet( timing_ );
00081 }
00082 
00083