CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #include "DQM/SiStripCommissioningSources/interface/FedTimingTask.h"
00002 #include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h"
00003 #include "DQMServices/Core/interface/DQMStore.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 
00006 using namespace sistrip;
00007 
00008 // -----------------------------------------------------------------------------
00009 //
00010 FedTimingTask::FedTimingTask( DQMStore* dqm,
00011                               const FedChannelConnection& conn ) :
00012   CommissioningTask( dqm, conn, "FedTimingTask" ),
00013   timing_(),
00014   nBins_(40) //@@ this should be from number of scope mode samples (mean booking in event loop and putting scope mode length in trigger fed)
00015 {
00016   LogDebug("Commissioning") << "[FedTimingTask::FedTimingTask] Constructing object...";
00017 }
00018 
00019 // -----------------------------------------------------------------------------
00020 //
00021 FedTimingTask::~FedTimingTask() {
00022   LogDebug("Commissioning") << "[FedTimingTask::FedTimingTask] Destructing object...";
00023 }
00024 
00025 // -----------------------------------------------------------------------------
00026 //
00027 void FedTimingTask::book() {
00028   LogDebug("Commissioning") << "[FedTimingTask::book]";
00029 
00030   uint16_t nbins = 24 * nBins_; // 24 "fine" pll skews possible
00031   
00032   std::string title;
00033   
00034   title = SiStripHistoTitle( sistrip::EXPERT_HISTO, 
00035                              sistrip::FED_TIMING, 
00036                              sistrip::FED_KEY, 
00037                              fedKey(),
00038                              sistrip::LLD_CHAN, 
00039                              connection().lldChannel() ).title();
00040 
00041   timing_.histo( dqm()->bookProfile( title, title, 
00042                                      nbins, -0.5, nbins*1.-0.5,
00043                                      1025, 0., 1025. ) );
00044   
00045   timing_.vNumOfEntries_.resize(nbins,0);
00046   timing_.vSumOfContents_.resize(nbins,0);
00047   timing_.vSumOfSquares_.resize(nbins,0);
00048   
00049 }
00050 
00051 // -----------------------------------------------------------------------------
00052 //
00053 /*
00054   Some notes: 
00055   - use all samples 
00056   - extract number of samples from trigger fed
00057   - need to book histos in event loop?
00058   - why only use fine skew setting when filling histos? should use coarse setting as well?
00059   - why do different settings every 100 events - change more freq? 
00060 */
00061 void FedTimingTask::fill( const SiStripEventSummary& summary,
00062                           const edm::DetSet<SiStripRawDigi>& digis ) {
00063   LogDebug("Commissioning") << "[FedTimingTask::fill]";
00064 
00065   //@@ if scope mode length is in trigger fed, then 
00066   //@@ can add check here on number of digis
00067   if ( digis.data.size() < nBins_ ) {
00068     edm::LogWarning("Commissioning") << "[FedTimingTask::fill]" 
00069                                      << " Unexpected number of digis! " 
00070                                      << digis.data.size(); 
00071   } else {
00072     
00073     uint32_t pll_fine = summary.pllFine();
00074     for ( uint16_t coarse = 0; coarse < nBins_/*digis.data.size()*/; coarse++ ) {
00075       uint16_t fine = (coarse+1)*24 - (pll_fine+1);
00076       updateHistoSet( timing_, fine, digis.data[coarse].adc() );
00077     }
00078 
00079   }
00080 
00081 }
00082 
00083 // -----------------------------------------------------------------------------
00084 //
00085 void FedTimingTask::update() {
00086   LogDebug("Commissioning") << "[FedTimingTask::update]";
00087   updateHistoSet( timing_ );
00088 }
00089 
00090