Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Class:      SiPixelPhase1Base
0004 //
0005 // Implementations of the class
0006 //
0007 // Original Author: Yi-Mu "Enoch" Chen
0008 
0009 #include "DQM/SiPixelPhase1Common/interface/SiPixelPhase1Base.h"
0010 
0011 // Constructor requires manually looping the trigger flag settings
0012 // Since constructor of GenericTriggerEventFlag requires
0013 // EDConsumerBase class protected member calls
0014 SiPixelPhase1Base::SiPixelPhase1Base(const edm::ParameterSet& iConfig)
0015     : DQMEDAnalyzer(), HistogramManagerHolder(iConfig, consumesCollector()) {
0016   // Flags will default to empty vector if not specified in configuration file
0017   auto flags = iConfig.getUntrackedParameter<edm::VParameterSet>("triggerflags", {});
0018 
0019   for (auto& flag : flags) {
0020     triggerlist.emplace_back(new GenericTriggerEventFlag(flag, consumesCollector(), *this));
0021   }
0022 }
0023 
0024 // Booking histograms as required by the DQM
0025 void SiPixelPhase1Base::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const& iSetup) {
0026   for (HistogramManager& histoman : histo) {
0027     histoman.book(iBooker, iSetup);
0028   }
0029 
0030   // Running trigger flag initialization (per run)
0031   for (auto& trigger : triggerlist) {
0032     if (trigger->on()) {
0033       trigger->initRun(run, iSetup);
0034     }
0035   }
0036 }
0037 
0038 // trigger checking function
0039 bool SiPixelPhase1Base::checktrigger(const edm::Event& iEvent,
0040                                      const edm::EventSetup& iSetup,
0041                                      const unsigned trgidx) const {
0042   //true if no trigger, MC, off, or accepted
0043 
0044   return triggerlist.empty() || !iEvent.isRealData() || !triggerlist.at(trgidx)->on() ||
0045          triggerlist.at(trgidx)->accept(iEvent, iSetup);
0046 }