Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:11:37

0001 #include "DQM/SiStripCommissioningSources/interface/ApvTimingTask.h"
0002 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0003 #include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h"
0004 #include "DQMServices/Core/interface/DQMStore.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 
0007 using namespace sistrip;
0008 
0009 // -----------------------------------------------------------------------------
0010 //@@ nBins_ should be number of scope mode samples from trigger fed data???
0011 ApvTimingTask::ApvTimingTask(DQMStore* dqm, const FedChannelConnection& conn)
0012     : CommissioningTask(dqm, conn, "ApvTimingTask"), timing_(), nSamples_(40), nFineDelays_(24), nBins_(40) {}
0013 
0014 // -----------------------------------------------------------------------------
0015 //
0016 ApvTimingTask::~ApvTimingTask() {}
0017 
0018 // -----------------------------------------------------------------------------
0019 //
0020 void ApvTimingTask::book() {
0021   uint16_t nbins = 24 * nBins_;
0022 
0023   std::string title = SiStripHistoTitle(sistrip::EXPERT_HISTO,
0024                                         sistrip::APV_TIMING,
0025                                         sistrip::FED_KEY,
0026                                         fedKey(),
0027                                         sistrip::LLD_CHAN,
0028                                         connection().lldChannel())
0029                           .title();
0030 
0031   timing_.histo(dqm()->bookProfile(title, title, nbins, -0.5, nBins_ * 25. - 0.5, 1025, 0., 1025.));
0032 
0033   timing_.vNumOfEntries_.resize(nbins, 0);
0034   timing_.vSumOfContents_.resize(nbins, 0);
0035   timing_.vSumOfSquares_.resize(nbins, 0);
0036 }
0037 
0038 // -----------------------------------------------------------------------------
0039 //
0040 /*
0041   Some notes: 
0042   - use all samples 
0043   - extract number of samples from trigger fed
0044   - need to book histos in event loop?
0045   - why only use fine skew setting when filling histos? should use coarse setting as well?
0046   - why do different settings every 100 events - change more freq? 
0047 */
0048 void ApvTimingTask::fill(const SiStripEventSummary& summary, const edm::DetSet<SiStripRawDigi>& digis) {
0049   if (digis.data.size() < nBins_) {  //@@ check scope mode length?
0050     edm::LogWarning(mlDqmSource_) << "[ApvTimingTask::" << __func__ << "]"
0051                                   << " Unexpected number of digis! " << digis.data.size();
0052     return;
0053   }
0054 
0055   uint32_t pll_fine = summary.pllFine();
0056   for (uint16_t coarse = 0; coarse < nBins_ /*digis.data.size()*/; coarse++) {
0057     uint16_t fine = (coarse + 1) * 24 - (pll_fine + 1);
0058     updateHistoSet(timing_, fine, digis.data[coarse].adc());
0059   }
0060 }
0061 
0062 // -----------------------------------------------------------------------------
0063 //
0064 void ApvTimingTask::update() { updateHistoSet(timing_); }