Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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