Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-18 02:29:47

0001 // -*- C++ -*-
0002 //
0003 // Package:    TriggerUtils
0004 // Class:      GenericTriggerEventFlagTest
0005 //
0006 // $Id: GenericTriggerEventFlagTest.cc,v 1.2 2012/01/19 20:17:34 vadler Exp $
0007 //
0008 /**
0009   \class    GenericTriggerEventFlagTest
0010   \brief    Tests functionality of GenericTriggerEventFlag
0011 
0012    This unit test ...
0013 
0014   \author   Volker Adler
0015   \version  $Id: GenericTriggerEventFlagTest.cc,v 1.2 2012/01/19 20:17:34 vadler Exp $
0016 */
0017 
0018 #include "FWCore/Framework/interface/stream/EDFilter.h"
0019 #include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h"
0020 
0021 class GenericTriggerEventFlagTest : public edm::stream::EDFilter<> {
0022   GenericTriggerEventFlag genericTriggerEventFlag_;
0023 
0024 public:
0025   explicit GenericTriggerEventFlagTest(const edm::ParameterSet& iConfig);
0026   virtual ~GenericTriggerEventFlagTest() override = default;
0027 
0028 private:
0029   virtual void beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) override;
0030   virtual bool filter(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0031 };
0032 
0033 GenericTriggerEventFlagTest::GenericTriggerEventFlagTest(const edm::ParameterSet& iConfig)
0034     : genericTriggerEventFlag_(GenericTriggerEventFlag(iConfig, consumesCollector(), *this)) {}
0035 
0036 void GenericTriggerEventFlagTest::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
0037   if (genericTriggerEventFlag_.on())
0038     genericTriggerEventFlag_.initRun(iRun, iSetup);
0039 }
0040 
0041 bool GenericTriggerEventFlagTest::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0042   if (genericTriggerEventFlag_.on() && !genericTriggerEventFlag_.accept(iEvent, iSetup))
0043     return false;
0044 
0045   return true;
0046 }
0047 
0048 #include "FWCore/Framework/interface/MakerMacros.h"
0049 DEFINE_FWK_MODULE(GenericTriggerEventFlagTest);